Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
CellularPanel::Filter Struct Reference
Inheritance diagram for CellularPanel::Filter:
[legend]
Collaboration diagram for CellularPanel::Filter:
[legend]

Public Member Functions

 Filter ()
 
 ~Filter ()
 
int FilterEvent (wxEvent &event) override
 

Static Public Member Functions

static void Create ()
 

Static Public Attributes

static wxWeakRef< CellularPanelspClickedPanel = nullptr
 
static wxWeakRef< CellularPanelspEnteredPanel = nullptr
 

Detailed Description

Definition at line 44 of file CellularPanel.cpp.

Constructor & Destructor Documentation

◆ Filter()

CellularPanel::Filter::Filter ( )
inline

Definition at line 46 of file CellularPanel.cpp.

47 {
48 wxEvtHandler::AddFilter( this );
49 }

◆ ~Filter()

CellularPanel::Filter::~Filter ( )
inline

Definition at line 51 of file CellularPanel.cpp.

52 {
53 wxEvtHandler::RemoveFilter( this );
54 }

Member Function Documentation

◆ Create()

static void CellularPanel::Filter::Create ( )
inlinestatic

Definition at line 56 of file CellularPanel.cpp.

57 {
58 static Filter instance;
59 }

◆ FilterEvent()

int CellularPanel::Filter::FilterEvent ( wxEvent &  event)
inlineoverride

Definition at line 61 of file CellularPanel.cpp.

62 {
63 const auto type = event.GetEventType();
64 if (type == wxEVT_KEY_DOWN &&
65 static_cast< wxKeyEvent& >( event ).GetKeyCode() == WXK_ESCAPE ) {
66 bool eatEvent = false;
67 for (const auto &pPanel: {spClickedPanel, spEnteredPanel}) {
68 if (pPanel) {
69 eatEvent = true;
70 // Handle escape either in the clicked panel to abort a drag, or
71 // to switch among hit test candidates before button down in the
72 // entered (but not yet clicked) panel
73 pPanel->HandleEscapeKey( true );
74 }
75 }
76 if (eatEvent)
77 return Event_Processed;
78 }
79 else if ((type == wxEVT_LEFT_DOWN ||
80 type == wxEVT_RIGHT_DOWN ||
81 type == wxEVT_MIDDLE_DOWN)) {
82 if ( spClickedPanel &&
83 spClickedPanel != event.GetEventObject() ) {
84 // Clicking away from the panel doesn't necessarily change wxWidgets
85 // focus, so we use this global filter instead
86 spClickedPanel->DoKillFocus();
87 // Don't eat the event
88 }
89 }
90 return Event_Skip;
91 }
static wxWeakRef< CellularPanel > spClickedPanel
static wxWeakRef< CellularPanel > spEnteredPanel

References spClickedPanel, and spEnteredPanel.

Member Data Documentation

◆ spClickedPanel

wxWeakRef< CellularPanel > CellularPanel::Filter::spClickedPanel = nullptr
static

◆ spEnteredPanel

wxWeakRef< CellularPanel > CellularPanel::Filter::spEnteredPanel = nullptr
static

Definition at line 94 of file CellularPanel.cpp.

Referenced by FilterEvent(), and CellularPanel::OnMouseEvent().


The documentation for this struct was generated from the following file: