Audacity  3.0.3
Typedefs | Functions
KeyboardCapture Namespace Reference

Typedefs

using FilterFunction = std::function< bool(wxKeyEvent &) >
 

Functions

bool IsHandler (const wxWindow *handler)
 
wxWindow * GetHandler ()
 
void Capture (wxWindow *handler)
 
void Release (wxWindow *handler)
 
FilterFunction SetPreFilter (const FilterFunction &function)
 Install a pre-filter, returning the previously installed one Pre-filter is called before passing the event to the captured window; if it returns false, then skip the event entirely. More...
 
FilterFunction SetPostFilter (const FilterFunction &function)
 Install a post-filter, returning the previously installed one Post-filter is called if the captured window skips either the EVT_CAPTURE_KEY or the following wxKEY_DOWN event (but not if it skips only the wxEVT_CHAR or wxEVT_KEY_UP event); it is passed a wxKEY_DOWN or a wxKEY_UP event; if it returns false, then the event is skipped. More...
 
void OnFocus (wxWindow &window, wxFocusEvent &event)
 a function useful to implement a focus event handler The window releases the keyboard if the event is for killing focus, otherwise the window captures the keyboard; then refresh the window and skip the event More...
 

Typedef Documentation

◆ FilterFunction

using KeyboardCapture::FilterFunction = typedef std::function< bool( wxKeyEvent& ) >

Definition at line 39 of file KeyboardCapture.h.

Function Documentation

◆ Capture()

AUDACITY_DLL_API void KeyboardCapture::Capture ( wxWindow *  handler)

Definition at line 70 of file KeyboardCapture.cpp.

71 {
72  sHandler() = handler;
73 }

References anonymous_namespace{KeyboardCapture.cpp}::sHandler().

Referenced by OnFocus(), SetActiveProject(), and TrackPanel::SetFocusedCell().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetHandler()

AUDACITY_DLL_API wxWindow * KeyboardCapture::GetHandler ( )

Definition at line 65 of file KeyboardCapture.cpp.

66 {
67  return sHandler();
68 }

References anonymous_namespace{KeyboardCapture.cpp}::sHandler().

Referenced by EventMonitor::FilterEvent(), and IsHandler().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ IsHandler()

AUDACITY_DLL_API bool KeyboardCapture::IsHandler ( const wxWindow *  handler)

Definition at line 60 of file KeyboardCapture.cpp.

61 {
62  return GetHandler() == handler;
63 }

References GetHandler().

Referenced by CellularPanel::OnKillFocus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnFocus()

AUDACITY_DLL_API void KeyboardCapture::OnFocus ( wxWindow &  window,
wxFocusEvent &  event 
)

a function useful to implement a focus event handler The window releases the keyboard if the event is for killing focus, otherwise the window captures the keyboard; then refresh the window and skip the event

Definition at line 95 of file KeyboardCapture.cpp.

96 {
97  if (event.GetEventType() == wxEVT_KILL_FOCUS)
98  KeyboardCapture::Release( &window );
99  else
100  KeyboardCapture::Capture( &window );
101 
102  window.Refresh( false );
103  event.Skip();
104 }

References Capture(), and Release().

Referenced by MixerTrackSlider::OnFocus(), DeviceToolBar::OnFocus(), MixerToolBar::OnFocus(), SelectionBar::OnFocus(), TranscriptionToolBar::OnFocus(), and NumericTextCtrl::OnFocus().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Release()

AUDACITY_DLL_API void KeyboardCapture::Release ( wxWindow *  handler)

Definition at line 75 of file KeyboardCapture.cpp.

76 {
77 // wxASSERT(sHandler() == handler);
78  sHandler() = nullptr;
79 }

References anonymous_namespace{KeyboardCapture.cpp}::sHandler().

Referenced by OnFocus(), CellularPanel::OnKillFocus(), and AudioIO::StopStream().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetPostFilter()

AUDACITY_DLL_API FilterFunction KeyboardCapture::SetPostFilter ( const FilterFunction function)

Install a post-filter, returning the previously installed one Post-filter is called if the captured window skips either the EVT_CAPTURE_KEY or the following wxKEY_DOWN event (but not if it skips only the wxEVT_CHAR or wxEVT_KEY_UP event); it is passed a wxKEY_DOWN or a wxKEY_UP event; if it returns false, then the event is skipped.

Definition at line 88 of file KeyboardCapture.cpp.

89 {
90  auto result = sPostFilter();
91  sPostFilter() = function;
92  return result;
93 }

References anonymous_namespace{KeyboardCapture.cpp}::sPostFilter().

Referenced by InstallHandlers::InstallHandlers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetPreFilter()

AUDACITY_DLL_API FilterFunction KeyboardCapture::SetPreFilter ( const FilterFunction function)

Install a pre-filter, returning the previously installed one Pre-filter is called before passing the event to the captured window; if it returns false, then skip the event entirely.

Definition at line 81 of file KeyboardCapture.cpp.

82 {
83  auto result = sPreFilter();
84  sPreFilter() = function;
85  return result;
86 }

References anonymous_namespace{KeyboardCapture.cpp}::sPreFilter().

Referenced by InstallHandlers::InstallHandlers().

Here is the call graph for this function:
Here is the caller graph for this function:
KeyboardCapture::Release
void Release(wxWindow *handler)
Definition: KeyboardCapture.cpp:75
anonymous_namespace{KeyboardCapture.cpp}::sPostFilter
KeyboardCapture::FilterFunction & sPostFilter()
Definition: KeyboardCapture.cpp:48
KeyboardCapture::Capture
void Capture(wxWindow *handler)
Definition: KeyboardCapture.cpp:70
anonymous_namespace{KeyboardCapture.cpp}::sHandler
wxWindowRef & sHandler()
Definition: KeyboardCapture.cpp:38
KeyboardCapture::GetHandler
wxWindow * GetHandler()
Definition: KeyboardCapture.cpp:65
anonymous_namespace{KeyboardCapture.cpp}::sPreFilter
KeyboardCapture::FilterFunction & sPreFilter()
Definition: KeyboardCapture.cpp:43