Audacity
3.2.0
src
MenuCreator.h
Go to the documentation of this file.
1
/**********************************************************************
2
3
Audacity: A Digital Audio Editor
4
5
MenuCreator.h
6
7
Dominic Mazzoni
8
9
Paul Licameli split from Menus.h
10
11
**********************************************************************/
12
#ifndef __AUDACITY_MENU_CREATOR__
13
#define __AUDACITY_MENU_CREATOR__
14
15
#include "
Callable.h
"
16
#include "
CommandManager.h
"
17
18
class
AUDACITY_DLL_API
MenuCreator
final :
public
CommandManager
19
{
20
public
:
21
// For manipulating the enclosing menu or sub-menu directly,
22
// adding any number of items, not using the CommandManager
23
struct
SpecialItem
final :
MenuRegistry::SpecialItem
24
{
25
using
Appender
= std::function<void(
AudacityProject
&, wxMenu&)>;
26
27
explicit
SpecialItem
(
const
Identifier
&internalName,
const
Appender
&fn_)
28
:
MenuRegistry
::
SpecialItem
{ internalName }
29
,
fn
{ fn_ }
30
{}
31
~SpecialItem
()
override
;
32
33
Appender
fn
;
34
};
35
36
static
constexpr
auto
Special = Callable::UniqueMaker<SpecialItem>();
37
38
// "permit" allows filtering even if the active window isn't a child of the
39
// project.
40
// Lyrics and MixerTrackCluster classes use it.
41
static
bool
FilterKeyEvent(
AudacityProject
&
project
,
42
const
wxKeyEvent & evt,
bool
permit =
false
);
43
44
static
MenuCreator
&
Get
(
AudacityProject
&
project
);
45
static
const
MenuCreator
&
Get
(
const
AudacityProject
&
project
);
46
47
MenuCreator
(
AudacityProject
&
project
);
48
~MenuCreator
()
override
;
49
void
CreateMenusAndCommands();
50
void
RebuildMenuBar();
51
static
void
RebuildAllMenuBars();
52
53
// a temporary hack that should be removed as soon as we
54
// get multiple effect preview working
55
bool
ReallyDoQuickCheck
()
override
;
56
57
void
RemoveDuplicateShortcuts();
58
59
private
:
60
void
ExecuteCommand
(
const
CommandContext
&context,
61
const
wxEvent *evt,
const
CommandListEntry
&
entry
)
override
;
62
};
63
64
struct
NormalizedKeyString
;
65
66
AUDACITY_DLL_API
67
NormalizedKeyString
KeyEventToKeyString
(
const
wxKeyEvent & keyEvent);
68
69
#endif
Callable.h
Functions and classes that generate callable objects.
CommandManager.h
entry
static ProjectFileIORegistry::AttributeWriterEntry entry
Definition:
ImportExport.cpp:50
KeyEventToKeyString
AUDACITY_DLL_API NormalizedKeyString KeyEventToKeyString(const wxKeyEvent &keyEvent)
Definition:
MenuCreator.cpp:698
project
const auto project
Definition:
TestWaveTrackMaker.cpp:18
fn
static const auto fn
Definition:
WaveformView.cpp:1109
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition:
Project.h:90
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition:
CommandContext.h:37
CommandManager
CommandManager implements a system for organizing all user-callable commands.
Definition:
CommandManager.h:54
CommandManager::Get
static CommandManager & Get(AudacityProject &project)
Definition:
CommandManager.cpp:110
CommandManager::ReallyDoQuickCheck
virtual bool ReallyDoQuickCheck()
Default implementation returns true.
Definition:
CommandManager.cpp:1521
CommandManager::ExecuteCommand
virtual void ExecuteCommand(const CommandContext &context, const wxEvent *evt, const CommandListEntry &entry)
Definition:
CommandManager.cpp:853
Identifier
An explicitly nonlocalized string, not meant for the user to see.
Definition:
Identifier.h:22
MenuCreator
MenuCreator is responsible for creating the main menu bar.
Definition:
MenuCreator.h:19
MenuCreator::~MenuCreator
~MenuCreator() override
MenuRegistry
Definition:
MenuRegistry.cpp:19
CommandManager::CommandListEntry
Definition:
CommandManager.h:375
MenuCreator::SpecialItem
Definition:
MenuCreator.h:24
MenuCreator::SpecialItem::Appender
std::function< void(AudacityProject &, wxMenu &)> Appender
Definition:
MenuCreator.h:25
MenuCreator::SpecialItem::SpecialItem
SpecialItem(const Identifier &internalName, const Appender &fn_)
Definition:
MenuCreator.h:27
MenuCreator::SpecialItem::~SpecialItem
~SpecialItem() override
MenuCreator::SpecialItem::fn
Appender fn
Definition:
MenuCreator.h:33
MenuRegistry::SpecialItem
Definition:
MenuRegistry.h:381
NormalizedKeyString
Definition:
Keyboard.h:24
Generated by
1.9.3