]>
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 | ||
36 | // ============================================================================ | |
37 | // implementation | |
38 | // ============================================================================ | |
39 | ||
40 | bool wxPopupWindow::Create(wxWindow *parent, int flags) | |
41 | { | |
42 | return wxPopupWindowBase::Create(parent) && | |
43 | wxWindow::Create(parent, -1, | |
44 | wxDefaultPosition, wxDefaultSize, | |
45 | flags | wxPOPUP_WINDOW); | |
46 | } | |
47 | ||
48 | void wxPopupWindow::DoGetPosition(int *x, int *y) const | |
49 | { | |
50 | // the position of a "top level" window such as this should be in | |
51 | // screen coordinates, not in the client ones which MSW gives us | |
52 | // (because we are a child window) | |
53 | wxPopupWindowBase::DoGetPosition(x, y); | |
54 | ||
55 | GetParent()->ClientToScreen(x, y); | |
56 | } | |
57 | ||
58 | WXDWORD wxPopupWindow::MSWGetStyle(long flags, WXDWORD *exstyle) const | |
59 | { | |
60 | // we only hnour the border flags | |
61 | WXDWORD style = wxWindow::MSWGetStyle(flags & wxBORDER_MASK, exstyle); | |
62 | ||
63 | // and we mustn't have WS_CHILD style or we would be limited to the parents | |
64 | // client area | |
65 | style &= ~WS_CHILD; | |
66 | style |= WS_POPUP; | |
67 | ||
68 | if ( exstyle ) | |
69 | { | |
70 | // a popup window floats on top of everything | |
71 | *exstyle |= WS_EX_TOPMOST | WS_EX_TOOLWINDOW; | |
72 | } | |
73 | ||
74 | return style; | |
75 | } | |
76 |