Audacity 3.2.0
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
20
21#include <wx/event.h> // to declare custom event types
22#include <memory>
23
24DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, wxEVT_APP_COMMAND_RECEIVED, -1);
25
26class OldStyleCommand;
27using OldStyleCommandPointer = std::shared_ptr<OldStyleCommand>;
28
29class AppCommandEvent final : public wxCommandEvent
30{
31private:
33
34public:
35 AppCommandEvent(wxEventType commandType = wxEVT_APP_COMMAND_RECEIVED, int id = 0);
36
37 AppCommandEvent(const AppCommandEvent &event);
39
40 wxEvent *Clone() const override;
41 void SetCommand(const OldStyleCommandPointer &cmd);
43
44private:
45 DECLARE_DYNAMIC_CLASS(AppCommandEvent)
46};
47
48typedef void (wxEvtHandler::*wxAppCommandEventFunction)(AppCommandEvent&);
49
50#define wxAppCommandEventHandler(func) \
51 (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxAppCommandEventFunction, &func)
52
53#define EVT_APP_COMMAND(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_APP_COMMAND_RECEIVED, winid, wxID_ANY, wxAppCommandEventHandler(fn), (wxObject *) NULL ),
54
55#endif /* End of include guard: __APPCOMMANDEVENT__ */
void(wxEvtHandler::* wxAppCommandEventFunction)(AppCommandEvent &)
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, wxEVT_APP_COMMAND_RECEIVED, -1)
An event 'envelope' for sending Command objects through the wxwidgets event loop.
OldStyleCommandPointer mCommand
AppCommandEvent(wxEventType commandType=wxEVT_APP_COMMAND_RECEIVED, int id=0)
void SetCommand(const OldStyleCommandPointer &cmd)
Store a pointer to a command object.
OldStyleCommandPointer GetCommand()
wxEvent * Clone() const override
Abstract base class for command interface. This is the version created by Dan Horgan....
Definition: Command.h:30
OldStyleCommandPointer is a unique_ptr to an OldStyleCommand.