]>
Commit | Line | Data |
---|---|---|
08127323 RD |
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> | |
0122b7e3 | 19 | #include <wx/popupwin.h> |
4416b508 | 20 | #include <wx/tipwin.h> |
08127323 RD |
21 | %} |
22 | ||
23 | //---------------------------------------------------------------------- | |
24 | ||
25 | %include typemaps.i | |
26 | %include my_typemaps.i | |
27 | ||
28 | // Import some definitions of other classes, etc. | |
29 | %import _defs.i | |
30 | %import misc.i | |
31 | %import gdi.i | |
32 | %import windows.i | |
33 | %import windows2.i | |
34 | %import mdi.i | |
35 | %import events.i | |
36 | ||
37 | %pragma(python) code = "import wx" | |
38 | ||
137b5242 RD |
39 | //---------------------------------------------------------------------- |
40 | ||
41 | %{ | |
42 | // Put some wx default wxChar* values into wxStrings. | |
43 | static const wxChar* wxSashNameStr = wxT("sashWindow"); | |
44 | DECLARE_DEF_STRING(SashNameStr); | |
45 | static const wxChar* wxSashLayoutNameStr = wxT("layoutWindow"); | |
46 | DECLARE_DEF_STRING(SashLayoutNameStr); | |
47 | %} | |
08127323 RD |
48 | //--------------------------------------------------------------------------- |
49 | ||
50 | enum wxSashEdgePosition { | |
51 | wxSASH_TOP = 0, | |
52 | wxSASH_RIGHT, | |
53 | wxSASH_BOTTOM, | |
54 | wxSASH_LEFT, | |
55 | wxSASH_NONE = 100 | |
56 | }; | |
57 | ||
58 | enum { | |
59 | wxEVT_SASH_DRAGGED, | |
60 | wxSW_3D, | |
1b62f00d RD |
61 | wxSW_3DSASH, |
62 | wxSW_3DBORDER, | |
63 | wxSW_BORDER | |
08127323 RD |
64 | }; |
65 | ||
66 | enum wxSashDragStatus | |
67 | { | |
68 | wxSASH_STATUS_OK, | |
69 | wxSASH_STATUS_OUT_OF_RANGE | |
70 | }; | |
71 | ||
72 | ||
73 | class wxSashEvent : public wxCommandEvent { | |
74 | public: | |
09f3d4e6 RD |
75 | wxSashEvent(int id = 0, wxSashEdgePosition edge = wxSASH_NONE); |
76 | ||
08127323 RD |
77 | void SetEdge(wxSashEdgePosition edge); |
78 | wxSashEdgePosition GetEdge(); | |
79 | void SetDragRect(const wxRect& rect); | |
80 | wxRect GetDragRect(); | |
81 | void SetDragStatus(wxSashDragStatus status); | |
82 | wxSashDragStatus GetDragStatus(); | |
83 | }; | |
84 | ||
85 | ||
86 | ||
87 | class wxSashWindow: public wxWindow { | |
88 | public: | |
89 | wxSashWindow(wxWindow* parent, wxWindowID id, | |
b68dc582 RD |
90 | const wxPoint& pos = wxDefaultPosition, |
91 | const wxSize& size = wxDefaultSize, | |
08127323 | 92 | long style = wxCLIP_CHILDREN | wxSW_3D, |
137b5242 | 93 | const wxString& name = wxPySashNameStr); |
09f3d4e6 | 94 | %name(wxPreSashWindow)wxSashWindow(); |
08127323 | 95 | |
09f3d4e6 RD |
96 | bool Create(wxWindow* parent, wxWindowID id, |
97 | const wxPoint& pos = wxDefaultPosition, | |
98 | const wxSize& size = wxDefaultSize, | |
99 | long style = wxCLIP_CHILDREN | wxSW_3D, | |
137b5242 | 100 | const wxString& name = wxPySashNameStr); |
08127323 | 101 | |
0122b7e3 | 102 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 103 | %pragma(python) addtomethod = "wxPreSashWindow:val._setOORInfo(val)" |
0122b7e3 | 104 | |
08127323 RD |
105 | bool GetSashVisible(wxSashEdgePosition edge); |
106 | int GetDefaultBorderSize(); | |
107 | int GetEdgeMargin(wxSashEdgePosition edge); | |
108 | int GetExtraBorderSize(); | |
109 | int GetMaximumSizeX(); | |
110 | int GetMaximumSizeY(); | |
111 | int GetMinimumSizeX(); | |
112 | int GetMinimumSizeY(); | |
113 | bool HasBorder(wxSashEdgePosition edge); | |
114 | void SetDefaultBorderSize(int width); | |
115 | void SetExtraBorderSize(int width); | |
116 | void SetMaximumSizeX(int min); | |
117 | void SetMaximumSizeY(int min); | |
118 | void SetMinimumSizeX(int min); | |
119 | void SetMinimumSizeY(int min); | |
120 | void SetSashVisible(wxSashEdgePosition edge, bool visible); | |
121 | void SetSashBorder(wxSashEdgePosition edge, bool hasBorder); | |
122 | ||
123 | }; | |
124 | ||
125 | ||
126 | //--------------------------------------------------------------------------- | |
127 | ||
128 | enum wxLayoutOrientation { | |
129 | wxLAYOUT_HORIZONTAL, | |
130 | wxLAYOUT_VERTICAL | |
131 | }; | |
132 | ||
133 | enum wxLayoutAlignment { | |
134 | wxLAYOUT_NONE, | |
135 | wxLAYOUT_TOP, | |
136 | wxLAYOUT_LEFT, | |
137 | wxLAYOUT_RIGHT, | |
138 | wxLAYOUT_BOTTOM, | |
139 | }; | |
140 | ||
141 | ||
142 | enum { | |
143 | wxEVT_QUERY_LAYOUT_INFO, | |
144 | wxEVT_CALCULATE_LAYOUT, | |
145 | }; | |
146 | ||
147 | ||
148 | class wxQueryLayoutInfoEvent: public wxEvent { | |
149 | public: | |
09f3d4e6 | 150 | wxQueryLayoutInfoEvent(wxWindowID id = 0); |
08127323 RD |
151 | |
152 | void SetRequestedLength(int length); | |
153 | int GetRequestedLength(); | |
154 | void SetFlags(int flags); | |
155 | int GetFlags(); | |
156 | void SetSize(const wxSize& size); | |
157 | wxSize GetSize(); | |
158 | void SetOrientation(wxLayoutOrientation orient); | |
159 | wxLayoutOrientation GetOrientation(); | |
160 | void SetAlignment(wxLayoutAlignment align); | |
161 | wxLayoutAlignment GetAlignment(); | |
162 | }; | |
163 | ||
164 | ||
165 | ||
166 | class wxCalculateLayoutEvent: public wxEvent { | |
167 | public: | |
09f3d4e6 RD |
168 | wxCalculateLayoutEvent(wxWindowID id = 0); |
169 | ||
08127323 RD |
170 | void SetFlags(int flags); |
171 | int GetFlags(); | |
172 | void SetRect(const wxRect& rect); | |
173 | wxRect GetRect(); | |
174 | }; | |
175 | ||
176 | ||
177 | class wxSashLayoutWindow: public wxSashWindow { | |
178 | public: | |
179 | wxSashLayoutWindow(wxWindow* parent, wxWindowID id, | |
b68dc582 RD |
180 | const wxPoint& pos = wxDefaultPosition, |
181 | const wxSize& size = wxDefaultSize, | |
08127323 | 182 | long style = wxCLIP_CHILDREN | wxSW_3D, |
137b5242 | 183 | const wxString& name = wxPySashLayoutNameStr); |
09f3d4e6 | 184 | %name(wxPreSashLayoutWindow)wxSashLayoutWindow(); |
08127323 | 185 | |
09f3d4e6 RD |
186 | bool Create(wxWindow* parent, wxWindowID id, |
187 | const wxPoint& pos = wxDefaultPosition, | |
188 | const wxSize& size = wxDefaultSize, | |
189 | long style = wxCLIP_CHILDREN | wxSW_3D, | |
137b5242 | 190 | const wxString& name = wxPySashLayoutNameStr); |
08127323 | 191 | |
0122b7e3 | 192 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" |
17c0e08c | 193 | %pragma(python) addtomethod = "wxPreSashLayoutWindow:val._setOORInfo(val)" |
0122b7e3 | 194 | |
08127323 RD |
195 | wxLayoutAlignment GetAlignment(); |
196 | wxLayoutOrientation GetOrientation(); | |
197 | void SetAlignment(wxLayoutAlignment alignment); | |
198 | void SetDefaultSize(const wxSize& size); | |
199 | void SetOrientation(wxLayoutOrientation orientation); | |
200 | }; | |
201 | ||
202 | //--------------------------------------------------------------------------- | |
203 | ||
9416aa89 | 204 | class wxLayoutAlgorithm : public wxObject { |
08127323 RD |
205 | public: |
206 | wxLayoutAlgorithm(); | |
207 | ~wxLayoutAlgorithm(); | |
208 | ||
209 | bool LayoutMDIFrame(wxMDIParentFrame* frame, wxRect* rect = NULL); | |
210 | bool LayoutFrame(wxFrame* frame, wxWindow* mainWindow = NULL); | |
cf694132 | 211 | bool LayoutWindow(wxWindow* parent, wxWindow* mainWindow = NULL); |
08127323 RD |
212 | }; |
213 | ||
214 | ||
215 | //--------------------------------------------------------------------------- | |
e6056257 | 216 | #ifndef __WXMAC__ |
2abc0a0f | 217 | |
0122b7e3 RD |
218 | // wxPopupWindow: a special kind of top level window used for popup menus, |
219 | // combobox popups and such. | |
220 | class wxPopupWindow : public wxWindow { | |
221 | public: | |
222 | wxPopupWindow(wxWindow *parent, int flags = wxBORDER_NONE); | |
223 | %name(wxPrePopupWindow)wxPopupWindow(); | |
224 | ||
225 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
17c0e08c | 226 | %pragma(python) addtomethod = "wxPrePopupWindow:val._setOORInfo(val)" |
0122b7e3 RD |
227 | |
228 | bool Create(wxWindow *parent, int flags = wxBORDER_NONE); | |
229 | ||
98624b49 | 230 | // the point must be given in screen coordinates! |
0122b7e3 RD |
231 | void Position(const wxPoint& ptOrigin, |
232 | const wxSize& size); | |
233 | }; | |
234 | ||
235 | ||
236 | %{ | |
237 | class wxPyPopupTransientWindow : public wxPopupTransientWindow | |
238 | { | |
239 | public: | |
240 | wxPyPopupTransientWindow() : wxPopupTransientWindow() {} | |
241 | wxPyPopupTransientWindow(wxWindow* parent, int style = wxBORDER_NONE) | |
242 | : wxPopupTransientWindow(parent, style) {} | |
243 | ||
244 | DEC_PYCALLBACK_BOOL_ME(ProcessLeftDown); | |
a57d56d6 | 245 | DEC_PYCALLBACK__(OnDismiss); |
79f1d86c | 246 | DEC_PYCALLBACK_BOOL_(CanDismiss); |
0122b7e3 RD |
247 | PYPRIVATE; |
248 | }; | |
249 | ||
250 | IMP_PYCALLBACK_BOOL_ME(wxPyPopupTransientWindow, wxPopupTransientWindow, ProcessLeftDown); | |
a57d56d6 | 251 | IMP_PYCALLBACK__(wxPyPopupTransientWindow, wxPopupTransientWindow, OnDismiss); |
79f1d86c | 252 | IMP_PYCALLBACK_BOOL_(wxPyPopupTransientWindow, wxPopupTransientWindow, CanDismiss); |
0122b7e3 RD |
253 | %} |
254 | ||
255 | ||
256 | ||
257 | // wxPopupTransientWindow: a wxPopupWindow which disappears automatically | |
258 | // when the user clicks mouse outside it or if it loses focus in any other way | |
259 | %name(wxPopupTransientWindow) class wxPyPopupTransientWindow : public wxPopupWindow | |
260 | { | |
261 | public: | |
262 | wxPyPopupTransientWindow(wxWindow *parent, int style = wxBORDER_NONE); | |
263 | %name(wxPrePopupTransientWindow)wxPyPopupTransientWindow(); | |
264 | ||
265 | void _setCallbackInfo(PyObject* self, PyObject* _class); | |
266 | %pragma(python) addtomethod = "__init__:self._setCallbackInfo(self, wxPopupTransientWindow)" | |
267 | ||
268 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
17c0e08c | 269 | %pragma(python) addtomethod = "wxPrePopupTransientWindow:val._setOORInfo(val)" |
0122b7e3 RD |
270 | |
271 | // popup the window (this will show it too) and keep focus at winFocus | |
272 | // (or itself if it's NULL), dismiss the popup if we lose focus | |
273 | virtual void Popup(wxWindow *focus = NULL); | |
274 | ||
275 | // hide the window | |
276 | virtual void Dismiss(); | |
277 | }; | |
278 | ||
279 | //--------------------------------------------------------------------------- | |
280 | ||
4416b508 RD |
281 | class wxTipWindow : public wxPyPopupTransientWindow |
282 | { | |
283 | public: | |
ce914f73 RD |
284 | %addmethods { |
285 | wxTipWindow(wxWindow *parent, | |
286 | const wxString* text, | |
287 | wxCoord maxLength = 100, | |
288 | wxRect* rectBound = NULL) { | |
289 | wxString tmp = *text; | |
290 | return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound); | |
291 | } | |
292 | } | |
4416b508 RD |
293 | |
294 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
ce914f73 RD |
295 | |
296 | // If rectBound is not NULL, the window will disappear automatically when | |
297 | // the mouse leave the specified rect: note that rectBound should be in the | |
298 | // screen coordinates! | |
299 | void SetBoundingRect(const wxRect& rectBound); | |
300 | ||
301 | // Hide and destroy the window | |
302 | void Close(); | |
4416b508 RD |
303 | }; |
304 | ||
1fded56b RD |
305 | #endif // ! __WXMAC__ |
306 | ||
307 | //--------------------------------------------------------------------------- | |
308 | ||
309 | #ifdef __WXMAC__ | |
310 | ||
311 | %import frames.i | |
312 | ||
313 | class wxTipWindow : public wxFrame | |
314 | { | |
315 | public: | |
316 | %addmethods { | |
317 | wxTipWindow(wxWindow *parent, | |
318 | const wxString* text, | |
319 | wxCoord maxLength = 100, | |
320 | wxRect* rectBound = NULL) { | |
321 | wxString tmp = *text; | |
322 | return new wxTipWindow(parent, tmp, maxLength, NULL, rectBound); | |
323 | } | |
324 | } | |
325 | ||
326 | %pragma(python) addtomethod = "__init__:self._setOORInfo(self)" | |
327 | ||
328 | // If rectBound is not NULL, the window will disappear automatically when | |
329 | // the mouse leave the specified rect: note that rectBound should be in the | |
330 | // screen coordinates! | |
331 | void SetBoundingRect(const wxRect& rectBound); | |
332 | ||
333 | // Hide and destroy the window | |
334 | void Close(); | |
335 | }; | |
336 | ||
337 | #endif // __WXMAC__ | |
4416b508 RD |
338 | |
339 | //--------------------------------------------------------------------------- | |
340 |