Audacity  3.0.3
KeyboardCapture.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  KeyboardCapture.h
6 
7  Paul Licameli split this from Project.h
8 
9 **********************************************************************/
10 
11 #ifndef __AUDACITY_KEYBOARD_CAPTURE__
12 #define __AUDACITY_KEYBOARD_CAPTURE__
13 
14 
15 
16 #include <functional>
17 #include <wx/event.h>
18 
22 
30 DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_CAPTURE_KEY, -1);
31 
32 namespace KeyboardCapture
33 {
34  AUDACITY_DLL_API bool IsHandler(const wxWindow *handler);
35  AUDACITY_DLL_API wxWindow *GetHandler();
36  AUDACITY_DLL_API void Capture(wxWindow *handler);
37  AUDACITY_DLL_API void Release(wxWindow *handler);
38 
39  using FilterFunction = std::function< bool( wxKeyEvent& ) >;
40 
44  AUDACITY_DLL_API
45  FilterFunction SetPreFilter( const FilterFunction &function );
46 
53  AUDACITY_DLL_API
54  FilterFunction SetPostFilter( const FilterFunction &function );
55 
60  AUDACITY_DLL_API
61  void OnFocus( wxWindow &window, wxFocusEvent &event );
62 }
63 
64 #endif
KeyboardCapture::SetPostFilter
FilterFunction SetPostFilter(const FilterFunction &function)
Install a post-filter, returning the previously installed one Post-filter is called if the captured w...
Definition: KeyboardCapture.cpp:88
KeyboardCapture::Release
void Release(wxWindow *handler)
Definition: KeyboardCapture.cpp:75
KeyboardCapture::IsHandler
bool IsHandler(const wxWindow *handler)
Definition: KeyboardCapture.cpp:60
KeyboardCapture::SetPreFilter
FilterFunction SetPreFilter(const FilterFunction &function)
Install a pre-filter, returning the previously installed one Pre-filter is called before passing the ...
Definition: KeyboardCapture.cpp:81
DECLARE_EXPORTED_EVENT_TYPE
DECLARE_EXPORTED_EVENT_TYPE(AUDACITY_DLL_API, EVT_CAPTURE_KEY, -1)
Custom events.
KeyboardCapture::Capture
void Capture(wxWindow *handler)
Definition: KeyboardCapture.cpp:70
KeyboardCapture::GetHandler
wxWindow * GetHandler()
Definition: KeyboardCapture.cpp:65
KeyboardCapture
Definition: KeyboardCapture.cpp:57
KeyboardCapture::OnFocus
void OnFocus(wxWindow &window, wxFocusEvent &event)
a function useful to implement a focus event handler The window releases the keyboard if the event is...
Definition: KeyboardCapture.cpp:95
KeyboardCapture::FilterFunction
std::function< bool(wxKeyEvent &) > FilterFunction
Definition: KeyboardCapture.h:39