Audacity  2.2.2
Public Member Functions | List of all members
ExecMenuCommand Class Referencefinal

A command which asks the CommandManager to execute a menu command by name. More...

#include <ExecMenuCommand.h>

Inheritance diagram for ExecMenuCommand:
CommandImplementation Command

Public Member Functions

 ExecMenuCommand (CommandType &type, std::unique_ptr< CommandOutputTarget > &&target)
 
virtual ~ExecMenuCommand ()
 
bool Apply (CommandExecutionContext context) override
 
- Public Member Functions inherited from CommandImplementation
void Progress (double completed)
 
void Status (const wxString &status) override
 
void Error (const wxString &message) override
 
 CommandImplementation (CommandType &type, std::unique_ptr< CommandOutputTarget > &&output)
 
virtual ~CommandImplementation ()
 
wxString GetName ()
 An instance method for getting the command name (for consistency) More...
 
CommandSignatureGetSignature ()
 Get the signature of the command. More...
 
bool SetParameter (const wxString &paramName, const wxVariant &paramValue)
 
- Public Member Functions inherited from Command
virtual ~Command ()
 

Additional Inherited Members

- Protected Member Functions inherited from CommandImplementation
void TypeCheck (const wxString &typeName, const wxString &paramName, const wxVariant &param)
 
void CheckParam (const wxString &paramName)
 
bool HasParam (const wxString &paramName)
 
bool GetBool (const wxString &paramName)
 
long GetLong (const wxString &paramName)
 
double GetDouble (const wxString &paramName)
 
wxString GetString (const wxString &paramName)
 
- Protected Attributes inherited from CommandImplementation
std::unique_ptr
< CommandOutputTarget
mOutput
 

Detailed Description

A command which asks the CommandManager to execute a menu command by name.

Definition at line 34 of file ExecMenuCommand.h.

Constructor & Destructor Documentation

ExecMenuCommand::ExecMenuCommand ( CommandType type,
std::unique_ptr< CommandOutputTarget > &&  target 
)
inline

Definition at line 37 of file ExecMenuCommand.h.

39  : CommandImplementation(type, std::move(target))
40  { }
CommandImplementation(CommandType &type, std::unique_ptr< CommandOutputTarget > &&output)
Definition: Command.cpp:95
virtual ExecMenuCommand::~ExecMenuCommand ( )
inlinevirtual

Definition at line 41 of file ExecMenuCommand.h.

41 { }

Member Function Documentation

bool ExecMenuCommand::Apply ( CommandExecutionContext  context)
overridevirtual

Actually carry out the command. Return true if successful and false otherwise.

Reimplemented from CommandImplementation.

Definition at line 36 of file ExecMenuCommand.cpp.

References AlwaysEnabledFlag, AudacityProject::GetCommandManager(), CommandExecutionContext::GetProject(), CommandImplementation::GetString(), and CommandManager::HandleTextualCommand().

37 {
38  CommandManager *cmdManager = context.GetProject()->GetCommandManager();
39 
40  wxString cmdName = GetString(wxT("CommandName"));
41  auto cmdFlags = AlwaysEnabledFlag; // TODO ?
42  auto cmdMask = AlwaysEnabledFlag;
43  return cmdManager->HandleTextualCommand(cmdName, cmdFlags, cmdMask);
44 }
wxString GetString(const wxString &paramName)
Definition: Command.cpp:165
CommandManager * GetCommandManager()
Definition: Project.h:328
bool HandleTextualCommand(const wxString &Str, CommandFlag flags, CommandMask mask)
CommandManager implements a system for organizing all user-callable commands.
AudacityProject * GetProject() const
Definition: Command.h:60

The documentation for this class was generated from the following files: