]> git.saurik.com Git - wxWidgets.git/blob - wxPython/src/windows3.i
synthetize 'button up' event before doubleclick, too
[wxWidgets.git] / wxPython / src / windows3.i
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: windows3.i
3 // Purpose: SWIG definitions of MORE window classes
4 //
5 // Author: Robin Dunn
6 //
7 // Created: 22-Dec-1998
8 // RCS-ID: $Id$
9 // Copyright: (c) 1998 by Total Control Software
10 // Licence: wxWindows license
11 /////////////////////////////////////////////////////////////////////////////
12
13 %module windows3
14
15 %{
16 #include "helpers.h"
17 #include <wx/sashwin.h>
18 #include <wx/laywin.h>
19 #ifndef __WXMAC__
20 #include <wx/popupwin.h>
21 #include <wx/tipwin.h>
22 #endif
23 %}
24
25 //----------------------------------------------------------------------
26
27 %include typemaps.i
28 %include my_typemaps.i
29
30 // Import some definitions of other classes, etc.
31 %import _defs.i
32 %import misc.i
33 %import gdi.i
34 %import windows.i
35 %import windows2.i
36 %import mdi.i
37 %import events.i
38
39 %pragma(python) code = "import wx"
40
41 //---------------------------------------------------------------------------
42
43 enum wxSashEdgePosition {
44 wxSASH_TOP = 0,
45 wxSASH_RIGHT,
46 wxSASH_BOTTOM,
47 wxSASH_LEFT,
48 wxSASH_NONE = 100
49 };
50
51 enum {
52 wxEVT_SASH_DRAGGED,
53 wxSW_3D,
54 wxSW_3DSASH,
55 wxSW_3DBORDER,
56 wxSW_BORDER
57 };
58
59 enum wxSashDragStatus
60 {
61 wxSASH_STATUS_OK,
62 wxSASH_STATUS_OUT_OF_RANGE
63 };
64
65
66 class wxSashEvent : public wxCommandEvent {
67 public:
68 wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE);
69
70 void SetEdge(wxSashEdgePosition edge);
71 wxSashEdgePosition GetEdge();
72 void SetDragRect(const wxRect& rect);
73 wxRect GetDragRect();
74 void SetDragStatus(wxSashDragStatus status);
75 wxSashDragStatus GetDragStatus();
76 };
77
78
79
80 class wxSashWindow: public wxWindow {
81 public:
82 wxSashWindow(wxWindow* parent, wxWindowID id,
83 const wxPoint& pos = wxDefaultPosition,
84 const wxSize& size = wxDefaultSize,
85 long style = wxCLIP_CHILDREN | wxSW_3D,
86 const char* name = "sashWindow");
87 %name(wxPreSashWindow)wxSashWindow();
88
89 bool Create(wxWindow* parent, wxWindowID id,
90 const wxPoint& pos = wxDefaultPosition,
91 const wxSize& size = wxDefaultSize,
92 long style = wxCLIP_CHILDREN | wxSW_3D,
93 const char* name = "sashWindow");
94
95 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
96 %pragma(python) addtomethod = "wxPreSashWindow:val._setOORInfo(val)"
97
98 bool GetSashVisible(wxSashEdgePosition edge);
99 int GetDefaultBorderSize();
100 int GetEdgeMargin(wxSashEdgePosition edge);
101 int GetExtraBorderSize();
102 int GetMaximumSizeX();
103 int GetMaximumSizeY();
104 int GetMinimumSizeX();
105 int GetMinimumSizeY();
106 bool HasBorder(wxSashEdgePosition edge);
107 void SetDefaultBorderSize(int width);
108 void SetExtraBorderSize(int width);
109 void SetMaximumSizeX(int min);
110 void SetMaximumSizeY(int min);
111 void SetMinimumSizeX(int min);
112 void SetMinimumSizeY(int min);
113 void SetSashVisible(wxSashEdgePosition edge, bool visible);
114 void SetSashBorder(wxSashEdgePosition edge, bool hasBorder);
115
116 };
117
118
119 //---------------------------------------------------------------------------
120
121 enum wxLayoutOrientation {
122 wxLAYOUT_HORIZONTAL,
123 wxLAYOUT_VERTICAL
124 };
125
126 enum wxLayoutAlignment {
127 wxLAYOUT_NONE,
128 wxLAYOUT_TOP,
129 wxLAYOUT_LEFT,
130 wxLAYOUT_RIGHT,
131 wxLAYOUT_BOTTOM,
132 };
133
134
135 enum {
136 wxEVT_QUERY_LAYOUT_INFO,
137 wxEVT_CALCULATE_LAYOUT,
138 };
139
140
141 class wxQueryLayoutInfoEvent: public wxEvent {
142 public:
143 wxQueryLayoutInfoEvent(wxWindowID id = 0);
144
145 void SetRequestedLength(int length);
146 int GetRequestedLength();
147 void SetFlags(int flags);
148 int GetFlags();
149 void SetSize(const wxSize& size);
150 wxSize GetSize();
151 void SetOrientation(wxLayoutOrientation orient);
152 wxLayoutOrientation GetOrientation();
153 void SetAlignment(wxLayoutAlignment align);
154 wxLayoutAlignment GetAlignment();
155 };
156
157
158
159 class wxCalculateLayoutEvent: public wxEvent {
160 public:
161 wxCalculateLayoutEvent(wxWindowID id = 0);
162
163 void SetFlags(int flags);
164 int GetFlags();
165 void SetRect(const wxRect& rect);
166 wxRect GetRect();
167 };
168
169
170 class wxSashLayoutWindow: public wxSashWindow {
171 public:
172 wxSashLayoutWindow(wxWindow* parent, wxWindowID id,
173 const wxPoint& pos = wxDefaultPosition,
174 const wxSize& size = wxDefaultSize,
175 long style = wxCLIP_CHILDREN | wxSW_3D,
176 const char* name = "layoutWindow");
177 %name(wxPreSashLayoutWindow)wxSashLayoutWindow();
178
179 bool Create(wxWindow* parent, wxWindowID id,
180 const wxPoint& pos = wxDefaultPosition,
181 const wxSize& size = wxDefaultSize,
182 long style = wxCLIP_CHILDREN | wxSW_3D,
183 const char* name = "layoutWindow");
184
185 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
186 %pragma(python) addtomethod = "wxPreSashLayoutWindow:val._setOORInfo(val)"
187
188 wxLayoutAlignment GetAlignment();
189 wxLayoutOrientation GetOrientation();
190 void SetAlignment(wxLayoutAlignment alignment);
191 void SetDefaultSize(const wxSize& size);
192 void SetOrientation(wxLayoutOrientation orientation);
193 };
194
195 //---------------------------------------------------------------------------
196
197 class wxLayoutAlgorithm : public wxObject {
198 public:
199 wxLayoutAlgorithm();
200 ~wxLayoutAlgorithm();
201
202 bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL);
203 bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL);
204 bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = NULL);
205 };
206
207
208 //---------------------------------------------------------------------------
209 #ifndef __WXMAC__
210
211 // wxPopupWindow: a special kind of top level window used for popup menus,
212 // combobox popups and such.
213 class wxPopupWindow : public wxWindow {
214 public:
215 wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE);
216 %name(wxPrePopupWindow)wxPopupWindow();
217
218 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
219 %pragma(python) addtomethod = "wxPrePopupWindow:val._setOORInfo(val)"
220
221 bool Create(wxWindow *parent, int flags = wxBORDER_NONE);
222
223 // the point must be given in screen coordinates!
224 void Position(const wxPoint& ptOrigin,
225 const wxSize& size);
226 };
227
228
229 %{
230 class wxPyPopupTransientWindow : public wxPopupTransientWindow
231 {
232 public:
233 wxPyPopupTransientWindow() : wxPopupTransientWindow() {}
234 wxPyPopupTransientWindow(wxWindow* parent, int style = wxBORDER_NONE)
235 : wxPopupTransientWindow(parent, style) {}
236
237 DEC_PYCALLBACK_BOOL_ME(ProcessLeftDown);
238 DEC_PYCALLBACK__(OnDismiss);
239 PYPRIVATE;
240 };
241
242 IMP_PYCALLBACK_BOOL_ME(wxPyPopupTransientWindow, wxPopupTransientWindow, ProcessLeftDown);
243 IMP_PYCALLBACK__(wxPyPopupTransientWindow, wxPopupTransientWindow, OnDismiss);
244 %}
245
246
247
248 // wxPopupTransientWindow: a wxPopupWindow which disappears automatically
249 // when the user clicks mouse outside it or if it loses focus in any other way
250 %name(wxPopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow
251 {
252 public:
253 wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE);
254 %name(wxPrePopupTransientWindow)wxPyPopupTransientWindow();
255
256 void _setCallbackInfo(PyObject* self, PyObject* _class);
257 %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPopupTransientWindow)"
258
259 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
260 %pragma(python) addtomethod = "wxPrePopupTransientWindow:val._setOORInfo(val)"
261
262 // popup the window (this will show it too) and keep focus at winFocus
263 // (or itself if it's NULL), dismiss the popup if we lose focus
264 virtual void Popup(wxWindow *focus = NULL);
265
266 // hide the window
267 virtual void Dismiss();
268 };
269
270 //---------------------------------------------------------------------------
271
272 class wxTipWindow : public wxPyPopupTransientWindow
273 {
274 public:
275 %addmethods {
276 wxTipWindow(wxWindow *parent,
277 const wxString* text,
278 wxCoord maxLength = 100,
279 wxRect* rectBound = NULL) {
280 wxString tmp = *text;
281 return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound);
282 }
283 }
284
285 %pragma(python) addtomethod = "__init__:self._setOORInfo(self)"
286
287 // If rectBound is not NULL, the window will disappear automatically when
288 // the mouse leave the specified rect: note that rectBound should be in the
289 // screen coordinates!
290 void SetBoundingRect(const wxRect& rectBound);
291
292 // Hide and destroy the window
293 void Close();
294 };
295
296
297 //---------------------------------------------------------------------------
298
299 #endif