MCPcopy Create free account
hub / github.com/audacity/audacity / Enable

Method Enable

libraries/lib-menus/CommandManager.cpp:634–651  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

632///added using AddItemList(), it will enable or disable all
633///of them at once
634void 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
653void CommandManager::CommandListEntry::Enable(bool b)
654{

Callers 3

UpdateButtonsMethod · 0.45
ReinitMethod · 0.45
ShuttleGui.cppFile · 0.45

Calls 3

findMethod · 0.45
endMethod · 0.45
EnableMultiItemMethod · 0.45

Tested by

no test coverage detected