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