]>
Commit | Line | Data |
---|---|---|
7c0d297a | 1 | ///////////////////////////////////////////////////////////////////////////// |
d0bbcd06 | 2 | // Name: popupwin.h |
63af513b | 3 | // Purpose: interface of wxPopupWindow |
7c0d297a | 4 | // Author: wxWidgets team |
d0bbcd06 | 5 | // RCS-ID: $Id$ |
526954c5 | 6 | // Licence: wxWindows licence |
7c0d297a RR |
7 | ///////////////////////////////////////////////////////////////////////////// |
8 | ||
9 | /** | |
10 | @class wxPopupWindow | |
7c0d297a RR |
11 | |
12 | A special kind of top level window used for popup menus, | |
13 | combobox popups and such. | |
14 | ||
15 | @library{wxcore} | |
16 | @category{managedwnd} | |
17 | ||
18 | @see wxDialog, wxFrame | |
19 | */ | |
20 | ||
21 | class wxPopupWindow: public wxNonOwnedWindow | |
22 | { | |
23 | public: | |
24 | ||
3d2ee2fb RD |
25 | /** |
26 | Default constructor | |
27 | */ | |
28 | wxPopupWindow(); | |
29 | ||
7c0d297a RR |
30 | /** |
31 | Constructor | |
32 | */ | |
33 | wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE); | |
dd72e767 | 34 | |
7c0d297a RR |
35 | /** |
36 | Create method for two-step creation | |
37 | */ | |
38 | bool Create(wxWindow *parent, int flags = wxBORDER_NONE); | |
dd72e767 | 39 | |
7c0d297a | 40 | /** |
0824e369 | 41 | Move the popup window to the right position, i.e.\ such that it is |
7c0d297a | 42 | entirely visible. |
dd72e767 | 43 | |
7c0d297a RR |
44 | The popup is positioned at ptOrigin + size if it opens below and to the |
45 | right (default), at ptOrigin - sizePopup if it opens above and to the | |
46 | left etc. | |
dd72e767 | 47 | |
7c0d297a RR |
48 | @param ptOrigin |
49 | Must be given in screen coordinates! | |
dd72e767 FM |
50 | @param sizePopup |
51 | The size of the popup window | |
7c0d297a RR |
52 | */ |
53 | virtual void Position(const wxPoint& ptOrigin, | |
dd72e767 | 54 | const wxSize& sizePopup); |
7c0d297a RR |
55 | }; |
56 | ||
6d090da1 VZ |
57 | /** |
58 | @class wxPopupTransientWindow | |
59 | ||
60 | A wxPopupWindow which disappears automatically when the user clicks mouse | |
61 | outside it or if it loses focus in any other way. | |
62 | ||
63 | This window can be useful for implementing custom combobox-like controls | |
64 | for example. | |
65 | ||
66 | @library{wxcore} | |
67 | @category{managedwnd} | |
68 | ||
69 | @see wxPopupWindow | |
70 | */ | |
71 | ||
72 | class wxPopupTransientWindow : public wxPopupWindow | |
73 | { | |
74 | public: | |
3d2ee2fb RD |
75 | /** |
76 | Default constructor. | |
77 | */ | |
78 | wxPopupTransientWindow(); | |
79 | ||
6d090da1 VZ |
80 | /** |
81 | Constructor. | |
82 | */ | |
83 | wxPopupTransientWindow(wxWindow *parent, int flags = wxBORDER_NONE); | |
84 | ||
85 | /** | |
86 | Popup the window (this will show it too). | |
87 | ||
88 | If @a winFocus is non-@NULL, it will be kept focused while this window | |
89 | is shown, otherwise this window itself will receive focus. In any case, | |
90 | the popup will disappear automatically if it loses focus because of a | |
91 | user action. | |
92 | ||
93 | @see Dismiss() | |
94 | */ | |
95 | virtual void Popup(wxWindow *focus = NULL); | |
96 | ||
97 | /** | |
98 | Hide the window. | |
99 | */ | |
100 | virtual void Dismiss(); | |
101 | ||
102 | /** | |
103 | Called when a mouse is pressed while the popup is shown. | |
104 | ||
105 | Return @true from here to prevent its normal processing by the popup | |
106 | (which consists in dismissing it if the mouse is clicked outside it). | |
107 | */ | |
108 | virtual bool ProcessLeftDown(wxMouseEvent& event); | |
3d2ee2fb RD |
109 | |
110 | protected: | |
111 | /** | |
112 | This is called when the popup is disappeared because of anything | |
113 | else but direct call to Dismiss(). | |
114 | */ | |
115 | virtual void OnDismiss(); | |
116 | ||
6d090da1 | 117 | }; |