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