]> git.saurik.com Git - wxWidgets.git/commitdiff
extended streaming-out for event handlers
authorStefan Csomor <csomor@advancedconcepts.ch>
Sat, 9 Aug 2003 08:20:03 +0000 (08:20 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Sat, 9 Aug 2003 08:20:03 +0000 (08:20 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22719 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/xtistrm.cpp

index 528d89bc57c4cdc5cb0c036643e5245ea63d92f2..1c9be7b698498527adcfde73b9bfc86b3a8600b9 100644 (file)
@@ -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<const wxWindow *>(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 )