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