From: Stefan Csomor Date: Sat, 9 Aug 2003 08:20:03 +0000 (+0000) Subject: extended streaming-out for event handlers X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/a315dda667f8d0592f3962fd54828f66337f7920?ds=inline extended streaming-out for event handlers git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/xtistrm.cpp b/src/common/xtistrm.cpp index 528d89bc57..1c9be7b698 100644 --- a/src/common/xtistrm.cpp +++ b/src/common/xtistrm.cpp @@ -117,6 +117,45 @@ void wxWriter::WriteAllProperties( const wxObject * obj , const wxClassInfo* ci { const wxObject* sink = NULL ; const wxHandlerInfo *handler = NULL ; + + const wxWindow * evSource = dynamic_cast(obj) ; + wxASSERT_MSG( evSource , wxT("Illegal Object Class (Non-Window) as Event Source") ) ; + + wxList *dynamicEvents = evSource->GetDynamicEventTable() ; + + if ( dynamicEvents ) + { + wxList::compatibility_iterator node = dynamicEvents->GetFirst(); + while (node) + { + wxDynamicEventTableEntry *entry = (wxDynamicEventTableEntry*)node->GetData(); + + // find the match + if ( entry->m_fn && (dti->GetEventType() == entry->m_eventType) && + (entry->m_id == -1 || + (entry->m_lastId == -1 && evSource->GetId() == entry->m_id) || + (entry->m_lastId != -1 && + (evSource->GetId() >= entry->m_id && evSource->GetId() <= entry->m_lastId) ) ) && + entry->m_eventSink + ) + { + sink = entry->m_eventSink ; + const wxClassInfo* sinkClassInfo = sink->GetClassInfo() ; + const wxHandlerInfo* sinkHandler = sinkClassInfo->GetFirstHandler() ; + while ( sinkHandler ) + { + if ( sinkHandler->GetEventFunction() == entry->m_fn ) + { + handler = sinkHandler ; + break ; + } + sinkHandler = sinkHandler->GetNext() ; + } + break ; + } + node = node->GetNext(); + } + } if ( persister->BeforeWriteDelegate( obj , ci , pi , sink , handler ) ) { if ( sink != NULL && handler != NULL )