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