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