]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/event.cpp
corrected realization of vertical toolbars (were always horizontal)
[wxWidgets.git] / src / common / event.cpp
index 6f3acbcadc58c79a8d2cc3722874413a2688ab93..221360d838a463bba53f53e8fd9ddac87a15e373 100644 (file)
@@ -52,9 +52,9 @@
 
 IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
 
 IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
 
 #if wxUSE_GUI
 
 #if wxUSE_GUI
+    IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
@@ -724,8 +724,6 @@ wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow *win)
     SetEventObject(win);
 }
 
     SetEventObject(win);
 }
 
-#endif // wxUSE_GUI
-
 void wxIdleEvent::CopyObject(wxObject& obj_d) const
 {
     wxIdleEvent *obj = (wxIdleEvent *)&obj_d;
 void wxIdleEvent::CopyObject(wxObject& obj_d) const
 {
     wxIdleEvent *obj = (wxIdleEvent *)&obj_d;
@@ -740,6 +738,8 @@ wxChildFocusEvent::wxChildFocusEvent(wxWindow *win)
     SetEventObject(win);
 }
 
     SetEventObject(win);
 }
 
+#endif // wxUSE_GUI
+
 // ----------------------------------------------------------------------------
 // wxEvtHandler
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // wxEvtHandler
 // ----------------------------------------------------------------------------
@@ -761,6 +761,9 @@ wxEvtHandler::wxEvtHandler()
     m_eventsLocker = new wxCriticalSection;
 #  endif
 #endif
     m_eventsLocker = new wxCriticalSection;
 #  endif
 #endif
+    // no client data (yet)
+    m_clientData = NULL;
+    m_clientDataType = wxClientData_None;
 }
 
 wxEvtHandler::~wxEvtHandler()
 }
 
 wxEvtHandler::~wxEvtHandler()
@@ -798,6 +801,10 @@ wxEvtHandler::~wxEvtHandler()
     delete m_eventsLocker;
 #  endif
 #endif
     delete m_eventsLocker;
 #  endif
 #endif
+
+    // we only delete object data, not untyped
+    if ( m_clientDataType == wxClientData_Object )
+        delete m_clientObject;
 }
 
 #if wxUSE_THREADS
 }
 
 #if wxUSE_THREADS
@@ -913,6 +920,8 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
     info = CLASSINFO(wxWindowGTK);
 #  elif defined(__WXMGL__)
     info = CLASSINFO(wxWindowMGL);
     info = CLASSINFO(wxWindowGTK);
 #  elif defined(__WXMGL__)
     info = CLASSINFO(wxWindowMGL);
+#  elif defined(__WXPM__)
+    info = CLASSINFO(wxWindowOS2);
 #  elif defined(__WXMAC__)
     info = CLASSINFO(wxWindowMac);
 #  elif defined(__WXMOTIF__)
 #  elif defined(__WXMAC__)
     info = CLASSINFO(wxWindowMac);
 #  elif defined(__WXMOTIF__)
@@ -1001,12 +1010,14 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
     {
         wxWindow *win = (wxWindow *)this;
 
     {
         wxWindow *win = (wxWindow *)this;
 
-        // also, don't propagate events beyond the first top level window: it
-        // doesn't make sense to process dialogs events in the parent frame
-        if ( !win->IsTopLevel() )
+        // honour the requests to stop propagation at this window: this is
+        // used by the dialogs, for example, to prevent processing the events
+        // from the dialog controls in the parent frame which rarely, if ever,
+        // makes sense
+        if ( !(win->GetExtraStyle() & wxWS_EX_BLOCK_EVENTS) )
         {
             wxWindow *parent = win->GetParent();
         {
             wxWindow *parent = win->GetParent();
-            if (parent && !parent->IsBeingDeleted())
+            if ( parent && !parent->IsBeingDeleted() )
                 return parent->GetEventHandler()->ProcessEvent(event);
         }
     }
                 return parent->GetEventHandler()->ProcessEvent(event);
         }
     }
@@ -1169,6 +1180,48 @@ bool wxEvtHandler::SearchDynamicEventTable( wxEvent& event )
     return FALSE;
 };
 
     return FALSE;
 };
 
+void wxEvtHandler::DoSetClientObject( wxClientData *data )
+{
+    wxASSERT_MSG( m_clientDataType != wxClientData_Void,
+                  wxT("can't have both object and void client data") );
+
+    if ( m_clientObject )
+        delete m_clientObject;
+
+    m_clientObject = data;
+    m_clientDataType = wxClientData_Object;
+}
+
+wxClientData *wxEvtHandler::DoGetClientObject() const
+{
+    // it's not an error to call GetClientObject() on a window which doesn't
+    // have client data at all - NULL will be returned
+    wxASSERT_MSG( m_clientDataType != wxClientData_Void,
+                  wxT("this window doesn't have object client data") );
+
+    return m_clientObject;
+}
+
+void wxEvtHandler::DoSetClientData( void *data )
+{
+    wxASSERT_MSG( m_clientDataType != wxClientData_Object,
+                  wxT("can't have both object and void client data") );
+
+    m_clientData = data;
+    m_clientDataType = wxClientData_Void;
+}
+
+void *wxEvtHandler::DoGetClientData() const
+{
+    // it's not an error to call GetClientData() on a window which doesn't have
+    // client data at all - NULL will be returned
+    wxASSERT_MSG( m_clientDataType != wxClientData_Object,
+                  wxT("this window doesn't have void client data") );
+
+    return m_clientData;
+}
+
+
 #if WXWIN_COMPATIBILITY
 bool wxEvtHandler::OnClose()
 {
 #if WXWIN_COMPATIBILITY
 bool wxEvtHandler::OnClose()
 {