]> git.saurik.com Git - wxWidgets.git/commitdiff
Added recursive event handler pushing to fix context help problem.
authorJulian Smart <julian@anthemion.co.uk>
Sun, 12 May 2002 12:46:34 +0000 (12:46 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sun, 12 May 2002 12:46:34 +0000 (12:46 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15530 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/common/cshelp.cpp

index e2737d2ed1fdf2fa8618f552d9d92827e9cf0e44..2cc7626a4aab31a5c276ef52ee2cc414da2abb0a 100644 (file)
@@ -87,6 +87,23 @@ wxContextHelp::~wxContextHelp()
         EndContextHelp();
 }
 
+static void wxPushOrPopEventHandlers(wxContextHelp* help, wxWindow* win, bool push)
+{
+    if (push)
+        win->PushEventHandler(new wxContextHelpEvtHandler(help));
+    else
+        win->PopEventHandler();
+
+    wxNode* node = win->GetChildren().First();
+    while (node)
+    {
+        wxWindow* child = (wxWindow*) node->Data();
+        wxPushOrPopEventHandlers(help, child, push);
+
+        node = node->Next();
+    }
+}
+
 // Begin 'context help mode'
 bool wxContextHelp::BeginContextHelp(wxWindow* win)
 {
@@ -103,7 +120,10 @@ bool wxContextHelp::BeginContextHelp(wxWindow* win)
     //    wxSetCursor(cursor);
 #endif
 
-    win->PushEventHandler(new wxContextHelpEvtHandler(this));
+    m_status = FALSE;
+
+//    win->PushEventHandler(new wxContextHelpEvtHandler(this));
+    wxPushOrPopEventHandlers(this, win, TRUE);
 
     win->CaptureMouse();
 
@@ -111,7 +131,8 @@ bool wxContextHelp::BeginContextHelp(wxWindow* win)
 
     win->ReleaseMouse();
 
-    win->PopEventHandler(TRUE);
+//    win->PopEventHandler(TRUE);
+    wxPushOrPopEventHandlers(this, win, FALSE);
 
     win->SetCursor(oldCursor);
 
@@ -173,7 +194,8 @@ bool wxContextHelpEvtHandler::ProcessEvent(wxEvent& event)
         (event.GetEventType() == wxEVT_ACTIVATE) ||
         (event.GetEventType() == wxEVT_MOUSE_CAPTURE_CHANGED))
     {
-        m_contextHelp->SetStatus(FALSE);
+        // May have already been set to TRUE by a left-click
+        //m_contextHelp->SetStatus(FALSE);
         m_contextHelp->EndContextHelp();
         return TRUE;
     }