]>
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 | ||
25 | /** | |
26 | Constructor | |
27 | */ | |
28 | wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE); | |
dd72e767 | 29 | |
7c0d297a RR |
30 | /** |
31 | Create method for two-step creation | |
32 | */ | |
33 | bool Create(wxWindow *parent, int flags = wxBORDER_NONE); | |
dd72e767 | 34 | |
7c0d297a RR |
35 | /** |
36 | Move the popup window to the right position, i.e. such that it is | |
37 | entirely visible. | |
dd72e767 | 38 | |
7c0d297a RR |
39 | The popup is positioned at ptOrigin + size if it opens below and to the |
40 | right (default), at ptOrigin - sizePopup if it opens above and to the | |
41 | left etc. | |
dd72e767 | 42 | |
7c0d297a RR |
43 | @param ptOrigin |
44 | Must be given in screen coordinates! | |
dd72e767 FM |
45 | @param sizePopup |
46 | The size of the popup window | |
7c0d297a RR |
47 | */ |
48 | virtual void Position(const wxPoint& ptOrigin, | |
dd72e767 | 49 | const wxSize& sizePopup); |
7c0d297a RR |
50 | }; |
51 | ||
6d090da1 VZ |
52 | /** |
53 | @class wxPopupTransientWindow | |
54 | ||
55 | A wxPopupWindow which disappears automatically when the user clicks mouse | |
56 | outside it or if it loses focus in any other way. | |
57 | ||
58 | This window can be useful for implementing custom combobox-like controls | |
59 | for example. | |
60 | ||
61 | @library{wxcore} | |
62 | @category{managedwnd} | |
63 | ||
64 | @see wxPopupWindow | |
65 | */ | |
66 | ||
67 | class wxPopupTransientWindow : public wxPopupWindow | |
68 | { | |
69 | public: | |
70 | /** | |
71 | Constructor. | |
72 | */ | |
73 | wxPopupTransientWindow(wxWindow *parent, int flags = wxBORDER_NONE); | |
74 | ||
75 | /** | |
76 | Popup the window (this will show it too). | |
77 | ||
78 | If @a winFocus is non-@NULL, it will be kept focused while this window | |
79 | is shown, otherwise this window itself will receive focus. In any case, | |
80 | the popup will disappear automatically if it loses focus because of a | |
81 | user action. | |
82 | ||
83 | @see Dismiss() | |
84 | */ | |
85 | virtual void Popup(wxWindow *focus = NULL); | |
86 | ||
87 | /** | |
88 | Hide the window. | |
89 | */ | |
90 | virtual void Dismiss(); | |
91 | ||
92 | /** | |
93 | Called when a mouse is pressed while the popup is shown. | |
94 | ||
95 | Return @true from here to prevent its normal processing by the popup | |
96 | (which consists in dismissing it if the mouse is clicked outside it). | |
97 | */ | |
98 | virtual bool ProcessLeftDown(wxMouseEvent& event); | |
99 | }; |