]>
Commit | Line | Data |
---|---|---|
e49d97e6 VZ |
1 | /////////////////////////////////////////////////////////////////////////////// |
2 | // Name: msw/popupwin.cpp | |
3 | // Purpose: implements wxPopupWindow for MSW | |
4 | // Author: Vadim Zeitlin | |
5 | // Modified by: | |
6 | // Created: 08.05.02 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) 2002 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr> | |
9 | // License: wxWindows license | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
20 | #ifdef __GNUG__ | |
21 | #pragma implementation "popup.h" | |
22 | #endif | |
23 | ||
24 | // For compilers that support precompilation, includes "wx.h". | |
25 | #include "wx/wxprec.h" | |
26 | ||
27 | #ifdef __BORLANDC__ | |
28 | #pragma hdrstop | |
29 | #endif | |
30 | ||
31 | #ifndef WX_PRECOMP | |
32 | #endif //WX_PRECOMP | |
33 | ||
34 | #include "wx/popupwin.h" | |
35 | ||
220c6d43 VZ |
36 | #include "wx/msw/private.h" // for WS_CHILD and WS_POPUP |
37 | ||
e49d97e6 VZ |
38 | // ============================================================================ |
39 | // implementation | |
40 | // ============================================================================ | |
41 | ||
42 | bool wxPopupWindow::Create(wxWindow *parent, int flags) | |
43 | { | |
44 | return wxPopupWindowBase::Create(parent) && | |
45 | wxWindow::Create(parent, -1, | |
46 | wxDefaultPosition, wxDefaultSize, | |
47 | flags | wxPOPUP_WINDOW); | |
48 | } | |
49 | ||
50 | void wxPopupWindow::DoGetPosition(int *x, int *y) const | |
51 | { | |
52 | // the position of a "top level" window such as this should be in | |
53 | // screen coordinates, not in the client ones which MSW gives us | |
54 | // (because we are a child window) | |
55 | wxPopupWindowBase::DoGetPosition(x, y); | |
56 | ||
57 | GetParent()->ClientToScreen(x, y); | |
58 | } | |
59 | ||
60 | WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const | |
61 | { | |
62 | // we only hnour the border flags | |
63 | WXDWORD style = wxWindow::MSWGetStyle(flags & wxBORDER_MASK, exstyle); | |
64 | ||
65 | // and we mustn't have WS_CHILD style or we would be limited to the parents | |
66 | // client area | |
67 | style &= ~WS_CHILD; | |
68 | style |= WS_POPUP; | |
69 | ||
70 | if ( exstyle ) | |
71 | { | |
72 | // a popup window floats on top of everything | |
73 | *exstyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW; | |
74 | } | |
75 | ||
76 | return style; | |
77 | } | |
78 |