Handle commands which change types at runtime. Closes #1413.

Originally committed to SVN as r6406.
This commit is contained in:
Thomas Goyne 2012-01-31 04:04:02 +00:00
parent 983ffc1e83
commit 64553dd633
1 changed files with 3 additions and 1 deletions

View File

@ -146,8 +146,10 @@ class CommandManager {
void UpdateItem(std::pair<std::string, wxMenuItem*> const& item) { void UpdateItem(std::pair<std::string, wxMenuItem*> const& item) {
cmd::Command *c = cmd::get(item.first); cmd::Command *c = cmd::get(item.first);
int flags = c->Type(); int flags = c->Type();
if (flags & cmd::COMMAND_VALIDATE) if (flags & cmd::COMMAND_VALIDATE) {
item.second->Enable(c->Validate(context)); item.second->Enable(c->Validate(context));
flags = c->Type();
}
if (flags & cmd::COMMAND_DYNAMIC_NAME) if (flags & cmd::COMMAND_DYNAMIC_NAME)
UpdateItemName(item); UpdateItemName(item);
if (flags & cmd::COMMAND_DYNAMIC_HELP) if (flags & cmd::COMMAND_DYNAMIC_HELP)