Enables or disables a menu item based on its name (not the label in the menu bar, but the name of the command.) If you give it the name of a multi-item (one that was added using AddItemList(), it will enable or disable all of them at once
| 632 | ///added using AddItemList(), it will enable or disable all |
| 633 | ///of them at once |
| 634 | void CommandManager::Enable(CommandListEntry &entry, bool enabled) |
| 635 | { |
| 636 | entry.Enable(enabled); |
| 637 | if (entry.multi) { |
| 638 | for (int i = 1, ID = entry.id; |
| 639 | i < entry.count; |
| 640 | ++i, ID = NextIdentifier(ID) |
| 641 | ) { |
| 642 | // This menu item is not necessarily in the same menu, because |
| 643 | // multi-items can be spread across multiple sub menus |
| 644 | if (auto iter = mCommandNumericIDHash.find(ID); |
| 645 | iter != mCommandNumericIDHash.end()) |
| 646 | iter->second->EnableMultiItem(enabled); |
| 647 | else |
| 648 | wxLogDebug(wxT("Warning: Menu entry with id %i not in hash"), ID); |
| 649 | } |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | void CommandManager::CommandListEntry::Enable(bool b) |
| 654 | { |
no test coverage detected