X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c649a6aba49b456a8e4b0a98e4da0e7cc44a1ad8..aa78d22e2008726218d47da1f2ac5864c11b8ebb:/src/msw/popupwin.cpp?ds=sidebyside diff --git a/src/msw/popupwin.cpp b/src/msw/popupwin.cpp index eb811168db..b4586d291b 100644 --- a/src/msw/popupwin.cpp +++ b/src/msw/popupwin.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "popup.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -29,6 +25,7 @@ #endif #ifndef WX_PRECOMP +#include "wx/defs.h" #endif //WX_PRECOMP #if wxUSE_POPUPWIN @@ -37,16 +34,17 @@ #include "wx/msw/private.h" // for GetDesktopWindow() -IMPLEMENT_DYNAMIC_CLASS(wxPopupWindow, wxWindow) - // ============================================================================ // implementation // ============================================================================ bool wxPopupWindow::Create(wxWindow *parent, int flags) { + // popup windows are created hidden by default + Hide(); + return wxPopupWindowBase::Create(parent) && - wxWindow::Create(parent, -1, + wxWindow::Create(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, flags | wxPOPUP_WINDOW); } @@ -84,13 +82,19 @@ WXHWND wxPopupWindow::MSWGetParent() const // WS_CHILD but then showing a popup would deactivate the parent which // is ugly and working around this, although possible, is even more // ugly + // GetDesktopWindow() is not always supported on WinCE, and if + // it is, it often returns NULL. +#ifdef __WXWINCE__ + return 0; +#else return (WXHWND)::GetDesktopWindow(); +#endif } bool wxPopupWindow::Show(bool show) { if ( !wxWindowMSW::Show(show) ) - return FALSE; + return false; if ( show ) { @@ -99,9 +103,12 @@ bool wxPopupWindow::Show(bool show) { wxLogLastError(_T("SetWindowPos")); } + + // and set it as the foreground window so the mouse can be captured + ::SetForegroundWindow(GetHwnd()); } - return TRUE; + return true; } #endif // #if wxUSE_POPUPWIN