Added recursive event handler pushing to fix context help problem.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15530 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2002-05-12 12:46:34 +00:00
parent 30acf700f9
commit b8b9d8a790

View File

@@ -87,6 +87,23 @@ wxContextHelp::~wxContextHelp()
EndContextHelp(); 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' // Begin 'context help mode'
bool wxContextHelp::BeginContextHelp(wxWindow* win) bool wxContextHelp::BeginContextHelp(wxWindow* win)
{ {
@@ -103,7 +120,10 @@ bool wxContextHelp::BeginContextHelp(wxWindow* win)
// wxSetCursor(cursor); // wxSetCursor(cursor);
#endif #endif
win->PushEventHandler(new wxContextHelpEvtHandler(this)); m_status = FALSE;
// win->PushEventHandler(new wxContextHelpEvtHandler(this));
wxPushOrPopEventHandlers(this, win, TRUE);
win->CaptureMouse(); win->CaptureMouse();
@@ -111,7 +131,8 @@ bool wxContextHelp::BeginContextHelp(wxWindow* win)
win->ReleaseMouse(); win->ReleaseMouse();
win->PopEventHandler(TRUE); // win->PopEventHandler(TRUE);
wxPushOrPopEventHandlers(this, win, FALSE);
win->SetCursor(oldCursor); win->SetCursor(oldCursor);
@@ -173,7 +194,8 @@ bool wxContextHelpEvtHandler::ProcessEvent(wxEvent& event)
(event.GetEventType() == wxEVT_ACTIVATE) || (event.GetEventType() == wxEVT_ACTIVATE) ||
(event.GetEventType() == wxEVT_MOUSE_CAPTURE_CHANGED)) (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(); m_contextHelp->EndContextHelp();
return TRUE; return TRUE;
} }