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