]> git.saurik.com Git - wxWidgets.git/blame - wxPython/src/_sizers.i
Deprecated methosd markup (documented).
[wxWidgets.git] / wxPython / src / _sizers.i
CommitLineData
d14a1e28
RD
1/////////////////////////////////////////////////////////////////////////////
2// Name: _sizers.i
3// Purpose: SWIG interface defs for the Sizers
4//
5// Author: Robin Dunn
6//
7// Created: 18-Sept-1999
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%newgroup;
23
3ea6e0ec
RD
24DocStr(wxSizerItem,
25"The wx.SizerItem class is used to track the position, size and other
26attributes of each item managed by a `wx.Sizer`. In normal usage user
27code should never need to deal directly with a wx.SizerItem, but
28custom classes derived from `wx.PySizer` will probably need to use the
29collection of wx.SizerItems held by wx.Sizer when calculating layout.
30
31:see: `wx.Sizer`, `wx.GBSizerItem`", "");
d14a1e28
RD
32
33class wxSizerItem : public wxObject {
34public:
3ea6e0ec
RD
35 DocCtorStr(
36 wxSizerItem(),
37 "Constructs an empty wx.SizerItem. Either a window, sizer or spacer
38size will need to be set before this item can be used in a Sizer.
39
40You will probably never need to create a wx.SizerItem directly as they
41are created automatically when the sizer's Add, Insert or Prepend
42methods are called.
43
44:see: `wx.SizerItemSpacer`, `wx.SizerItemWindow`, `wx.SizerItemSizer`", "");
45
46
d14a1e28 47
3ea6e0ec
RD
48 %extend {
49 DocStr(
50 wxSizerItem( wxWindow *window, int proportion, int flag,
51 int border, PyObject* userData=NULL ),
52 "Constructs a `wx.SizerItem` for tracking a window.", "");
53
54 %name(SizerItemWindow) wxSizerItem( wxWindow *window, int proportion, int flag,
55 int border, PyObject* userData=NULL ) {
56 wxPyUserData* data = NULL;
57 if ( userData ) {
58 bool blocked = wxPyBeginBlockThreads();
59 data = new wxPyUserData(userData);
60 wxPyEndBlockThreads(blocked);
61 }
62 return new wxSizerItem(window, proportion, flag, border, data);
63 }
64
65
66 DocStr(
67 wxSizerItem( int width, int height, int proportion, int flag,
68 int border, PyObject* userData=NULL),
69 "Constructs a `wx.SizerItem` for tracking a spacer.", "");
70 %name(SizerItemSpacer) wxSizerItem( int width, int height, int proportion, int flag,
71 int border, PyObject* userData=NULL) {
72 wxPyUserData* data = NULL;
73 if ( userData ) {
74 bool blocked = wxPyBeginBlockThreads();
75 data = new wxPyUserData(userData);
76 wxPyEndBlockThreads(blocked);
77 }
78 return new wxSizerItem(width, height, proportion, flag, border, data);
79 }
80
81 DocStr(
82 wxSizerItem( wxSizer *sizer, int proportion, int flag,
83 int border, PyObject* userData=NULL ),
84 "Constructs a `wx.SizerItem` for tracking a subsizer", "");
85 %name(SizerItemSizer) wxSizerItem( wxSizer *sizer, int proportion, int flag,
86 int border, PyObject* userData=NULL ) {
87 wxPyUserData* data = NULL;
88 if ( userData ) {
89 bool blocked = wxPyBeginBlockThreads();
90 data = new wxPyUserData(userData);
91 wxPyEndBlockThreads(blocked);
92 }
93 return new wxSizerItem(sizer, proportion, flag, border, data);
94 }
95 }
d14a1e28 96
d14a1e28 97
3ea6e0ec
RD
98
99 DocDeclStr(
100 void , DeleteWindows(),
101 "Destroy the window or the windows in a subsizer, depending on the type
102of item.", "");
103
104 DocDeclStr(
105 void , DetachSizer(),
106 "Enable deleting the SizerItem without destroying the contained sizer.", "");
107
d14a1e28 108
3ea6e0ec
RD
109 DocDeclStr(
110 wxSize , GetSize(),
111 "Get the current size of the item, as set in the last Layout.", "");
112
113 DocDeclStr(
114 wxSize , CalcMin(),
115 "Calculates the minimum desired size for the item, including any space
116needed by borders.", "");
117
118 DocDeclStr(
119 void , SetDimension( wxPoint pos, wxSize size ),
120 "Set the position and size of the space allocated for this item by the
121sizer, and adjust the position and size of the item (window or
122subsizer) to be within that space taking alignment and borders into
123account.", "");
124
125
126 DocDeclStr(
127 wxSize , GetMinSize(),
128 "Get the minimum size needed for the item.", "");
129
329b045c
RD
130 DocDeclStr(
131 wxSize , GetMinSizeWithBorder() const,
132 "Get the minimum size needed for the item with space for the borders
133added, if needed.", "");
134
3ea6e0ec
RD
135 DocDeclStr(
136 void , SetInitSize( int x, int y ),
137 "", "");
138
d14a1e28 139
3ea6e0ec
RD
140 DocStr(SetRatio,
141 "Set the ratio item attribute.", "");
d14a1e28
RD
142 %name(SetRatioWH) void SetRatio( int width, int height );
143 %name(SetRatioSize) void SetRatio( wxSize size );
144 void SetRatio( float ratio );
3ea6e0ec
RD
145
146 DocDeclStr(
147 float , GetRatio(),
148 "Set the ratio item attribute.", "");
7aada1e0
RD
149
150 DocDeclStr(
151 wxRect , GetRect(),
152 "Returns the rectangle that the sizer item should occupy", "");
3ea6e0ec 153
d14a1e28 154
3ea6e0ec
RD
155 DocDeclStr(
156 bool , IsWindow(),
157 "Is this sizer item a window?", "");
158
159 DocDeclStr(
160 bool , IsSizer(),
161 "Is this sizer item a subsizer?", "");
162
163 DocDeclStr(
164 bool , IsSpacer(),
165 "Is this sizer item a spacer?", "");
166
d14a1e28 167
3ea6e0ec
RD
168 DocDeclStr(
169 void , SetProportion( int proportion ),
170 "Set the proportion value for this item.", "");
d14a1e28 171
3ea6e0ec
RD
172 DocDeclStr(
173 int , GetProportion(),
174 "Get the proportion value for this item.", "");
d14a1e28 175
3ea6e0ec
RD
176 %pythoncode { SetOption = wx._deprecated(SetProportion, "Please use `SetProportion` instead.") }
177 %pythoncode { GetOption = wx._deprecated(GetProportion, "Please use `GetProportion` instead.") }
d14a1e28 178
d14a1e28 179
3ea6e0ec
RD
180 DocDeclStr(
181 void , SetFlag( int flag ),
182 "Set the flag value for this item.", "");
183
184 DocDeclStr(
185 int , GetFlag(),
186 "Get the flag value for this item.", "");
187
188
189 DocDeclStr(
190 void , SetBorder( int border ),
191 "Set the border value for this item.", "");
192
193 DocDeclStr(
194 int , GetBorder(),
195 "Get the border value for this item.", "");
d14a1e28 196
d14a1e28 197
3ea6e0ec
RD
198
199 DocDeclStr(
200 wxWindow *, GetWindow(),
201 "Get the window (if any) that is managed by this sizer item.", "");
202
203 DocDeclStr(
204 void , SetWindow( wxWindow *window ),
205 "Set the window to be managed by this sizer item.", "");
206
207
208 DocDeclStr(
209 wxSizer *, GetSizer(),
210 "Get the subsizer (if any) that is managed by this sizer item.", "");
211
212 DocDeclStr(
213 void , SetSizer( wxSizer *sizer ),
214 "Set the subsizer to be managed by this sizer item.", "");
215
216
217 DocDeclStr(
218 const wxSize& , GetSpacer(),
219 "Get the size of the spacer managed by this sizer item.", "");
220
221 DocDeclStr(
222 void , SetSpacer( const wxSize &size ),
223 "Set the size of the spacer to be managed by this sizer item.", "");
224
d14a1e28 225
3ea6e0ec
RD
226 DocDeclStr(
227 void , Show( bool show ),
228 "Set the show item attribute, which sizers use to determine if the item
229is to be made part of the layout or not. If the item is tracking a
230window then it is shown or hidden as needed.", "");
231
232 DocDeclStr(
233 bool , IsShown(),
234 "Is the item to be shown in the layout?", "");
235
236
237 DocDeclStr(
238 wxPoint , GetPosition(),
239 "Returns the current position of the item, as set in the last Layout.", "");
240
d14a1e28
RD
241
242 // wxObject* GetUserData();
243 %extend {
244 // Assume that the user data is a wxPyUserData object and return the contents
3ea6e0ec
RD
245
246 DocStr(GetUserData,
247 "Returns the userData associated with this sizer item, or None if there
248isn't any.", "");
d14a1e28
RD
249 PyObject* GetUserData() {
250 wxPyUserData* data = (wxPyUserData*)self->GetUserData();
251 if (data) {
252 Py_INCREF(data->m_obj);
253 return data->m_obj;
254 } else {
255 Py_INCREF(Py_None);
256 return Py_None;
257 }
258 }
259 }
260};
261
262
263//---------------------------------------------------------------------------
264
265%{
266// Figure out the type of the sizer item
267
268struct wxPySizerItemInfo {
269 wxPySizerItemInfo()
a72f4631
RD
270 : window(NULL), sizer(NULL), gotSize(false),
271 size(wxDefaultSize), gotPos(false), pos(-1)
d14a1e28
RD
272 {}
273
274 wxWindow* window;
275 wxSizer* sizer;
276 bool gotSize;
277 wxSize size;
278 bool gotPos;
279 int pos;
280};
281
282static wxPySizerItemInfo wxPySizerItemTypeHelper(PyObject* item, bool checkSize, bool checkIdx ) {
283
284 wxPySizerItemInfo info;
285 wxSize size;
286 wxSize* sizePtr = &size;
287
288 // Find out what the type of the item is
289 // try wxWindow
290 if ( ! wxPyConvertSwigPtr(item, (void**)&info.window, wxT("wxWindow")) ) {
291 PyErr_Clear();
292 info.window = NULL;
293
294 // try wxSizer
295 if ( ! wxPyConvertSwigPtr(item, (void**)&info.sizer, wxT("wxSizer")) ) {
296 PyErr_Clear();
297 info.sizer = NULL;
298
299 // try wxSize or (w,h)
300 if ( checkSize && wxSize_helper(item, &sizePtr)) {
301 info.size = *sizePtr;
a72f4631 302 info.gotSize = true;
d14a1e28
RD
303 }
304
305 // or a single int
306 if (checkIdx && PyInt_Check(item)) {
307 info.pos = PyInt_AsLong(item);
a72f4631 308 info.gotPos = true;
d14a1e28
RD
309 }
310 }
311 }
312
313 if ( !(info.window || info.sizer || (checkSize && info.gotSize) || (checkIdx && info.gotPos)) ) {
314 // no expected type, figure out what kind of error message to generate
315 if ( !checkSize && !checkIdx )
316 PyErr_SetString(PyExc_TypeError, "wxWindow or wxSizer expected for item");
317 else if ( checkSize && !checkIdx )
318 PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) expected for item");
319 else if ( !checkSize && checkIdx)
320 PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer or int (position) expected for item");
321 else
322 // can this one happen?
323 PyErr_SetString(PyExc_TypeError, "wxWindow, wxSizer, wxSize, or (w,h) or int (position) expected for item");
324 }
325
326 return info;
327}
328%}
329
330
331
332
3ea6e0ec
RD
333DocStr(wxSizer,
334"wx.Sizer is the abstract base class used for laying out subwindows in
335a window. You cannot use wx.Sizer directly; instead, you will have to
336use one of the sizer classes derived from it such as `wx.BoxSizer`,
337`wx.StaticBoxSizer`, `wx.NotebookSizer`, `wx.GridSizer`, `wx.FlexGridSizer`
338and `wx.GridBagSizer`.
339
340The concept implemented by sizers in wxWidgets is closely related to
341layout tools in other GUI toolkits, such as Java's AWT, the GTK
342toolkit or the Qt toolkit. It is based upon the idea of the individual
343subwindows reporting their minimal required size and their ability to
344get stretched if the size of the parent window has changed. This will
345most often mean that the programmer does not set the original size of
346a dialog in the beginning, rather the dialog will assigned a sizer and
347this sizer will be queried about the recommended size. The sizer in
348turn will query its children, which can be normal windows or contorls,
349empty space or other sizers, so that a hierarchy of sizers can be
350constructed. Note that wxSizer does not derive from wxWindow and thus
351do not interfere with tab ordering and requires very little resources
352compared to a real window on screen.
353
354What makes sizers so well fitted for use in wxWidgets is the fact that
355every control reports its own minimal size and the algorithm can
356handle differences in font sizes or different window (dialog item)
357sizes on different platforms without problems. If for example the
358standard font as well as the overall design of Mac widgets requires
359more space than on Windows, then the initial size of a dialog using a
360sizer will automatically be bigger on Mac than on Windows.", "
361
362:note: If you wish to create a custom sizer class in wxPython you
363 should derive the class from `wx.PySizer` in order to get
364 Python-aware capabilities for the various virtual methods.
365
366:see: `wx.SizerItem`
367
368:todo: More dscriptive text here along with some pictures...
369
370");
371
d14a1e28
RD
372class wxSizer : public wxObject {
373public:
374 // wxSizer(); **** abstract, can't instantiate
375 // ~wxSizer();
376
377 %extend {
378 void _setOORInfo(PyObject* _self) {
a77bf68f
RD
379 if (!self->GetClientObject())
380 self->SetClientObject(new wxPyOORClientData(_self));
d14a1e28
RD
381 }
382
3ea6e0ec
RD
383 DocAStr(Add,
384 "Add(self, item, int proportion=0, int flag=0, int border=0,
7aada1e0 385 PyObject userData=None) -> wx.SizerItem",
3ea6e0ec
RD
386
387 "Appends a child item to the sizer.", "
388
389 :param item: The item can be one of three kinds of objects:
390
391 - **window**: A `wx.Window` to be managed by the sizer. Its
392 minimal size (either set explicitly by the user or
393 calculated internally when constructed with wx.DefaultSize)
394 is interpreted as the minimal size to use when laying out
395 item in the sizer. This is particularly useful in
396 connection with `wx.Window.SetSizeHints`.
397
398 - **sizer**: The (child-)sizer to be added to the sizer. This
399 allows placing a child sizer in a sizer and thus to create
400 hierarchies of sizers (typically a vertical box as the top
401 sizer and several horizontal boxes on the level beneath).
402
403 - **size**: A `wx.Size` or a 2-element sequence of integers
404 that represents the width and height of a spacer to be added
405 to the sizer. Adding spacers to sizers gives more
406 flexibility in the design of dialogs; imagine for example a
407 horizontal box with two buttons at the bottom of a dialog:
408 you might want to insert a space between the two buttons and
409 make that space stretchable using the *proportion* value and
410 the result will be that the left button will be aligned with
411 the left side of the dialog and the right button with the
412 right side - the space in between will shrink and grow with
413 the dialog.
414
415 :param proportion: Although the meaning of this parameter is
416 undefined in wx.Sizer, it is used in `wx.BoxSizer` to indicate
417 if a child of a sizer can change its size in the main
418 orientation of the wx.BoxSizer - where 0 stands for not
419 changeable and a value of more than zero is interpreted
420 relative (a proportion of the total) to the value of other
421 children of the same wx.BoxSizer. For example, you might have
422 a horizontal wx.BoxSizer with three children, two of which are
423 supposed to change their size with the sizer. Then the two
424 stretchable windows should each be given *proportion* value of
425 1 to make them grow and shrink equally with the sizer's
426 horizontal dimension. But if one of them had a *proportion*
427 value of 2 then it would get a double share of the space
428 available after the fixed size items are positioned.
429
430 :param flag: This parameter can be used to set a number of flags
431 which can be combined using the binary OR operator ``|``. Two
432 main behaviours are defined using these flags. One is the
433 border around a window: the *border* parameter determines the
434 border width whereas the flags given here determine which
435 side(s) of the item that the border will be added. The other
436 flags determine how the sizer item behaves when the space
437 allotted to the sizer changes, and is somewhat dependent on
438 the specific kind of sizer used.
439
440 +----------------------------+------------------------------------------+
441 |- wx.TOP |These flags are used to specify |
442 |- wx.BOTTOM |which side(s) of the sizer item that |
443 |- wx.LEFT |the *border* width will apply to. |
444 |- wx.RIGHT | |
445 |- wx.ALL | |
446 | | |
447 +----------------------------+------------------------------------------+
448 |- wx.EXAPAND |The item will be expanded to fill |
449 | |the space allotted to the item. |
450 +----------------------------+------------------------------------------+
451 |- wx.SHAPED |The item will be expanded as much as |
452 | |possible while also maintaining its |
453 | |aspect ratio |
454 +----------------------------+------------------------------------------+
455 |- wx.FIXED_MINSIZE |Normally wx.Sizers will use |
456 | |`wx.Window.GetMinSize` or |
457 | |`wx.Window.GetBestSize` to determine what |
458 | |the minimal size of window items should |
459 | |be, and will use that size to calculate |
460 | |the layout. This allows layouts to adjust |
461 | |when an item changes and it's best size |
462 | |becomes different. If you would rather |
463 | |have a window item stay the size it |
464 | |started with then use wx.FIXED_MINSIZE. |
465 +----------------------------+------------------------------------------+
466 |- wx.ALIGN_CENTER |The wx.ALIGN flags allow you to specify |
467 |- wx.ALIGN_LEFT |the alignment of the item within the space|
468 |- wx.ALIGN_RIGHT |allotted to it by the sizer, ajusted for |
469 |- wx.ALIGN_TOP |the border if any. |
470 |- wx.ALIGN_BOTTOM | |
471 |- wx.ALIGN_CENTER_VERTICAL | |
472 |- wx.ALIGN_CENTER_HORIZONTAL| |
473 +----------------------------+------------------------------------------+
474
475
476 :param border: Determines the border width, if the *flag*
477 parameter is set to include any border flag.
478
479 :param userData: Allows an extra object to be attached to the
480 sizer item, for use in derived classes when sizing information
481 is more complex than the *proportion* and *flag* will allow for.
482");
d14a1e28 483
7aada1e0
RD
484 wxSizerItem* Add(PyObject* item, int proportion=0, int flag=0, int border=0,
485 PyObject* userData=NULL) {
d14a1e28
RD
486
487 wxPyUserData* data = NULL;
da32eb53 488 bool blocked = wxPyBeginBlockThreads();
a72f4631 489 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
d14a1e28
RD
490 if ( userData && (info.window || info.sizer || info.gotSize) )
491 data = new wxPyUserData(userData);
da32eb53 492 wxPyEndBlockThreads(blocked);
d14a1e28
RD
493
494 // Now call the real Add method if a valid item type was found
495 if ( info.window )
7aada1e0 496 return self->Add(info.window, proportion, flag, border, data);
d14a1e28 497 else if ( info.sizer )
7aada1e0 498 return self->Add(info.sizer, proportion, flag, border, data);
d14a1e28 499 else if (info.gotSize)
7aada1e0
RD
500 return self->Add(info.size.GetWidth(), info.size.GetHeight(),
501 proportion, flag, border, data);
502 else
503 return NULL;
d14a1e28
RD
504 }
505
7aada1e0
RD
506// virtual wxSizerItem* AddSpacer(int size);
507// virtual wxSizerItem* AddStretchSpacer(int prop = 1);
d14a1e28 508
3ea6e0ec
RD
509 DocAStr(Insert,
510 "Insert(self, int before, item, int proportion=0, int flag=0, int border=0,
7aada1e0 511 PyObject userData=None) -> wx.SizerItem",
3ea6e0ec
RD
512
513 "Inserts a new item into the list of items managed by this sizer before
514the item at index *before*. See `Add` for a description of the parameters.", "");
7aada1e0
RD
515 wxSizerItem* Insert(int before, PyObject* item, int proportion=0, int flag=0,
516 int border=0, PyObject* userData=NULL) {
d14a1e28
RD
517
518 wxPyUserData* data = NULL;
da32eb53 519 bool blocked = wxPyBeginBlockThreads();
a72f4631 520 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
d14a1e28
RD
521 if ( userData && (info.window || info.sizer || info.gotSize) )
522 data = new wxPyUserData(userData);
da32eb53 523 wxPyEndBlockThreads(blocked);
d14a1e28
RD
524
525 // Now call the real Insert method if a valid item type was found
526 if ( info.window )
7aada1e0 527 return self->Insert(before, info.window, proportion, flag, border, data);
d14a1e28 528 else if ( info.sizer )
7aada1e0 529 return self->Insert(before, info.sizer, proportion, flag, border, data);
d14a1e28 530 else if (info.gotSize)
7aada1e0
RD
531 return self->Insert(before, info.size.GetWidth(), info.size.GetHeight(),
532 proportion, flag, border, data);
533 else
534 return NULL;
d14a1e28
RD
535 }
536
537
7aada1e0
RD
538// virtual wxSizerItem* InsertSpacer(size_t index, int size);
539// virtual wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1);
3ea6e0ec
RD
540
541 DocAStr(Prepend,
542 "Prepend(self, item, int proportion=0, int flag=0, int border=0,
7aada1e0 543 PyObject userData=None) -> wx.SizerItem",
d14a1e28 544
3ea6e0ec
RD
545 "Adds a new item to the begining of the list of sizer items managed by
546this sizer. See `Add` for a description of the parameters.", "");
7aada1e0
RD
547 wxSizerItem* Prepend(PyObject* item, int proportion=0, int flag=0, int border=0,
548 PyObject* userData=NULL) {
d14a1e28
RD
549
550 wxPyUserData* data = NULL;
da32eb53 551 bool blocked = wxPyBeginBlockThreads();
a72f4631 552 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, true, false);
d14a1e28
RD
553 if ( userData && (info.window || info.sizer || info.gotSize) )
554 data = new wxPyUserData(userData);
da32eb53 555 wxPyEndBlockThreads(blocked);
d14a1e28
RD
556
557 // Now call the real Prepend method if a valid item type was found
558 if ( info.window )
7aada1e0 559 return self->Prepend(info.window, proportion, flag, border, data);
d14a1e28 560 else if ( info.sizer )
7aada1e0 561 return self->Prepend(info.sizer, proportion, flag, border, data);
d14a1e28 562 else if (info.gotSize)
7aada1e0
RD
563 return self->Prepend(info.size.GetWidth(), info.size.GetHeight(),
564 proportion, flag, border, data);
565 else
566 return NULL;
d14a1e28
RD
567 }
568
7aada1e0
RD
569// virtual wxSizerItem* PrependSpacer(int size);
570// virtual wxSizerItem* PrependStretchSpacer(int prop = 1);
3ea6e0ec
RD
571
572 DocAStr(Remove,
573 "Remove(self, item) -> bool",
574 "Removes an item from the sizer and destroys it. This method does not
575cause any layout or resizing to take place, call `Layout` to update
576the layout on screen after removing a child from the sizer. The
577*item* parameter can be either a window, a sizer, or the zero-based
578index of an item to remove. Returns True if the child item was found
579and removed.", "
580
581:note: For historical reasons calling this method with a `wx.Window`
582 parameter is depreacted, as it will not be able to destroy the
583 window since it is owned by its parent. You should use `Detach`
584 instead.
585");
d14a1e28 586 bool Remove(PyObject* item) {
da32eb53 587 bool blocked = wxPyBeginBlockThreads();
a72f4631 588 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
da32eb53 589 wxPyEndBlockThreads(blocked);
d14a1e28
RD
590 if ( info.window )
591 return self->Remove(info.window);
592 else if ( info.sizer )
593 return self->Remove(info.sizer);
594 else if ( info.gotPos )
595 return self->Remove(info.pos);
596 else
a72f4631 597 return false;
d14a1e28
RD
598 }
599
3ea6e0ec
RD
600
601 DocAStr(Detach,
602 "Detach(self, item) -> bool",
603 "Detaches an item from the sizer without destroying it. This method
604does not cause any layout or resizing to take place, call `Layout` to
605do so. The *item* parameter can be either a window, a sizer, or the
606zero-based index of the item to be detached. Returns True if the child item
607was found and detached.", "");
60a71c29
RD
608 bool Detach(PyObject* item) {
609 bool blocked = wxPyBeginBlockThreads();
a72f4631 610 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
60a71c29
RD
611 wxPyEndBlockThreads(blocked);
612 if ( info.window )
613 return self->Detach(info.window);
614 else if ( info.sizer )
615 return self->Detach(info.sizer);
616 else if ( info.gotPos )
617 return self->Detach(info.pos);
618 else
a72f4631 619 return false;
60a71c29
RD
620 }
621
622
7aada1e0
RD
623 DocAStr(GetItem,
624 "GetItem(self, item) -> wx.SizerItem",
625 "Returns the `wx.SizerItem` which holds the *item* given. The *item*
626parameter can be either a window, a sizer, or the zero-based index of
627the item to be detached.", "");
628 wxSizerItem* GetItem(PyObject* item) {
629 bool blocked = wxPyBeginBlockThreads();
630 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
631 wxPyEndBlockThreads(blocked);
632 if ( info.window )
633 return self->GetItem(info.window);
634 else if ( info.sizer )
635 return self->GetItem(info.sizer);
636 else if ( info.gotPos )
637 return self->GetItem(info.pos);
638 else
639 return NULL;
640 }
641
642
dd9f7fea 643 void _SetItemMinSize(PyObject* item, const wxSize& size) {
da32eb53 644 bool blocked = wxPyBeginBlockThreads();
a72f4631 645 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
da32eb53 646 wxPyEndBlockThreads(blocked);
d14a1e28
RD
647 if ( info.window )
648 self->SetItemMinSize(info.window, size);
649 else if ( info.sizer )
650 self->SetItemMinSize(info.sizer, size);
651 else if ( info.gotPos )
652 self->SetItemMinSize(info.pos, size);
653 }
654 }
655
3ea6e0ec
RD
656 %pythoncode {
657 def SetItemMinSize(self, item, *args):
658 """
659 SetItemMinSize(self, item, Size size)
660
661 Sets the minimum size that will be allocated for an item in the sizer.
662 The *item* parameter can be either a window, a sizer, or the
663 zero-based index of the item. If a window or sizer is given then it
664 will be searched for recursivly in subsizers if neccessary.
665 """
666 if len(args) == 2:
667 %# for backward compatibility accept separate width,height args too
668 return self._SetItemMinSize(item, args)
669 else:
670 return self._SetItemMinSize(item, args[0])
671 }
672
673 DocDeclAStrName(
7aada1e0 674 wxSizerItem* , Add( wxSizerItem *item ),
3ea6e0ec
RD
675 "AddItem(self, SizerItem item)",
676 "Adds a `wx.SizerItem` to the sizer.", "",
677 AddItem);
678
679 DocDeclAStrName(
7aada1e0 680 wxSizerItem* , Insert( size_t index, wxSizerItem *item ),
3ea6e0ec
RD
681 "InsertItem(self, int index, SizerItem item)",
682 "Inserts a `wx.SizerItem` to the sizer at the position given by *index*.", "",
683 InsertItem);
684
685 DocDeclAStrName(
7aada1e0 686 wxSizerItem* , Prepend( wxSizerItem *item ),
3ea6e0ec
RD
687 "PrependItem(self, SizerItem item)",
688 "Prepends a `wx.SizerItem` to the sizer.", "",
689 PrependItem);
690
d14a1e28
RD
691
692
693 %pythoncode {
3ea6e0ec 694 def AddMany(self, items):
dce2bd22
RD
695 """
696 AddMany is a convenience method for adding several items
697 to a sizer at one time. Simply pass it a list of tuples,
698 where each tuple consists of the parameters that you
699 would normally pass to the `Add` method.
700 """
3ea6e0ec
RD
701 for item in items:
702 if type(item) != type(()) or (len(item) == 2 and type(item[0]) == type(1)):
703 item = (item, )
704 self.Add(*item)
d14a1e28 705
d147c724 706 %# for backwards compatibility only, please do not use in new code
dce2bd22
RD
707 AddWindow = wx._deprecated(Add, "AddWindow is deprecated, use `Add` instead.")
708 AddSizer = wx._deprecated(Add, "AddSizer is deprecated, use `Add` instead.")
709 AddSpacer = wx._deprecated(Add, "AddSpacer is deprecated, use `Add` instead.")
710 PrependWindow = wx._deprecated(Prepend, "PrependWindow is deprecated, use `Prepend` instead.")
711 PrependSizer = wx._deprecated(Prepend, "PrependSizer is deprecated, use `Prepend` instead.")
712 PrependSpacer = wx._deprecated(Prepend, "PrependSpacer is deprecated, use `Prepend` instead.")
713 InsertWindow = wx._deprecated(Insert, "InsertWindow is deprecated, use `Insert` instead.")
714 InsertSizer = wx._deprecated(Insert, "InsertSizer is deprecated, use `Insert` instead.")
715 InsertSpacer = wx._deprecated(Insert, "InsertSpacer is deprecated, use `Insert` instead.")
716 RemoveWindow = wx._deprecated(Remove, "RemoveWindow is deprecated, use `Remove` instead.")
717 RemoveSizer = wx._deprecated(Remove, "RemoveSizer is deprecated, use `Remove` instead.")
718 RemovePos = wx._deprecated(Remove, "RemovePos is deprecated, use `Remove` instead.")
d14a1e28 719
d14a1e28
RD
720 }
721
722
3ea6e0ec
RD
723 DocDeclStr(
724 void , SetDimension( int x, int y, int width, int height ),
725 "Call this to force the sizer to take the given dimension and thus
726force the items owned by the sizer to resize themselves according to
727the rules defined by the parameter in the `Add`, `Insert` or `Prepend`
728methods.", "");
729
730 DocDeclStr(
731 void , SetMinSize( const wxSize &size ),
732 "Call this to give the sizer a minimal size. Normally, the sizer will
733calculate its minimal size based purely on how much space its children
734need. After calling this method `GetMinSize` will return either the
735minimal size as requested by its children or the minimal size set
736here, depending on which is bigger.", "");
737
d14a1e28 738
3ea6e0ec
RD
739 DocDeclStr(
740 wxSize , GetSize(),
741 "Returns the current size of the space managed by the sizer.", "");
742
743 DocDeclStr(
744 wxPoint , GetPosition(),
745 "Returns the current position of the sizer's managed space.", "");
746
747 DocDeclStr(
748 wxSize , GetMinSize(),
749 "Returns the minimal size of the sizer. This is either the combined
750minimal size of all the children and their borders or the minimal size
751set by SetMinSize, depending on which is bigger.", "");
752
d14a1e28
RD
753
754 %pythoncode {
755 def GetSizeTuple(self):
60a71c29 756 return self.GetSize().Get()
d14a1e28 757 def GetPositionTuple(self):
60a71c29 758 return self.GetPosition().Get()
d14a1e28 759 def GetMinSizeTuple(self):
60a71c29 760 return self.GetMinSize().Get()
d14a1e28
RD
761 }
762
3ea6e0ec
RD
763 DocDeclStr(
764 virtual void , RecalcSizes(),
765 "Using the sizes calculated by `CalcMin` reposition and resize all the
766items managed by this sizer. You should not need to call this directly as
767it is called by `Layout`.", "");
768
769 DocDeclStr(
770 virtual wxSize , CalcMin(),
771 "This method is where the sizer will do the actual calculation of its
772children's minimal sizes. You should not need to call this directly as
773it is called by `Layout`.", "");
774
775
776 DocDeclStr(
777 void , Layout(),
778 "This method will force the recalculation and layout of the items
779controlled by the sizer using the current space allocated to the
780sizer. Normally this is called automatically from the owning window's
781EVT_SIZE handler, but it is also useful to call it from user code when
782one of the items in a sizer change size, or items are added or
783removed.", "");
784
d14a1e28 785
3ea6e0ec
RD
786 DocDeclStr(
787 wxSize , Fit( wxWindow *window ),
788 "Tell the sizer to resize the *window* to match the sizer's minimal
789size. This is commonly done in the constructor of the window itself in
790order to set its initial size to match the needs of the children as
791determined by the sizer. Returns the new size.
d14a1e28 792
3ea6e0ec
RD
793For a top level window this is the total window size, not the client size.", "");
794
795 DocDeclStr(
796 void , FitInside( wxWindow *window ),
797 "Tell the sizer to resize the *virtual size* of the *window* to match the
798sizer's minimal size. This will not alter the on screen size of the
799window, but may cause the addition/removal/alteration of scrollbars
800required to view the virtual area in windows which manage it.
801
802:see: `wx.ScrolledWindow.SetScrollbars`, `SetVirtualSizeHints`
803", "");
804
d14a1e28 805
3ea6e0ec
RD
806 DocDeclStr(
807 void , SetSizeHints( wxWindow *window ),
808 "Tell the sizer to set (and `Fit`) the minimal size of the *window* to
809match the sizer's minimal size. This is commonly done in the
810constructor of the window itself if the window is resizable (as are
811many dialogs under Unix and frames on probably all platforms) in order
812to prevent the window from being sized smaller than the minimal size
813required by the sizer.", "");
814
815 DocDeclStr(
816 void , SetVirtualSizeHints( wxWindow *window ),
817 "Tell the sizer to set the minimal size of the window virtual area to
818match the sizer's minimal size. For windows with managed scrollbars
819this will set them appropriately.
820
821:see: `wx.ScrolledWindow.SetScrollbars`
822", "");
823
d14a1e28 824
3ea6e0ec 825 DocDeclStr(
a72f4631 826 void , Clear( bool deleteWindows=false ),
3ea6e0ec
RD
827 "Clear all items from the sizer, optionally destroying the window items
828as well.", "");
829
830 DocDeclStr(
831 void , DeleteWindows(),
832 "Destroy all windows managed by the sizer.", "");
833
d14a1e28
RD
834
835
836 // wxList& GetChildren();
837 %extend {
3ea6e0ec
RD
838 DocAStr(GetChildren,
839 "GetChildren(sefl) -> list",
840 "Returns a list of all the `wx.SizerItem` objects managed by the sizer.", "");
d14a1e28
RD
841 PyObject* GetChildren() {
842 wxSizerItemList& list = self->GetChildren();
843 return wxPy_ConvertList(&list);
844 }
845 }
846
847
3ea6e0ec 848 // Manage whether individual windows or subsizers are considered
d14a1e28
RD
849 // in the layout calculations or not.
850
851 %extend {
3ea6e0ec 852 DocAStr(Show,
a72f4631 853 "Show(self, item, bool show=True, bool recursive=false) -> bool",
3ea6e0ec
RD
854 "Shows or hides an item managed by the sizer. To make a sizer item
855disappear or reappear, use Show followed by `Layout`. The *item*
856parameter can be either a window, a sizer, or the zero-based index of
8f214674
RD
857the item. Use the recursive parameter to show or hide an item in a
858subsizer. Returns True if the item was found.", "");
a72f4631 859 bool Show(PyObject* item, bool show = true, bool recursive=false) {
019fd9d3 860 bool blocked = wxPyBeginBlockThreads();
a72f4631 861 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, true);
019fd9d3 862 wxPyEndBlockThreads(blocked);
d14a1e28 863 if ( info.window )
8f214674 864 return self->Show(info.window, show, recursive);
d14a1e28 865 else if ( info.sizer )
8f214674 866 return self->Show(info.sizer, show, recursive);
3ea6e0ec 867 else if ( info.gotPos )
8f214674 868 return self->Show(info.pos, show);
5f476690
RD
869 else
870 return false;
d14a1e28 871 }
3ea6e0ec
RD
872
873 DocAStr(IsShown,
874 "IsShown(self, item)",
875 "Determines if the item is currently shown. sizer. To make a sizer
876item disappear or reappear, use Show followed by `Layout`. The *item*
877parameter can be either a window, a sizer, or the zero-based index of
878the item.", "");
d14a1e28 879 bool IsShown(PyObject* item) {
019fd9d3 880 bool blocked = wxPyBeginBlockThreads();
a72f4631 881 wxPySizerItemInfo info = wxPySizerItemTypeHelper(item, false, false);
019fd9d3 882 wxPyEndBlockThreads(blocked);
d14a1e28
RD
883 if ( info.window )
884 return self->IsShown(info.window);
885 else if ( info.sizer )
886 return self->IsShown(info.sizer);
3ea6e0ec
RD
887 else if ( info.gotPos )
888 return self->IsShown(info.pos);
d14a1e28 889 else
a72f4631 890 return false;
d14a1e28
RD
891 }
892 }
893
3ea6e0ec 894 %pythoncode {
41b78a7a 895 def Hide(self, item, recursive=False):
3ea6e0ec 896 """
8f214674 897 A convenience method for Show(item, False, recursive).
3ea6e0ec 898 """
9dcf02b4 899 return self.Show(item, False, recursive)
3ea6e0ec 900 }
d14a1e28 901
3ea6e0ec
RD
902
903 DocDeclStr(
904 void , ShowItems(bool show),
e2837d11 905 "Recursively call `wx.SizerItem.Show` on all sizer items.", "");
3ea6e0ec 906
d14a1e28
RD
907};
908
909
910//---------------------------------------------------------------------------
911// Use this one for deriving Python classes from
912%{
913// See pyclasses.h
914IMP_PYCALLBACK___pure(wxPySizer, wxSizer, RecalcSizes);
915IMP_PYCALLBACK_wxSize__pure(wxPySizer, wxSizer, CalcMin);
916IMPLEMENT_DYNAMIC_CLASS(wxPySizer, wxSizer);
917%}
918
919
3ea6e0ec
RD
920DocStr(wxPySizer,
921"wx.PySizer is a special version of `wx.Sizer` that has been
922instrumented to allow the C++ virtual methods to be overloaded in
923Python derived classes. You would derive from this class if you are
924wanting to implement a custom sizer in Python code. Simply implement
925`CalcMin` and `RecalcSizes` in the derived class and you're all set.
926For example::
927
928 class MySizer(wx.PySizer):
929 def __init__(self):
930 wx.PySizer.__init__(self)
931
932 def CalcMin(self):
933 for item in self.GetChildren():
934 # calculate the total minimum width and height needed
935 # by all items in the sizer according to this sizer's
936 # layout algorithm.
937 ...
938 return wx.Size(width, height)
939
940 def RecalcSizes(self):
941 # find the space allotted to this sizer
942 pos = self.GetPosition()
943 size = self.GetSize()
944 for item in self.GetChildren():
945 # Recalculate (if necessary) the position and size of
946 # each item and then call item.SetDimension to do the
947 # actual positioning and sizing of the items within the
948 # space alloted to this sizer.
949 ...
950 item.SetDimension(itemPos, itemSize)
951
952
953When `Layout` is called it first calls `CalcMin` followed by
954`RecalcSizes` so you can optimize a bit by saving the results of
955`CalcMin` and resuing them in `RecalcSizes`.
956
957:see: `wx.SizerItem`, `wx.Sizer.GetChildren`
958
959", "");
d14a1e28
RD
960class wxPySizer : public wxSizer {
961public:
2b9048c5 962 %pythonAppend wxPySizer "self._setCallbackInfo(self, PySizer);self._setOORInfo(self)"
d14a1e28 963
3ea6e0ec
RD
964 DocCtorStr(
965 wxPySizer(),
966 "Creates a wx.PySizer. Must be called from the __init__ in the derived
967class.", "");
968
d14a1e28
RD
969 void _setCallbackInfo(PyObject* self, PyObject* _class);
970};
971
972
973//---------------------------------------------------------------------------
974%newgroup;
975
3ea6e0ec
RD
976
977DocStr(wxBoxSizer,
978"The basic idea behind a box sizer is that windows will most often be
979laid out in rather simple basic geometry, typically in a row or a
980column or nested hierarchies of either. A wx.BoxSizer will lay out
981its items in a simple row or column, depending on the orientation
982parameter passed to the constructor.", "
983
984It is the unique feature of a box sizer, that it can grow in both
985directions (height and width) but can distribute its growth in the
986main direction (horizontal for a row) *unevenly* among its children.
987This is determined by the proportion parameter give to items when they
988are added to the sizer. It is interpreted as a weight factor, i.e. it
989can be zero, indicating that the window may not be resized at all, or
990above zero. If several windows have a value above zero, the value is
991interpreted relative to the sum of all weight factors of the sizer, so
992when adding two windows with a value of 1, they will both get resized
993equally and each will receive half of the available space after the
994fixed size items have been sized. If the items have unequal
995proportion settings then they will receive a coresondingly unequal
996allotment of the free space.
997
998:see: `wx.StaticBoxSizer`
999");
1000
d14a1e28
RD
1001class wxBoxSizer : public wxSizer {
1002public:
2b9048c5 1003 %pythonAppend wxBoxSizer "self._setOORInfo(self)"
d14a1e28 1004
3ea6e0ec
RD
1005 DocCtorStr(
1006 wxBoxSizer(int orient = wxHORIZONTAL),
1007 "Constructor for a wx.BoxSizer. *orient* may be one of ``wx.VERTICAL``
1008or ``wx.HORIZONTAL`` for creating either a column sizer or a row
1009sizer.", "");
d14a1e28 1010
3ea6e0ec
RD
1011
1012 DocDeclStr(
1013 int , GetOrientation(),
1014 "Returns the current orientation of the sizer.", "");
1015
1016 DocDeclStr(
1017 void , SetOrientation(int orient),
1018 "Resets the orientation of the sizer.", "");
1019
d14a1e28
RD
1020};
1021
1022//---------------------------------------------------------------------------
1023%newgroup;
1024
3ea6e0ec
RD
1025
1026DocStr(wxStaticBoxSizer,
1027"wx.StaticBoxSizer derives from and functions identically to the
1028`wx.BoxSizer` and adds a `wx.StaticBox` around the items that the sizer
1029manages. Note that this static box must be created separately and
1030passed to the sizer constructor.", "");
1031
d14a1e28
RD
1032class wxStaticBoxSizer : public wxBoxSizer {
1033public:
2b9048c5 1034 %pythonAppend wxStaticBoxSizer "self._setOORInfo(self)"
d14a1e28 1035
3ea6e0ec
RD
1036 DocCtorStr(
1037 wxStaticBoxSizer(wxStaticBox *box, int orient = wxHORIZONTAL),
1038 "Constructor. It takes an associated static box and the orientation
1039*orient* as parameters - orient can be either of ``wx.VERTICAL`` or
1040``wx.HORIZONTAL``.", "");
d14a1e28 1041
3ea6e0ec
RD
1042 DocDeclStr(
1043 wxStaticBox *, GetStaticBox(),
1044 "Returns the static box associated with this sizer.", "");
1045
d14a1e28
RD
1046};
1047
1048//---------------------------------------------------------------------------
1049%newgroup;
1050
3ea6e0ec
RD
1051
1052DocStr(wxGridSizer,
1053"A grid sizer is a sizer which lays out its children in a
1054two-dimensional table with all cells having the same size. In other
1055words, the width of each cell within the grid is the width of the
1056widest item added to the sizer and the height of each grid cell is the
1057height of the tallest item. An optional vertical and/or horizontal
1058gap between items can also be specified (in pixels.)
1059
1060Items are placed in the cells of the grid in the order they are added,
1061in row-major order. In other words, the first row is filled first,
1062then the second, and so on until all items have been added. (If
1063neccessary, additional rows will be added as items are added.) If you
1064need to have greater control over the cells that items are placed in
1065then use the `wx.GridBagSizer`.
1066", "");
1067
d14a1e28
RD
1068class wxGridSizer: public wxSizer
1069{
1070public:
2b9048c5 1071 %pythonAppend wxGridSizer "self._setOORInfo(self)"
d14a1e28 1072
3ea6e0ec
RD
1073 DocCtorStr(
1074 wxGridSizer( int rows=1, int cols=0, int vgap=0, int hgap=0 ),
1075 "Constructor for a wx.GridSizer. *rows* and *cols* determine the number
1076of columns and rows in the sizer - if either of the parameters is
1077zero, it will be calculated to from the total number of children in
1078the sizer, thus making the sizer grow dynamically. *vgap* and *hgap*
1079define extra space between all children.", "");
1080
1081 DocDeclStr(
1082 void , SetCols( int cols ),
1083 "Sets the number of columns in the sizer.", "");
1084
1085 DocDeclStr(
1086 void , SetRows( int rows ),
1087 "Sets the number of rows in the sizer.", "");
1088
1089 DocDeclStr(
1090 void , SetVGap( int gap ),
1091 "Sets the vertical gap (in pixels) between the cells in the sizer.", "");
1092
1093 DocDeclStr(
1094 void , SetHGap( int gap ),
1095 "Sets the horizontal gap (in pixels) between cells in the sizer", "");
1096
1097 DocDeclStr(
1098 int , GetCols(),
1099 "Returns the number of columns in the sizer.", "");
1100
1101 DocDeclStr(
1102 int , GetRows(),
1103 "Returns the number of rows in the sizer.", "");
1104
1105 DocDeclStr(
1106 int , GetVGap(),
1107 "Returns the vertical gap (in pixels) between the cells in the sizer.", "");
1108
1109 DocDeclStr(
1110 int , GetHGap(),
1111 "Returns the horizontal gap (in pixels) between cells in the sizer.", "");
1112
d14a1e28
RD
1113};
1114
1115//---------------------------------------------------------------------------
1116%newgroup;
1117
1118enum wxFlexSizerGrowMode
1119{
1120 // don't resize the cells in non-flexible direction at all
1121 wxFLEX_GROWMODE_NONE,
1122
1123 // uniformly resize only the specified ones (default)
1124 wxFLEX_GROWMODE_SPECIFIED,
1125
1126 // uniformly resize all cells
1127 wxFLEX_GROWMODE_ALL
1128};
1129
1130
3ea6e0ec
RD
1131
1132
1133
1134DocStr(wxFlexGridSizer,
1135"A flex grid sizer is a sizer which lays out its children in a
1136two-dimensional table with all table cells in one row having the same
1137height and all cells in one column having the same width, but all
1138rows or all columns are not necessarily the same height or width as in
1139the `wx.GridSizer`.
1140
1141wx.FlexGridSizer can also size items equally in one direction but
1142unequally (\"flexibly\") in the other. If the sizer is only flexible
1143in one direction (this can be changed using `SetFlexibleDirection`), it
1144needs to be decided how the sizer should grow in the other (\"non
1145flexible\") direction in order to fill the available space. The
1146`SetNonFlexibleGrowMode` method serves this purpose.
1147
1148", "");
1149
d14a1e28
RD
1150class wxFlexGridSizer: public wxGridSizer
1151{
1152public:
2b9048c5 1153 %pythonAppend wxFlexGridSizer "self._setOORInfo(self)"
d14a1e28 1154
3ea6e0ec
RD
1155 DocCtorStr(
1156 wxFlexGridSizer( int rows=1, int cols=0, int vgap=0, int hgap=0 ),
1157 "Constructor for a wx.FlexGridSizer. *rows* and *cols* determine the
1158number of columns and rows in the sizer - if either of the parameters
1159is zero, it will be calculated to from the total number of children in
1160the sizer, thus making the sizer grow dynamically. *vgap* and *hgap*
1161define extra space between all children.", "");
1162
1163
1164 DocDeclStr(
1165 void , AddGrowableRow( size_t idx, int proportion = 0 ),
1166 "Specifies that row *idx* (starting from zero) should be grown if there
1167is extra space available to the sizer.
1168
1169The *proportion* parameter has the same meaning as the stretch factor
1170for the box sizers except that if all proportions are 0, then all
1171columns are resized equally (instead of not being resized at all).", "");
d14a1e28 1172
3ea6e0ec
RD
1173 DocDeclStr(
1174 void , RemoveGrowableRow( size_t idx ),
1175 "Specifies that row *idx* is no longer growable.", "");
1176
1177 DocDeclStr(
1178 void , AddGrowableCol( size_t idx, int proportion = 0 ),
1179 "Specifies that column *idx* (starting from zero) should be grown if
1180there is extra space available to the sizer.
1181
1182The *proportion* parameter has the same meaning as the stretch factor
1183for the box sizers except that if all proportions are 0, then all
1184columns are resized equally (instead of not being resized at all).", "");
1185
1186 DocDeclStr(
1187 void , RemoveGrowableCol( size_t idx ),
1188 "Specifies that column *idx* is no longer growable.", "");
1189
1190
1191 DocDeclStr(
1192 void , SetFlexibleDirection(int direction),
1193 "Specifies whether the sizer should flexibly resize its columns, rows,
1194or both. Argument *direction* can be one of the following values. Any
1195other value is ignored.
1196
1197 ============== =======================================
1198 wx.VERTICAL Rows are flexibly sized.
1199 wx.HORIZONTAL Columns are flexibly sized.
1200 wx.BOTH Both rows and columns are flexibly sized
1201 (this is the default value).
1202 ============== =======================================
1203
1204Note that this method does not trigger relayout.
1205", "");
1206
1207 DocDeclStr(
1208 int , GetFlexibleDirection(),
1209 "Returns a value that specifies whether the sizer
1210flexibly resizes its columns, rows, or both (default).
d14a1e28 1211
3ea6e0ec 1212:see: `SetFlexibleDirection`", "");
d14a1e28 1213
3ea6e0ec 1214
d14a1e28 1215
3ea6e0ec
RD
1216 DocDeclStr(
1217 void , SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode),
1218 "Specifies how the sizer should grow in the non-flexible direction if
1219there is one (so `SetFlexibleDirection` must have been called
1220previously). Argument *mode* can be one of the following values:
1221
1222 ========================== =================================================
1223 wx.FLEX_GROWMODE_NONE Sizer doesn't grow in the non flexible direction.
1224 wx.FLEX_GROWMODE_SPECIFIED Sizer honors growable columns/rows set with
1225 `AddGrowableCol` and `AddGrowableRow`. In this
1226 case equal sizing applies to minimum sizes of
1227 columns or rows (this is the default value).
1228 wx.FLEX_GROWMODE_ALL Sizer equally stretches all columns or rows in
1229 the non flexible direction, whether they are
1230 growable or not in the flexbile direction.
1231 ========================== =================================================
1232
1233Note that this method does not trigger relayout.
1234
1235", "");
1236
1237 DocDeclStr(
1238 wxFlexSizerGrowMode , GetNonFlexibleGrowMode(),
1239 "Returns the value that specifies how the sizer grows in the
1240non-flexible direction if there is one.
d14a1e28 1241
3ea6e0ec
RD
1242:see: `SetNonFlexibleGrowMode`", "");
1243
dd9f7fea
RD
1244
1245 // Read-only access to the row heights and col widths arrays
3ea6e0ec
RD
1246 DocDeclAStr(
1247 const wxArrayInt& , GetRowHeights() const,
1248 "GetRowHeights(self) -> list",
1249 "Returns a list of integers representing the heights of each of the
1250rows in the sizer.", "");
1251
1252 DocDeclAStr(
1253 const wxArrayInt& , GetColWidths() const,
1254 "GetColWidths(self) -> list",
1255 "Returns a list of integers representing the widths of each of the
1256columns in the sizer.", "");
1257
d14a1e28
RD
1258};
1259
1260//---------------------------------------------------------------------------