X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/63ebec23f23420f49163f22ff3ba3955f6be0aa9..aad65f130d9cb77d0e9f2b7b580c54712386f77a:/src/os2/popupwin.cpp diff --git a/src/os2/popupwin.cpp b/src/os2/popupwin.cpp index adc25e8f9c..4c0ca2757a 100644 --- a/src/os2/popupwin.cpp +++ b/src/os2/popupwin.cpp @@ -30,6 +30,8 @@ #include "wx/popupwin.h" +wxWindowList wxPopupWindow::m_svShownPopups; + // ============================================================================ // implementation // ============================================================================ @@ -74,3 +76,73 @@ WXDWORD wxPopupWindow::OS2GetStyle( return dwStyle; } // end of wxPopupWindow::OS2GetStyle +bool wxPopupWindow::Show( + bool bShow +) +{ + SWP vSwp; + // + // Skip wxWindow::Show() which calls wxBringWindowToTop(): this results in + // activating the popup window and stealing the atcivation from our parent + // which means that the parent frame becomes deactivated when opening a + // combobox, for example -- definitely not what we want + // + if (!wxWindowBase::Show(bShow)) + return FALSE; + + if (bShow) + { + m_svShownPopups.Append(this); + } + else // remove from the shown list + { + m_svShownPopups.DeleteObject(this); + } + ::WinQueryWindowPos(GetHwnd(), &vSwp); + + if (bShow) + { + ::WinSetWindowPos( GetHwnd() + ,HWND_TOP + ,vSwp.x + ,vSwp.y + ,vSwp.cx + ,vSwp.cy + ,SWP_DEACTIVATE | SWP_SHOW | SWP_ZORDER + ); + } + else + { + ::WinSetWindowPos( GetHwnd() + ,HWND_BOTTOM + ,vSwp.x + ,vSwp.y + ,vSwp.cx + ,vSwp.cy + ,SWP_HIDE | SWP_ZORDER + ); + } + return TRUE; +} // end of wxPopupWindow::Show + +/* static */ +wxPopupWindow* wxPopupWindow::FindPopupFor( + wxWindow* pWinParent +) +{ + // + // Find a popup with the given parent in the linked list of all shown + // popups + // + for ( wxWindowList::Node *node = m_svShownPopups.GetFirst(); + node; + node = node->GetNext() ) + { + wxWindow* pWin = node->GetData(); + + if (pWin->GetParent() == pWinParent ) + return (wxPopupWindow *)pWin; + } + return NULL; +} // end of wxPopupWindow::FindPopupFor +