From ad9fb0334fbfe5747b67c09ba714c1f00bd40ff8 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 6 Jun 2002 19:35:51 +0000 Subject: [PATCH] Dislaying popup tip windows seems to work right now. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15766 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/popupwin.h | 4 +--- include/wx/gtk1/popupwin.h | 4 +--- src/common/cshelp.cpp | 13 ++++++++----- src/gtk/popupwin.cpp | 16 ++++++++++++++-- src/gtk1/popupwin.cpp | 16 ++++++++++++++-- 5 files changed, 38 insertions(+), 15 deletions(-) diff --git a/include/wx/gtk/popupwin.h b/include/wx/gtk/popupwin.h index d01ecdff01..40ad14d746 100644 --- a/include/wx/gtk/popupwin.h +++ b/include/wx/gtk/popupwin.h @@ -27,9 +27,7 @@ class wxPopupWindow: public wxPopupWindowBase { public: wxPopupWindow() { } -#ifdef __DARWIN__ - virtual ~wxPopupWindow() { } -#endif + virtual ~wxPopupWindow(); wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) { (void)Create(parent, flags); } diff --git a/include/wx/gtk1/popupwin.h b/include/wx/gtk1/popupwin.h index d01ecdff01..40ad14d746 100644 --- a/include/wx/gtk1/popupwin.h +++ b/include/wx/gtk1/popupwin.h @@ -27,9 +27,7 @@ class wxPopupWindow: public wxPopupWindowBase { public: wxPopupWindow() { } -#ifdef __DARWIN__ - virtual ~wxPopupWindow() { } -#endif + virtual ~wxPopupWindow(); wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE) { (void)Create(parent, flags); } diff --git a/src/common/cshelp.cpp b/src/common/cshelp.cpp index 18b62f6f66..f25d0943e7 100644 --- a/src/common/cshelp.cpp +++ b/src/common/cshelp.cpp @@ -6,7 +6,7 @@ // Created: 08/09/2000 // RCS-ID: $Id$ // Copyright: (c) 2000 Julian Smart, Vadim Zeitlin -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -144,14 +144,14 @@ bool wxContextHelp::BeginContextHelp(wxWindow* win) { wxPoint pt; wxWindow* winAtPtr = wxFindWindowAtPointer(pt); - /* + /* if (winAtPtr) { - wxString msg; + wxString msg; msg.Printf("Picked %s (%d)", (const char*) winAtPtr->GetName(), winAtPtr->GetId()); cout << msg << '\n'; } - */ + */ if (winAtPtr) DispatchEvent(winAtPtr, pt); @@ -170,6 +170,7 @@ bool wxContextHelp::EndContextHelp() bool wxContextHelp::EventLoop() { m_inHelp = TRUE; + while ( m_inHelp ) { if (wxTheApp->Pending()) @@ -181,6 +182,7 @@ bool wxContextHelp::EventLoop() wxTheApp->ProcessIdle(); } } + return TRUE; } @@ -223,8 +225,9 @@ bool wxContextHelp::DispatchEvent(wxWindow* win, const wxPoint& pt) { wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(), pt) ; helpEvent.SetEventObject(this); + eventProcessed = win->GetEventHandler()->ProcessEvent(helpEvent); - + // Go up the window hierarchy until the event is handled (or not). // I.e. keep submitting ancestor windows until one is recognised // by the app code that processes the ids and displays help. diff --git a/src/gtk/popupwin.cpp b/src/gtk/popupwin.cpp index 7f63baa20f..923a68bbd1 100644 --- a/src/gtk/popupwin.cpp +++ b/src/gtk/popupwin.cpp @@ -149,6 +149,12 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) +wxPopupWindow::~wxPopupWindow() +{ + if (GTK_WIDGET_HAS_GRAB(m_widget)) + gtk_grab_remove( m_widget ); +} + bool wxPopupWindow::Create( wxWindow *parent, int style ) { m_needParent = FALSE; @@ -342,9 +348,15 @@ bool wxPopupWindow::Show( bool show ) GtkOnSize( m_x, m_y, m_width, m_height ); } - + + if (!show) + gtk_grab_remove( m_widget ); + bool ret = wxWindow::Show( show ); - + + if (show) + gtk_grab_add( m_widget ); + return ret; } diff --git a/src/gtk1/popupwin.cpp b/src/gtk1/popupwin.cpp index 7f63baa20f..923a68bbd1 100644 --- a/src/gtk1/popupwin.cpp +++ b/src/gtk1/popupwin.cpp @@ -149,6 +149,12 @@ END_EVENT_TABLE() IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) +wxPopupWindow::~wxPopupWindow() +{ + if (GTK_WIDGET_HAS_GRAB(m_widget)) + gtk_grab_remove( m_widget ); +} + bool wxPopupWindow::Create( wxWindow *parent, int style ) { m_needParent = FALSE; @@ -342,9 +348,15 @@ bool wxPopupWindow::Show( bool show ) GtkOnSize( m_x, m_y, m_width, m_height ); } - + + if (!show) + gtk_grab_remove( m_widget ); + bool ret = wxWindow::Show( show ); - + + if (show) + gtk_grab_add( m_widget ); + return ret; } -- 2.47.2