A little fix for Vadim's fix
[wxWidgets.git] / include / wx / msw / popupwin.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/popupwin.h
3 // Purpose: wxPopupWindow class for wxMSW
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 06.01.01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_MSW_POPUPWIN_H_
13 #define _WX_MSW_POPUPWIN_H_
14
15 // ----------------------------------------------------------------------------
16 // wxPopupWindow
17 // ----------------------------------------------------------------------------
18
19 class WXDLLEXPORT wxPopupWindow : public wxPopupWindowBase
20 {
21 public:
22 wxPopupWindow() { }
23
24 wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE)
25 { (void)Create(parent, flags); }
26
27 bool Create(wxWindow *parent, int flags = wxBORDER_NONE)
28 {
29 return wxPopupWindowBase::Create(parent) &&
30 wxWindow::Create(parent, -1,
31 wxDefaultPosition, wxDefaultSize,
32 (flags & wxBORDER_MASK) | wxPOPUP_WINDOW);
33 }
34
35 protected:
36 virtual void DoGetPosition(int *x, int *y) const
37 {
38 // the position of a "top level" window such as this should be in
39 // screen coordinates, not in the client ones which MSW gives us
40 // (because we are a child window)
41 wxPopupWindowBase::DoGetPosition(x, y);
42
43 GetParent()->ClientToScreen(x, y);
44 }
45 };
46
47 #endif // _WX_MSW_POPUPWIN_H_
48