]>
Commit | Line | Data |
---|---|---|
d14a1e28 RD |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: _gbsizer.i | |
3 | // Purpose: SWIG interface stuff for wxGBGridBagSizer and etc. | |
4 | // | |
5 | // Author: Robin Dunn | |
6 | // | |
7 | // Created: 05-Nov-2003 | |
8 | // RCS-ID: $Id$ | |
9 | // Copyright: (c) 2003 by Total Control Software | |
10 | // Licence: wxWindows license | |
11 | ///////////////////////////////////////////////////////////////////////////// | |
12 | ||
13 | // Not a %module | |
14 | ||
15 | ||
16 | //--------------------------------------------------------------------------- | |
17 | ||
18 | %{ | |
19 | %} | |
20 | ||
21 | //--------------------------------------------------------------------------- | |
22 | ||
23 | %typemap(in) wxGBPosition& (wxGBPosition temp) { | |
24 | $1 = &temp; | |
25 | if ( ! wxGBPosition_helper($input, &$1)) SWIG_fail; | |
26 | } | |
27 | %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGBPosition& { | |
28 | $1 = wxPySimple_typecheck($input, wxT("wxGBPosition"), 2); | |
29 | } | |
30 | ||
31 | %typemap(in) wxGBSpan& (wxGBSpan temp) { | |
32 | $1 = &temp; | |
33 | if ( ! wxGBSpan_helper($input, &$1)) SWIG_fail; | |
34 | } | |
35 | %typemap(typecheck, precedence=SWIG_TYPECHECK_POINTER) wxGBSpan& { | |
36 | $1 = wxPySimple_typecheck($input, wxT("wxGBSpan"), 2); | |
37 | } | |
38 | ||
39 | ||
40 | %{ | |
41 | bool wxGBPosition_helper(PyObject* source, wxGBPosition** obj) | |
42 | { | |
09b77fb7 RD |
43 | if (source == Py_None) { |
44 | **obj = wxGBPosition(-1,-1); | |
a72f4631 | 45 | return true; |
09b77fb7 | 46 | } |
d14a1e28 RD |
47 | return wxPyTwoIntItem_helper(source, obj, wxT("wxGBPosition")); |
48 | } | |
49 | ||
50 | bool wxGBSpan_helper(PyObject* source, wxGBSpan** obj) | |
51 | { | |
09b77fb7 RD |
52 | if (source == Py_None) { |
53 | **obj = wxGBSpan(-1,-1); | |
a72f4631 | 54 | return true; |
09b77fb7 | 55 | } |
d14a1e28 RD |
56 | return wxPyTwoIntItem_helper(source, obj, wxT("wxGBSpan")); |
57 | } | |
58 | ||
59 | %} | |
60 | ||
61 | ||
62 | //--------------------------------------------------------------------------- | |
63 | %newgroup; | |
94d33c49 | 64 | |
3ea6e0ec RD |
65 | DocStr(wxGBPosition, |
66 | "This class represents the position of an item in a virtual grid of | |
67 | rows and columns managed by a `wx.GridBagSizer`. wxPython has | |
68 | typemaps that will automatically convert from a 2-element sequence of | |
69 | integers to a wx.GBPosition, so you can use the more pythonic | |
70 | representation of the position nearly transparently in Python code.", ""); | |
d14a1e28 RD |
71 | |
72 | class wxGBPosition | |
73 | { | |
74 | public: | |
75 | wxGBPosition(int row=0, int col=0); | |
214c4fbe RD |
76 | ~wxGBPosition(); |
77 | ||
d14a1e28 RD |
78 | int GetRow() const; |
79 | int GetCol() const; | |
80 | void SetRow(int row); | |
81 | void SetCol(int col); | |
d14a1e28 | 82 | |
09b77fb7 | 83 | |
1fce4e96 RD |
84 | %extend { |
85 | KeepGIL(__eq__); | |
86 | DocStr(__eq__, "Compare GBPosition for equality.", ""); | |
87 | bool __eq__(PyObject* other) { | |
88 | wxGBPosition temp, *obj = &temp; | |
89 | if ( other == Py_None ) return false; | |
90 | if ( ! wxGBPosition_helper(other, &obj) ) { | |
91 | PyErr_Clear(); | |
92 | return false; | |
93 | } | |
94 | return self->operator==(*obj); | |
95 | } | |
96 | ||
97 | ||
98 | KeepGIL(__ne__); | |
99 | DocStr(__ne__, "Compare GBPosition for inequality.", ""); | |
100 | bool __ne__(PyObject* other) { | |
101 | wxGBPosition temp, *obj = &temp; | |
102 | if ( other == Py_None ) return true; | |
103 | if ( ! wxGBPosition_helper(other, &obj)) { | |
104 | PyErr_Clear(); | |
105 | return true; | |
106 | } | |
107 | return self->operator!=(*obj); | |
108 | } | |
109 | } | |
110 | ||
111 | ||
d14a1e28 | 112 | %extend { |
dd9f7fea RD |
113 | void Set(int row=0, int col=0) { |
114 | self->SetRow(row); | |
115 | self->SetCol(col); | |
116 | } | |
117 | ||
118 | PyObject* Get() { | |
6e6b3557 | 119 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
d14a1e28 RD |
120 | PyObject* tup = PyTuple_New(2); |
121 | PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRow())); | |
122 | PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetCol())); | |
da32eb53 | 123 | wxPyEndBlockThreads(blocked); |
d14a1e28 RD |
124 | return tup; |
125 | } | |
126 | } | |
127 | %pythoncode { | |
d07d2bc9 | 128 | asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead") |
dd9f7fea RD |
129 | def __str__(self): return str(self.Get()) |
130 | def __repr__(self): return 'wx.GBPosition'+str(self.Get()) | |
131 | def __len__(self): return len(self.Get()) | |
132 | def __getitem__(self, index): return self.Get()[index] | |
d14a1e28 RD |
133 | def __setitem__(self, index, val): |
134 | if index == 0: self.SetRow(val) | |
135 | elif index == 1: self.SetCol(val) | |
136 | else: raise IndexError | |
dd9f7fea | 137 | def __nonzero__(self): return self.Get() != (0,0) |
41b78a7a | 138 | __safe_for_unpickling__ = True |
02376d73 | 139 | def __reduce__(self): return (wx.GBPosition, self.Get()) |
d14a1e28 RD |
140 | } |
141 | ||
142 | %pythoncode { | |
143 | row = property(GetRow, SetRow) | |
144 | col = property(GetCol, SetCol) | |
145 | } | |
146 | }; | |
147 | ||
148 | ||
149 | ||
d14a1e28 | 150 | |
3ea6e0ec RD |
151 | DocStr(wxGBSpan, |
152 | "This class is used to hold the row and column spanning attributes of | |
153 | items in a `wx.GridBagSizer`. wxPython has typemaps that will | |
154 | automatically convert from a 2-element sequence of integers to a | |
155 | wx.GBSpan, so you can use the more pythonic representation of the span | |
156 | nearly transparently in Python code. | |
157 | ", ""); | |
158 | ||
d14a1e28 RD |
159 | class wxGBSpan |
160 | { | |
161 | public: | |
3ea6e0ec RD |
162 | DocCtorStr( |
163 | wxGBSpan(int rowspan=1, int colspan=1), | |
164 | "Construct a new wxGBSpan, optionally setting the rowspan and | |
165 | colspan. The default is (1,1). (Meaning that the item occupies one | |
166 | cell in each direction.", ""); | |
d14a1e28 | 167 | |
214c4fbe RD |
168 | ~wxGBSpan(); |
169 | ||
d14a1e28 RD |
170 | int GetRowspan() const; |
171 | int GetColspan() const; | |
172 | void SetRowspan(int rowspan); | |
173 | void SetColspan(int colspan); | |
1fce4e96 | 174 | |
d14a1e28 | 175 | |
1fce4e96 RD |
176 | %extend { |
177 | KeepGIL(__eq__); | |
178 | DocStr(__eq__, "Compare wxGBSpan for equality.", ""); | |
179 | bool __eq__(PyObject* other) { | |
180 | wxGBSpan temp, *obj = &temp; | |
181 | if ( other == Py_None ) return false; | |
182 | if ( ! wxGBSpan_helper(other, &obj) ) { | |
183 | PyErr_Clear(); | |
184 | return false; | |
185 | } | |
186 | return self->operator==(*obj); | |
187 | } | |
188 | ||
189 | ||
190 | KeepGIL(__ne__); | |
191 | DocStr(__ne__, "Compare GBSpan for inequality.", ""); | |
192 | bool __ne__(PyObject* other) { | |
193 | wxGBSpan temp, *obj = &temp; | |
194 | if ( other == Py_None ) return true; | |
195 | if ( ! wxGBSpan_helper(other, &obj)) { | |
196 | PyErr_Clear(); | |
197 | return true; | |
198 | } | |
199 | return self->operator!=(*obj); | |
200 | } | |
201 | } | |
202 | ||
d14a1e28 RD |
203 | |
204 | %extend { | |
dd9f7fea RD |
205 | void Set(int rowspan=1, int colspan=1) { |
206 | self->SetRowspan(rowspan); | |
207 | self->SetColspan(colspan); | |
208 | } | |
209 | ||
210 | PyObject* Get() { | |
6e6b3557 | 211 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
d14a1e28 RD |
212 | PyObject* tup = PyTuple_New(2); |
213 | PyTuple_SET_ITEM(tup, 0, PyInt_FromLong(self->GetRowspan())); | |
214 | PyTuple_SET_ITEM(tup, 1, PyInt_FromLong(self->GetColspan())); | |
da32eb53 | 215 | wxPyEndBlockThreads(blocked); |
d14a1e28 RD |
216 | return tup; |
217 | } | |
218 | } | |
219 | %pythoncode { | |
d07d2bc9 | 220 | asTuple = wx._deprecated(Get, "asTuple is deprecated, use `Get` instead") |
dd9f7fea RD |
221 | def __str__(self): return str(self.Get()) |
222 | def __repr__(self): return 'wx.GBSpan'+str(self.Get()) | |
223 | def __len__(self): return len(self.Get()) | |
224 | def __getitem__(self, index): return self.Get()[index] | |
d14a1e28 RD |
225 | def __setitem__(self, index, val): |
226 | if index == 0: self.SetRowspan(val) | |
227 | elif index == 1: self.SetColspan(val) | |
228 | else: raise IndexError | |
dd9f7fea | 229 | def __nonzero__(self): return self.Get() != (0,0) |
41b78a7a | 230 | __safe_for_unpickling__ = True |
02376d73 | 231 | def __reduce__(self): return (wx.GBSpan, self.Get()) |
d14a1e28 RD |
232 | } |
233 | ||
234 | %pythoncode { | |
235 | rowspan = property(GetRowspan, SetRowspan) | |
236 | colspan = property(GetColspan, SetColspan) | |
237 | } | |
238 | }; | |
239 | ||
240 | ||
241 | %immutable; | |
242 | const wxGBSpan wxDefaultSpan; | |
243 | %mutable; | |
244 | ||
245 | ||
246 | //--------------------------------------------------------------------------- | |
247 | ||
248 | ||
3ea6e0ec RD |
249 | DocStr(wxGBSizerItem, |
250 | "The wx.GBSizerItem class is used to track the additional data about | |
251 | items in a `wx.GridBagSizer` such as the item's position in the grid | |
252 | and how many rows or columns it spans. | |
253 | ", ""); | |
d14a1e28 RD |
254 | class wxGBSizerItem : public wxSizerItem |
255 | { | |
256 | public: | |
3ea6e0ec RD |
257 | DocCtorStr( |
258 | wxGBSizerItem(), | |
259 | "Constructs an empty wx.GBSizerItem. Either a window, sizer or spacer | |
260 | size will need to be set, as well as a position and span before this | |
261 | item can be used in a Sizer. | |
262 | ||
263 | You will probably never need to create a wx.GBSizerItem directly as they | |
264 | are created automatically when the sizer's Add method is called.", ""); | |
265 | ||
214c4fbe RD |
266 | ~wxGBSizerItem(); |
267 | ||
268 | ||
3ea6e0ec RD |
269 | %extend { |
270 | DocStr(wxGBSizerItem( wxWindow *window, const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL ), | |
271 | "Construct a `wx.GBSizerItem` for a window.", ""); | |
1b8c7ba6 RD |
272 | |
273 | %RenameCtor(GBSizerItemWindow, wxGBSizerItem( wxWindow *window, | |
274 | const wxGBPosition& pos, | |
275 | const wxGBSpan& span, | |
276 | int flag, | |
277 | int border, | |
278 | PyObject* userData=NULL )) | |
3ea6e0ec RD |
279 | { |
280 | wxPyUserData* data = NULL; | |
281 | if ( userData ) { | |
6e6b3557 | 282 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
3ea6e0ec RD |
283 | data = new wxPyUserData(userData); |
284 | wxPyEndBlockThreads(blocked); | |
285 | } | |
286 | return new wxGBSizerItem(window, pos, span, flag, border, data); | |
287 | } | |
288 | ||
289 | ||
290 | DocStr(wxGBSizerItem( wxSizer *sizer,const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL ), | |
291 | "Construct a `wx.GBSizerItem` for a sizer", ""); | |
214c4fbe | 292 | %disownarg( wxSizer *sizer ); |
1b8c7ba6 RD |
293 | %RenameCtor(GBSizerItemSizer, wxGBSizerItem( wxSizer *sizer, |
294 | const wxGBPosition& pos, | |
295 | const wxGBSpan& span, | |
296 | int flag, | |
297 | int border, | |
298 | PyObject* userData=NULL )) | |
3ea6e0ec RD |
299 | { |
300 | wxPyUserData* data = NULL; | |
301 | if ( userData ) { | |
6e6b3557 | 302 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
3ea6e0ec RD |
303 | data = new wxPyUserData(userData); |
304 | wxPyEndBlockThreads(blocked); | |
305 | } | |
306 | return new wxGBSizerItem(sizer, pos, span, flag, border, data); | |
307 | } | |
214c4fbe | 308 | %cleardisown( wxSizer *sizer ); |
3ea6e0ec RD |
309 | |
310 | ||
311 | DocStr(wxGBSizerItem( int width,int height,const wxGBPosition& pos,const wxGBSpan& span,int flag,int border,PyObject* userData=NULL), | |
312 | "Construct a `wx.GBSizerItem` for a spacer.", ""); | |
1b8c7ba6 RD |
313 | %RenameCtor(GBSizerItemSpacer, wxGBSizerItem( int width, |
314 | int height, | |
315 | const wxGBPosition& pos, | |
316 | const wxGBSpan& span, | |
317 | int flag, | |
318 | int border, | |
319 | PyObject* userData=NULL)) | |
3ea6e0ec RD |
320 | { |
321 | wxPyUserData* data = NULL; | |
322 | if ( userData ) { | |
6e6b3557 | 323 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
3ea6e0ec RD |
324 | data = new wxPyUserData(userData); |
325 | wxPyEndBlockThreads(blocked); | |
326 | } | |
327 | return new wxGBSizerItem(width, height, pos, span, flag, border, data); | |
328 | } | |
329 | } | |
330 | ||
331 | ||
332 | DocDeclStr( | |
333 | wxGBPosition , GetPos() const, | |
334 | "Get the grid position of the item", ""); | |
335 | ||
dd9f7fea | 336 | %pythoncode { def GetPosTuple(self): return self.GetPos().Get() } |
d14a1e28 | 337 | |
3ea6e0ec RD |
338 | |
339 | ||
340 | DocDeclStr( | |
341 | wxGBSpan , GetSpan() const, | |
342 | "Get the row and column spanning of the item", ""); | |
343 | ||
dd9f7fea | 344 | %pythoncode { def GetSpanTuple(self): return self.GetSpan().Get() } |
d14a1e28 | 345 | |
3ea6e0ec RD |
346 | |
347 | ||
348 | DocDeclStr( | |
349 | bool , SetPos( const wxGBPosition& pos ), | |
350 | "If the item is already a member of a sizer then first ensure that | |
351 | there is no other item that would intersect with this one at the new | |
352 | position, then set the new position. Returns True if the change is | |
353 | successful and after the next Layout() the item will be moved.", ""); | |
354 | ||
d14a1e28 | 355 | |
3ea6e0ec RD |
356 | DocDeclStr( |
357 | bool , SetSpan( const wxGBSpan& span ), | |
358 | "If the item is already a member of a sizer then first ensure that | |
359 | there is no other item that would intersect with this one with its new | |
360 | spanning size, then set the new spanning. Returns True if the change | |
361 | is successful and after the next Layout() the item will be resized. | |
362 | ", ""); | |
d14a1e28 | 363 | |
d14a1e28 | 364 | |
3ea6e0ec RD |
365 | |
366 | DocDeclStr( | |
367 | bool , Intersects(const wxGBSizerItem& other), | |
368 | "Returns True if this item and the other item instersect.", ""); | |
369 | ||
d14a1e28 | 370 | |
3ea6e0ec RD |
371 | DocDeclStrName( |
372 | bool , Intersects(const wxGBPosition& pos, const wxGBSpan& span), | |
373 | "Returns True if the given pos/span would intersect with this item.", "", | |
374 | IntersectsPos); | |
375 | ||
d14a1e28 | 376 | |
3ea6e0ec RD |
377 | %extend { |
378 | DocStr(GetEndPos, | |
379 | "Get the row and column of the endpoint of this item.", ""); | |
380 | wxGBPosition GetEndPos() { | |
381 | int row, col; | |
382 | self->GetEndPos(row, col); | |
383 | return wxGBPosition(row, col); | |
384 | } | |
385 | } | |
d14a1e28 | 386 | |
3ea6e0ec RD |
387 | |
388 | DocDeclStr( | |
389 | wxGridBagSizer* , GetGBSizer() const, | |
390 | "Get the sizer this item is a member of.", ""); | |
391 | ||
392 | DocDeclStr( | |
393 | void , SetGBSizer(wxGridBagSizer* sizer), | |
394 | "Set the sizer this item is a member of.", ""); | |
d14a1e28 | 395 | |
76b8fa1d RD |
396 | %property(EndPos, GetEndPos, doc="See `GetEndPos`"); |
397 | %property(GBSizer, GetGBSizer, SetGBSizer, doc="See `GetGBSizer` and `SetGBSizer`"); | |
398 | %property(Pos, GetPos, SetPos, doc="See `GetPos` and `SetPos`"); | |
399 | %property(Span, GetSpan, SetSpan, doc="See `GetSpan` and `SetSpan`"); | |
d14a1e28 RD |
400 | }; |
401 | ||
402 | ||
403 | //--------------------------------------------------------------------------- | |
404 | ||
3ea6e0ec RD |
405 | DocStr(wxGridBagSizer, |
406 | "A `wx.Sizer` that can lay out items in a virtual grid like a | |
407 | `wx.FlexGridSizer` but in this case explicit positioning of the items | |
408 | is allowed using `wx.GBPosition`, and items can optionally span more | |
409 | than one row and/or column using `wx.GBSpan`. The total size of the | |
410 | virtual grid is determined by the largest row and column that items are | |
411 | positioned at, adjusted for spanning. | |
412 | ", ""); | |
d14a1e28 RD |
413 | |
414 | class wxGridBagSizer : public wxFlexGridSizer | |
415 | { | |
416 | public: | |
553f11cd RD |
417 | %pythonAppend wxGridBagSizer "self._setOORInfo(self)" |
418 | ||
3ea6e0ec RD |
419 | DocCtorStr( |
420 | wxGridBagSizer(int vgap = 0, int hgap = 0 ), | |
421 | "Constructor, with optional parameters to specify the gap between the | |
422 | rows and columns.", ""); | |
d14a1e28 | 423 | |
3ea6e0ec | 424 | |
d14a1e28 | 425 | %extend { |
3ea6e0ec RD |
426 | DocAStr(Add, |
427 | "Add(self, item, GBPosition pos, GBSpan span=DefaultSpan, int flag=0, | |
7aada1e0 | 428 | int border=0, userData=None) -> wx.GBSizerItem", |
3ea6e0ec RD |
429 | |
430 | "Adds an item to the sizer at the grid cell *pos*, optionally spanning | |
431 | more than one row or column as specified with *span*. The remaining | |
432 | args behave similarly to `wx.Sizer.Add`. | |
433 | ||
434 | Returns True if the item was successfully placed at the given cell | |
435 | position, False if something was already there. | |
436 | ", ""); | |
7aada1e0 RD |
437 | wxGBSizerItem* Add( PyObject* item, |
438 | const wxGBPosition& pos, | |
439 | const wxGBSpan& span = wxDefaultSpan, | |
440 | int flag = 0, | |
441 | int border = 0, | |
442 | PyObject* userData = NULL ) { | |
d14a1e28 RD |
443 | |
444 | wxPyUserData* data = NULL; | |
6e6b3557 | 445 | wxPyBlock_t blocked = wxPyBeginBlockThreads(); |
a72f4631 | 446 | wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false); |
d14a1e28 RD |
447 | if ( userData && (info.window || info.sizer || info.gotSize) ) |
448 | data = new wxPyUserData(userData); | |
214c4fbe RD |
449 | if ( info.sizer ) |
450 | PyObject_SetAttrString(item,"thisown",Py_False); | |
da32eb53 | 451 | wxPyEndBlockThreads(blocked); |
d14a1e28 RD |
452 | |
453 | // Now call the real Add method if a valid item type was found | |
454 | if ( info.window ) | |
7aada1e0 | 455 | return (wxGBSizerItem*)self->Add(info.window, pos, span, flag, border, data); |
d14a1e28 | 456 | else if ( info.sizer ) |
7aada1e0 | 457 | return (wxGBSizerItem*)self->Add(info.sizer, pos, span, flag, border, data); |
d14a1e28 | 458 | else if (info.gotSize) |
7aada1e0 RD |
459 | return (wxGBSizerItem*)self->Add(info.size.GetWidth(), info.size.GetHeight(), |
460 | pos, span, flag, border, data); | |
461 | return NULL; | |
d14a1e28 RD |
462 | } |
463 | } | |
214c4fbe RD |
464 | |
465 | %disownarg( wxGBSizerItem *item ); | |
3ea6e0ec | 466 | DocDeclAStrName( |
7aada1e0 RD |
467 | wxGBSizerItem* , Add( wxGBSizerItem *item ), |
468 | "Add(self, GBSizerItem item) -> wx.GBSizerItem", | |
3ea6e0ec RD |
469 | "Add an item to the sizer using a `wx.GBSizerItem`. Returns True if |
470 | the item was successfully placed at its given cell position, False if | |
471 | something was already there.", "", | |
472 | AddItem); | |
214c4fbe | 473 | %cleardisown( wxGBSizerItem *item ); |
d612c25a RD |
474 | |
475 | DocDeclStr( | |
476 | wxSize , GetCellSize(int row, int col) const, | |
477 | "Get the size of the specified cell, including hgap and | |
478 | vgap. Only valid after a Layout.", ""); | |
d14a1e28 | 479 | |
3ea6e0ec RD |
480 | DocDeclStr( |
481 | wxSize , GetEmptyCellSize() const, | |
482 | "Get the size used for cells in the grid with no item.", ""); | |
483 | ||
484 | DocDeclStr( | |
485 | void , SetEmptyCellSize(const wxSize& sz), | |
486 | "Set the size used for cells in the grid with no item.", ""); | |
487 | ||
d14a1e28 | 488 | |
3ea6e0ec | 489 | |
d14a1e28 | 490 | %nokwargs GetItemPosition; |
3ea6e0ec RD |
491 | %noautodoc GetItemPosition; |
492 | DocStr(GetItemPosition, | |
493 | "GetItemPosition(self, item) -> GBPosition | |
494 | ||
495 | Get the grid position of the specified *item* where *item* is either a | |
496 | window or subsizer that is a member of this sizer, or a zero-based | |
497 | index of an item.", ""); | |
d14a1e28 RD |
498 | wxGBPosition GetItemPosition(wxWindow *window); |
499 | wxGBPosition GetItemPosition(wxSizer *sizer); | |
500 | wxGBPosition GetItemPosition(size_t index); | |
501 | ||
3ea6e0ec | 502 | |
d14a1e28 | 503 | %nokwargs SetItemPosition; |
3ea6e0ec RD |
504 | %noautodoc SetItemPosition; |
505 | DocStr(SetItemPosition, | |
506 | "SetItemPosition(self, item, GBPosition pos) -> bool | |
507 | ||
508 | Set the grid position of the specified *item* where *item* is either a | |
509 | window or subsizer that is a member of this sizer, or a zero-based | |
510 | index of an item. Returns True on success. If the move is not | |
511 | allowed (because an item is already there) then False is returned. | |
512 | ", ""); | |
d14a1e28 RD |
513 | bool SetItemPosition(wxWindow *window, const wxGBPosition& pos); |
514 | bool SetItemPosition(wxSizer *sizer, const wxGBPosition& pos); | |
515 | bool SetItemPosition(size_t index, const wxGBPosition& pos); | |
516 | ||
3ea6e0ec RD |
517 | |
518 | ||
d14a1e28 | 519 | %nokwargs GetItemSpan; |
3ea6e0ec RD |
520 | %noautodoc GetItemSpan; |
521 | DocStr(GetItemSpan, | |
522 | "GetItemSpan(self, item) -> GBSpan | |
523 | ||
524 | Get the row/col spanning of the specified *item* where *item* is | |
525 | either a window or subsizer that is a member of this sizer, or a | |
526 | zero-based index of an item.", ""); | |
d14a1e28 RD |
527 | wxGBSpan GetItemSpan(wxWindow *window); |
528 | wxGBSpan GetItemSpan(wxSizer *sizer); | |
529 | wxGBSpan GetItemSpan(size_t index); | |
530 | ||
3ea6e0ec RD |
531 | |
532 | ||
d14a1e28 | 533 | %nokwargs SetItemSpan; |
3ea6e0ec RD |
534 | %noautodoc SetItemSpan; |
535 | DocStr(SetItemSpan, | |
536 | "SetItemSpan(self, item, GBSpan span) -> bool | |
537 | ||
538 | Set the row/col spanning of the specified *item* where *item* is | |
539 | either a window or subsizer that is a member of this sizer, or a | |
540 | zero-based index of an item. Returns True on success. If the move is | |
541 | not allowed (because an item is already there) then False is returned.", ""); | |
d14a1e28 RD |
542 | bool SetItemSpan(wxWindow *window, const wxGBSpan& span); |
543 | bool SetItemSpan(wxSizer *sizer, const wxGBSpan& span); | |
544 | bool SetItemSpan(size_t index, const wxGBSpan& span); | |
3ea6e0ec | 545 | |
d14a1e28 RD |
546 | |
547 | ||
d14a1e28 | 548 | %nokwargs FindItem; |
3ea6e0ec RD |
549 | %noautodoc FindItem; |
550 | DocStr(FindItem, | |
551 | "FindItem(self, item) -> GBSizerItem | |
552 | ||
553 | Find the sizer item for the given window or subsizer, returns None if | |
554 | not found. (non-recursive)", ""); | |
d14a1e28 RD |
555 | wxGBSizerItem* FindItem(wxWindow* window); |
556 | wxGBSizerItem* FindItem(wxSizer* sizer); | |
7d69a571 RD |
557 | %pythoncode { |
558 | def GetItem(self, item): | |
559 | gbsi = None | |
560 | si = wx.FlexGridSizer.GetItem(self, item) | |
561 | if not si: | |
562 | return None | |
563 | if type(item) is not int: | |
564 | gbsi = self.FindItem(item) | |
565 | if gbsi: return gbsi | |
566 | return si | |
567 | } | |
d14a1e28 | 568 | |
3ea6e0ec RD |
569 | DocDeclStr( |
570 | wxGBSizerItem* , FindItemAtPosition(const wxGBPosition& pos), | |
571 | "Return the sizer item for the given grid cell, or None if there is no | |
572 | item at that position. (non-recursive)", ""); | |
d14a1e28 | 573 | |
dd9f7fea RD |
574 | |
575 | ||
3ea6e0ec RD |
576 | DocDeclStr( |
577 | wxGBSizerItem* , FindItemAtPoint(const wxPoint& pt), | |
578 | "Return the sizer item located at the point given in *pt*, or None if | |
579 | there is no item at that point. The (x,y) coordinates in pt correspond | |
580 | to the client coordinates of the window using the sizer for | |
581 | layout. (non-recursive)", ""); | |
d14a1e28 | 582 | |
d14a1e28 | 583 | |
3ea6e0ec RD |
584 | |
585 | // DocDeclStr( | |
586 | // wxGBSizerItem* , FindItemWithData(const wxObject* userData), | |
587 | // "Return the sizer item that has a matching user data (it only compares | |
588 | // pointer values) or None if not found. (non-recursive)", ""); | |
589 | ||
590 | ||
d14a1e28 RD |
591 | |
592 | // Look at all items and see if any intersect (or would overlap) the given | |
dd9f7fea | 593 | // item. Returns True if so, False if there would be no overlap. If an |
d14a1e28 RD |
594 | // excludeItem is given then it will not be checked for intersection, for |
595 | // example it may be the item we are checking the position of. | |
3ea6e0ec RD |
596 | |
597 | ||
598 | DocDeclStr( | |
599 | bool , CheckForIntersection(wxGBSizerItem* item, wxGBSizerItem* excludeItem = NULL), | |
600 | "Look at all items and see if any intersect (or would overlap) the | |
601 | given *item*. Returns True if so, False if there would be no overlap. | |
602 | If an *excludeItem* is given then it will not be checked for | |
603 | intersection, for example it may be the item we are checking the | |
604 | position of. | |
605 | ", ""); | |
606 | ||
607 | DocDeclStrName( | |
608 | bool , CheckForIntersection(const wxGBPosition& pos, const wxGBSpan& span, wxGBSizerItem* excludeItem = NULL), | |
609 | "Look at all items and see if any intersect (or would overlap) the | |
610 | given position and span. Returns True if so, False if there would be | |
611 | no overlap. If an *excludeItem* is given then it will not be checked | |
612 | for intersection, for example it may be the item we are checking the | |
613 | position of.", "", | |
614 | CheckForIntersectionPos); | |
615 | ||
d14a1e28 RD |
616 | }; |
617 | ||
618 | ||
619 | //--------------------------------------------------------------------------- |