]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/sizer.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxStdDialogButtonSizer
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
10 @class wxStdDialogButtonSizer
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.
20 When there aren't interface guidelines defined for a particular platform or
21 toolkit, wxStdDialogButtonSizer reverts
22 to the Windows implementation.
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.
30 If you add a button with wxID_SAVE, on Mac OS X the button will be renamed to
32 the wxID_NO button will be renamed to "Don't Save" in accordance with the Mac
33 OS X Human Interface Guidelines.
38 @see wxSizer, @ref overview_sizer "Sizer Overview",
39 wxDialog::CreateButtonSizer
41 class wxStdDialogButtonSizer
: public wxBoxSizer
45 Constructor for a wxStdDialogButtonSizer.
47 wxStdDialogButtonSizer();
50 Adds a button to the wxStdDialogButtonSizer. The @a button must have
51 one of the following identifiers:
62 void AddButton(wxButton
* button
);
65 Rearranges the buttons and applies proper spacing between buttons to make them
66 match the platform or toolkit's interface guidelines.
71 Sets the affirmative button for the sizer. This allows you to use identifiers
72 other than the standard identifiers outlined above.
74 void SetAffirmativeButton(wxButton
* button
);
77 Sets the cancel button for the sizer. This allows you to use identifiers other
78 than the standard identifiers outlined above.
80 void SetCancelButton(wxButton
* button
);
83 Sets the negative button for the sizer. This allows you to use identifiers
84 other than the standard identifiers outlined above.
86 void SetNegativeButton(wxButton
* button
);
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.
103 class wxSizerItem
: public wxObject
108 Construct a sizer item for tracking a subsizer.
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
,
116 wxSizerItem(wxSizer
* window
, const wxSizerFlags
& flags
);
117 wxSizerItem(wxSizer
* sizer
, int proportion
, int flag
,
123 Deletes the user data and subsizer, if any.
128 Calculates the minimum desired size for the item, including any space
134 Destroy the window or the windows in a subsizer, depending on the type
137 void DeleteWindows();
140 Enable deleting the SizerItem without destroying the contained sizer.
145 Return the border attribute.
147 int GetBorder() const;
150 Return the flags attribute.
152 See @ref wxsizer_flags "wxSizer flags list" for details.
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 Sets the minimum size to be allocated for this item.
170 If this item is a window, the @a size is also passed to
171 wxWindow::SetMinSize().
173 void SetMinSize(const wxSize
& size
);
178 void SetMinSize(int x
, int y
);
181 What is the current position of the item, as set in the last Layout.
183 wxPoint
GetPosition() const;
186 Get the proportion item attribute.
188 int GetProportion() const;
191 Get the ration item attribute.
193 float GetRatio() const;
196 Get the rectangle of the item on the parent window, excluding borders.
201 Get the current size of the item, as set in the last Layout.
203 wxSize
GetSize() const;
206 If this item is tracking a sizer, return it. @NULL otherwise.
208 wxSizer
* GetSizer() const;
211 If this item is tracking a spacer, return its size.
213 const wxSize
GetSpacer() const;
216 Get the userData item attribute.
218 wxObject
* GetUserData() const;
221 If this item is tracking a window then return it. @NULL otherwise.
223 wxWindow
* GetWindow() const;
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.
229 In other words, for sizer items, all of the child elements must be
230 hidden for the sizer itself to be considered hidden.
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()).
236 bool IsShown() const;
239 Is this item a sizer?
241 bool IsSizer() const;
244 Is this item a spacer?
246 bool IsSpacer() const;
249 Is this item a window?
251 bool IsWindow() const;
254 Set the border item attribute.
256 void SetBorder(int border
);
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.
263 void SetDimension(const wxPoint
& pos
, const wxSize
& size
);
266 Set the flag item attribute.
268 void SetFlag(int flag
);
271 Sets the numeric id of the wxSizerItem to @e id.
278 void SetInitSize(int x
, int y
);
281 Set the proportion item attribute.
283 void SetProportion(int proportion
);
287 Set the ratio item attribute.
289 void SetRatio(int width
, int height
);
290 void SetRatio(wxSize size
);
291 void SetRatio(float ratio
);
295 Set the sizer tracked by this item.
297 void SetSizer(wxSizer
* sizer
);
300 Set the size of the spacer tracked by this item.
302 void SetSpacer(const wxSize
& size
);
305 Set the window to be tracked by thsi item.
307 void SetWindow(wxWindow
* window
);
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.
314 void Show(bool show
);
322 Container for sizer items flags providing readable names for them.
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
330 sizer->Add(ctrl, 0, wxEXPAND | wxALL, 10);
336 sizer->Add(ctrl, wxSizerFlags().Expand().Border(10));
339 This is more readable and also allows you to create wxSizerFlags objects which
340 can be reused for several sizer items.
343 wxSizerFlags flagsExpand(1);
344 flagsExpand.Expand().Border(10);
346 sizer->Add(ctrl1, flagsExpand);
347 sizer->Add(ctrl2, flagsExpand);
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
363 Creates the wxSizer with the proportion specified by @e proportion.
365 wxSizerFlags(int proportion
= 0);
368 Sets the alignment of this wxSizerFlags to @e align.
370 This method replaces the previously set alignment with the specified
373 @see Top(), Left(), Right(), Bottom(), Centre()
375 @param align Combination of @c wxALIGN_XXX bit masks.
377 wxSizerFlags
& Align(int align
= 0);
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.
383 wxSizerFlags
& Border(int direction
, int borderinpixels
);
386 Sets the wxSizerFlags to have a border with size as returned by
389 @param direction Direction(s) to apply the border in.
391 wxSizerFlags
& Border(int direction
= wxALL
);
394 Aligns the object to the bottom, similar for @c Align(wxALIGN_BOTTOM).
396 Unlike Align(), this method doesn't change the horizontal alignment of
399 wxSizerFlags
& Bottom();
402 Sets the object of the wxSizerFlags to center itself in the area it is
405 wxSizerFlags
& Center();
408 Center() for people with the other dialect of English.
410 wxSizerFlags
& Centre();
413 Sets the border in the given @a direction having twice the default
416 wxSizerFlags
& DoubleBorder(int direction
= wxALL
);
419 Sets the border in left and right directions having twice the default
422 wxSizerFlags
& DoubleHorzBorder();
425 Sets the object of the wxSizerFlags to expand to fill as much area as
428 wxSizerFlags
& Expand();
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.
434 wxSizerFlags
& FixedMinSize();
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.
445 wxSizerFlags
& ReserveSpaceEvenIfHidden();
448 Returns the border used by default in Border() method.
450 static int GetDefaultBorder();
453 Aligns the object to the left, similar for @c Align(wxALIGN_LEFT).
455 Unlike Align(), this method doesn't change the vertical alignment of
458 wxSizerFlags
& Left();
461 Sets the proportion of this wxSizerFlags to @e proportion
463 wxSizerFlags
& Proportion(int proportion
= 0);
466 Aligns the object to the right, similar for @c Align(wxALIGN_RIGHT).
468 Unlike Align(), this method doesn't change the vertical alignment of
471 wxSizerFlags
& Right();
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.
477 wxSizerFlags
& Shaped();
480 Aligns the object to the top, similar for @c Align(wxALIGN_TOP).
482 Unlike Align(), this method doesn't change the horizontal alignment of
488 Sets the border in the given @a direction having thrice the default
491 wxSizerFlags
& TripleBorder(int direction
= wxALL
);
497 @class wxNotebookSizer
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.
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
514 @see wxSizer, wxNotebook,
515 @ref overview_sizer "Sizers overview"
517 class wxNotebookSizer
: public wxSizer
521 Constructor. It takes an associated notebook as its only parameter.
523 wxNotebookSizer(wxNotebook
* notebook
);
526 Returns the notebook associated with the sizer.
528 wxNotebook
* GetNotebook();
534 @class wxFlexGridSizer
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
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
554 @see wxSizer, @ref overview_sizer "Sizer Overview"
556 class wxFlexGridSizer
: public wxGridSizer
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
567 wxFlexGridSizer(int rows
, int cols
, int vgap
, int hgap
);
568 wxFlexGridSizer(int cols
, int vgap
= 0, int hgap
= 0);
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).
578 void AddGrowableCol(size_t idx
, int proportion
= 0);
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.
586 void AddGrowableRow(size_t idx
, int proportion
= 0);
589 Returns a wxOrientation value that specifies whether the sizer flexibly
590 resizes its columns, rows, or both (default).
592 @return One of the following values:
594 @see SetFlexibleDirection()
596 int GetFlexibleDirection() const;
599 Returns the value that specifies how the sizer grows in the "non-flexible"
600 direction if there is one.
602 @return One of the following values:
604 @see SetFlexibleDirection(),
605 SetNonFlexibleGrowMode()
607 int GetNonFlexibleGrowMode() const;
610 Specifies that column idx is no longer growable.
612 void RemoveGrowableCol(size_t idx
);
615 Specifies that row idx is no longer growable.
617 void RemoveGrowableRow(size_t idx
);
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.
627 void SetFlexibleDirection(int direction
);
630 Specifies how the sizer should grow in the non-flexible direction if
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.
638 void SetNonFlexibleGrowMode(wxFlexSizerGrowMode mode
);
646 wxSizer is the abstract base class used for laying out subwindows in a window.
648 cannot use wxSizer directly; instead, you will have to use one of the sizer
649 classes derived from it. Currently there are wxBoxSizer,
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.
659 based upon the idea of the individual subwindows reporting their minimal
661 size and their ability to get stretched if the size of the parent window has
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
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
670 and thus does not interfere with tab ordering and requires very little
672 to a real window on screen.
674 What makes sizers so well fitted for use in wxWidgets is the fact that every
676 reports its own minimal size and the algorithm can handle differences in font
678 or different window (dialog item) sizes on different platforms without
680 the standard font as well as the overall design of Motif widgets requires more
682 on Windows, the initial dialog size will automatically be bigger on Motif than
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.
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.
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.
701 @anchor 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.
717 These flags are used to specify which side(s) of the sizer item
718 the border width will apply to.}
720 The item will be expanded to fill the space assigned to the item.}
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
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.)
738 @itemdef{wxALIGN_CENTER<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
757 @see @ref overview_sizer "Sizer Overview"
759 class wxSizer
: public wxObject
763 The constructor. Note that wxSizer is an abstract base class and may not
774 Appends a child to the sizer.
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
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
786 A wxSizerFlags object that enables you to specify most of the above
787 parameters more conveniently.
789 wxSizerItem
* Add(wxWindow
* window
, const wxSizerFlags
& flags
);
792 Appends a child to the sizer.
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
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
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
815 OR-combination of flags affecting sizer's behavior. See
816 @ref wxsizer_flags "wxSizer flags list" for details.
818 Determines the border width, if the flag parameter is set to
819 include any border flag.
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.
825 wxSizerItem
* Add(wxWindow
* window
, int proportion
= 0,
828 wxObject
* userData
= NULL
);
831 Appends a child to the sizer.
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
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).
843 A wxSizerFlags object that enables you to specify most of the above
844 parameters more conveniently.
846 wxSizerItem
* Add(wxSizer
* sizer
, const wxSizerFlags
& flags
);
849 Appends a child to the sizer.
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
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).
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
872 OR-combination of flags affecting sizer's behavior. See
873 @ref wxsizer_flags "wxSizer flags list" for details.
875 Determines the border width, if the flag parameter is set to
876 include any border flag.
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.
882 wxSizerItem
* Add(wxSizer
* sizer
, int proportion
= 0,
885 wxObject
* userData
= NULL
);
888 Appends a spacer child to the sizer.
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
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.
906 Height of the spacer.
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
919 OR-combination of flags affecting sizer's behavior. See
920 @ref wxsizer_flags "wxSizer flags list" for details.
922 Determines the border width, if the flag parameter is set to
923 include any border flag.
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.
929 wxSizerItem
* Add(int width
, int height
, int proportion
= 0,
932 wxObject
* userData
= NULL
);
935 Adds non-stretchable space to the sizer. More readable way of calling
936 wxSizer::Add(size, size, 0).
938 wxSizerItem
* AddSpacer(int size
);
941 Adds stretchable space to the sizer. More readable way of calling
942 wxSizer::Add(0, 0, prop).
944 wxSizerItem
* AddStretchSpacer(int prop
= 1);
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.
953 Detaches all children from the sizer. If @a delete_windows is @true then
954 child windows will also be deleted.
956 void Clear(bool delete_windows
= false);
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().
969 @see ComputeFittingWindowSize(), Fit()
971 wxSize
ComputeFittingClientSize(wxWindow
* window
);
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().
980 @see ComputeFittingClientSize(), Fit()
982 wxSize
ComputeFittingWindowSize(wxWindow
* window
);
985 Detach the child @a window from the sizer without destroying it.
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.
990 Returns @true if the child item was found and detached, @false otherwise.
994 bool Detach(wxWindow
* window
);
997 Detach the child @a sizer from the sizer without destroying it.
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.
1002 Returns @true if the child item was found and detached, @false otherwise.
1006 bool Detach(wxSizer
* sizer
);
1009 Detach a item at position @a index from the sizer without destroying it.
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.
1017 bool Detach(size_t index
);
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
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.
1028 @see ComputeFittingClientSize(), ComputeFittingWindowSize()
1030 wxSize
Fit(wxWindow
* window
);
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.
1038 @see wxScrolled::SetScrollbars(), SetVirtualSizeHints()
1040 void FitInside(wxWindow
* window
);
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".
1047 wxSizerItemList
& GetChildren();
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".
1054 const wxSizerItemList
& GetChildren() const;
1057 Returns the window this sizer is used in or @NULL if none.
1059 wxWindow
* GetContainingWindow() const;
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.
1066 wxSizerItem
* GetItem(wxWindow
* window
, bool recursive
= false);
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.
1074 wxSizerItem
* GetItem(wxSizer
* sizer
, bool recursive
= false);
1076 Finds wxSizerItem which is located in the sizer at position
1078 Use parameter @a recursive to search in subsizers too.
1079 Returns pointer to item or @NULL.
1081 wxSizerItem
* GetItem(size_t index
);
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.
1090 wxSizerItem
* GetItemById(int id
, bool recursive
= false);
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.
1103 wxSize
GetMinSize();
1106 Returns the current position of the sizer.
1108 wxPoint
GetPosition();
1111 Returns the current size of the sizer.
1116 Hides the child @a window.
1118 To make a sizer item disappear, use Hide() followed by Layout().
1120 Use parameter @a recursive to hide elements found in subsizers.
1121 Returns @true if the child item was found, @false otherwise.
1123 @see IsShown(), Show()
1125 bool Hide(wxWindow
* window
, bool recursive
= false);
1128 Hides the child @a sizer.
1130 To make a sizer item disappear, use Hide() followed by Layout().
1132 Use parameter @a recursive to hide elements found in subsizers.
1133 Returns @true if the child item was found, @false otherwise.
1135 @see IsShown(), Show()
1137 bool Hide(wxSizer
* sizer
, bool recursive
= false);
1140 Hides the item at position @a index.
1142 To make a sizer item disappear, use Hide() followed by Layout().
1144 Use parameter @a recursive to hide elements found in subsizers.
1145 Returns @true if the child item was found, @false otherwise.
1147 @see IsShown(), Show()
1149 bool Hide(size_t index
);
1152 Insert a child into the sizer before any existing item at
1154 See Add() for the meaning of the other parameters.
1156 wxSizerItem
* Insert(size_t index
, wxWindow
* window
,
1157 const wxSizerFlags
& flags
);
1160 Insert a child into the sizer before any existing item at
1162 See Add() for the meaning of the other parameters.
1164 wxSizerItem
* Insert(size_t index
, wxWindow
* window
,
1168 wxObject
* userData
= NULL
);
1171 Insert a child into the sizer before any existing item at
1173 See Add() for the meaning of the other parameters.
1175 wxSizerItem
* Insert(size_t index
, wxSizer
* sizer
,
1176 const wxSizerFlags
& flags
);
1179 Insert a child into the sizer before any existing item at
1181 See Add() for the meaning of the other parameters.
1183 wxSizerItem
* Insert(size_t index
, wxSizer
* sizer
,
1187 wxObject
* userData
= NULL
);
1190 Insert a child into the sizer before any existing item at
1192 See Add() for the meaning of the other parameters.
1194 wxSizerItem
* Insert(size_t index
, int width
, int height
,
1198 wxObject
* userData
= NULL
);
1201 Inserts non-stretchable space to the sizer. More readable way of calling
1202 wxSizer::Insert(size, size, 0).
1204 wxSizerItem
* InsertSpacer(size_t index
, int size
);
1207 Inserts stretchable space to the sizer. More readable way of calling
1208 wxSizer::Insert(0, 0, prop).
1210 wxSizerItem
* InsertStretchSpacer(size_t index
, int prop
= 1);
1213 Returns @true if the @e window is shown.
1215 @see Hide(), Show(), wxSizerItem::IsShown()
1217 bool IsShown(wxWindow
* window
) const;
1220 Returns @true if the @e sizer is shown.
1222 @see Hide(), Show(), wxSizerItem::IsShown()
1224 bool IsShown(wxSizer
* sizer
) const;
1227 Returns @true if the item at @a index is shown.
1229 @see Hide(), Show(), wxSizerItem::IsShown()
1231 bool IsShown(size_t index
) const;
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
1237 the current dimension.
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.
1245 wxSizerItem
* Prepend(wxWindow
* window
, const wxSizerFlags
& flags
);
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.
1251 wxSizerItem
* Prepend(wxWindow
* window
, int proportion
= 0,
1254 wxObject
* userData
= NULL
);
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.
1260 wxSizerItem
* Prepend(wxSizer
* sizer
,
1261 const wxSizerFlags
& flags
);
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.
1267 wxSizerItem
* Prepend(wxSizer
* sizer
, int proportion
= 0,
1270 wxObject
* userData
= NULL
);
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.
1276 wxSizerItem
* Prepend(int width
, int height
,
1280 wxObject
* userData
= NULL
);
1283 Prepends non-stretchable space to the sizer. More readable way of
1284 calling wxSizer::Prepend(size, size, 0).
1286 wxSizerItem
* PrependSpacer(int size
);
1289 Prepends stretchable space to the sizer. More readable way of calling
1290 wxSizer::Prepend(0, 0, prop).
1292 wxSizerItem
* PrependStretchSpacer(int prop
= 1);
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.
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).
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
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.
1316 @return @true if the child item was found and removed, @false otherwise.
1318 bool Remove(wxWindow
* window
);
1321 Removes a sizer child from the sizer and destroys it.
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.
1327 @param sizer The wxSizer to be removed.
1329 @return @true if the child item was found and removed, @false otherwise.
1331 bool Remove(wxSizer
* sizer
);
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).
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.
1342 @param index The position of the child in the sizer, e.g. 0 for the
1345 @return @true if the child item was found and removed, @false otherwise.
1347 bool Remove(size_t index
);
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).
1355 Use parameter @a recursive to search the given element recursively in subsizers.
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.
1361 Returns @true if the child item was found and removed, @false otherwise.
1363 bool Replace(wxWindow
* oldwin
, wxWindow
* newwin
,
1364 bool recursive
= false);
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.
1371 Use parameter @a recursive to search the given element recursively in subsizers.
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.
1377 Returns @true if the child item was found and removed, @false otherwise.
1379 bool Replace(wxSizer
* oldsz
, wxSizer
* newsz
,
1380 bool recursive
= false);
1383 Detaches the given item at position @a index from the sizer and
1384 replaces it with the given wxSizerItem @a newitem.
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).
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.
1394 Returns @true if the child item was found and removed, @false otherwise.
1396 bool Replace(size_t index
, wxSizerItem
* newitem
);
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.
1403 void SetDimension(int x
, int y
, int width
, int height
);
1408 void SetDimension(const wxPoint
& pos
, const wxSize
& size
);
1411 Set an item's minimum size by window, sizer, or position.
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
1417 @see wxSizerItem::SetMinSize()
1419 void SetItemMinSize(wxWindow
* window
, int width
, int height
);
1422 Set an item's minimum size by window, sizer, or position.
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
1428 @see wxSizerItem::SetMinSize()
1430 void SetItemMinSize(wxSizer
* sizer
, int width
, int height
);
1433 Set an item's minimum size by window, sizer, or position.
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
1439 @see wxSizerItem::SetMinSize()
1441 void SetItemMinSize(size_t index
, int width
, int height
);
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.
1450 void SetMinSize(const wxSize
& size
);
1455 void SetMinSize(int width
, int height
);
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.
1469 void SetSizeHints(wxWindow
* window
);
1472 Tell the sizer to set the minimal size of the @a window virtual area to match
1474 minimal size. For windows with managed scrollbars this will set them
1477 @see wxScrolled::SetScrollbars()
1479 void SetVirtualSizeHints(wxWindow
* window
);
1482 Shows or hides the @a window.
1483 To make a sizer item disappear or reappear, use Show() followed by Layout().
1485 Use parameter @a recursive to show or hide elements found in subsizers.
1487 Returns @true if the child item was found, @false otherwise.
1489 @see Hide(), IsShown()
1491 bool Show(wxWindow
* window
, bool show
= true,
1492 bool recursive
= false);
1495 Shows or hides @a sizer.
1496 To make a sizer item disappear or reappear, use Show() followed by Layout().
1498 Use parameter @a recursive to show or hide elements found in subsizers.
1500 Returns @true if the child item was found, @false otherwise.
1502 @see Hide(), IsShown()
1504 bool Show(wxSizer
* sizer
, bool show
= true,
1505 bool recursive
= false);
1508 Shows the item at @a index.
1509 To make a sizer item disappear or reappear, use Show() followed by Layout().
1511 Returns @true if the child item was found, @false otherwise.
1513 @see Hide(), IsShown()
1515 bool Show(size_t index
, bool show
= true);
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.
1529 @category{winlayout}
1531 @see wxSizer, @ref overview_sizer "Sizer Overview"
1533 class wxGridSizer
: public wxSizer
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
1544 wxGridSizer(int rows
, int cols
, int vgap
, int hgap
);
1545 wxGridSizer(int cols
, int vgap
= 0, int hgap
= 0);
1549 Returns the number of columns in the sizer.
1554 Returns the horizontal gap (in pixels) between cells in the sizer.
1559 Returns the number of rows in the sizer.
1564 Returns the vertical gap (in pixels) between the cells in the sizer.
1569 Sets the number of columns in the sizer.
1571 void SetCols(int cols
);
1574 Sets the horizontal gap (in pixels) between cells in the sizer.
1576 void SetHGap(int gap
);
1579 Sets the number of rows in the sizer.
1581 void SetRows(int rows
);
1584 Sets the vertical gap (in pixels) between the cells in the sizer.
1586 void SetVGap(int gap
);
1592 @class wxStaticBoxSizer
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
1601 @category{winlayout}
1603 @see wxSizer, wxStaticBox, wxBoxSizer, @ref overview_sizer
1606 class wxStaticBoxSizer
: public wxBoxSizer
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.
1616 wxStaticBoxSizer(wxStaticBox
* box
, int orient
);
1617 wxStaticBoxSizer(int orient
, wxWindow parent
,
1618 const wxString
& label
= wxEmptyString
);
1622 Returns the static box associated with the sizer.
1624 wxStaticBox
* GetStaticBox();
1632 The basic idea behind a box sizer is that windows will most often be laid out
1634 simple basic geometry, typically in a row or a column or several hierarchies of
1637 For more information, please see @ref overview_sizer_box
1638 "Programming with wxBoxSizer".
1641 @category{winlayout}
1643 @see wxSizer, @ref overview_sizer "Sizers Overview"
1645 class wxBoxSizer
: public wxSizer
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.
1652 wxBoxSizer(int orient
);
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.
1661 Returns the orientation of the box sizer, either wxVERTICAL
1664 int GetOrientation();
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.