]>
git.saurik.com Git - wxWidgets.git/blob - src/os2/popupwin.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: os2/popupwin.cpp
3 // Purpose: implements wxPopupWindow for OS2
4 // Author: Dave Webster
8 // Copyright: (c) 2002 Dave Webster <dwebster@bhmi.com>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "popup.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
31 #include "wx/popupwin.h"
33 wxWindowList
wxPopupWindow::m_svShownPopups
;
35 // ============================================================================
37 // ============================================================================
39 bool wxPopupWindow::Create(
44 return wxPopupWindowBase::Create(pParent
) &&
45 wxWindow::Create( pParent
49 ,nFlags
| wxPOPUP_WINDOW
51 } // end of wxPopupWindow::Create
53 void wxPopupWindow::DoGetPosition(
59 // The position of a "top level" window such as this should be in
60 // screen coordinates, not in the client ones which MSW gives us
61 // (because we are a child window)
63 wxPopupWindowBase::DoGetPosition(pnX
, pnY
);
64 GetParent()->ClientToScreen(pnX
, pnY
);
65 } // end of wxPopupWindow::DoGetPosition
67 WXDWORD
wxPopupWindow::OS2GetStyle(
72 WXDWORD dwStyle
= wxWindow::OS2GetStyle( lFlags
& wxBORDER_MASK
77 } // end of wxPopupWindow::OS2GetStyle
79 bool wxPopupWindow::Show(
85 // Skip wxWindow::Show() which calls wxBringWindowToTop(): this results in
86 // activating the popup window and stealing the atcivation from our parent
87 // which means that the parent frame becomes deactivated when opening a
88 // combobox, for example -- definitely not what we want
90 if (!wxWindowBase::Show(bShow
))
95 m_svShownPopups
.Append(this);
97 else // remove from the shown list
99 m_svShownPopups
.DeleteObject(this);
101 ::WinQueryWindowPos(GetHwnd(), &vSwp
);
105 ::WinSetWindowPos( GetHwnd()
111 ,SWP_DEACTIVATE
| SWP_SHOW
| SWP_ZORDER
116 ::WinSetWindowPos( GetHwnd()
122 ,SWP_HIDE
| SWP_ZORDER
126 } // end of wxPopupWindow::Show
129 wxPopupWindow
* wxPopupWindow::FindPopupFor(
134 // Find a popup with the given parent in the linked list of all shown
137 for ( wxWindowList::Node
*node
= m_svShownPopups
.GetFirst();
139 node
= node
->GetNext() )
141 wxWindow
* pWin
= node
->GetData();
143 if (pWin
->GetParent() == pWinParent
)
144 return (wxPopupWindow
*)pWin
;
147 } // end of wxPopupWindow::FindPopupFor