]> git.saurik.com Git - wxWidgets.git/blob - interface/wx/sizer.h
document that under wxMSW slant == italic
[wxWidgets.git] / interface / wx / sizer.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: sizer.h
3 // Purpose: interface of wxStdDialogButtonSizer
4 // Author: wxWidgets team
5 // RCS-ID: $Id$
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
8
9
10 /**
11 @class wxSizer
12
13 wxSizer is the abstract base class used for laying out subwindows in a window.
14 You cannot use wxSizer directly; instead, you will have to use one of the sizer
15 classes derived from it. Currently there are wxBoxSizer, wxStaticBoxSizer,
16 wxGridSizer, wxFlexGridSizer, wxWrapSizer and wxGridBagSizer.
17
18 The layout algorithm used by sizers in wxWidgets is closely related to layout
19 in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit.
20 It is based upon the idea of the individual subwindows reporting their minimal
21 required size and their ability to get stretched if the size of the parent window
22 has changed.
23
24 This will most often mean that the programmer does not set the original size of
25 a dialog in the beginning, rather the dialog will be assigned a sizer and this
26 sizer will be queried about the recommended size. The sizer in turn will query
27 its children, which can be normal windows, empty space or other sizers, so that
28 a hierarchy of sizers can be constructed. Note that wxSizer does not derive
29 from wxWindow and thus does not interfere with tab ordering and requires very little
30 resources compared to a real window on screen.
31
32 What makes sizers so well fitted for use in wxWidgets is the fact that every
33 control reports its own minimal size and the algorithm can handle differences in
34 font sizes or different window (dialog item) sizes on different platforms without
35 problems. If e.g. the standard font as well as the overall design of Motif widgets
36 requires more space than on Windows, the initial dialog size will automatically
37 be bigger on Motif than on Windows.
38
39 Sizers may also be used to control the layout of custom drawn items on the
40 window. The wxSizer::Add(), wxSizer::Insert(), and wxSizer::Prepend() functions
41 return a pointer to the newly added wxSizerItem.
42 Just add empty space of the desired size and attributes, and then use the
43 wxSizerItem::GetRect() method to determine where the drawing operations
44 should take place.
45
46 Please notice that sizers, like child windows, are owned by the library and
47 will be deleted by it which implies that they must be allocated on the heap.
48 However if you create a sizer and do not add it to another sizer or
49 window, the library wouldn't be able to delete such an orphan sizer and in
50 this, and only this, case it should be deleted explicitly.
51
52 @beginWxPythonOnly
53 If you wish to create a sizer class in wxPython you should
54 derive the class from @c wxPySizer in order to get Python-aware
55 capabilities for the various virtual methods.
56 @endWxPythonOnly
57
58 @section wxsizer_flags wxSizer flags
59
60 The "flag" argument accepted by wxSizeItem constructors and other
61 functions, e.g. wxSizer::Add(), is OR-combination of the following flags.
62 Two main behaviours are defined using these flags. One is the border around
63 a window: the border parameter determines the border width whereas the
64 flags given here determine which side(s) of the item that the border will
65 be added. The other flags determine how the sizer item behaves when the
66 space allotted to the sizer changes, and is somewhat dependent on the
67 specific kind of sizer used.
68
69 @beginDefList
70 @itemdef{wxTOP<br>
71 wxBOTTOM<br>
72 wxLEFT<br>
73 wxRIGHT<br>
74 wxALL,
75 These flags are used to specify which side(s) of the sizer item
76 the border width will apply to.}
77 @itemdef{wxEXPAND,
78 The item will be expanded to fill the space assigned to the item.}
79 @itemdef{wxSHAPED,
80 The item will be expanded as much as possible while also
81 maintaining its aspect ratio.}
82 @itemdef{wxFIXED_MINSIZE,
83 Normally wxSizers will use GetAdjustedBestSize() to determine what
84 the minimal size of window items should be, and will use that size
85 to calculate the layout. This allows layouts to adjust when an
86 item changes and its best size becomes different. If you would
87 rather have a window item stay the size it started with then use
88 @c wxFIXED_MINSIZE.}
89 @itemdef{wxRESERVE_SPACE_EVEN_IF_HIDDEN,
90 Normally wxSizers don't allocate space for hidden windows or other
91 items. This flag overrides this behavior so that sufficient space
92 is allocated for the window even if it isn't visible. This makes
93 it possible to dynamically show and hide controls without resizing
94 parent dialog, for example. (Available since 2.8.8.)}
95 @itemdef{wxALIGN_CENTER<br>
96 wxALIGN_CENTRE<br>
97 wxALIGN_LEFT<br>
98 wxALIGN_RIGHT<br>
99 wxALIGN_TOP<br>
100 wxALIGN_BOTTOM<br>
101 wxALIGN_CENTER_VERTICAL<br>
102 wxALIGN_CENTRE_VERTICAL<br>
103 wxALIGN_CENTER_HORIZONTAL<br>
104 wxALIGN_CENTRE_HORIZONTAL,
105 The @c wxALIGN_* flags allow you to specify the alignment of the item
106 within the space allotted to it by the sizer, adjusted for the
107 border if any.}
108 @endDefList
109
110 @library{wxcore}
111 @category{winlayout}
112
113 @see @ref overview_sizer
114 */
115 class wxSizer : public wxObject
116 {
117 public:
118 /**
119 The constructor.
120 Note that wxSizer is an abstract base class and may not be instantiated.
121 */
122 wxSizer();
123
124 /**
125 The destructor.
126 */
127 virtual ~wxSizer();
128
129 /**
130 Appends a child to the sizer.
131
132 wxSizer itself is an abstract class, but the parameters are equivalent
133 in the derived classes that you will instantiate to use it so they are
134 described here:
135
136 @param window
137 The window to be added to the sizer. Its initial size (either set
138 explicitly by the user or calculated internally when using
139 wxDefaultSize) is interpreted as the minimal and in many cases also
140 the initial size.
141 @param flags
142 A wxSizerFlags object that enables you to specify most of the above
143 parameters more conveniently.
144 */
145 wxSizerItem* Add(wxWindow* window, const wxSizerFlags& flags);
146
147 /**
148 Appends a child to the sizer.
149
150 wxSizer itself is an abstract class, but the parameters are equivalent
151 in the derived classes that you will instantiate to use it so they are
152 described here:
153
154 @param window
155 The window to be added to the sizer. Its initial size (either set
156 explicitly by the user or calculated internally when using
157 wxDefaultSize) is interpreted as the minimal and in many cases also
158 the initial size.
159 @param proportion
160 Although the meaning of this parameter is undefined in wxSizer, it
161 is used in wxBoxSizer to indicate if a child of a sizer can change
162 its size in the main orientation of the wxBoxSizer - where 0 stands
163 for not changeable and a value of more than zero is interpreted
164 relative to the value of other children of the same wxBoxSizer. For
165 example, you might have a horizontal wxBoxSizer with three
166 children, two of which are supposed to change their size with the
167 sizer. Then the two stretchable windows would get a value of 1 each
168 to make them grow and shrink equally with the sizer's horizontal
169 dimension.
170 @param flag
171 OR-combination of flags affecting sizer's behavior. See
172 @ref wxsizer_flags "wxSizer flags list" for details.
173 @param border
174 Determines the border width, if the flag parameter is set to
175 include any border flag.
176 @param userData
177 Allows an extra object to be attached to the sizer item, for use in
178 derived classes when sizing information is more complex than the
179 proportion and flag will allow for.
180 */
181 wxSizerItem* Add(wxWindow* window,
182 int proportion = 0,
183 int flag = 0,
184 int border = 0,
185 wxObject* userData = NULL);
186
187 /**
188 Appends a child to the sizer.
189
190 wxSizer itself is an abstract class, but the parameters are equivalent
191 in the derived classes that you will instantiate to use it so they are
192 described here:
193
194 @param sizer
195 The (child-)sizer to be added to the sizer. This allows placing a
196 child sizer in a sizer and thus to create hierarchies of sizers
197 (typically a vertical box as the top sizer and several horizontal
198 boxes on the level beneath).
199 @param flags
200 A wxSizerFlags object that enables you to specify most of the above
201 parameters more conveniently.
202 */
203 wxSizerItem* Add(wxSizer* sizer, const wxSizerFlags& flags);
204
205 /**
206 Appends a child to the sizer.
207
208 wxSizer itself is an abstract class, but the parameters are equivalent
209 in the derived classes that you will instantiate to use it so they are
210 described here:
211
212 @param sizer
213 The (child-)sizer to be added to the sizer. This allows placing a
214 child sizer in a sizer and thus to create hierarchies of sizers
215 (typically a vertical box as the top sizer and several horizontal
216 boxes on the level beneath).
217 @param proportion
218 Although the meaning of this parameter is undefined in wxSizer, it
219 is used in wxBoxSizer to indicate if a child of a sizer can change
220 its size in the main orientation of the wxBoxSizer - where 0 stands
221 for not changeable and a value of more than zero is interpreted
222 relative to the value of other children of the same wxBoxSizer. For
223 example, you might have a horizontal wxBoxSizer with three
224 children, two of which are supposed to change their size with the
225 sizer. Then the two stretchable windows would get a value of 1 each
226 to make them grow and shrink equally with the sizer's horizontal
227 dimension.
228 @param flag
229 OR-combination of flags affecting sizer's behavior. See
230 @ref wxsizer_flags "wxSizer flags list" for details.
231 @param border
232 Determines the border width, if the flag parameter is set to
233 include any border flag.
234 @param userData
235 Allows an extra object to be attached to the sizer item, for use in
236 derived classes when sizing information is more complex than the
237 proportion and flag will allow for.
238 */
239 wxSizerItem* Add(wxSizer* sizer,
240 int proportion = 0,
241 int flag = 0,
242 int border = 0,
243 wxObject* userData = NULL);
244
245 /**
246 Appends a spacer child to the sizer.
247
248 wxSizer itself is an abstract class, but the parameters are equivalent
249 in the derived classes that you will instantiate to use it so they are
250 described here.
251
252 @a width and @a height specify the dimension of a spacer to be added to
253 the sizer. Adding spacers to sizers gives more flexibility in the
254 design of dialogs; imagine for example a horizontal box with two
255 buttons at the bottom of a dialog: you might want to insert a space
256 between the two buttons and make that space stretchable using the
257 proportion flag and the result will be that the left button will be
258 aligned with the left side of the dialog and the right button with the
259 right side - the space in between will shrink and grow with the dialog.
260
261 @param width
262 Width of the spacer.
263 @param height
264 Height of the spacer.
265 @param proportion
266 Although the meaning of this parameter is undefined in wxSizer, it
267 is used in wxBoxSizer to indicate if a child of a sizer can change
268 its size in the main orientation of the wxBoxSizer - where 0 stands
269 for not changeable and a value of more than zero is interpreted
270 relative to the value of other children of the same wxBoxSizer. For
271 example, you might have a horizontal wxBoxSizer with three
272 children, two of which are supposed to change their size with the
273 sizer. Then the two stretchable windows would get a value of 1 each
274 to make them grow and shrink equally with the sizer's horizontal
275 dimension.
276 @param flag
277 OR-combination of flags affecting sizer's behavior. See
278 @ref wxsizer_flags "wxSizer flags list" for details.
279 @param border
280 Determines the border width, if the flag parameter is set to
281 include any border flag.
282 @param userData
283 Allows an extra object to be attached to the sizer item, for use in
284 derived classes when sizing information is more complex than the
285 proportion and flag will allow for.
286 */
287 wxSizerItem* Add(int width, int height,
288 int proportion = 0,
289 int flag = 0,
290 int border = 0,
291 wxObject* userData = NULL);
292
293 /**
294 Adds non-stretchable space to the sizer.
295 More readable way of calling:
296 @code
297 wxSizer::Add(size, size, 0).
298 @endcode
299 */
300 wxSizerItem* AddSpacer(int size);
301
302 /**
303 Adds stretchable space to the sizer.
304 More readable way of calling:
305 @code
306 wxSizer::Add(0, 0, prop).
307 @endcode
308 */
309 wxSizerItem* AddStretchSpacer(int prop = 1);
310
311 /**
312 This method is abstract and has to be overwritten by any derived class.
313 Here, the sizer will do the actual calculation of its children's minimal sizes.
314 */
315 virtual wxSize CalcMin() = 0;
316
317 /**
318 Detaches all children from the sizer.
319 If @a delete_windows is @true then child windows will also be deleted.
320 */
321 virtual void Clear(bool delete_windows = false);
322
323 /**
324 Computes client area size for @a window so that it matches the sizer's
325 minimal size. Unlike GetMinSize(), this method accounts for other
326 constraints imposed on @e window, namely display's size (returned size
327 will never be too large for the display) and maximum window size if
328 previously set by wxWindow::SetMaxSize().
329
330 The returned value is suitable for passing to wxWindow::SetClientSize() or
331 wxWindow::SetMinClientSize().
332
333 @since 2.8.8
334
335 @see ComputeFittingWindowSize(), Fit()
336 */
337 wxSize ComputeFittingClientSize(wxWindow* window);
338
339 /**
340 Like ComputeFittingClientSize(), but converts the result into window
341 size. The returned value is suitable for passing to wxWindow::SetSize()
342 or wxWindow::SetMinSize().
343
344 @since 2.8.8
345
346 @see ComputeFittingClientSize(), Fit()
347 */
348 wxSize ComputeFittingWindowSize(wxWindow* window);
349
350 /**
351 Detach the child @a window from the sizer without destroying it.
352
353 This method does not cause any layout or resizing to take place, call Layout()
354 to update the layout "on screen" after detaching a child from the sizer.
355
356 Returns @true if the child item was found and detached, @false otherwise.
357
358 @see Remove()
359 */
360 virtual bool Detach(wxWindow* window);
361
362 /**
363 Detach the child @a sizer from the sizer without destroying it.
364
365 This method does not cause any layout or resizing to take place, call Layout()
366 to update the layout "on screen" after detaching a child from the sizer.
367
368 Returns @true if the child item was found and detached, @false otherwise.
369
370 @see Remove()
371 */
372 virtual bool Detach(wxSizer* sizer);
373
374 /**
375 Detach a item at position @a index from the sizer without destroying it.
376
377 This method does not cause any layout or resizing to take place, call Layout()
378 to update the layout "on screen" after detaching a child from the sizer.
379 Returns @true if the child item was found and detached, @false otherwise.
380
381 @see Remove()
382 */
383 virtual bool Detach(int index);
384
385 /**
386 Tell the sizer to resize the @a window so that its client area matches the
387 sizer's minimal size (ComputeFittingClientSize() is called to determine it).
388 This is commonly done in the constructor of the window itself, see sample
389 in the description of wxBoxSizer.
390
391 @return The new window size.
392
393 @see ComputeFittingClientSize(), ComputeFittingWindowSize()
394 */
395 wxSize Fit(wxWindow* window);
396
397 /**
398 Tell the sizer to resize the virtual size of the @a window to match the sizer's
399 minimal size. This will not alter the on screen size of the window, but may
400 cause the addition/removal/alteration of scrollbars required to view the virtual
401 area in windows which manage it.
402
403 @see wxScrolled::SetScrollbars(), SetVirtualSizeHints()
404 */
405 void FitInside(wxWindow* window);
406
407 //@{
408 /**
409 Returns the list of the items in this sizer.
410
411 The elements of type-safe wxList @c wxSizerItemList are pointers to
412 objects of type wxSizerItem.
413 */
414 wxSizerItemList& GetChildren();
415 const wxSizerItemList& GetChildren() const;
416 //@}
417
418 /**
419 Returns the window this sizer is used in or @NULL if none.
420 */
421 wxWindow* GetContainingWindow() const;
422
423 /**
424 Returns the number of items in the sizer.
425
426 If you just need to test whether the sizer is empty or not you can also
427 use IsEmpty() function.
428 */
429 size_t GetItemCount() const;
430
431 /**
432 Finds wxSizerItem which holds the given @a window.
433 Use parameter @a recursive to search in subsizers too.
434 Returns pointer to item or @NULL.
435 */
436 wxSizerItem* GetItem(wxWindow* window, bool recursive = false);
437
438 /**
439 Finds wxSizerItem which holds the given @a sizer.
440 Use parameter @a recursive to search in subsizers too.
441 Returns pointer to item or @NULL.
442 */
443
444 wxSizerItem* GetItem(wxSizer* sizer, bool recursive = false);
445
446 /**
447 Finds wxSizerItem which is located in the sizer at position @a index.
448 Use parameter @a recursive to search in subsizers too.
449 Returns pointer to item or @NULL.
450 */
451 wxSizerItem* GetItem(size_t index);
452
453 /**
454 Finds item of the sizer which has the given @e id.
455 This @a id is not the window id but the id of the wxSizerItem itself.
456 This is mainly useful for retrieving the sizers created from XRC resources.
457 Use parameter @a recursive to search in subsizers too.
458 Returns pointer to item or @NULL.
459 */
460 wxSizerItem* GetItemById(int id, bool recursive = false);
461
462 /**
463 Returns the minimal size of the sizer.
464
465 This is either the combined minimal size of all the children and their
466 borders or the minimal size set by SetMinSize(), depending on which is bigger.
467 Note that the returned value is client size, not window size.
468 In particular, if you use the value to set toplevel window's minimal or
469 actual size, use wxWindow::SetMinClientSize() or wxWindow::SetClientSize(),
470 not wxWindow::SetMinSize() or wxWindow::SetSize().
471 */
472 wxSize GetMinSize();
473
474 /**
475 Returns the current position of the sizer.
476 */
477 wxPoint GetPosition() const;
478
479 /**
480 Returns the current size of the sizer.
481 */
482 wxSize GetSize() const;
483
484 /**
485 Hides the child @a window.
486
487 To make a sizer item disappear, use Hide() followed by Layout().
488
489 Use parameter @a recursive to hide elements found in subsizers.
490 Returns @true if the child item was found, @false otherwise.
491
492 @see IsShown(), Show()
493 */
494 bool Hide(wxWindow* window, bool recursive = false);
495
496 /**
497 Hides the child @a sizer.
498
499 To make a sizer item disappear, use Hide() followed by Layout().
500
501 Use parameter @a recursive to hide elements found in subsizers.
502 Returns @true if the child item was found, @false otherwise.
503
504 @see IsShown(), Show()
505 */
506 bool Hide(wxSizer* sizer, bool recursive = false);
507
508 /**
509 Hides the item at position @a index.
510
511 To make a sizer item disappear, use Hide() followed by Layout().
512
513 Use parameter @a recursive to hide elements found in subsizers.
514 Returns @true if the child item was found, @false otherwise.
515
516 @see IsShown(), Show()
517 */
518 bool Hide(size_t index);
519
520 /**
521 Insert a child into the sizer before any existing item at @a index.
522
523 See Add() for the meaning of the other parameters.
524 */
525 wxSizerItem* Insert(size_t index, wxWindow* window,
526 const wxSizerFlags& flags);
527
528 /**
529 Insert a child into the sizer before any existing item at @a index.
530
531 See Add() for the meaning of the other parameters.
532 */
533 wxSizerItem* Insert(size_t index, wxWindow* window,
534 int proportion = 0,
535 int flag = 0,
536 int border = 0,
537 wxObject* userData = NULL);
538
539 /**
540 Insert a child into the sizer before any existing item at @a index.
541
542 See Add() for the meaning of the other parameters.
543 */
544 wxSizerItem* Insert(size_t index, wxSizer* sizer,
545 const wxSizerFlags& flags);
546
547 /**
548 Insert a child into the sizer before any existing item at @a index.
549
550 See Add() for the meaning of the other parameters.
551 */
552 wxSizerItem* Insert(size_t index, wxSizer* sizer,
553 int proportion = 0,
554 int flag = 0,
555 int border = 0,
556 wxObject* userData = NULL);
557
558 /**
559 Insert a child into the sizer before any existing item at @a index.
560
561 See Add() for the meaning of the other parameters.
562 */
563 wxSizerItem* Insert(size_t index, int width, int height,
564 int proportion = 0,
565 int flag = 0,
566 int border = 0,
567 wxObject* userData = NULL);
568
569 /**
570 Inserts non-stretchable space to the sizer.
571 More readable way of calling wxSizer::Insert(size, size, 0).
572 */
573 wxSizerItem* InsertSpacer(size_t index, int size);
574
575 /**
576 Inserts stretchable space to the sizer.
577 More readable way of calling wxSizer::Insert(0, 0, prop).
578 */
579 wxSizerItem* InsertStretchSpacer(size_t index, int prop = 1);
580
581 /**
582 Return @true if the sizer has no elements.
583
584 @see GetItemCount()
585 */
586 bool IsEmpty() const;
587
588 /**
589 Returns @true if the @a window is shown.
590
591 @see Hide(), Show(), wxSizerItem::IsShown()
592 */
593 bool IsShown(wxWindow* window) const;
594
595 /**
596 Returns @true if the @a sizer is shown.
597
598 @see Hide(), Show(), wxSizerItem::IsShown()
599 */
600 bool IsShown(wxSizer* sizer) const;
601
602 /**
603 Returns @true if the item at @a index is shown.
604
605 @see Hide(), Show(), wxSizerItem::IsShown()
606 */
607 bool IsShown(size_t index) const;
608
609 /**
610 Call this to force layout of the children anew, e.g. after having added a child
611 to or removed a child (window, other sizer or space) from the sizer while
612 keeping the current dimension.
613 */
614 virtual void Layout();
615
616 /**
617 Same as Add(), but prepends the items to the beginning of the
618 list of items (windows, subsizers or spaces) owned by this sizer.
619 */
620 wxSizerItem* Prepend(wxWindow* window, const wxSizerFlags& flags);
621
622 /**
623 Same as Add(), but prepends the items to the beginning of the
624 list of items (windows, subsizers or spaces) owned by this sizer.
625 */
626 wxSizerItem* Prepend(wxWindow* window, int proportion = 0,
627 int flag = 0,
628 int border = 0,
629 wxObject* userData = NULL);
630
631 /**
632 Same as Add(), but prepends the items to the beginning of the
633 list of items (windows, subsizers or spaces) owned by this sizer.
634 */
635 wxSizerItem* Prepend(wxSizer* sizer,
636 const wxSizerFlags& flags);
637
638 /**
639 Same as Add(), but prepends the items to the beginning of the
640 list of items (windows, subsizers or spaces) owned by this sizer.
641 */
642 wxSizerItem* Prepend(wxSizer* sizer, int proportion = 0,
643 int flag = 0,
644 int border = 0,
645 wxObject* userData = NULL);
646
647 /**
648 Same as Add(), but prepends the items to the beginning of the
649 list of items (windows, subsizers or spaces) owned by this sizer.
650 */
651 wxSizerItem* Prepend(int width, int height,
652 int proportion = 0,
653 int flag = 0,
654 int border = 0,
655 wxObject* userData = NULL);
656
657 /**
658 Prepends non-stretchable space to the sizer.
659 More readable way of calling wxSizer::Prepend(size, size, 0).
660 */
661 wxSizerItem* PrependSpacer(int size);
662
663 /**
664 Prepends stretchable space to the sizer.
665 More readable way of calling wxSizer::Prepend(0, 0, prop).
666 */
667 wxSizerItem* PrependStretchSpacer(int prop = 1);
668
669 /**
670 This method is abstract and has to be overwritten by any derived class.
671 Here, the sizer will do the actual calculation of its children's
672 positions and sizes.
673 */
674 virtual void RecalcSizes() = 0;
675
676 /**
677 Removes a child window from the sizer, but does @b not destroy it
678 (because windows are owned by their parent window, not the sizer).
679
680 @deprecated
681 The overload of this method taking a wxWindow* parameter
682 is deprecated as it does not destroy the window as would usually be
683 expected from Remove(). You should use Detach() in new code instead.
684 There is currently no wxSizer method that will both detach and destroy
685 a wxWindow item.
686
687 @note This method does not cause any layout or resizing to take
688 place, call Layout() to update the layout "on screen" after
689 removing a child from the sizer.
690
691 @return @true if the child item was found and removed, @false otherwise.
692 */
693 virtual bool Remove(wxWindow* window);
694
695 /**
696 Removes a sizer child from the sizer and destroys it.
697
698 @note This method does not cause any layout or resizing to take
699 place, call Layout() to update the layout "on screen" after
700 removing a child from the sizer.
701
702 @param sizer The wxSizer to be removed.
703
704 @return @true if the child item was found and removed, @false otherwise.
705 */
706 virtual bool Remove(wxSizer* sizer);
707
708 /**
709 Removes a child from the sizer and destroys it if it is a sizer or a
710 spacer, but not if it is a window (because windows are owned by their
711 parent window, not the sizer).
712
713 @note This method does not cause any layout or resizing to take
714 place, call Layout() to update the layout "on screen" after
715 removing a child from the sizer.
716
717 @param index
718 The position of the child in the sizer, e.g. 0 for the first item.
719
720 @return @true if the child item was found and removed, @false otherwise.
721 */
722 virtual bool Remove(int index);
723
724 /**
725 Detaches the given @a oldwin from the sizer and replaces it with the
726 given @a newwin. The detached child window is @b not deleted (because
727 windows are owned by their parent window, not the sizer).
728
729 Use parameter @a recursive to search the given element recursively in subsizers.
730
731 This method does not cause any layout or resizing to take place,
732 call Layout() to update the layout "on screen" after replacing a
733 child from the sizer.
734
735 Returns @true if the child item was found and removed, @false otherwise.
736 */
737 virtual bool Replace(wxWindow* oldwin, wxWindow* newwin,
738 bool recursive = false);
739
740 /**
741 Detaches the given @a oldsz from the sizer and replaces it with the
742 given @a newsz. The detached child sizer is deleted.
743
744 Use parameter @a recursive to search the given element recursively in subsizers.
745
746 This method does not cause any layout or resizing to take place,
747 call Layout() to update the layout "on screen" after replacing a
748 child from the sizer.
749
750 Returns @true if the child item was found and removed, @false otherwise.
751 */
752 virtual bool Replace(wxSizer* oldsz, wxSizer* newsz,
753 bool recursive = false);
754
755 /**
756 Detaches the given item at position @a index from the sizer and
757 replaces it with the given wxSizerItem @a newitem.
758
759 The detached child is deleted @b only if it is a sizer or a spacer
760 (but not if it is a wxWindow because windows are owned by their
761 parent window, not the sizer).
762
763 This method does not cause any layout or resizing to take place,
764 call Layout() to update the layout "on screen" after replacing a
765 child from the sizer.
766
767 Returns @true if the child item was found and removed, @false otherwise.
768 */
769 virtual bool Replace(size_t index, wxSizerItem* newitem);
770
771 /**
772 Call this to force the sizer to take the given dimension and thus force
773 the items owned by the sizer to resize themselves according to the
774 rules defined by the parameter in the Add() and Prepend() methods.
775 */
776 void SetDimension(int x, int y, int width, int height);
777
778 /**
779 @overload
780 */
781 void SetDimension(const wxPoint& pos, const wxSize& size);
782
783 /**
784 Set an item's minimum size by window, sizer, or position.
785
786 The item will be found recursively in the sizer's descendants.
787 This function enables an application to set the size of an item after
788 initial creation.
789
790 @see wxSizerItem::SetMinSize()
791 */
792 bool SetItemMinSize(wxWindow* window, int width, int height);
793
794 /**
795 Set an item's minimum size by window, sizer, or position.
796
797 The item will be found recursively in the sizer's descendants.
798 This function enables an application to set the size of an item after
799 initial creation.
800
801 @see wxSizerItem::SetMinSize()
802 */
803 bool SetItemMinSize(wxSizer* sizer, int width, int height);
804
805 /**
806 Set an item's minimum size by window, sizer, or position.
807
808 The item will be found recursively in the sizer's descendants.
809 This function enables an application to set the size of an item after
810 initial creation.
811
812 @see wxSizerItem::SetMinSize()
813 */
814 bool SetItemMinSize(size_t index, int width, int height);
815
816 /**
817 Call this to give the sizer a minimal size.
818
819 Normally, the sizer will calculate its minimal size based purely on how
820 much space its children need. After calling this method GetMinSize()
821 will return either the minimal size as requested by its children or the
822 minimal size set here, depending on which is bigger.
823 */
824 void SetMinSize(const wxSize& size);
825
826 /**
827 @overload
828 */
829 void SetMinSize(int width, int height);
830
831 /**
832 This method first calls Fit() and then wxTopLevelWindow::SetSizeHints()
833 on the @a window passed to it.
834
835 This only makes sense when @a window is actually a wxTopLevelWindow such
836 as a wxFrame or a wxDialog, since SetSizeHints only has any effect in these classes.
837 It does nothing in normal windows or controls.
838
839 This method is implicitly used by wxWindow::SetSizerAndFit() which is
840 commonly invoked in the constructor of a toplevel window itself (see
841 the sample in the description of wxBoxSizer) if the toplevel window is
842 resizable.
843 */
844 void SetSizeHints(wxWindow* window);
845
846 /**
847 Tell the sizer to set the minimal size of the @a window virtual area to match
848 the sizer's minimal size. For windows with managed scrollbars this will set them
849 appropriately.
850
851 @deprecated @todo provide deprecation description
852
853 @see wxScrolled::SetScrollbars()
854 */
855 void SetVirtualSizeHints(wxWindow* window);
856
857 /**
858 Shows or hides the @a window.
859 To make a sizer item disappear or reappear, use Show() followed by Layout().
860
861 Use parameter @a recursive to show or hide elements found in subsizers.
862
863 Returns @true if the child item was found, @false otherwise.
864
865 @see Hide(), IsShown()
866 */
867 bool Show(wxWindow* window, bool show = true,
868 bool recursive = false);
869
870 /**
871 Shows or hides @a sizer.
872 To make a sizer item disappear or reappear, use Show() followed by Layout().
873
874 Use parameter @a recursive to show or hide elements found in subsizers.
875
876 Returns @true if the child item was found, @false otherwise.
877
878 @see Hide(), IsShown()
879 */
880 bool Show(wxSizer* sizer, bool show = true,
881 bool recursive = false);
882
883 /**
884 Shows the item at @a index.
885 To make a sizer item disappear or reappear, use Show() followed by Layout().
886
887 Returns @true if the child item was found, @false otherwise.
888
889 @see Hide(), IsShown()
890 */
891 bool Show(size_t index, bool show = true);
892 };
893
894
895 /**
896 @class wxStdDialogButtonSizer
897
898 This class creates button layouts which conform to the standard button spacing
899 and ordering defined by the platform or toolkit's user interface guidelines
900 (if such things exist). By using this class, you can ensure that all your
901 standard dialogs look correct on all major platforms. Currently it conforms to
902 the Windows, GTK+ and Mac OS X human interface guidelines.
903
904 When there aren't interface guidelines defined for a particular platform or
905 toolkit, wxStdDialogButtonSizer reverts to the Windows implementation.
906
907 To use this class, first add buttons to the sizer by calling
908 wxStdDialogButtonSizer::AddButton (or wxStdDialogButtonSizer::SetAffirmativeButton,
909 wxStdDialogButtonSizer::SetNegativeButton or wxStdDialogButtonSizer::SetCancelButton)
910 and then call Realize in order to create the actual button layout used.
911 Other than these special operations, this sizer works like any other sizer.
912
913 If you add a button with wxID_SAVE, on Mac OS X the button will be renamed to
914 "Save" and the wxID_NO button will be renamed to "Don't Save" in accordance
915 with the Mac OS X Human Interface Guidelines.
916
917 @library{wxcore}
918 @category{winlayout}
919
920 @see wxSizer, @ref overview_sizer, wxDialog::CreateButtonSizer
921 */
922 class wxStdDialogButtonSizer : public wxBoxSizer
923 {
924 public:
925 /**
926 Constructor for a wxStdDialogButtonSizer.
927 */
928 wxStdDialogButtonSizer();
929
930 /**
931 Adds a button to the wxStdDialogButtonSizer. The @a button must have
932 one of the following identifiers:
933 - wxID_OK
934 - wxID_YES
935 - wxID_SAVE
936 - wxID_APPLY
937 - wxID_CLOSE
938 - wxID_NO
939 - wxID_CANCEL
940 - wxID_HELP
941 - wxID_CONTEXT_HELP
942 */
943 void AddButton(wxButton* button);
944
945 /**
946 Rearranges the buttons and applies proper spacing between buttons to make
947 them match the platform or toolkit's interface guidelines.
948 */
949 void Realize();
950
951 /**
952 Sets the affirmative button for the sizer.
953
954 This allows you to use identifiers other than the standard identifiers
955 outlined above.
956 */
957 void SetAffirmativeButton(wxButton* button);
958
959 /**
960 Sets the cancel button for the sizer.
961
962 This allows you to use identifiers other than the standard identifiers
963 outlined above.
964 */
965 void SetCancelButton(wxButton* button);
966
967 /**
968 Sets the negative button for the sizer.
969
970 This allows you to use identifiers other than the standard identifiers
971 outlined above.
972 */
973 void SetNegativeButton(wxButton* button);
974 };
975
976
977
978 /**
979 @class wxSizerItem
980
981 The wxSizerItem class is used to track the position, size and other
982 attributes of each item managed by a wxSizer.
983
984 It is not usually necessary to use this class because the sizer elements can
985 also be identified by their positions or window or sizer pointers but sometimes
986 it may be more convenient to use it directly.
987
988 @library{wxcore}
989 @category{winlayout}
990 */
991 class wxSizerItem : public wxObject
992 {
993 public:
994 /**
995 Construct a sizer item for tracking a spacer.
996 */
997 wxSizerItem(int width, int height, int proportion, int flag,
998 int border, wxObject* userData);
999
1000 //@{
1001 /**
1002 Construct a sizer item for tracking a window.
1003 */
1004 wxSizerItem(wxWindow* window, const wxSizerFlags& flags);
1005 wxSizerItem(wxWindow* window, int proportion, int flag,
1006 int border,
1007 wxObject* userData);
1008 //@}
1009
1010 //@{
1011 /**
1012 Construct a sizer item for tracking a subsizer.
1013 */
1014 wxSizerItem(wxSizer* window, const wxSizerFlags& flags);
1015 wxSizerItem(wxSizer* sizer, int proportion, int flag,
1016 int border,
1017 wxObject* userData);
1018 //@}
1019
1020 /**
1021 Deletes the user data and subsizer, if any.
1022 */
1023 virtual ~wxSizerItem();
1024
1025 /**
1026 Calculates the minimum desired size for the item, including any space
1027 needed by borders.
1028 */
1029 virtual wxSize CalcMin();
1030
1031 /**
1032 Destroy the window or the windows in a subsizer, depending on the type
1033 of item.
1034 */
1035 virtual void DeleteWindows();
1036
1037 /**
1038 Enable deleting the SizerItem without destroying the contained sizer.
1039 */
1040 void DetachSizer();
1041
1042 /**
1043 Return the border attribute.
1044 */
1045 int GetBorder() const;
1046
1047 /**
1048 Return the flags attribute.
1049
1050 See @ref wxsizer_flags "wxSizer flags list" for details.
1051 */
1052 int GetFlag() const;
1053
1054 /**
1055 Return the numeric id of wxSizerItem, or @c wxID_NONE if the id has
1056 not been set.
1057 */
1058 int GetId() const;
1059
1060 /**
1061 Get the minimum size needed for the item.
1062 */
1063 wxSize GetMinSize() const;
1064
1065 /**
1066 Sets the minimum size to be allocated for this item.
1067
1068 If this item is a window, the @a size is also passed to
1069 wxWindow::SetMinSize().
1070 */
1071 void SetMinSize(const wxSize& size);
1072
1073 /**
1074 @overload
1075 */
1076 void SetMinSize(int x, int y);
1077
1078 /**
1079 What is the current position of the item, as set in the last Layout.
1080 */
1081 wxPoint GetPosition() const;
1082
1083 /**
1084 Get the proportion item attribute.
1085 */
1086 int GetProportion() const;
1087
1088 /**
1089 Get the ration item attribute.
1090 */
1091 float GetRatio() const;
1092
1093 /**
1094 Get the rectangle of the item on the parent window, excluding borders.
1095 */
1096 virtual wxRect GetRect();
1097
1098 /**
1099 Get the current size of the item, as set in the last Layout.
1100 */
1101 virtual wxSize GetSize() const;
1102
1103 /**
1104 If this item is tracking a sizer, return it. @NULL otherwise.
1105 */
1106 wxSizer* GetSizer() const;
1107
1108 /**
1109 If this item is tracking a spacer, return its size.
1110 */
1111 wxSize GetSpacer() const;
1112
1113 /**
1114 Get the userData item attribute.
1115 */
1116 wxObject* GetUserData() const;
1117
1118 /**
1119 If this item is tracking a window then return it. @NULL otherwise.
1120 */
1121 wxWindow* GetWindow() const;
1122
1123 /**
1124 Returns @true if this item is a window or a spacer and it is shown or
1125 if this item is a sizer and not all of its elements are hidden.
1126
1127 In other words, for sizer items, all of the child elements must be
1128 hidden for the sizer itself to be considered hidden.
1129
1130 As an exception, if the @c wxRESERVE_SPACE_EVEN_IF_HIDDEN flag was
1131 used for this sizer item, then IsShown() always returns @true for it
1132 (see wxSizerFlags::ReserveSpaceEvenIfHidden()).
1133 */
1134 bool IsShown() const;
1135
1136 /**
1137 Is this item a sizer?
1138 */
1139 bool IsSizer() const;
1140
1141 /**
1142 Is this item a spacer?
1143 */
1144 bool IsSpacer() const;
1145
1146 /**
1147 Is this item a window?
1148 */
1149 bool IsWindow() const;
1150
1151 /**
1152 Set the border item attribute.
1153 */
1154 void SetBorder(int border);
1155
1156 /**
1157 Set the position and size of the space allocated to the sizer, and
1158 adjust the position and size of the item to be within that space
1159 taking alignment and borders into account.
1160 */
1161 virtual void SetDimension(const wxPoint& pos, const wxSize& size);
1162
1163 /**
1164 Set the flag item attribute.
1165 */
1166 void SetFlag(int flag);
1167
1168 /**
1169 Sets the numeric id of the wxSizerItem to @e id.
1170 */
1171 void SetId(int id);
1172
1173 /**
1174 @todo docme.
1175 */
1176 void SetInitSize(int x, int y);
1177
1178 /**
1179 Set the proportion item attribute.
1180 */
1181 void SetProportion(int proportion);
1182
1183 //@{
1184 /**
1185 Set the ratio item attribute.
1186 */
1187 void SetRatio(int width, int height);
1188 void SetRatio(wxSize size);
1189 void SetRatio(float ratio);
1190 //@}
1191
1192 /**
1193 Set the sizer tracked by this item.
1194 @deprecated @todo provide deprecation description
1195 */
1196 void SetSizer(wxSizer* sizer);
1197
1198 /**
1199 Set the size of the spacer tracked by this item.
1200 @deprecated @todo provide deprecation description
1201 */
1202 void SetSpacer(const wxSize& size);
1203
1204 /**
1205 Set the window to be tracked by this item.
1206 @deprecated @todo provide deprecation description
1207 */
1208 void SetWindow(wxWindow* window);
1209
1210 /**
1211 Set the show item attribute, which sizers use to determine if the item
1212 is to be made part of the layout or not. If the item is tracking a
1213 window then it is shown or hidden as needed.
1214 */
1215 void Show(bool show);
1216 };
1217
1218
1219
1220 /**
1221 @class wxSizerFlags
1222
1223 Container for sizer items flags providing readable names for them.
1224
1225 Normally, when you add an item to a sizer via wxSizer::Add, you have to
1226 specify a lot of flags and parameters which can be unwieldy. This is where
1227 wxSizerFlags comes in: it allows you to specify all parameters using the
1228 named methods instead. For example, instead of
1229
1230 @code
1231 sizer->Add(ctrl, 0, wxEXPAND | wxALL, 10);
1232 @endcode
1233
1234 you can now write
1235
1236 @code
1237 sizer->Add(ctrl, wxSizerFlags().Expand().Border(wxALL, 10));
1238 @endcode
1239
1240 This is more readable and also allows you to create wxSizerFlags objects which
1241 can be reused for several sizer items.
1242
1243 @code
1244 wxSizerFlags flagsExpand(1);
1245 flagsExpand.Expand().Border(wxALL, 10);
1246
1247 sizer->Add(ctrl1, flagsExpand);
1248 sizer->Add(ctrl2, flagsExpand);
1249 @endcode
1250
1251 Note that by specification, all methods of wxSizerFlags return the wxSizerFlags
1252 object itself to allowing chaining multiple methods calls like in the examples
1253 above.
1254
1255 @library{wxcore}
1256 @category{winlayout}
1257
1258 @see wxSizer
1259 */
1260 class wxSizerFlags
1261 {
1262 public:
1263 /**
1264 Creates the wxSizer with the proportion specified by @a proportion.
1265 */
1266 wxSizerFlags(int proportion = 0);
1267
1268 /**
1269 Sets the alignment of this wxSizerFlags to @a align.
1270
1271 This method replaces the previously set alignment with the specified one.
1272
1273 @param alignment
1274 Combination of @c wxALIGN_XXX bit masks.
1275
1276 @see Top(), Left(), Right(), Bottom(), Centre()
1277 */
1278 wxSizerFlags& Align(int alignment);
1279
1280 /**
1281 Sets the wxSizerFlags to have a border of a number of pixels specified
1282 by @a borderinpixels with the directions specified by @a direction.
1283 */
1284 wxSizerFlags& Border(int direction, int borderinpixels);
1285
1286 /**
1287 Sets the wxSizerFlags to have a border with size as returned by
1288 GetDefaultBorder().
1289
1290 @param direction
1291 Direction(s) to apply the border in.
1292 */
1293 wxSizerFlags& Border(int direction = wxALL);
1294
1295 /**
1296 Aligns the object to the bottom, similar for @c Align(wxALIGN_BOTTOM).
1297
1298 Unlike Align(), this method doesn't change the horizontal alignment of
1299 the item.
1300 */
1301 wxSizerFlags& Bottom();
1302
1303 /**
1304 Sets the object of the wxSizerFlags to center itself in the area it is
1305 given.
1306 */
1307 wxSizerFlags& Center();
1308
1309 /**
1310 Center() for people with the other dialect of English.
1311 */
1312 wxSizerFlags& Centre();
1313
1314 /**
1315 Sets the border in the given @a direction having twice the default
1316 border size.
1317 */
1318 wxSizerFlags& DoubleBorder(int direction = wxALL);
1319
1320 /**
1321 Sets the border in left and right directions having twice the default
1322 border size.
1323 */
1324 wxSizerFlags& DoubleHorzBorder();
1325
1326 /**
1327 Sets the object of the wxSizerFlags to expand to fill as much area as
1328 it can.
1329 */
1330 wxSizerFlags& Expand();
1331
1332 /**
1333 Set the @c wxFIXED_MINSIZE flag which indicates that the initial size
1334 of the window should be also set as its minimal size.
1335 */
1336 wxSizerFlags& FixedMinSize();
1337
1338 /**
1339 Set the @c wxRESERVE_SPACE_EVEN_IF_HIDDEN flag. Normally wxSizers
1340 don't allocate space for hidden windows or other items. This flag
1341 overrides this behavior so that sufficient space is allocated for the
1342 window even if it isn't visible. This makes it possible to dynamically
1343 show and hide controls without resizing parent dialog, for example.
1344
1345 @since 2.8.8
1346 */
1347 wxSizerFlags& ReserveSpaceEvenIfHidden();
1348
1349 /**
1350 Returns the border used by default in Border() method.
1351 */
1352 static int GetDefaultBorder();
1353
1354 /**
1355 Aligns the object to the left, similar for @c Align(wxALIGN_LEFT).
1356
1357 Unlike Align(), this method doesn't change the vertical alignment of
1358 the item.
1359 */
1360 wxSizerFlags& Left();
1361
1362 /**
1363 Sets the proportion of this wxSizerFlags to @e proportion
1364 */
1365 wxSizerFlags& Proportion(int proportion);
1366
1367 /**
1368 Aligns the object to the right, similar for @c Align(wxALIGN_RIGHT).
1369
1370 Unlike Align(), this method doesn't change the vertical alignment of
1371 the item.
1372 */
1373 wxSizerFlags& Right();
1374
1375 /**
1376 Set the @c wx_SHAPED flag which indicates that the elements should
1377 always keep the fixed width to height ratio equal to its original value.
1378 */
1379 wxSizerFlags& Shaped();
1380
1381 /**
1382 Aligns the object to the top, similar for @c Align(wxALIGN_TOP).
1383
1384 Unlike Align(), this method doesn't change the horizontal alignment of
1385 the item.
1386 */
1387 wxSizerFlags& Top();
1388
1389 /**
1390 Sets the border in the given @a direction having thrice the default
1391 border size.
1392 */
1393 wxSizerFlags& TripleBorder(int direction = wxALL);
1394 };
1395
1396
1397 /**
1398 Values which define the behaviour for resizing wxFlexGridSizer cells in the
1399 "non-flexible" direction.
1400 */
1401 enum wxFlexSizerGrowMode
1402 {
1403 /// Don't resize the cells in non-flexible direction at all.
1404 wxFLEX_GROWMODE_NONE,
1405
1406 /// Uniformly resize only the specified ones (default).
1407 wxFLEX_GROWMODE_SPECIFIED,
1408
1409 /// Uniformly resize all cells.
1410 wxFLEX_GROWMODE_ALL
1411 };
1412
1413 /**
1414 @class wxFlexGridSizer
1415
1416 A flex grid sizer is a sizer which lays out its children in a two-dimensional
1417 table with all table fields in one row having the same height and all fields
1418 in one column having the same width, but all rows or all columns are not
1419 necessarily the same height or width as in the wxGridSizer.
1420
1421 Since wxWidgets 2.5.0, wxFlexGridSizer can also size items equally in one
1422 direction but unequally ("flexibly") in the other. If the sizer is only
1423 flexible in one direction (this can be changed using wxFlexGridSizer::SetFlexibleDirection),
1424 it needs to be decided how the sizer should grow in the other ("non-flexible")
1425 direction in order to fill the available space.
1426 The wxFlexGridSizer::SetNonFlexibleGrowMode() method serves this purpose.
1427
1428 @library{wxcore}
1429 @category{winlayout}
1430
1431 @see wxSizer, @ref overview_sizer
1432 */
1433 class wxFlexGridSizer : public wxGridSizer
1434 {
1435 public:
1436 //@{
1437 /**
1438 Constructor for a wxFlexGridSizer.
1439
1440 @a rows and @a cols determine the number of columns and rows in the sizer -
1441 if either of the parameters is zero, it will be calculated to form the
1442 total number of children in the sizer, thus making the sizer grow
1443 dynamically.
1444
1445 @a vgap and @a hgap define extra space between all children.
1446 */
1447 wxFlexGridSizer(int rows, int cols, int vgap, int hgap);
1448 wxFlexGridSizer(int cols, int vgap = 0, int hgap = 0);
1449 //@}
1450
1451 /**
1452 Specifies that column @a idx (starting from zero) should be grown if
1453 there is extra space available to the sizer.
1454
1455 The @a proportion parameter has the same meaning as the stretch factor
1456 for the sizers (see wxBoxSizer) except that if all proportions are 0,
1457 then all columns are resized equally (instead of not being resized at all).
1458
1459 Notice that the column must not be already growable, if you need to change
1460 the proportion you must call RemoveGrowableCol() first and then make it
1461 growable (with a different proportion) again. You can use IsColGrowable()
1462 to check whether a column is already growable.
1463 */
1464 void AddGrowableCol(size_t idx, int proportion = 0);
1465
1466 /**
1467 Specifies that row idx (starting from zero) should be grown if there
1468 is extra space available to the sizer.
1469
1470 This is identical to AddGrowableCol() except that it works with rows
1471 and not columns.
1472 */
1473 void AddGrowableRow(size_t idx, int proportion = 0);
1474
1475 /**
1476 Returns a ::wxOrientation value that specifies whether the sizer flexibly
1477 resizes its columns, rows, or both (default).
1478
1479 @return
1480 One of the following values:
1481 - wxVERTICAL: Rows are flexibly sized.
1482 - wxHORIZONTAL: Columns are flexibly sized.
1483 - wxBOTH: Both rows and columns are flexibly sized (this is the default value).
1484
1485 @see SetFlexibleDirection()
1486 */
1487 int GetFlexibleDirection() const;
1488
1489 /**
1490 Returns the value that specifies how the sizer grows in the "non-flexible"
1491 direction if there is one.
1492
1493 The behaviour of the elements in the flexible direction (i.e. both rows
1494 and columns by default, or rows only if GetFlexibleDirection() is
1495 @c wxVERTICAL or columns only if it is @c wxHORIZONTAL) is always governed
1496 by their proportion as specified in the call to AddGrowableRow() or
1497 AddGrowableCol(). What happens in the other direction depends on the
1498 value of returned by this function as described below.
1499
1500 @return
1501 One of the following values:
1502 - wxFLEX_GROWMODE_NONE: Sizer doesn't grow its elements at all in
1503 the non-flexible direction.
1504 - wxFLEX_GROWMODE_SPECIFIED: Sizer honors growable columns/rows set
1505 with AddGrowableCol() and AddGrowableRow() in the non-flexible
1506 direction as well. In this case equal sizing applies to minimum
1507 sizes of columns or rows (this is the default value).
1508 - wxFLEX_GROWMODE_ALL: Sizer equally stretches all columns or rows in
1509 the non-flexible direction, independently of the proportions
1510 applied in the flexible direction.
1511
1512 @see SetFlexibleDirection(), SetNonFlexibleGrowMode()
1513 */
1514 wxFlexSizerGrowMode GetNonFlexibleGrowMode() const;
1515
1516 /**
1517 Returns @true if column @a idx is growable.
1518
1519 @since 2.9.0
1520 */
1521 bool IsColGrowable(size_t idx);
1522
1523 /**
1524 Returns @true if row @a idx is growable.
1525
1526 @since 2.9.0
1527 */
1528 bool IsRowGrowable(size_t idx);
1529
1530 /**
1531 Specifies that the @a idx column index is no longer growable.
1532 */
1533 void RemoveGrowableCol(size_t idx);
1534
1535 /**
1536 Specifies that the @a idx row index is no longer growable.
1537 */
1538 void RemoveGrowableRow(size_t idx);
1539
1540 /**
1541 Specifies whether the sizer should flexibly resize its columns, rows, or both.
1542
1543 Argument @a direction can be @c wxVERTICAL, @c wxHORIZONTAL or @c wxBOTH
1544 (which is the default value). Any other value is ignored.
1545
1546 See GetFlexibleDirection() for the explanation of these values.
1547 Note that this method does not trigger relayout.
1548 */
1549 void SetFlexibleDirection(int direction);
1550
1551 /**
1552 Specifies how the sizer should grow in the non-flexible direction if
1553 there is one (so SetFlexibleDirection() must have been called previously).
1554
1555 Argument @a mode can be one of those documented in GetNonFlexibleGrowMode(),
1556 please see there for their explanation.
1557 Note that this method does not trigger relayout.
1558 */
1559 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode);
1560 };
1561
1562
1563 /**
1564 @class wxGridSizer
1565
1566 A grid sizer is a sizer which lays out its children in a two-dimensional
1567 table with all table fields having the same size, i.e. the width of each
1568 field is the width of the widest child, the height of each field is the
1569 height of the tallest child.
1570
1571 @library{wxcore}
1572 @category{winlayout}
1573
1574 @see wxSizer, @ref overview_sizer
1575 */
1576 class wxGridSizer : public wxSizer
1577 {
1578 public:
1579 //@{
1580 /**
1581 Constructor for a wxGridSizer.
1582
1583 @a rows and @a cols determine the number of columns and rows in the sizer -
1584 if either of the parameters is zero, it will be calculated to form the
1585 total number of children in the sizer, thus making the sizer grow dynamically.
1586
1587 @a vgap and @a hgap define extra space between all children.
1588 */
1589 wxGridSizer(int rows, int cols, int vgap, int hgap);
1590 wxGridSizer(int cols, int vgap = 0, int hgap = 0);
1591 //@}
1592
1593 /**
1594 Returns the number of columns in the sizer.
1595 */
1596 int GetCols() const;
1597
1598 /**
1599 Returns the horizontal gap (in pixels) between cells in the sizer.
1600 */
1601 int GetHGap() const;
1602
1603 /**
1604 Returns the number of rows in the sizer.
1605 */
1606 int GetRows() const;
1607
1608 /**
1609 Returns the vertical gap (in pixels) between the cells in the sizer.
1610 */
1611 int GetVGap() const;
1612
1613 /**
1614 Sets the number of columns in the sizer.
1615 */
1616 void SetCols(int cols);
1617
1618 /**
1619 Sets the horizontal gap (in pixels) between cells in the sizer.
1620 */
1621 void SetHGap(int gap);
1622
1623 /**
1624 Sets the number of rows in the sizer.
1625 */
1626 void SetRows(int rows);
1627
1628 /**
1629 Sets the vertical gap (in pixels) between the cells in the sizer.
1630 */
1631 void SetVGap(int gap);
1632 };
1633
1634
1635
1636 /**
1637 @class wxStaticBoxSizer
1638
1639 wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds a static
1640 box around the sizer.
1641 This static box may be either created independently or the sizer may create
1642 it itself as a convenience. In any case, the sizer owns the wxStaticBox control
1643 and will delete it, if it is deleted.
1644
1645 @library{wxcore}
1646 @category{winlayout}
1647
1648 @see wxSizer, wxStaticBox, wxBoxSizer, @ref overview_sizer
1649 */
1650 class wxStaticBoxSizer : public wxBoxSizer
1651 {
1652 public:
1653 /**
1654 This constructor uses an already existing static box.
1655
1656 It takes the associated static box and the orientation @a orient, which
1657 can be either @c wxVERTICAL or @c wxHORIZONTAL as parameters.
1658 */
1659 wxStaticBoxSizer(wxStaticBox* box, int orient);
1660
1661 /**
1662 This constructor creates a new static box with the given label and parent window.
1663 */
1664 wxStaticBoxSizer(int orient, wxWindow *parent,
1665 const wxString& label = wxEmptyString);
1666
1667 /**
1668 Returns the static box associated with the sizer.
1669 */
1670 wxStaticBox* GetStaticBox() const;
1671 };
1672
1673
1674
1675 /**
1676 @class wxBoxSizer
1677
1678 The basic idea behind a box sizer is that windows will most often be laid out
1679 in rather simple basic geometry, typically in a row or a column or several
1680 hierarchies of either.
1681
1682 For more information, please see @ref overview_sizer_box.
1683
1684 @library{wxcore}
1685 @category{winlayout}
1686
1687 @see wxSizer, @ref overview_sizer
1688 */
1689 class wxBoxSizer : public wxSizer
1690 {
1691 public:
1692 /**
1693 Constructor for a wxBoxSizer. @a orient may be either of wxVERTICAL
1694 or wxHORIZONTAL for creating either a column sizer or a row sizer.
1695 */
1696 wxBoxSizer(int orient);
1697
1698 /**
1699 Implements the calculation of a box sizer's minimal.
1700
1701 It is used internally only and must not be called by the user.
1702 Documented for information.
1703 */
1704 virtual wxSize CalcMin();
1705
1706 /**
1707 Returns the orientation of the box sizer, either wxVERTICAL
1708 or wxHORIZONTAL.
1709 */
1710 int GetOrientation() const;
1711
1712 /**
1713 Implements the calculation of a box sizer's dimensions and then sets
1714 the size of its children (calling wxWindow::SetSize if the child is a window).
1715
1716 It is used internally only and must not be called by the user
1717 (call Layout() if you want to resize). Documented for information.
1718 */
1719 void RecalcSizes();
1720 };
1721