]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/event.cpp
fingers crossed..
[wxWidgets.git] / src / common / event.cpp
index 301ae910822019a37c3ab10f1224a5685187139b..73d7d79ba674238864b8bfd44a00c55a4b74c8f9 100644 (file)
@@ -83,6 +83,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxWindowCreateEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxWindowDestroyEvent, wxEvent)
     IMPLEMENT_DYNAMIC_CLASS(wxHelpEvent, wxCommandEvent)
+    IMPLEMENT_DYNAMIC_CLASS(wxContextMenuEvent, wxCommandEvent)
 #endif // wxUSE_GUI
 
 const wxEventTable *wxEvtHandler::GetEventTable() const
@@ -942,15 +943,21 @@ bool wxEvtHandler::ProcessEvent(wxEvent& event)
     }
 
 #if wxUSE_GUI
-    // Carry on up the parent-child hierarchy,
-    // but only if event is a command event: it wouldn't
-    // make sense for a parent to receive a child's size event, for example
+    // Carry on up the parent-child hierarchy, but only if event is a command
+    // event: it wouldn't make sense for a parent to receive a child's size
+    // event, for example
     if ( m_isWindow && event.IsCommandEvent() )
     {
         wxWindow *win = (wxWindow *)this;
-        wxWindow *parent = win->GetParent();
-        if (parent && !parent->IsBeingDeleted())
-            return parent->GetEventHandler()->ProcessEvent(event);
+
+        // 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() )
+        {
+            wxWindow *parent = win->GetParent();
+            if (parent && !parent->IsBeingDeleted())
+                return parent->GetEventHandler()->ProcessEvent(event);
+        }
     }
 #endif // wxUSE_GUI