Audacity  2.2.2
AppCommandEvent.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity - A Digital Audio Editor
4  Copyright 1999-2009 Audacity Team
5  File License: wxWidgets
6 
7  Dan Horgan
8 
9 ******************************************************************//*******************************************************************/
15 
16 #ifndef __APPCOMMANDEVENT__
17 #define __APPCOMMANDEVENT__
18 
19 #include <wx/event.h>
20 #include "../Audacity.h"
21 #include "../MemoryX.h"
22 
23 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, wxEVT_APP_COMMAND_RECEIVED, -1);
24 
25 class OldStyleCommand;
26 using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
27 
28 class AppCommandEvent final : public wxCommandEvent
29 {
30 private:
32 
33 public:
34  AppCommandEvent(wxEventType commandType = wxEVT_APP_COMMAND_RECEIVED, int id = 0);
35 
36  AppCommandEvent(const AppCommandEvent &event);
38 
39  wxEvent *Clone() const override;
40  void SetCommand(const OldStyleCommandPointer &cmd);
42 
43 private:
44  DECLARE_DYNAMIC_CLASS(AppCommandEvent)
45 };
46 
47 typedef void (wxEvtHandler::*wxAppCommandEventFunction)(AppCommandEvent&);
48 
49 #define wxAppCommandEventHandler(func) \
50  (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAppCommandEventFunction, &func)
51 
52 #define EVT_APP_COMMAND(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_APP_COMMAND_RECEIVED, winid, wxID_ANY, wxAppCommandEventHandler(fn), (wxObject *) NULL ),
53 
54 #endif /* End of include guard: __APPCOMMANDEVENT__ */
OldStyleCommandPointer GetCommand()
AppCommandEvent(wxEventType commandType=wxEVT_APP_COMMAND_RECEIVED, int id=0)
wxEvent * Clone() const override
void(wxEvtHandler::* wxAppCommandEventFunction)(AppCommandEvent &)
OldStyleCommandPointer mCommand
An event 'envelope' for sending Command objects through the wxwidgets event loop. ...
OldStyleCommandPointer is a unique_ptr to an OldStyleCommand.
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, wxEVT_APP_COMMAND_RECEIVED,-1)
void SetCommand(const OldStyleCommandPointer &cmd)
Store a pointer to a command object.
Abstract base class for command interface. This is the version created by Dan Horgan. It was previously a factory for other command classes. It created a separation between the type of a command and the command itself, which is being removed. These Cmmands were managed by CommandDirectory.
Definition: Command.h:33