Add support for commands with dynamic help strings
Originally committed to SVN as r6326.
This commit is contained in:
parent
64c7043123
commit
b0c1ef2d6b
2 changed files with 7 additions and 2 deletions
|
@ -79,8 +79,11 @@ namespace cmd {
|
|||
/// This command's name may change based on the state of the project
|
||||
COMMAND_DYNAMIC_NAME = 8,
|
||||
|
||||
/// This command's help string may change
|
||||
COMMAND_DYNAMIC_HELP = 16,
|
||||
|
||||
/// This command's icon may change based on the state of the project
|
||||
COMMAND_DYNAMIC_ICON = 16
|
||||
COMMAND_DYNAMIC_ICON = 32
|
||||
};
|
||||
|
||||
/// Holds an individual Command
|
||||
|
@ -93,7 +96,7 @@ namespace cmd {
|
|||
/// Plain string for display purposes; should normally be the same as StrMenu
|
||||
/// but without accelerators
|
||||
virtual wxString StrDisplay(const agi::Context *) const=0;
|
||||
/// Short help string descripting the command purpose.
|
||||
/// Short help string describing what the command does
|
||||
virtual wxString StrHelp() const=0;
|
||||
|
||||
/// Get this command's type flags
|
||||
|
|
|
@ -148,6 +148,8 @@ class CommandManager {
|
|||
int flags = c->Type();
|
||||
if (flags & cmd::COMMAND_DYNAMIC_NAME)
|
||||
UpdateItemName(item);
|
||||
if (flags & cmd::COMMAND_DYNAMIC_HELP)
|
||||
item.second->SetHelp(c->StrHelp());
|
||||
if (flags & cmd::COMMAND_VALIDATE)
|
||||
item.second->Enable(c->Validate(context));
|
||||
if (flags & cmd::COMMAND_RADIO || flags & cmd::COMMAND_TOGGLE) {
|
||||
|
|
Loading…
Reference in a new issue