X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6ed98c6a3b7f2be77ea16b5d26467796c1be9f4d..9a6d14383a57771a334f6d0b6376dd47bf24049d:/src/os2/popupwin.cpp diff --git a/src/os2/popupwin.cpp b/src/os2/popupwin.cpp index 4c0ca2757a..346d6c87d4 100644 --- a/src/os2/popupwin.cpp +++ b/src/os2/popupwin.cpp @@ -6,7 +6,7 @@ // Created: 13.05.02 // RCS-ID: $Id$ // Copyright: (c) 2002 Dave Webster -// License: wxWindows license +// License: wxWindows licence /////////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#ifdef __GNUG__ - #pragma implementation "popup.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -28,18 +24,15 @@ #ifndef WX_PRECOMP #endif //WX_PRECOMP +#if wxUSE_POPUPWIN #include "wx/popupwin.h" -wxWindowList wxPopupWindow::m_svShownPopups; - // ============================================================================ // implementation // ============================================================================ -bool wxPopupWindow::Create( - wxWindow* pParent -, int nFlags -) +bool wxPopupWindow::Create( wxWindow* pParent, + int nFlags ) { return wxPopupWindowBase::Create(pParent) && wxWindow::Create( pParent @@ -50,10 +43,8 @@ bool wxPopupWindow::Create( ); } // end of wxPopupWindow::Create -void wxPopupWindow::DoGetPosition( - int* pnX -, int* pnY -) const +void wxPopupWindow::DoGetPosition( int* pnX, + int* pnY ) const { // // The position of a "top level" window such as this should be in @@ -64,85 +55,21 @@ void wxPopupWindow::DoGetPosition( GetParent()->ClientToScreen(pnX, pnY); } // end of wxPopupWindow::DoGetPosition -WXDWORD wxPopupWindow::OS2GetStyle( - long lFlags -, WXDWORD* dwExstyle -) const +WXHWND wxPopupWindow::OS2GetParent() const { - WXDWORD dwStyle = wxWindow::OS2GetStyle( lFlags & wxBORDER_MASK - ,dwExstyle - ); - - 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 + // we must be a child of the desktop to be able to extend beyond the parent + // window client area (like the comboboxes drop downs do) // - if (!wxWindowBase::Show(bShow)) - return FALSE; + return (WXHWND)HWND_DESKTOP; +} // end of wxPopupWindow::OS2GetParent - 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 -) +WXDWORD wxPopupWindow::OS2GetStyle( long lFlags, + WXDWORD* dwExstyle ) const { - // - // 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 + WXDWORD dwStyle = wxWindow::OS2GetStyle( lFlags & wxBORDER_MASK + ,dwExstyle + ); + return dwStyle; +} // end of wxPopupWindow::OS2GetStyle +#endif