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