mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 22:12:58 +02:00
Context menu for scrubbing in the ruler
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#define __AUDACITY_COMMAND_FUNCTORS__
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/event.h>
|
||||
#include "../MemoryX.h"
|
||||
|
||||
class wxEvent;
|
||||
@@ -61,6 +62,24 @@ private:
|
||||
const audCommandKeyFunction<OBJ> mCommandKeyFunction;
|
||||
};
|
||||
|
||||
// This allows functions to be used either by command manager or by a wxMenu popup,
|
||||
// but the functions MUST ignore the argument!
|
||||
template<typename OBJ>
|
||||
using audCommandPopupFunction = void (OBJ::*)(wxCommandEvent&);
|
||||
|
||||
template<typename OBJ>
|
||||
class PopupFunctor final : public CommandFunctor
|
||||
{
|
||||
public:
|
||||
explicit PopupFunctor(OBJ *This, audCommandPopupFunction<OBJ> pfn)
|
||||
: mThis{ This }, mCommandPopupFunction{ pfn } {}
|
||||
void operator () (int, const wxEvent *) override
|
||||
{ wxCommandEvent dummy; (mThis->*mCommandPopupFunction) (dummy); }
|
||||
private:
|
||||
OBJ *const mThis;
|
||||
const audCommandPopupFunction<OBJ> mCommandPopupFunction;
|
||||
};
|
||||
|
||||
template<typename OBJ>
|
||||
using audCommandListFunction = void (OBJ::*)(int);
|
||||
|
||||
@@ -108,6 +127,11 @@ inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
||||
audCommandKeyFunction<OBJ> pfn)
|
||||
{ return CommandFunctorPointer{ safenew KeyFunctor<OBJ>{ This, pfn } }; }
|
||||
|
||||
template<typename OBJ>
|
||||
inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
||||
audCommandPopupFunction<OBJ> pfn)
|
||||
{ return CommandFunctorPointer{ safenew PopupFunctor<OBJ>{ This, pfn } }; }
|
||||
|
||||
template<typename OBJ>
|
||||
inline CommandFunctorPointer MakeFunctor(OBJ *This,
|
||||
audCommandListFunction<OBJ> pfn)
|
||||
|
Reference in New Issue
Block a user