]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/event.cpp
added wx/defs.h include to correct compilation issues under Mac OS X
[wxWidgets.git] / src / common / event.cpp
index 043fa5caabde72bbdd3727475904d904e68b5fa6..02c63cc4fa448445bb324774dc40c5a98be95418 100644 (file)
@@ -52,9 +52,9 @@
 
 IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
 IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
-IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
 
 #if wxUSE_GUI
+    IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxNotifyEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
@@ -67,6 +67,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent)
+    IMPLEMENT_DYNAMIC_CLASS(wxChildFocusEvent, wxCommandEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxShowEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxMaximizeEvent, wxEvent)
@@ -150,6 +151,7 @@ DEFINE_EVENT_TYPE(wxEVT_MIDDLE_DCLICK)
 DEFINE_EVENT_TYPE(wxEVT_RIGHT_DCLICK)
 DEFINE_EVENT_TYPE(wxEVT_SET_FOCUS)
 DEFINE_EVENT_TYPE(wxEVT_KILL_FOCUS)
+DEFINE_EVENT_TYPE(wxEVT_CHILD_FOCUS)
 DEFINE_EVENT_TYPE(wxEVT_MOUSEWHEEL)
 
 // Non-client mouse events
@@ -722,8 +724,6 @@ wxWindowDestroyEvent::wxWindowDestroyEvent(wxWindow *win)
     SetEventObject(win);
 }
 
-#endif // wxUSE_GUI
-
 void wxIdleEvent::CopyObject(wxObject& obj_d) const
 {
     wxIdleEvent *obj = (wxIdleEvent *)&obj_d;
@@ -732,6 +732,18 @@ void wxIdleEvent::CopyObject(wxObject& obj_d) const
     obj->m_requestMore = m_requestMore;
 }
 
+wxChildFocusEvent::wxChildFocusEvent(wxWindow *win)
+                 : wxCommandEvent(wxEVT_CHILD_FOCUS)
+{
+    SetEventObject(win);
+}
+
+#endif // wxUSE_GUI
+
+// ----------------------------------------------------------------------------
+// wxEvtHandler
+// ----------------------------------------------------------------------------
+
 /*
  * Event handler
  */
@@ -989,12 +1001,14 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
     {
         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();
-            if (parent && !parent->IsBeingDeleted())
+            if ( parent && !parent->IsBeingDeleted() )
                 return parent->GetEventHandler()->ProcessEvent(event);
         }
     }