Audacity 3.2.0
Public Member Functions | Static Public Member Functions | List of all members
Journal::Events::anonymous_namespace{JournalEvents.cpp}::RegisteredEventType Struct Reference
Inheritance diagram for Journal::Events::anonymous_namespace{JournalEvents.cpp}::RegisteredEventType:
[legend]
Collaboration diagram for Journal::Events::anonymous_namespace{JournalEvents.cpp}::RegisteredEventType:
[legend]

Public Member Functions

 RegisteredEventType (Code code)
 
- Public Member Functions inherited from Journal::RegisteredCommand
 RegisteredCommand (const wxString &name, Dispatcher dispatcher)
 

Static Public Member Functions

static bool DispatchEvent (wxArrayStringEx fields)
 

Detailed Description

Definition at line 64 of file JournalEvents.cpp.

Constructor & Destructor Documentation

◆ RegisteredEventType()

Journal::Events::anonymous_namespace{JournalEvents.cpp}::RegisteredEventType::RegisteredEventType ( Code  code)
inlineexplicit

Definition at line 66 of file JournalEvents.cpp.

67 : RegisteredCommand{ code.GET(), DispatchEvent }
68 {}
RegisteredCommand(const wxString &name, Dispatcher dispatcher)

Member Function Documentation

◆ DispatchEvent()

bool Journal::Events::anonymous_namespace{JournalEvents.cpp}::RegisteredEventType::DispatchEvent ( wxArrayStringEx  fields)
static

Definition at line 145 of file JournalEvents.cpp.

146{
147 bool handled = false;
148 if ( !fields.empty() ) {
149 auto &catalog = ByCode();
150 auto first = fields.begin();
151 if (auto iter = catalog.find( *first ); iter != catalog.end()) {
152 auto &type = iter->second;
153 fields.erase( first );
154 auto pEvent = type.deserializer( type.type, fields );
155 if ( pEvent ) {
156 // So far only dispatching command events. Maybe other
157 // methods of dispatch will be appropriate for other types.
158 if ( auto pHandler = dynamic_cast<wxEvtHandler*>(
159 pEvent->GetEventObject() )
160 ) {
161 if (auto pWindow = dynamic_cast<wxWindow *>(pHandler))
162 // Allow for the pushing and popping of event handlers
163 // on windows
164 pHandler = pWindow->GetEventHandler();
165 pHandler->SafelyProcessEvent( *pEvent );
166 handled = true;
167 }
168 }
169 }
170 }
171 return handled;
172}

References Journal::Events::anonymous_namespace{JournalEvents.cpp}::ByCode().

Here is the call graph for this function:

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