From 25b1b442d63f3ff7ca4d007843b2d02f9137f801 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Tue, 17 Jun 2003 08:26:01 +0000 Subject: [PATCH] Added corrected Show() to wxPopupWindow git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21197 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/msw/popupwin.h | 2 ++ src/msw/popupwin.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/include/wx/msw/popupwin.h b/include/wx/msw/popupwin.h index ae220bc388..1dffaa67ee 100644 --- a/include/wx/msw/popupwin.h +++ b/include/wx/msw/popupwin.h @@ -30,6 +30,8 @@ public: bool Create(wxWindow *parent, int flags = wxBORDER_NONE); + virtual bool Show(bool show = TRUE); + protected: // popups handle the position like wxTopLevelWindow, not wxWindow virtual void DoGetPosition(int *x, int *y) const; diff --git a/src/msw/popupwin.cpp b/src/msw/popupwin.cpp index 7e44f08a0e..6cddce9ae3 100644 --- a/src/msw/popupwin.cpp +++ b/src/msw/popupwin.cpp @@ -87,4 +87,26 @@ WXHWND wxPopupWindow::MSWGetParent() const return (WXHWND)::GetDesktopWindow(); } +bool wxPopupWindow::Show(bool show) +{ + if ( !wxWindowBase::Show(show) ) + return FALSE; + + HWND hWnd = GetHwnd(); + int cshow = show ? SW_SHOW : SW_HIDE; + ::ShowWindow(hWnd, cshow); + + if ( show ) + { + // raise to top of z order + if (!::SetWindowPos(hWnd, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE)) + { + wxLogLastError(_T("SetWindowPos")); + } + } + + return TRUE; +} + #endif // #if wxUSE_POPUPWIN + -- 2.45.2