]> git.saurik.com Git - wxWidgets.git/blob - include/wx/popupwin.h
proper fullscreen handling
[wxWidgets.git] / include / wx / popupwin.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/popupwin.h
3 // Purpose: wxPopupWindow interface declaration
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 06.01.01
7 // RCS-ID: $Id$
8 // Copyright: (c) 2001 Vadim Zeitlin <zeitlin@dptmaths.ens-cachan.fr>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_POPUPWIN_H_BASE_
13 #define _WX_POPUPWIN_H_BASE_
14
15 #ifdef __GNUG__
16 #pragma interface "popupwinbase.h"
17 #endif
18
19 #include "wx/window.h"
20
21 #if wxUSE_POPUPWIN
22
23 // ----------------------------------------------------------------------------
24 // wxPopupWindow: a special kind of top level window used for popup menus,
25 // combobox popups and such.
26 // ----------------------------------------------------------------------------
27
28 class WXDLLEXPORT wxPopupWindowBase : public wxWindow
29 {
30 public:
31 wxPopupWindowBase() { }
32 #ifdef __DARWIN__
33 virtual ~wxPopupWindowBase() { }
34 #endif
35
36 // create the popup window
37 //
38 // style may only contain border flags
39 bool Create(wxWindow *parent, int style = wxBORDER_NONE);
40
41 // move the popup window to the right position, i.e. such that it is
42 // entirely visible
43 //
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 &c
47 //
48 // the point must be given in screen coordinates!
49 virtual void Position(const wxPoint& ptOrigin,
50 const wxSize& size);
51 };
52
53 // include the real class declaration
54 #ifdef __WXMSW__
55 #include "wx/msw/popupwin.h"
56 #elif __WXGTK__
57 #include "wx/gtk/popupwin.h"
58 #else
59 #error "wxPopupWindow is not supported under this platform."
60 #endif
61
62 // ----------------------------------------------------------------------------
63 // wxPopupTransientWindow: a wxPopupWindow which disappears automatically
64 // when the user clicks mouse outside it or if it loses focus in any other way
65 // ----------------------------------------------------------------------------
66
67 class WXDLLEXPORT wxPopupTransientWindow : public wxPopupWindow
68 {
69 public:
70 // ctors
71 wxPopupTransientWindow() { Init(); }
72 wxPopupTransientWindow(wxWindow *parent);
73
74 virtual ~wxPopupTransientWindow();
75
76 // popup the window (this will show it too) and keep focus at winFocus
77 // (or itself if it's NULL), dismiss the popup if we lose focus
78 virtual void Popup(wxWindow *focus = NULL);
79
80 // hide the window
81 virtual void Dismiss();
82
83 // called when a mouse is pressed while the popup is shown: return TRUE
84 // from here to prevent its normal processing by the popup (which consists
85 // in dismissing it if the mouse is cilcked outside it)
86 virtual bool ProcessLeftDown(wxMouseEvent& event);
87
88 protected:
89 // common part of all ctors
90 void Init();
91
92 // this is called when the popup is disappeared because of anything
93 // else but direct call to Dismiss()
94 virtual void OnDismiss();
95
96 // dismiss and notify the derived class
97 void DismissAndNotify();
98
99 // remove our event handlers
100 void PopHandlers();
101
102 // the child of this popup if any
103 wxWindow *m_child;
104
105 // the window which has the focus while we're shown
106 wxWindow *m_focus;
107
108 friend class wxPopupWindowHandler;
109 friend class wxPopupFocusHandler;
110 };
111
112 #if wxUSE_COMBOBOX && defined(__WXUNIVERSAL__)
113
114 // ----------------------------------------------------------------------------
115 // wxPopupComboWindow: wxPopupTransientWindow used by wxComboBox
116 // ----------------------------------------------------------------------------
117
118 class WXDLLEXPORT wxComboBox;
119 class WXDLLEXPORT wxComboControl;
120
121 class WXDLLEXPORT wxPopupComboWindow : public wxPopupTransientWindow
122 {
123 public:
124 wxPopupComboWindow(wxComboControl *parent);
125
126 bool Create(wxComboControl *parent);
127
128 // position the window correctly relatively to the combo
129 void PositionNearCombo();
130
131 protected:
132 // notify the combo here
133 virtual void OnDismiss();
134
135 // the parent combobox
136 wxComboControl *m_combo;
137 };
138
139 #endif // wxUSE_COMBOBOX && defined(__WXUNIVERSAL__)
140
141 #endif // wxUSE_POPUPWIN
142
143 #endif // _WX_POPUPWIN_H_BASE_
144