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