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 +