]>
git.saurik.com Git - wxWidgets.git/blob - interface/sizer.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStdDialogButtonSizer
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.
39 @see wxSizer, @ref overview_sizeroverview "Sizer overview",
40 wxDialog::CreateButtonSizer
42 class wxStdDialogButtonSizer
: public wxBoxSizer
46 Constructor for a wxStdDialogButtonSizer.
48 wxStdDialogButtonSizer();
51 Adds a button to the wxStdDialogButtonSizer. The button must have one of the
52 following identifiers:
63 void AddButton(wxButton
* button
);
66 Rearranges the buttons and applies proper spacing between buttons to make them
67 match the platform or toolkit's interface guidelines.
72 Sets the affirmative button for the sizer. This allows you to use identifiers
73 other than the standard identifiers outlined above.
75 void SetAffirmativeButton(wxButton
* button
);
78 Sets the cancel button for the sizer. This allows you to use identifiers other
79 than the standard identifiers outlined above.
81 void SetCancelButton(wxButton
* button
);
84 Sets the negative button for the sizer. This allows you to use identifiers
85 other than the standard identifiers outlined above.
87 void SetNegativeButton(wxButton
* button
);
96 The wxSizerItem class is used to track the position, size and other
97 attributes of each item managed by a wxSizer. It is not
98 usually necessary to use this class because the sizer elements can also be
99 identified by their positions or window or sizer pointers but sometimes it may
100 be more convenient to use it directly.
105 class wxSizerItem
: public wxObject
110 Construct a sizer item for tracking a subsizer.
112 wxSizerItem(int width
, int height
, int proportion
, int flag
,
113 int border
, wxObject
* userData
);
114 wxSizerItem(wxWindow
* window
, const wxSizerFlags
& flags
);
115 wxSizerItem(wxWindow
* window
, int proportion
, int flag
,
118 wxSizerItem(wxSizer
* window
, const wxSizerFlags
& flags
);
119 wxSizerItem(wxSizer
* sizer
, int proportion
, int flag
,
125 Deletes the user data and subsizer, if any.
130 Calculates the minimum desired size for the item, including any space
136 Destroy the window or the windows in a subsizer, depending on the type
139 void DeleteWindows();
142 Enable deleting the SizerItem without destroying the contained sizer.
147 Return the border attribute.
149 int GetBorder() const;
152 Return the flags attribute.
157 Return the numeric id of wxSizerItem, or @c wxID_NONE if the id has
163 Get the minimum size needed for the item.
165 wxSize
GetMinSize() const;
168 What is the current position of the item, as set in the last Layout.
170 wxPoint
GetPosition() const;
173 Get the proportion item attribute.
175 int GetProportion() const;
178 Get the ration item attribute.
180 float GetRatio() const;
183 Get the rectangle of the item on the parent window, excluding borders.
188 Get the current size of the item, as set in the last Layout.
190 wxSize
GetSize() const;
193 If this item is tracking a sizer, return it. @NULL otherwise.
195 wxSizer
* GetSizer() const;
198 If this item is tracking a spacer, return its size.
200 const wxSize
GetSpacer() const;
203 Get the userData item attribute.
205 wxObject
* GetUserData() const;
208 If this item is tracking a window then return it. @NULL otherwise.
210 wxWindow
* GetWindow() const;
213 Returns @true if this item is a window or a spacer and it is shown or if this
214 item is a sizer and not all its elements are hidden. In other words, for sizer
215 items, all of the child elements must be hidden for the sizer itself to be
218 bool IsShown() const;
221 Is this item a sizer?
223 bool IsSizer() const;
226 Is this item a spacer?
228 bool IsSpacer() const;
231 Is this item a window?
233 bool IsWindow() const;
236 Set the border item attribute.
238 void SetBorder(int border
);
241 Set the position and size of the space allocated to the sizer, and
242 adjust the position and size of the item to be within that space
243 taking alignment and borders into account.
245 void SetDimension(const wxPoint
& pos
, const wxSize
& size
);
248 Set the flag item attribute.
250 void SetFlag(int flag
);
253 Sets the numeric id of the wxSizerItem to @e id.
260 void SetInitSize(int x
, int y
);
263 Set the proportion item attribute.
265 void SetProportion(int proportion
);
269 Set the ratio item attribute.
271 void SetRatio(int width
, int height
);
272 void SetRatio(wxSize size
);
273 void SetRatio(float ratio
);
277 Set the sizer tracked by this item.
279 void SetSizer(wxSizer
* sizer
);
282 Set the size of the spacer tracked by this item.
284 void SetSpacer(const wxSize
& size
);
287 Set the window to be tracked by thsi item.
289 void SetWindow(wxWindow
* window
);
292 Set the show item attribute, which sizers use to determine if the item
293 is to be made part of the layout or not. If the item is tracking a
294 window then it is shown or hidden as needed.
296 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
345 Creates the wxSizer with the proportion specified by @e proportion.
347 wxSizerFlags(int proportion
= 0);
350 Sets the alignment of this wxSizerFlags to @e align.
351 Note that if this method is not called, the wxSizerFlags has no specified
354 @see Top(), Left(), Right(),
357 wxSizerFlags
Align(int align
= 0);
361 Sets the wxSizerFlags to have a border of a number of pixels specified by
362 @a borderinpixels with the directions specified by @e direction.
363 In the overloaded version without @a borderinpixels parameter, the border of
364 default size, as returned by GetDefaultBorder(),
367 wxSizerFlags
Border(int direction
, int borderinpixels
);
368 wxSizerFlags
Border(int direction
= wxALL
);
372 Aligns the object to the bottom, shortcut for @c Align(wxALIGN_BOTTOM)
376 wxSizerFlags
Bottom();
379 Sets the object of the wxSizerFlags to center itself in the area it is given.
381 wxSizerFlags
Center();
384 Center() for people with the other dialect of english.
386 wxSizerFlags
Centre();
389 Sets the border in the given @a direction having twice the default border
392 wxSizerFlags
DoubleBorder(int direction
= wxALL
);
395 Sets the border in left and right directions having twice the default border
398 wxSizerFlags
DoubleHorzBorder();
401 Sets the object of the wxSizerFlags to expand to fill as much area as it can.
403 wxSizerFlags
Expand();
406 Set the @c wxFIXED_MINSIZE flag which indicates that the initial size of
407 the window should be also set as its minimal size.
409 wxSizerFlags
FixedMinSize();
412 Returns the border used by default in Border() method.
414 static int GetDefaultBorder();
417 Aligns the object to the left, shortcut for @c Align(wxALIGN_LEFT)
424 Sets the proportion of this wxSizerFlags to @e proportion
426 wxSizerFlags
Proportion(int proportion
= 0);
429 Aligns the object to the right, shortcut for @c Align(wxALIGN_RIGHT)
433 wxSizerFlags
Right();
436 Set the @c wx_SHAPED flag which indicates that the elements should
437 always keep the fixed width to height ratio equal to its original value.
439 wxSizerFlags
Shaped();
442 Aligns the object to the top, shortcut for @c Align(wxALIGN_TOP)
449 Sets the border in the given @a direction having thrice the default border
452 wxSizerFlags
TripleBorder(int direction
= wxALL
);
458 @class wxNotebookSizer
461 @b This class is deprecated and should not be used in new code! It is no
462 longer needed, wxNotebook control can be inserted
463 into any sizer class and its minimal size will be determined correctly.
464 See @ref overview_sizeroverview "wxSizer overview" for more information.
466 wxNotebookSizer is a specialized sizer to make sizers work in connection
467 with using notebooks. This sizer is different from any other sizer as
468 you must not add any children to it - instead, it queries the notebook class
470 The only thing this sizer does is to determine the size of the biggest
471 page of the notebook and report an adjusted minimal size to a more toplevel
477 @see wxSizer, wxNotebook, @ref overview_sizeroverview "Sizer overview"
479 class wxNotebookSizer
: public wxSizer
483 Constructor. It takes an associated notebook as its only parameter.
485 wxNotebookSizer(wxNotebook
* notebook
);
488 Returns the notebook associated with the sizer.
490 wxNotebook
* GetNotebook();
496 @class wxFlexGridSizer
499 A flex grid sizer is a sizer which lays out its children in a two-dimensional
500 table with all table fields in one row having the same
501 height and all fields in one column having the same width, but all
502 rows or all columns are not necessarily the same height or width as in
505 Since wxWidgets 2.5.0, wxFlexGridSizer can also size items equally in one
506 direction but unequally ("flexibly") in the other. If the sizer is only
507 flexible in one direction (this can be changed using
508 wxFlexGridSizer::SetFlexibleDirection),
509 it needs to be decided how the sizer should grow in the other ("non-flexible")
510 direction in order to fill the available space. The
511 wxFlexGridSizer::SetNonFlexibleGrowMode method
517 @see wxSizer, @ref overview_sizeroverview "Sizer overview"
519 class wxFlexGridSizer
: public wxGridSizer
524 Constructor for a wxGridSizer. @a rows and @a cols determine the number of
525 columns and rows in the sizer - if either of the parameters is zero, it will be
526 calculated to form the total number of children in the sizer, thus making the
527 sizer grow dynamically. @a vgap and @a hgap define extra space between
530 wxFlexGridSizer(int rows
, int cols
, int vgap
, int hgap
);
531 wxFlexGridSizer(int cols
, int vgap
= 0, int hgap
= 0);
535 Specifies that column @a idx (starting from zero) should be grown if
536 there is extra space available to the sizer.
537 The @a proportion parameter has the same meaning as the stretch factor for
538 the sizers() except that if all proportions are 0,
539 then all columns are resized equally (instead of not being resized at all).
541 void AddGrowableCol(size_t idx
, int proportion
= 0);
544 Specifies that row idx (starting from zero) should be grown if there
545 is extra space available to the sizer.
546 See AddGrowableCol() for the description
547 of @a proportion parameter.
549 void AddGrowableRow(size_t idx
, int proportion
= 0);
552 Returns a wxOrientation value that specifies whether the sizer flexibly
553 resizes its columns, rows, or both (default).
555 @returns One of the following values:
557 @see SetFlexibleDirection()
559 int GetFlexibleDirection() const;
562 Returns the value that specifies how the sizer grows in the "non-flexible"
563 direction if there is one.
565 @returns One of the following values:
567 @see SetFlexibleDirection(),
568 SetNonFlexibleGrowMode()
570 int GetNonFlexibleGrowMode() const;
573 Specifies that column idx is no longer growable.
575 void RemoveGrowableCol(size_t idx
);
578 Specifies that row idx is no longer growable.
580 void RemoveGrowableRow(size_t idx
);
583 Specifies whether the sizer should flexibly resize its columns, rows, or
584 both. Argument @c direction can be @c wxVERTICAL, @c wxHORIZONTAL
585 or @c wxBOTH (which is the default value). Any other value is ignored. See
586 @ref getflexibledrection() GetFlexibleDirection for the
587 explanation of these values.
588 Note that this method does not trigger relayout.
590 void SetFlexibleDirection(int direction
);
593 Specifies how the sizer should grow in the non-flexible direction if
595 SetFlexibleDirection() must have
596 been called previously). Argument @a mode can be one of those documented in
597 GetNonFlexibleGrowMode(), please
598 see there for their explanation.
599 Note that this method does not trigger relayout.
601 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode
);
610 wxSizer is the abstract base class used for laying out subwindows in a window.
612 cannot use wxSizer directly; instead, you will have to use one of the sizer
613 classes derived from it. Currently there are wxBoxSizer,
620 The layout algorithm used by sizers in wxWidgets is closely related to layout
621 in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit.
623 based upon the idea of the individual subwindows reporting their minimal
625 size and their ability to get stretched if the size of the parent window has
627 This will most often mean that the programmer does not set the original size of
628 a dialog in the beginning, rather the dialog will be assigned a sizer and this
630 will be queried about the recommended size. The sizer in turn will query its
631 children, which can be normal windows, empty space or other sizers, so that
632 a hierarchy of sizers can be constructed. Note that wxSizer does not derive
634 and thus does not interfere with tab ordering and requires very little
636 to a real window on screen.
638 What makes sizers so well fitted for use in wxWidgets is the fact that every
640 reports its own minimal size and the algorithm can handle differences in font
642 or different window (dialog item) sizes on different platforms without
644 the standard font as well as the overall design of Motif widgets requires more
646 on Windows, the initial dialog size will automatically be bigger on Motif than
649 Sizers may also be used to control the layout of custom drawn items on the
651 Add, Insert, and Prepend functions return a pointer to the newly added
653 add empty space of the desired size and attributes, and then use the
655 method to determine where the drawing operations should take place.
657 Please notice that sizers, like child windows, are owned by the library and
658 will be deleted by it which implies that they must be allocated on the heap.
659 However if you create a sizer and do not add it to another sizer or window, the
660 library wouldn't be able to delete such an orphan sizer and in this, and only
661 this, case it should be deleted explicitly.
663 @b wxPython note: If you wish to create a sizer class in wxPython you should
664 derive the class from @c wxPySizer in order to get Python-aware
665 capabilities for the various virtual methods.
670 @see @ref overview_sizeroverview "Sizer overview"
672 class wxSizer
: public wxObject
676 The constructor. Note that wxSizer is an abstract base class and may not
688 Appends a child to the sizer. wxSizer itself is an abstract class, but the
690 equivalent in the derived classes that you will instantiate to use it so they
695 The window to be added to the sizer. Its initial size (either set
697 user or calculated internally when using wxDefaultSize) is interpreted as
698 the minimal and in many
699 cases also the initial size.
701 The (child-)sizer to be added to the sizer. This allows placing a child
703 sizer and thus to create hierarchies of sizers (typically a vertical box as
704 the top sizer and several
705 horizontal boxes on the level beneath).
706 @param width and height
707 The dimension of a spacer to be added to the sizer. Adding spacers to sizers
708 gives more flexibility in the design of dialogs; imagine for example a
709 horizontal box with two buttons at the
710 bottom of a dialog: you might want to insert a space between the two
711 buttons and make that space stretchable
712 using the proportion flag and the result will be that the left button will
713 be aligned with the left
714 side of the dialog and the right button with the right side - the space in
715 between will shrink and grow with
718 Although the meaning of this parameter is undefined in wxSizer, it is used
720 to indicate if a child of a sizer can change its size in the main
721 orientation of the wxBoxSizer - where
722 0 stands for not changeable and a value of more than zero is interpreted
723 relative to the value of other
724 children of the same wxBoxSizer. For example, you might have a horizontal
725 wxBoxSizer with three children, two
726 of which are supposed to change their size with the sizer. Then the two
727 stretchable windows would get a
728 value of 1 each to make them grow and shrink equally with the sizer's
729 horizontal dimension.
731 This parameter can be used to set a number of flags
732 which can be combined using the binary OR operator |. Two main
733 behaviours are defined using these flags. One is the border around a
734 window: the border parameter determines the border width whereas
735 the flags given here determine which side(s) of the item that the
736 border will be added. The other flags determine how the sizer item
737 behaves when the space allotted to the sizer changes, and is somewhat
738 dependent on the specific kind of sizer used.
758 These flags are used to specify which side(s) of
759 the sizer item the border width will apply to.
770 The item will be expanded to fill
771 the space assigned to the item.
782 The item will be expanded as much
783 as possible while also maintaining its aspect ratio
794 Normally wxSizers will use
795 GetAdjustedBestSize to
796 determine what the minimal size of window items should be, and will
797 use that size to calculate the layout. This allows layouts to
798 adjust when an item changes and its best size becomes
799 different. If you would rather have a window item stay the size it
800 started with then use wxFIXED_MINSIZE.
806 wxALIGN_CENTER wxALIGN_CENTRE
816 wxALIGN_CENTER_VERTICAL wxALIGN_CENTRE_VERTICAL
818 wxALIGN_CENTER_HORIZONTAL wxALIGN_CENTRE_HORIZONTAL
823 The wxALIGN flags allow you to
824 specify the alignment of the item within the space allotted to it by
825 the sizer, adjusted for the border if any.
827 Determines the border width, if the flag
828 parameter is set to include any border flag.
830 Allows an extra object to be attached to the sizer
831 item, for use in derived classes when sizing information is more
832 complex than the proportion and flag will allow for.
834 A wxSizerFlags object that
835 enables you to specify most of the above parameters more conveniently.
837 wxSizerItem
* Add(wxWindow
* window
, const wxSizerFlags
& flags
);
838 wxSizerItem
* Add(wxWindow
* window
, int proportion
= 0,
841 wxObject
* userData
= NULL
);
842 wxSizerItem
* Add(wxSizer
* sizer
, const wxSizerFlags
& flags
);
843 wxSizerItem
* Add(wxSizer
* sizer
, int proportion
= 0,
846 wxObject
* userData
= NULL
);
847 wxSizerItem
* Add(int width
, int height
, int proportion
= 0,
850 wxObject
* userData
= NULL
);
854 Adds non-stretchable space to the sizer. More readable way of calling
855 wxSizer::Add(size, size, 0).
857 wxSizerItem
* AddSpacer(int size
);
860 Adds stretchable space to the sizer. More readable way of calling
861 wxSizer::Add(0, 0, prop).
863 wxSizerItem
* AddStretchSpacer(int prop
= 1);
866 This method is abstract and has to be overwritten by any derived class.
867 Here, the sizer will do the actual calculation of its children's minimal sizes.
872 Detaches all children from the sizer. If @a delete_windows is @true then
873 child windows will also be deleted.
875 void Clear(bool delete_windows
= false);
878 Computes client area size for @a window so that it matches the sizer's
879 minimal size. Unlike GetMinSize(), this method accounts for other
880 constraints imposed on @e window, namely display's size (returned size
881 will never be too large for the display) and maximum window size if
882 previously set by wxWindow::SetMaxSize(). The returned value is
883 suitable for passing to wxWindow::SetClientSize() or
884 wxWindow::SetMinClientSize().
888 @see ComputeFittingWindowSize(), Fit()
890 wxSize
ComputeFittingClientSize(wxWindow
* window
);
893 Like ComputeFittingClientSize(), but converts the result into window
894 size. The returned value is suitable for passing to wxWindow::SetSize()
895 or wxWindow::SetMinSize().
899 @see ComputeFittingClientSize(), Fit()
901 wxSize
ComputeFittingWindowSize(wxWindow
* window
);
905 Detach a child from the sizer without destroying it. @a window is the window to
907 detached, @a sizer is the equivalent sizer and @a index is the position of
908 the child in the sizer, typically 0 for the first item. This method does not
909 cause any layout or resizing to take place, call Layout()
910 to update the layout "on screen" after detaching a child from the sizer.
911 Returns @true if the child item was found and detached, @false otherwise.
915 bool Detach(wxWindow
* window
);
916 bool Detach(wxSizer
* sizer
);
917 bool Detach(size_t index
);
921 Tell the sizer to resize the @a window so that its client area matches the
923 (ComputeFittingClientSize() is called
925 This is commonly done in the constructor of the window
926 itself, see sample in the description
927 of wxBoxSizer. Returns the new window size.
929 @see ComputeFittingClientSize(), ComputeFittingWindowSize()
931 wxSize
Fit(wxWindow
* window
);
934 Tell the sizer to resize the virtual size of the @a window to match the sizer's
935 minimal size. This will not alter the on screen size of the window, but may
937 the addition/removal/alteration of scrollbars required to view the virtual area
939 windows which manage it.
941 @see wxScrolledWindow::SetScrollbars, SetVirtualSizeHints()
943 void FitInside(wxWindow
* window
);
947 Returns the list of the items in this sizer. The elements of type-safe
948 wxList @c wxSizerItemList are objects of type
949 @ref overview_wxsizeritem "wxSizerItem *".
951 const wxSizerItemList
GetChildren();
952 const wxSizerItemList
GetChildren();
956 Returns the window this sizer is used in or @NULL if none.
958 wxWindow
* GetContainingWindow() const;
962 Finds item of the sizer which holds given @e window, @a sizer or is located
963 in sizer at position @e index.
964 Use parameter @a recursive to search in subsizers too.
965 Returns pointer to item or @NULL.
967 wxSizerItem
* GetItem(wxWindow
* window
, bool recursive
= false);
968 wxSizerItem
* GetItem(wxSizer
* sizer
, bool recursive
= false);
969 wxSizerItem
* GetItem(size_t index
);
973 Finds item of the sizer which has the given @e id. This @a id is not the
974 window id but the id of the wxSizerItem itself. This is mainly useful for
975 retrieving the sizers created from XRC resources.
976 Use parameter @a recursive to search in subsizers too.
977 Returns pointer to item or @NULL.
979 wxSizerItem
* GetItemById(int id
, bool recursive
= false);
982 Returns the minimal size of the sizer. This is either the combined minimal
983 size of all the children and their borders or the minimal size set by
984 SetMinSize(), depending on which is bigger.
985 Note that the returned value is client size, not window size.
986 In particular, if you use the value to set toplevel window's minimal or
987 actual size, use wxWindow::SetMinClientSize
988 or wxWindow::SetClientSize, not
990 or wxWindow::SetSize.
995 Returns the current position of the sizer.
997 wxPoint
GetPosition();
1000 Returns the current size of the sizer.
1006 Hides the @e window, @e sizer, or item at @e index.
1007 To make a sizer item disappear, use Hide() followed by Layout().
1008 Use parameter @a recursive to hide elements found in subsizers.
1009 Returns @true if the child item was found, @false otherwise.
1011 @see IsShown(), Show()
1013 bool Hide(wxWindow
* window
, bool recursive
= false);
1014 bool Hide(wxSizer
* sizer
, bool recursive
= false);
1015 bool Hide(size_t index
);
1020 Insert a child into the sizer before any existing item at
1022 See Add() for the meaning of the other parameters.
1027 The position this child should assume in the sizer.
1029 wxSizerItem
* Insert(size_t index
, wxWindow
* window
,
1030 const wxSizerFlags
& flags
);
1031 wxSizerItem
* Insert(size_t index
, wxWindow
* window
,
1035 wxObject
* userData
= NULL
);
1036 wxSizerItem
* Insert(size_t index
, wxSizer
* sizer
,
1037 const wxSizerFlags
& flags
);
1038 wxSizerItem
* Insert(size_t index
, wxSizer
* sizer
,
1042 wxObject
* userData
= NULL
);
1043 wxSizerItem
* Insert(size_t index
, int width
, int height
,
1047 wxObject
* userData
= NULL
);
1051 Inserts non-stretchable space to the sizer. More readable way of calling
1052 wxSizer::Insert(size, size, 0).
1054 wxSizerItem
* InsertSpacer(size_t index
, int size
);
1057 Inserts stretchable space to the sizer. More readable way of calling
1058 wxSizer::Insert(0, 0, prop).
1060 wxSizerItem
* InsertStretchSpacer(size_t index
, int prop
= 1);
1064 Returns @true if the @e window, @e sizer, or item at @a index is shown.
1068 bool IsShown(wxWindow
* window
) const;
1069 const bool IsShown(wxSizer
* sizer
) const;
1070 const bool IsShown(size_t index
) const;
1074 Call this to force layout of the children anew, e.g. after having added a child
1075 to or removed a child (window, other sizer or space) from the sizer while
1077 the current dimension.
1083 Same as Add(), but prepends the items to the beginning of the
1084 list of items (windows, subsizers or spaces) owned by this sizer.
1086 wxSizerItem
* Prepend(wxWindow
* window
, const wxSizerFlags
& flags
);
1087 wxSizerItem
* Prepend(wxWindow
* window
, int proportion
= 0,
1090 wxObject
* userData
= NULL
);
1091 wxSizerItem
* Prepend(wxSizer
* sizer
,
1092 const wxSizerFlags
& flags
);
1093 wxSizerItem
* Prepend(wxSizer
* sizer
, int proportion
= 0,
1096 wxObject
* userData
= NULL
);
1097 wxSizerItem
* Prepend(int width
, int height
,
1101 wxObject
* userData
= NULL
);
1105 Prepends non-stretchable space to the sizer. More readable way of calling
1106 wxSizer::Prepend(size, size, 0).
1108 wxSizerItem
* PrependSpacer(int size
);
1111 Prepends stretchable space to the sizer. More readable way of calling
1112 wxSizer::Prepend(0, 0, prop).
1114 wxSizerItem
* PrependStretchSpacer(int prop
= 1);
1117 This method is abstract and has to be overwritten by any derived class.
1118 Here, the sizer will do the actual calculation of its children's positions
1125 Removes a child from the sizer and destroys it if it is a sizer or a spacer,
1126 but not if it is a window (because windows are owned by their parent window,
1127 not the sizer). @a sizer is the wxSizer to be removed,
1128 @a index is the position of the child in the sizer, e.g. 0 for the first item.
1129 This method does not cause any layout or resizing to take place, call
1130 Layout() to update the layout "on screen" after removing a
1131 child from the sizer.
1132 @b NB: The method taking a wxWindow* parameter is deprecated as it does not
1133 destroy the window as would usually be expected from Remove. You should use
1134 Detach() in new code instead. There is
1135 currently no wxSizer method that will both detach and destroy a wxWindow item.
1136 Returns @true if the child item was found and removed, @false otherwise.
1138 bool Remove(wxWindow
* window
);
1139 bool Remove(wxSizer
* sizer
);
1140 bool Remove(size_t index
);
1145 Detaches the given @e oldwin, @a oldsz child from the sizer and
1146 replaces it with the given window, sizer, or wxSizerItem.
1147 The detached child is removed @b only if it is a sizer or a spacer
1148 (because windows are owned by their parent window, not the sizer).
1149 Use parameter @a recursive to search the given element recursively in subsizers.
1151 This method does not cause any layout or resizing to take place, call
1152 Layout() to update the layout "on screen" after replacing a
1153 child from the sizer.
1154 Returns @true if the child item was found and removed, @false otherwise.
1156 bool Replace(wxWindow
* oldwin
, wxWindow
* newwin
,
1157 bool recursive
= false);
1158 bool Replace(wxSizer
* oldsz
, wxSizer
* newsz
,
1159 bool recursive
= false);
1160 bool Remove(size_t oldindex
, wxSizerItem
* newitem
);
1164 Call this to force the sizer to take the given dimension and thus force the
1166 by the sizer to resize themselves according to the rules defined by the
1168 Add() and Prepend() methods.
1170 void SetDimension(int x
, int y
, int width
, int height
);
1174 Set an item's minimum size by window, sizer, or position. The item will be
1176 in the sizer's descendants. This function enables an application to set the
1178 after initial creation.
1180 void SetItemMinSize(wxWindow
* window
, int width
, int height
);
1181 void SetItemMinSize(wxSizer
* sizer
, int width
, int height
);
1182 void SetItemMinSize(size_t index
, int width
, int height
);
1187 Call this to give the sizer a minimal size. Normally, the sizer will calculate
1189 minimal size based purely on how much space its children need. After calling
1191 method GetMinSize() will return either the minimal size
1192 as requested by its children or the minimal size set here, depending on which is
1195 void SetMinSize(int width
, int height
);
1196 void SetMinSize(const wxSize
& size
);
1200 This method first calls Fit() and then
1201 wxTopLevelWindow::SetSizeHints on the @e window
1202 passed to it. This only makes sense when @a window is actually a
1203 wxTopLevelWindow such as a wxFrame or a
1204 wxDialog, since SetSizeHints only has any effect in these classes.
1205 It does nothing in normal windows or controls.
1206 This method is implicitly used by wxWindow::SetSizerAndFit
1207 which is commonly invoked in the constructor of a toplevel window itself (see
1208 the sample in the description of wxBoxSizer) if the
1209 toplevel window is resizable.
1211 void SetSizeHints(wxWindow
* window
);
1214 Tell the sizer to set the minimal size of the @a window virtual area to match
1216 minimal size. For windows with managed scrollbars this will set them
1219 @see wxScrolledWindow::SetScrollbars
1221 void SetVirtualSizeHints(wxWindow
* window
);
1225 Shows or hides the @e window, @e sizer, or item at @e index.
1226 To make a sizer item disappear or reappear, use Show() followed by Layout().
1227 Use parameter @a recursive to show or hide elements found in subsizers.
1228 Returns @true if the child item was found, @false otherwise.
1230 @see Hide(), IsShown()
1232 bool Show(wxWindow
* window
, bool show
= true,
1233 bool recursive
= false);
1234 bool Show(wxSizer
* sizer
, bool show
= true,
1235 bool recursive
= false);
1236 bool Show(size_t index
, bool show
= true);
1246 A grid sizer is a sizer which lays out its children in a two-dimensional
1247 table with all table fields having the same size,
1248 i.e. the width of each field is the width of the widest child,
1249 the height of each field is the height of the tallest child.
1252 @category{winlayout}
1254 @see wxSizer, @ref overview_sizeroverview "Sizer overview"
1256 class wxGridSizer
: public wxSizer
1261 Constructor for a wxGridSizer. @a rows and @a cols determine the number of
1262 columns and rows in the sizer - if either of the parameters is zero, it will be
1263 calculated to form the total number of children in the sizer, thus making the
1264 sizer grow dynamically. @a vgap and @a hgap define extra space between
1267 wxGridSizer(int rows
, int cols
, int vgap
, int hgap
);
1268 wxGridSizer(int cols
, int vgap
= 0, int hgap
= 0);
1272 Returns the number of columns in the sizer.
1277 Returns the horizontal gap (in pixels) between cells in the sizer.
1282 Returns the number of rows in the sizer.
1287 Returns the vertical gap (in pixels) between the cells in the sizer.
1292 Sets the number of columns in the sizer.
1294 void SetCols(int cols
);
1297 Sets the horizontal gap (in pixels) between cells in the sizer.
1299 void SetHGap(int gap
);
1302 Sets the number of rows in the sizer.
1304 void SetRows(int rows
);
1307 Sets the vertical gap (in pixels) between the cells in the sizer.
1309 void SetVGap(int gap
);
1315 @class wxStaticBoxSizer
1318 wxStaticBoxSizer is a sizer derived from wxBoxSizer but adds a static
1319 box around the sizer. This static box may be either created independently or
1320 the sizer may create it itself as a convenience. In any case, the sizer owns
1321 the wxStaticBox control and will delete it if it is
1325 @category{winlayout}
1327 @see wxSizer, wxStaticBox, wxBoxSizer, @ref overview_sizeroverview "Sizer
1330 class wxStaticBoxSizer
: public wxBoxSizer
1335 The first constructor uses an already existing static box. It takes the
1336 associated static box and the orientation @e orient, which can be either
1337 @c wxVERTICAL or @c wxHORIZONTAL as parameters.
1338 The second one creates a new static box with the given label and parent window.
1340 wxStaticBoxSizer(wxStaticBox
* box
, int orient
);
1341 wxStaticBoxSizer(int orient
, wxWindow parent
,
1342 const wxString
& label
= wxEmptyString
);
1346 Returns the static box associated with the sizer.
1348 wxStaticBox
* GetStaticBox();
1357 The basic idea behind a box sizer is that windows will most often be laid out
1359 simple basic geometry, typically in a row or a column or several hierarchies of
1362 For more information, please see @ref overview_boxsizerprogramming "Programming
1366 @category{winlayout}
1368 @see wxSizer, @ref overview_sizeroverview "Sizer overview"
1370 class wxBoxSizer
: public wxSizer
1374 Constructor for a wxBoxSizer. @a orient may be either of wxVERTICAL
1375 or wxHORIZONTAL for creating either a column sizer or a row sizer.
1377 wxBoxSizer(int orient
);
1380 Implements the calculation of a box sizer's minimal. It is used internally
1381 only and must not be called by the user. Documented for information.
1386 Returns the orientation of the box sizer, either wxVERTICAL
1389 int GetOrientation();
1392 Implements the calculation of a box sizer's dimensions and then sets
1393 the size of its children (calling wxWindow::SetSize
1394 if the child is a window). It is used internally only and must not be called
1395 by the user (call Layout() if you want to resize). Documented for information.