Audacity 3.2.0
ModNullCallback.cpp
Go to the documentation of this file.
1/**********************************************************************
2
3 Audacity: A Digital Audio Editor
4
5 ModNullCallback.cpp
6
7 James Crook
8
9 Audacity is free software.
10 This file is licensed under the wxWidgets license, see License.txt
11
12********************************************************************//*****************************************************************//********************************************************************/
27
28#include <wx/wx.h>
29#include "ModNullCallback.h"
30#include "ModuleConstants.h"
31#include "ShuttleGui.h"
32#include "Project.h"
34#include "CommonCommandFlags.h"
35
36/*
37//#define ModuleDispatchName "ModuleDispatch"
38See the example in this file. It has several cases/options in it.
39*/
40
41// derived from wxFrame as it needs to be some kind of event handler.
42class ModNullCallback : public wxFrame
43{
44public:
45// Name these OnFuncXXX functions by whatever they will do.
46 void OnFuncFirst(const CommandContext &);
47 void OnFuncSecond(const CommandContext &);
48};
49
51{
52 int k=32;
53}
54
56{
57 int k=42;
58}
60
61#define ModNullFN(X) static_cast<CommandFunctorPointer>((&ModNullCallback:: X))
62
63extern "C" {
64
66{
67// no specific command handler object ... use the project.
68return project;
69}
70
72
73namespace {
75{
76 // Get here only after the module version check passes
77 using namespace MenuTable;
78 // We add two new commands into the Analyze menu.
79 static AttachedItem sAttachment{ wxT("Analyze"),
80 ( FinderScope( ident ), Section( wxT("NullModule"),
81 Command(
82 _T("A New Command"), // internal name
83 XXO("1st Experimental Command..."), //displayed name
84 ModNullFN( OnFuncFirst ),
86 Command(
87 _T("Another New Command"),
88 XXO("2nd Experimental Command"),
89 ModNullFN( OnFuncSecond ),
91 ) )
92 };
93}
94}
95
96// This is the function that connects us to Audacity.
99{
100 switch (type)
101 {
102 case ModuleInitialize:
104 break;
105 case AppInitialized:
106 break;
107 case AppQuiting:
108 break;
109 default:
110 break;
111 }
112
113 return 1;
114}
115
116//Example code commented out.
117#if 0
118// This is an example function to hijack the main panel
119int DLL_API MainPanelFunc(int ix)
120{
121 ix=ix;//compiler food
122 // If we wanted to hide Audacity's Project,
123 // we'd create a new wxFrame right here and return a pointer to it
124 // as our return result.
125
126// Don't hijack the main panel, just return a NULL;
127 return NULL;
128}
129#endif
130
131} // End extern "C"
wxT("CloseDown"))
wxEvtHandler CommandHandlerObject
const ReservedCommandFlag & AudioIONotBusyFlag()
#define XXO(s)
Definition: Internat.h:44
int DLL_API ModuleDispatch(ModuleDispatchTypes type)
#define ModNullFN(X)
static CommandHandlerObject & ident(AudacityProject &project)
ModNullCallback * pModNullCallback
#define DLL_API
ModuleDispatchTypes
@ AppInitialized
@ ModuleInitialize
@ AppQuiting
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
ModNullCallback is a class containing all the callback functions for this demonstartion module....
void OnFuncFirst(const CommandContext &)
void OnFuncSecond(const CommandContext &)
std::unique_ptr< MenuPart > Section(const Identifier &internalName, Args &&... args)
std::unique_ptr< CommandItem > Command(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const CommandManager::Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())