]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/popupwin.h
Return NULL from wxWindow::GetCapture() when the capture is being lost.
[wxWidgets.git] / interface / wx / popupwin.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: popupwin.h
3 // Purpose: interface of wxPopupWindow
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
7
8 /**
9 @class wxPopupWindow
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
24 /**
25 Default constructor
26 */
27 wxPopupWindow();
28
29 /**
30 Constructor
31 */
32 wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
33
34 /**
35 Create method for two-step creation
36 */
37 bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
38
39 /**
40 Move the popup window to the right position, i.e.\ such that it is
41 entirely visible.
42
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.
46
47 @param ptOrigin
48 Must be given in screen coordinates!
49 @param sizePopup
50 The size of the popup window
51 */
52 virtual void Position(const wxPoint& ptOrigin,
53 const wxSize& sizePopup);
54 };
55
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:
74 /**
75 Default constructor.
76 */
77 wxPopupTransientWindow();
78
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);
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
116 };