]>
git.saurik.com Git - wxWidgets.git/blob - interface/sizer.h
db38e760b3a3f611b51f1fec12ebe2b0753a275e
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: documentation for wxStdDialogButtonSizer class
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxStdDialogButtonSizer
13 This class creates button layouts which conform to the standard button spacing
14 and ordering defined by the platform
15 or toolkit's user interface guidelines (if such things exist). By using this
16 class, you can ensure that all your
17 standard dialogs look correct on all major platforms. Currently it conforms to
18 the Windows, GTK+ and Mac OS X
19 human interface guidelines.
21 When there aren't interface guidelines defined for a particular platform or
22 toolkit, wxStdDialogButtonSizer reverts
23 to the Windows implementation.
25 To use this class, first add buttons to the sizer by calling AddButton (or
26 SetAffirmativeButton, SetNegativeButton,
27 or SetCancelButton) and then call Realize in order to create the actual button
28 layout used. Other than these special
29 operations, this sizer works like any other sizer.
31 If you add a button with wxID_SAVE, on Mac OS X the button will be renamed to
33 the wxID_NO button will be renamed to "Don't Save" in accordance with the Mac
34 OS X Human Interface Guidelines.
40 wxSizer, @ref overview_sizeroverview "Sizer overview",
41 wxDialog::CreateButtonSizer
43 class wxStdDialogButtonSizer
: public wxBoxSizer
47 Constructor for a wxStdDialogButtonSizer.
49 wxStdDialogButtonSizer();
52 Adds a button to the wxStdDialogButtonSizer. The button must have one of the
53 following identifiers:
65 void AddButton(wxButton
* button
);
68 Rearranges the buttons and applies proper spacing between buttons to make them
69 match the platform or toolkit's interface guidelines.
74 Sets the affirmative button for the sizer. This allows you to use identifiers
75 other than the standard identifiers outlined above.
77 void SetAffirmativeButton(wxButton
* button
);
80 Sets the cancel button for the sizer. This allows you to use identifiers other
81 than the standard identifiers outlined above.
83 void SetCancelButton(wxButton
* button
);
86 Sets the negative button for the sizer. This allows you to use identifiers
87 other than the standard identifiers outlined above.
89 void SetNegativeButton(wxButton
* button
);
97 The wxSizerItem class is used to track the position, size and other
98 attributes of each item managed by a wxSizer. It is not
99 usually necessary to use this class because the sizer elements can also be
100 identified by their positions or window or sizer pointers but sometimes it may
101 be more convenient to use it directly.
106 class wxSizerItem
: public wxObject
111 Construct a sizer item for tracking a subsizer.
113 wxSizerItem(int width
, int height
, int proportion
, int flag
,
114 int border
, wxObject
* userData
);
115 wxSizerItem(wxWindow
* window
, const wxSizerFlags
& flags
);
116 wxSizerItem(wxWindow
* window
, int proportion
, int flag
,
119 wxSizerItem(wxSizer
* window
, const wxSizerFlags
& flags
);
120 wxSizerItem(wxSizer
* sizer
, int proportion
, int flag
,
126 Deletes the user data and subsizer, if any.
131 Calculates the minimum desired size for the item, including any space
137 Destroy the window or the windows in a subsizer, depending on the type
140 void DeleteWindows();
143 Enable deleting the SizerItem without destroying the contained sizer.
148 Return the border attribute.
153 Return the flags attribute.
158 Return the numeric id of wxSizerItem, or @c wxID_NONE if the id has
164 Get the minimum size needed for the item.
169 What is the current position of the item, as set in the last Layout.
171 wxPoint
GetPosition();
174 Get the proportion item attribute.
179 Get the ration item attribute.
184 Get the rectangle of the item on the parent window, excluding borders.
189 Get the current size of the item, as set in the last Layout.
194 If this item is tracking a sizer, return it. @NULL otherwise.
199 If this item is tracking a spacer, return its size.
201 const wxSize
GetSpacer();
204 Get the userData item attribute.
206 wxObject
* GetUserData();
209 If this item is tracking a window then return it. @NULL otherwise.
211 wxWindow
* GetWindow();
214 Returns @true if this item is a window or a spacer and it is shown or if this
215 item is a sizer and not all its elements are hidden. In other words, for sizer
216 items, all of the child elements must be hidden for the sizer itself to be
222 Is this item a sizer?
227 Is this item a spacer?
232 Is this item a window?
237 Set the border item attribute.
239 void SetBorder(int border
);
242 Set the position and size of the space allocated to the sizer, and
243 adjust the position and size of the item to be within that space
244 taking alignment and borders into account.
246 void SetDimension(const wxPoint
& pos
, const wxSize
& size
);
249 Set the flag item attribute.
251 void SetFlag(int flag
);
254 Sets the numeric id of the wxSizerItem to @e id.
261 void SetInitSize(int x
, int y
);
264 Set the proportion item attribute.
266 void SetProportion(int proportion
);
270 Set the ratio item attribute.
272 void SetRatio(int width
, int height
);
273 void SetRatio(wxSize size
);
274 void SetRatio(float ratio
);
278 Set the sizer tracked by this item.
280 void SetSizer(wxSizer
* sizer
);
283 Set the size of the spacer tracked by this item.
285 void SetSpacer(const wxSize
& size
);
288 Set the window to be tracked by thsi item.
290 void SetWindow(wxWindow
* window
);
293 Set the show item attribute, which sizers use to determine if the item
294 is to be made part of the layout or not. If the item is tracking a
295 window then it is shown or hidden as needed.
297 void Show(bool show
);
305 Normally, when you add an item to a sizer via
306 wxSizer::Add, you have to specify a lot of flags and
307 parameters which can be unwieldy. This is where wxSizerFlags comes in: it
308 allows you to specify all parameters using the named methods instead. For
312 sizer-Add(ctrl, 0, wxEXPAND | wxALL, 10);
318 sizer-Add(ctrl, wxSizerFlags().Expand().Border(10));
321 This is more readable and also allows you to create wxSizerFlags objects which
322 can be reused for several sizer items.
325 wxSizerFlags flagsExpand(1);
326 flagsExpand.Expand().Border(10);
328 sizer-Add(ctrl1, flagsExpand);
329 sizer-Add(ctrl2, flagsExpand);
332 Note that by specification, all methods of wxSizerFlags return the wxSizerFlags
333 object itself to allowing chaining multiple methods calls like in the examples
346 Creates the wxSizer with the proportion specified by @e proportion.
348 wxSizerFlags(int proportion
= 0);
351 Sets the alignment of this wxSizerFlags to @e align.
353 Note that if this method is not called, the wxSizerFlags has no specified
356 @sa Top(), Left(), Right(),
359 wxSizerFlags
Align(int align
= 0);
363 Sets the wxSizerFlags to have a border of a number of pixels specified by
364 @e borderinpixels with the directions specified by @e direction.
366 In the overloaded version without @e borderinpixels parameter, the border of
367 default size, as returned by GetDefaultBorder(),
370 wxSizerFlags
Border(int direction
, int borderinpixels
);
371 wxSizerFlags
Border(int direction
= wxALL
);
375 Aligns the object to the bottom, shortcut for @c Align(wxALIGN_BOTTOM)
379 wxSizerFlags
Bottom();
382 Sets the object of the wxSizerFlags to center itself in the area it is given.
384 wxSizerFlags
Center();
387 Center() for people with the other dialect of english.
389 wxSizerFlags
Centre();
392 Sets the border in the given @e direction having twice the default border
395 wxSizerFlags
DoubleBorder(int direction
= wxALL
);
398 Sets the border in left and right directions having twice the default border
401 wxSizerFlags
DoubleHorzBorder();
404 Sets the object of the wxSizerFlags to expand to fill as much area as it can.
406 wxSizerFlags
Expand();
409 Set the @c wxFIXED_MINSIZE flag which indicates that the initial size of
410 the window should be also set as its minimal size.
412 wxSizerFlags
FixedMinSize();
415 Returns the border used by default in Border() method.
417 static int GetDefaultBorder();
420 Aligns the object to the left, shortcut for @c Align(wxALIGN_LEFT)
427 Sets the proportion of this wxSizerFlags to @e proportion
429 wxSizerFlags
Proportion(int proportion
= 0);
432 Aligns the object to the right, shortcut for @c Align(wxALIGN_RIGHT)
436 wxSizerFlags
Right();
439 Set the @c wx_SHAPED flag which indicates that the elements should
440 always keep the fixed width to height ratio equal to its original value.
442 wxSizerFlags
Shaped();
445 Aligns the object to the top, shortcut for @c Align(wxALIGN_TOP)
449 #define wxSizerFlags Top() /* implementation is private */
452 Sets the border in the given @e direction having thrice the default border
455 wxSizerFlags
TripleBorder(int direction
= wxALL
);
460 @class wxNotebookSizer
463 @b This class is deprecated and should not be used in new code! It is no
464 longer needed, wxNotebook control can be inserted
465 into any sizer class and its minimal size will be determined correctly.
466 See @ref overview_sizeroverview "wxSizer overview" for more information.
468 wxNotebookSizer is a specialized sizer to make sizers work in connection
469 with using notebooks. This sizer is different from any other sizer as
470 you must not add any children to it - instead, it queries the notebook class
472 The only thing this sizer does is to determine the size of the biggest
473 page of the notebook and report an adjusted minimal size to a more toplevel
480 wxSizer, wxNotebook, @ref overview_sizeroverview "Sizer overview"
482 class wxNotebookSizer
: public wxSizer
486 Constructor. It takes an associated notebook as its only parameter.
488 wxNotebookSizer(wxNotebook
* notebook
);
491 Returns the notebook associated with the sizer.
493 wxNotebook
* GetNotebook();
498 @class wxFlexGridSizer
501 A flex grid sizer is a sizer which lays out its children in a two-dimensional
502 table with all table fields in one row having the same
503 height and all fields in one column having the same width, but all
504 rows or all columns are not necessarily the same height or width as in
507 Since wxWidgets 2.5.0, wxFlexGridSizer can also size items equally in one
508 direction but unequally ("flexibly") in the other. If the sizer is only
509 flexible in one direction (this can be changed using
510 wxFlexGridSizer::SetFlexibleDirection),
511 it needs to be decided how the sizer should grow in the other ("non-flexible")
512 direction in order to fill the available space. The
513 wxFlexGridSizer::SetNonFlexibleGrowMode method
520 wxSizer, @ref overview_sizeroverview "Sizer overview"
522 class wxFlexGridSizer
: public wxGridSizer
527 Constructor for a wxGridSizer. @e rows and @e cols determine the number of
528 columns and rows in the sizer - if either of the parameters is zero, it will be
529 calculated to form the total number of children in the sizer, thus making the
530 sizer grow dynamically. @e vgap and @e hgap define extra space between
533 wxFlexGridSizer(int rows
, int cols
, int vgap
, int hgap
);
534 wxFlexGridSizer(int cols
, int vgap
= 0, int hgap
= 0);
538 Specifies that column @e idx (starting from zero) should be grown if
539 there is extra space available to the sizer.
541 The @e proportion parameter has the same meaning as the stretch factor for
542 the sizers except that if all proportions are 0,
543 then all columns are resized equally (instead of not being resized at all).
545 void AddGrowableCol(size_t idx
, int proportion
= 0);
548 Specifies that row idx (starting from zero) should be grown if there
549 is extra space available to the sizer.
551 See AddGrowableCol() for the description
552 of @e proportion parameter.
554 void AddGrowableRow(size_t idx
, int proportion
= 0);
557 Returns a wxOrientation value that specifies whether the sizer flexibly
558 resizes its columns, rows, or both (default).
560 @returns One of the following values:
562 @sa SetFlexibleDirection()
564 int GetFlexibleDirection();
567 Returns the value that specifies how the sizer grows in the "non-flexible"
568 direction if there is one.
570 @returns One of the following values:
572 @sa SetFlexibleDirection(),
573 SetNonFlexibleGrowMode()
575 int GetNonFlexibleGrowMode();
578 Specifies that column idx is no longer growable.
580 void RemoveGrowableCol(size_t idx
);
583 Specifies that row idx is no longer growable.
585 void RemoveGrowableRow(size_t idx
);
588 Specifies whether the sizer should flexibly resize its columns, rows, or
589 both. Argument @c direction can be @c wxVERTICAL, @c wxHORIZONTAL
590 or @c wxBOTH (which is the default value). Any other value is ignored. See
591 @ref getflexibledrection() GetFlexibleDirection for the
592 explanation of these values.
594 Note that this method does not trigger relayout.
596 void SetFlexibleDirection(int direction
);
599 Specifies how the sizer should grow in the non-flexible direction if
601 SetFlexibleDirection() must have
602 been called previously). Argument @e mode can be one of those documented in
603 GetNonFlexibleGrowMode(), please
604 see there for their explanation.
606 Note that this method does not trigger relayout.
608 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode
);
616 wxSizer is the abstract base class used for laying out subwindows in a window.
618 cannot use wxSizer directly; instead, you will have to use one of the sizer
619 classes derived from it. Currently there are wxBoxSizer,
626 The layout algorithm used by sizers in wxWidgets is closely related to layout
627 in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit.
629 based upon the idea of the individual subwindows reporting their minimal
631 size and their ability to get stretched if the size of the parent window has
633 This will most often mean that the programmer does not set the original size of
634 a dialog in the beginning, rather the dialog will be assigned a sizer and this
636 will be queried about the recommended size. The sizer in turn will query its
637 children, which can be normal windows, empty space or other sizers, so that
638 a hierarchy of sizers can be constructed. Note that wxSizer does not derive
640 and thus does not interfere with tab ordering and requires very little
642 to a real window on screen.
644 What makes sizers so well fitted for use in wxWidgets is the fact that every
646 reports its own minimal size and the algorithm can handle differences in font
648 or different window (dialog item) sizes on different platforms without
650 the standard font as well as the overall design of Motif widgets requires more
652 on Windows, the initial dialog size will automatically be bigger on Motif than
655 Sizers may also be used to control the layout of custom drawn items on the
657 Add, Insert, and Prepend functions return a pointer to the newly added
659 add empty space of the desired size and attributes, and then use the
661 method to determine where the drawing operations should take place.
663 Please notice that sizers, like child windows, are owned by the library and
664 will be deleted by it which implies that they must be allocated on the heap.
665 However if you create a sizer and do not add it to another sizer or window, the
666 library wouldn't be able to delete such an orphan sizer and in this, and only
667 this, case it should be deleted explicitly.
669 @b wxPython note: If you wish to create a sizer class in wxPython you should
670 derive the class from @c wxPySizer in order to get Python-aware
671 capabilities for the various virtual methods.
677 @ref overview_sizeroverview "Sizer overview"
679 class wxSizer
: public wxObject
683 The constructor. Note that wxSizer is an abstract base class and may not
695 Appends a child to the sizer. wxSizer itself is an abstract class, but the
697 equivalent in the derived classes that you will instantiate to use it so they
702 The window to be added to the sizer. Its initial size (either set explicitly by
704 user or calculated internally when using wxDefaultSize) is interpreted as the
706 cases also the initial size.
709 The (child-)sizer to be added to the sizer. This allows placing a child sizer
711 sizer and thus to create hierarchies of sizers (typically a vertical box as the
712 top sizer and several
713 horizontal boxes on the level beneath).
715 @param width and height
716 The dimension of a spacer to be added to the sizer. Adding spacers to sizers
717 gives more flexibility in the design of dialogs; imagine for example a
718 horizontal box with two buttons at the
719 bottom of a dialog: you might want to insert a space between the two buttons
720 and make that space stretchable
721 using the proportion flag and the result will be that the left button will be
722 aligned with the left
723 side of the dialog and the right button with the right side - the space in
724 between will shrink and grow with
728 Although the meaning of this parameter is undefined in wxSizer, it is used in
730 to indicate if a child of a sizer can change its size in the main orientation
731 of the wxBoxSizer - where
732 0 stands for not changeable and a value of more than zero is interpreted
733 relative to the value of other
734 children of the same wxBoxSizer. For example, you might have a horizontal
735 wxBoxSizer with three children, two
736 of which are supposed to change their size with the sizer. Then the two
737 stretchable windows would get a
738 value of 1 each to make them grow and shrink equally with the sizer's
739 horizontal dimension.
742 This parameter can be used to set a number of flags
743 which can be combined using the binary OR operator |. Two main
744 behaviours are defined using these flags. One is the border around a
745 window: the border parameter determines the border width whereas
746 the flags given here determine which side(s) of the item that the
747 border will be added. The other flags determine how the sizer item
748 behaves when the space allotted to the sizer changes, and is somewhat
749 dependent on the specific kind of sizer used.
762 These flags are used to specify which side(s) of
763 the sizer item the border width will apply to.
769 The item will be expanded to fill
770 the space assigned to the item.
775 The item will be expanded as much
776 as possible while also maintaining its aspect ratio
781 Normally wxSizers will use
782 GetAdjustedBestSize to
783 determine what the minimal size of window items should be, and will
784 use that size to calculate the layout. This allows layouts to
785 adjust when an item changes and its best size becomes
786 different. If you would rather have a window item stay the size it
787 started with then use wxFIXED_MINSIZE.
789 wxALIGN_CENTER wxALIGN_CENTRE
799 wxALIGN_CENTER_VERTICAL wxALIGN_CENTRE_VERTICAL
801 wxALIGN_CENTER_HORIZONTAL wxALIGN_CENTRE_HORIZONTAL
804 The wxALIGN flags allow you to
805 specify the alignment of the item within the space allotted to it by
806 the sizer, adjusted for the border if any.
809 Determines the border width, if the flag
810 parameter is set to include any border flag.
813 Allows an extra object to be attached to the sizer
814 item, for use in derived classes when sizing information is more
815 complex than the proportion and flag will allow for.
818 A wxSizerFlags object that
819 enables you to specify most of the above parameters more conveniently.
821 wxSizerItem
* Add(wxWindow
* window
, const wxSizerFlags
& flags
);
822 wxSizerItem
* Add(wxWindow
* window
, int proportion
= 0,
825 wxObject
* userData
= @NULL
);
826 wxSizerItem
* Add(wxSizer
* sizer
, const wxSizerFlags
& flags
);
827 wxSizerItem
* Add(wxSizer
* sizer
, int proportion
= 0,
830 wxObject
* userData
= @NULL
);
831 wxSizerItem
* Add(int width
, int height
, int proportion
= 0,
834 wxObject
* userData
= @NULL
);
838 Adds non-stretchable space to the sizer. More readable way of calling
839 wxSizer::Add(size, size, 0).
841 wxSizerItem
* AddSpacer(int size
);
844 Adds stretchable space to the sizer. More readable way of calling
845 wxSizer::Add(0, 0, prop).
847 wxSizerItem
* AddStretchSpacer(int prop
= 1);
850 This method is abstract and has to be overwritten by any derived class.
851 Here, the sizer will do the actual calculation of its children's minimal sizes.
856 Detaches all children from the sizer. If @e delete_windows is @true then
857 child windows will also be deleted.
859 void Clear(bool delete_windows
= @
false);
862 Computes client area size for @e window so that it matches the
863 sizer's minimal size. Unlike GetMinSize(), this
864 method accounts for other constraints imposed on @e window, namely display's
865 size (returned size will never be too large for the display) and maximum
866 window size if previously set by
867 wxWindow::SetMaxSize.
869 The returned value is suitable for passing to
870 wxWindow::SetClientSize or
871 wxWindow::SetMinClientSize.
873 @sa ComputeFittingWindowSize(), Fit()
875 wxSize
ComputeFittingClientSize(wxWindow
* window
);
878 Like ComputeFittingClientSize(),
879 but converts the result into window size.
881 The returned value is suitable for passing to
883 wxWindow::SetMinSize.
885 @sa ComputeFittingClientSize(), Fit()
887 wxSize
ComputeFittingWindowSize(wxWindow
* window
);
891 Detach a child from the sizer without destroying it. @e window is the window to
893 detached, @e sizer is the equivalent sizer and @e index is the position of
894 the child in the sizer, typically 0 for the first item. This method does not
895 cause any layout or resizing to take place, call Layout()
896 to update the layout "on screen" after detaching a child from the sizer.
898 Returns @true if the child item was found and detached, @false otherwise.
902 bool Detach(wxWindow
* window
);
903 bool Detach(wxSizer
* sizer
);
904 bool Detach(size_t index
);
908 Tell the sizer to resize the @e window so that its client area matches the
910 (ComputeFittingClientSize() is called
912 This is commonly done in the constructor of the window
913 itself, see sample in the description
914 of wxBoxSizer. Returns the new window size.
916 @sa ComputeFittingClientSize(), ComputeFittingWindowSize()
918 #define wxSize Fit(wxWindow* window) /* implementation is private */
921 Tell the sizer to resize the virtual size of the @e window to match the sizer's
922 minimal size. This will not alter the on screen size of the window, but may
924 the addition/removal/alteration of scrollbars required to view the virtual area
926 windows which manage it.
928 @sa wxScrolledWindow::SetScrollbars, SetVirtualSizeHints()
930 void FitInside(wxWindow
* window
);
934 Returns the list of the items in this sizer. The elements of type-safe
935 wxList @c wxSizerItemList are objects of type
936 @ref overview_wxsizeritem "wxSizerItem *".
938 const wxSizerItemList
GetChildren();
939 wxSizerItemList
GetChildren();
943 Returns the window this sizer is used in or @NULL if none.
945 wxWindow
* GetContainingWindow();
949 Finds item of the sizer which holds given @e window, @e sizer or is located
950 in sizer at position @e index.
951 Use parameter @e recursive to search in subsizers too.
953 Returns pointer to item or @NULL.
955 wxSizerItem
* GetItem(wxWindow
* window
, bool recursive
= @
false);
956 wxSizerItem
* GetItem(wxSizer
* sizer
, bool recursive
= @
false);
957 wxSizerItem
* GetItem(size_t index
);
961 Finds item of the sizer which has the given @e id. This @e id is not the
962 window id but the id of the wxSizerItem itself. This is mainly useful for
963 retrieving the sizers created from XRC resources.
965 Use parameter @e recursive to search in subsizers too.
967 Returns pointer to item or @NULL.
969 wxSizerItem
* GetItemById(int id
, bool recursive
= @
false);
972 Returns the minimal size of the sizer. This is either the combined minimal
973 size of all the children and their borders or the minimal size set by
974 SetMinSize(), depending on which is bigger.
976 Note that the returned value is client size, not window size.
977 In particular, if you use the value to set toplevel window's minimal or
978 actual size, use wxWindow::SetMinClientSize
979 or wxWindow::SetClientSize, not
981 or wxWindow::SetSize.
986 Returns the current position of the sizer.
988 wxPoint
GetPosition();
991 Returns the current size of the sizer.
997 Hides the @e window, @e sizer, or item at @e index.
998 To make a sizer item disappear, use Hide() followed by Layout().
999 Use parameter @e recursive to hide elements found in subsizers.
1001 Returns @true if the child item was found, @false otherwise.
1003 @sa IsShown(), Show()
1005 bool Hide(wxWindow
* window
, bool recursive
= @
false);
1006 bool Hide(wxSizer
* sizer
, bool recursive
= @
false);
1007 bool Hide(size_t index
);
1012 Insert a child into the sizer before any existing item at
1013 See Add() for the meaning of the other parameters.
1018 The position this child should assume in the sizer.
1020 wxSizerItem
* Insert(size_t index
, wxWindow
* window
,
1021 const wxSizerFlags
& flags
);
1022 wxSizerItem
* Insert(size_t index
, wxWindow
* window
,
1026 wxObject
* userData
= @NULL
);
1027 wxSizerItem
* Insert(size_t index
, wxSizer
* sizer
,
1028 const wxSizerFlags
& flags
);
1029 wxSizerItem
* Insert(size_t index
, wxSizer
* sizer
,
1033 wxObject
* userData
= @NULL
);
1034 wxSizerItem
* Insert(size_t index
, int width
, int height
,
1038 wxObject
* userData
= @NULL
);
1042 Inserts non-stretchable space to the sizer. More readable way of calling
1043 wxSizer::Insert(size, size, 0).
1045 wxSizerItem
* InsertSpacer(size_t index
, int size
);
1048 Inserts stretchable space to the sizer. More readable way of calling
1049 wxSizer::Insert(0, 0, prop).
1051 wxSizerItem
* InsertStretchSpacer(size_t index
, int prop
= 1);
1055 Returns @true if the @e window, @e sizer, or item at @e index is shown.
1059 bool IsShown(wxWindow
* window
);
1060 bool IsShown(wxSizer
* sizer
);
1061 bool IsShown(size_t index
);
1065 Call this to force layout of the children anew, e.g. after having added a child
1066 to or removed a child (window, other sizer or space) from the sizer while
1068 the current dimension.
1074 Same as Add(), but prepends the items to the beginning of the
1075 list of items (windows, subsizers or spaces) owned by this sizer.
1077 wxSizerItem
* Prepend(wxWindow
* window
, const wxSizerFlags
& flags
);
1078 wxSizerItem
* Prepend(wxWindow
* window
, int proportion
= 0,
1081 wxObject
* userData
= @NULL
);
1082 wxSizerItem
* Prepend(wxSizer
* sizer
,
1083 const wxSizerFlags
& flags
);
1084 wxSizerItem
* Prepend(wxSizer
* sizer
, int proportion
= 0,
1087 wxObject
* userData
= @NULL
);
1088 wxSizerItem
* Prepend(int width
, int height
,
1092 wxObject
* userData
= @NULL
);
1096 Prepends non-stretchable space to the sizer. More readable way of calling
1097 wxSizer::Prepend(size, size, 0).
1099 wxSizerItem
* PrependSpacer(int size
);
1102 Prepends stretchable space to the sizer. More readable way of calling
1103 wxSizer::Prepend(0, 0, prop).
1105 wxSizerItem
* PrependStretchSpacer(int prop
= 1);
1108 This method is abstract and has to be overwritten by any derived class.
1109 Here, the sizer will do the actual calculation of its children's positions
1116 Removes a child from the sizer and destroys it if it is a sizer or a spacer,
1117 but not if it is a window (because windows are owned by their parent window,
1118 not the sizer). @e sizer is the wxSizer to be removed,
1119 @e index is the position of the child in the sizer, e.g. 0 for the first item.
1120 This method does not cause any layout or resizing to take place, call
1121 Layout() to update the layout "on screen" after removing a
1122 child from the sizer.
1124 @b NB: The method taking a wxWindow* parameter is deprecated as it does not
1125 destroy the window as would usually be expected from Remove. You should use
1126 Detach() in new code instead. There is
1127 currently no wxSizer method that will both detach and destroy a wxWindow item.
1129 Returns @true if the child item was found and removed, @false otherwise.
1131 bool Remove(wxWindow
* window
);
1132 bool Remove(wxSizer
* sizer
);
1133 bool Remove(size_t index
);
1138 Detaches the given @e oldwin, @e oldsz child from the sizer and
1139 replaces it with the given window, sizer, or wxSizerItem.
1141 The detached child is removed @b only if it is a sizer or a spacer
1142 (because windows are owned by their parent window, not the sizer).
1144 Use parameter @e recursive to search the given element recursively in subsizers.
1145 This method does not cause any layout or resizing to take place, call
1146 Layout() to update the layout "on screen" after replacing a
1147 child from the sizer.
1149 Returns @true if the child item was found and removed, @false otherwise.
1151 bool Replace(wxWindow
* oldwin
, wxWindow
* newwin
,
1152 bool recursive
= @
false);
1153 bool Replace(wxSizer
* oldsz
, wxSizer
* newsz
,
1154 bool recursive
= @
false);
1155 bool Remove(size_t oldindex
, wxSizerItem
* newitem
);
1159 Call this to force the sizer to take the given dimension and thus force the
1161 by the sizer to resize themselves according to the rules defined by the
1163 Add() and Prepend() methods.
1165 void SetDimension(int x
, int y
, int width
, int height
);
1169 Set an item's minimum size by window, sizer, or position. The item will be
1171 in the sizer's descendants. This function enables an application to set the
1173 after initial creation.
1175 void SetItemMinSize(wxWindow
* window
, int width
, int height
);
1176 void SetItemMinSize(wxSizer
* sizer
, int width
, int height
);
1177 void SetItemMinSize(size_t index
, int width
, int height
);
1182 Call this to give the sizer a minimal size. Normally, the sizer will calculate
1184 minimal size based purely on how much space its children need. After calling
1186 method GetMinSize() will return either the minimal size
1187 as requested by its children or the minimal size set here, depending on which is
1190 void SetMinSize(int width
, int height
);
1191 void SetMinSize(const wxSize
& size
);
1195 This method first calls Fit() and then
1196 wxTopLevelWindow::SetSizeHints on the @e window
1197 passed to it. This only makes sense when @e window is actually a
1198 wxTopLevelWindow such as a wxFrame or a
1199 wxDialog, since SetSizeHints only has any effect in these classes.
1200 It does nothing in normal windows or controls.
1202 This method is implicitly used by wxWindow::SetSizerAndFit
1203 which is commonly invoked in the constructor of a toplevel window itself (see
1204 the sample in the description of wxBoxSizer) if the
1205 toplevel window is resizable.
1207 void SetSizeHints(wxWindow
* window
);
1210 Tell the sizer to set the minimal size of the @e window virtual area to match
1212 minimal size. For windows with managed scrollbars this will set them
1215 @sa wxScrolledWindow::SetScrollbars
1217 void SetVirtualSizeHints(wxWindow
* window
);
1221 Shows or hides the @e window, @e sizer, or item at @e index.
1222 To make a sizer item disappear or reappear, use Show() followed by Layout().
1223 Use parameter @e recursive to show or hide elements found in subsizers.
1225 Returns @true if the child item was found, @false otherwise.
1227 @sa Hide(), IsShown()
1229 bool Show(wxWindow
* window
, bool show
= @
true,
1230 bool recursive
= @
false);
1231 bool Show(wxSizer
* sizer
, bool show
= @
true,
1232 bool recursive
= @
false);
1233 bool Show(size_t index
, bool show
= @
true);
1242 A grid sizer is a sizer which lays out its children in a two-dimensional
1243 table with all table fields having the same size,
1244 i.e. the width of each field is the width of the widest child,
1245 the height of each field is the height of the tallest child.
1248 @category{winlayout}
1251 wxSizer, @ref overview_sizeroverview "Sizer overview"
1253 class wxGridSizer
: public wxSizer
1258 Constructor for a wxGridSizer. @e rows and @e cols determine the number of
1259 columns and rows in the sizer - if either of the parameters is zero, it will be
1260 calculated to form the total number of children in the sizer, thus making the
1261 sizer grow dynamically. @e vgap and @e hgap define extra space between
1264 wxGridSizer(int rows
, int cols
, int vgap
, int hgap
);
1265 wxGridSizer(int cols
, int vgap
= 0, int hgap
= 0);
1269 Returns the number of columns in the sizer.
1274 Returns the horizontal gap (in pixels) between cells in the sizer.
1279 Returns the number of rows in the sizer.
1284 Returns the vertical gap (in pixels) between the cells in the sizer.
1289 Sets the number of columns in the sizer.
1291 void SetCols(int cols
);
1294 Sets the horizontal gap (in pixels) between cells in the sizer.
1296 void SetHGap(int gap
);
1299 Sets the number of rows in the sizer.
1301 void SetRows(int rows
);
1304 Sets the vertical gap (in pixels) between the cells in the sizer.
1306 void SetVGap(int gap
);
1311 @class wxStaticBoxSizer
1314 wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds a static
1315 box around the sizer. This static box may be either created independently or
1316 the sizer may create it itself as a convenience. In any case, the sizer owns
1317 the wxStaticBox control and will delete it if it is
1321 @category{winlayout}
1324 wxSizer, wxStaticBox, wxBoxSizer, @ref overview_sizeroverview "Sizer overview"
1326 class wxStaticBoxSizer
: public wxBoxSizer
1331 The first constructor uses an already existing static box. It takes the
1332 associated static box and the orientation @e orient, which can be either
1333 @c wxVERTICAL or @c wxHORIZONTAL as parameters.
1335 The second one creates a new static box with the given label and parent window.
1337 wxStaticBoxSizer(wxStaticBox
* box
, int orient
);
1338 wxStaticBoxSizer(int orient
, wxWindow parent
,
1339 const wxString
& label
= wxEmptyString
);
1343 Returns the static box associated with the sizer.
1345 wxStaticBox
* GetStaticBox();
1353 The basic idea behind a box sizer is that windows will most often be laid out
1355 simple basic geometry, typically in a row or a column or several hierarchies of
1358 For more information, please see @ref overview_boxsizerprogramming "Programming
1362 @category{winlayout}
1365 wxSizer, @ref overview_sizeroverview "Sizer overview"
1367 class wxBoxSizer
: public wxSizer
1371 Constructor for a wxBoxSizer. @e orient may be either of wxVERTICAL
1372 or wxHORIZONTAL for creating either a column sizer or a row sizer.
1374 wxBoxSizer(int orient
);
1377 Implements the calculation of a box sizer's minimal. It is used internally
1378 only and must not be called by the user. Documented for information.
1383 Returns the orientation of the box sizer, either wxVERTICAL
1386 int GetOrientation();
1389 Implements the calculation of a box sizer's dimensions and then sets
1390 the size of its children (calling wxWindow::SetSize
1391 if the child is a window). It is used internally only and must not be called
1392 by the user (call Layout() if you want to resize). Documented for information.