13#ifndef __AUDACITY_MENU_REGISTRY__
14#define __AUDACITY_MENU_REGISTRY__
29 template<
typename MenuTraits>
struct Visitor;
31 template<
typename MenuTraits>
struct Visitor;
41 Options(
const wxChar *accel_ ) : accel{ accel_ } {}
46 : accel{ accel_ }, longName{ longName_ } {}
49 { accel = value;
return std::move(*
this); }
51 { bIsEffect = value;
return std::move(*
this); }
53 { parameter = value;
return std::move(*
this); }
55 { longName = value;
return std::move(*
this); }
57 { global =
true;
return std::move(*
this); }
59 { useStrictFlags =
true;
return std::move(*
this); }
61 { wantKeyUp =
true;
return std::move(*
this); }
63 { skipKeyDown =
true;
return std::move(*
this); }
67 { allowDup =
true;
return std::move(*
this); }
70 { allowInMacros = value;
return std::move(*
this); }
75 { checker =
fn;
return std::move(*
this); }
78 checker = MakeCheckFn(
key, defaultValue );
79 return std::move(*
this);
83 checker = MakeCheckFn( setting );
84 return std::move(*
this);
87 const wxChar *accel{
wxT(
"") };
89 bool bIsEffect{
false };
93 bool useStrictFlags{
false };
94 bool wantKeyUp{
false };
95 bool skipKeyDown{
false };
96 bool allowDup{
false };
98 int allowInMacros{ -1 };
101 static CheckFn MakeCheckFn(
const wxString
key,
bool defaultValue);
120 std::pair<bool, bool>
124 bool ShouldDoSeparator();
140 std::function<
void()> doSeparator
146 const auto pProperties =
dynamic_cast<const ItemProperties*
>(&item);
165 const auto pProperties =
dynamic_cast<const ItemProperties*
>(&item);
196 template<
typename RegistryTraits>
220 GroupItem<Traits>, MenuItemData, const Identifier&
224 using Extension::Extension;
227 Properties GetProperties()
const override;
246 GroupItem<Traits>, Condition, const Identifier &
249 using Extension::Extension;
251 using Condition::operator();
294 template<
typename Handler >
316 flags, options,
nullptr)
333 std::vector<ComponentInterfaceSymbol> items_,
344 template<
typename Handler >
346 std::vector<ComponentInterfaceSymbol> items_,
354 flags_, isEffect_,
finder)
360 std::vector< ComponentInterfaceSymbol > items,
363 bool isEffect =
false)
366 flags, isEffect, nullptr)
371 const std::vector<ComponentInterfaceSymbol>
items;
382 using SingleItem::SingleItem;
390 GroupItem<Traits>, void, const Identifier &
394 using Extension::Extension;
397 Ordering GetOrdering()
const override;
403 GroupItem<Traits>, void, const Identifier &
407 using Extension::Extension;
427 constexpr auto Items = Callable::UniqueMaker<MenuItems>();
436 constexpr auto Section = Callable::UniqueMaker<MenuPart>();
445 constexpr auto Menu = Callable::UniqueMaker<MenuItem>();
456 constexpr auto Command = Callable::UniqueMaker<CommandItem>();
459 const Identifier &, std::vector<ComponentInterfaceSymbol>>();
Functions and classes that generate callable objects.
std::bitset< NCommandFlags > CommandFlag
std::function< CommandHandlerObject &(AudacityProject &) > CommandHandlerFinder
TaggedIdentifier< CommandIdTag, false > CommandID
Identifies a menu command or macro. Case-insensitive comparison.
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
This specialization of Setting for bool adds a Toggle method to negate the saved value.
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
An explicitly nonlocalized string, not meant for the user to see.
Generates classes whose instances register items at construction.
Holds a msgid for the translation catalog; may also bind format arguments.
Set a variable temporarily in a scope.
constexpr auto UniqueMaker()
Generate variadic factory functions.
std::vector< Identifier > Path
std::vector< MenuItem > MenuItems
const char * begin(const char *str) noexcept
Extend Base with extra fields, in a second, protected base class.
CommandGroupItem(const CommandID &name, std::vector< ComponentInterfaceSymbol > items, CommandFunctorPointer::NonMemberFn fn, CommandFlag flags, bool isEffect=false)
CommandGroupItem(const Identifier &name_, std::vector< ComponentInterfaceSymbol > items_, void(Handler::*pmf)(const CommandContext &), CommandFlag flags_, bool isEffect_, CommandHandlerFinder finder=FinderScope::DefaultFinder())
CommandFunctorPointer callback
CommandHandlerFinder finder
const std::vector< ComponentInterfaceSymbol > items
CommandHandlerFinder finder
CommandItem(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())
CommandFunctorPointer callback
const TranslatableString label_in
CommandItem(const CommandID &name, const TranslatableString &label_in, CommandFunctorPointer::NonMemberFn callback, CommandFlag flags, const Options &options={})
Has variadic and range constructors that check types.
Common abstract base class for items that are not groups.
void BeginGroup(const GroupItem< RegistryTraits > &item, const Path &path) const
Call-through for a decorating pre-visitor.
void EndGroup(const GroupItem< RegistryTraits > &item, const Path &path) const
Call-through for a decorating post-visitor.
void Visit(const SingleItem &item, const Path &path) const
Call-through for a decorating leaf-visitor.
Primary template for a list of arbitrary types.
void(*)(const CommandContext &context) NonMemberFn
void(CommandHandlerObject::*)(const CommandContext &context) MemberFn