#include <wx/sizer.h>
wxSizer is the abstract base class used for laying out subwindows in a window.
You cannot use wxSizer directly; instead, you will have to use one of the sizer classes derived from it. Currently there are wxBoxSizer, wxStaticBoxSizer, wxGridSizer, wxFlexGridSizer, wxWrapSizer and wxGridBagSizer.
The layout algorithm used by sizers in wxWidgets is closely related to layout in other GUI toolkits, such as Java's AWT, the GTK toolkit or the Qt toolkit. It is based upon the idea of the individual subwindows reporting their minimal required size and their ability to get stretched if the size of the parent window has changed.
This will most often mean that the programmer does not set the original size of a dialog in the beginning, rather the dialog will be assigned a sizer and this sizer will be queried about the recommended size. The sizer in turn will query its children, which can be normal windows, empty space or other sizers, so that a hierarchy of sizers can be constructed. Note that wxSizer does not derive from wxWindow and thus does not interfere with tab ordering and requires very little resources compared to a real window on screen.
What makes sizers so well fitted for use in wxWidgets is the fact that every control reports its own minimal size and the algorithm can handle differences in font sizes or different window (dialog item) sizes on different platforms without problems. If e.g. the standard font as well as the overall design of Motif widgets requires more space than on Windows, the initial dialog size will automatically be bigger on Motif than on Windows.
Sizers may also be used to control the layout of custom drawn items on the window. The wxSizer::Add(), wxSizer::Insert(), and wxSizer::Prepend() functions return a pointer to the newly added wxSizerItem. Just add empty space of the desired size and attributes, and then use the wxSizerItem::GetRect() method to determine where the drawing operations should take place.
Please notice that sizers, like child windows, are owned by the library and will be deleted by it which implies that they must be allocated on the heap. However if you create a sizer and do not add it to another sizer or window, the library wouldn't be able to delete such an orphan sizer and in this, and only this, case it should be deleted explicitly.
The "flag" argument accepted by wxSizeItem constructors and other functions, e.g. wxSizer::Add(), is OR-combination of the following flags. Two main behaviours are defined using these flags. One is the border around a window: the border parameter determines the border width whereas the flags given here determine which side(s) of the item that the border will be added. The other flags determine how the sizer item behaves when the space allotted to the sizer changes, and is somewhat dependent on the specific kind of sizer used.
wxTOP wxBOTTOM wxLEFT wxRIGHT wxALL | These flags are used to specify which side(s) of the sizer item the border width will apply to. |
wxEXPAND | The item will be expanded to fill the space assigned to the item. |
wxSHAPED | The item will be expanded as much as possible while also maintaining its aspect ratio. |
wxFIXED_MINSIZE | Normally wxSizers will use GetAdjustedBestSize() to determine what the minimal size of window items should be, and will use that size to calculate the layout. This allows layouts to adjust when an item changes and its best size becomes different. If you would rather have a window item stay the size it started with then use wxFIXED_MINSIZE . |
wxRESERVE_SPACE_EVEN_IF_HIDDEN | Normally wxSizers don't allocate space for hidden windows or other items. This flag overrides this behaviour so that sufficient space is allocated for the window even if it isn't visible. This makes it possible to dynamically show and hide controls without resizing parent dialog, for example. (Available since 2.8.8.) |
wxALIGN_CENTER wxALIGN_CENTRE wxALIGN_LEFT wxALIGN_RIGHT wxALIGN_TOP wxALIGN_BOTTOM wxALIGN_CENTER_VERTICAL wxALIGN_CENTRE_VERTICAL wxALIGN_CENTER_HORIZONTAL wxALIGN_CENTRE_HORIZONTAL | The wxALIGN_* flags allow you to specify the alignment of the item within the space allotted to it by the sizer, adjusted for the border if any. |
Public Member Functions | |
wxSizer () | |
The constructor. | |
virtual | ~wxSizer () |
The destructor. | |
wxSizerItem * | Add (wxWindow *window, const wxSizerFlags &flags) |
Appends a child to the sizer. | |
wxSizerItem * | Add (wxWindow *window, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Appends a child to the sizer. | |
wxSizerItem * | Add (wxSizer *sizer, const wxSizerFlags &flags) |
Appends a child to the sizer. | |
wxSizerItem * | Add (wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Appends a child to the sizer. | |
wxSizerItem * | Add (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Appends a spacer child to the sizer. | |
wxSizerItem * | Add (int width, int height, const wxSizerFlags &flags) |
Appends a spacer child to the sizer. | |
wxSizerItem * | Add (wxSizerItem *item) |
virtual wxSizerItem * | AddSpacer (int size) |
This base function adds non-stretchable space to both the horizontal and vertical orientation of the sizer. | |
wxSizerItem * | AddStretchSpacer (int prop=1) |
Adds stretchable space to the sizer. | |
virtual wxSize | CalcMin ()=0 |
This method is abstract and has to be overwritten by any derived class. | |
virtual void | Clear (bool delete_windows=false) |
Detaches all children from the sizer. | |
wxSize | ComputeFittingClientSize (wxWindow *window) |
Computes client area size for window so that it matches the sizer's minimal size. | |
wxSize | ComputeFittingWindowSize (wxWindow *window) |
Like ComputeFittingClientSize(), but converts the result into window size. | |
virtual bool | Detach (wxWindow *window) |
Detach the child window from the sizer without destroying it. | |
virtual bool | Detach (wxSizer *sizer) |
Detach the child sizer from the sizer without destroying it. | |
virtual bool | Detach (int index) |
Detach a item at position index from the sizer without destroying it. | |
wxSize | Fit (wxWindow *window) |
Tell the sizer to resize the window so that its client area matches the sizer's minimal size (ComputeFittingClientSize() is called to determine it). | |
void | FitInside (wxWindow *window) |
Tell the sizer to resize the virtual size of the window to match the sizer's minimal size. | |
virtual bool | InformFirstDirection (int direction, int size, int availableOtherDir) |
Inform sizer about the first direction that has been decided (by parent item). | |
wxWindow * | GetContainingWindow () const |
Returns the window this sizer is used in or NULL if none. | |
void | SetContainingWindow (wxWindow *window) |
Set the window this sizer is used in. | |
size_t | GetItemCount () const |
Returns the number of items in the sizer. | |
wxSizerItem * | GetItem (wxWindow *window, bool recursive=false) |
Finds wxSizerItem which holds the given window. | |
wxSizerItem * | GetItem (wxSizer *sizer, bool recursive=false) |
Finds wxSizerItem which holds the given sizer. | |
wxSizerItem * | GetItem (size_t index) |
Finds wxSizerItem which is located in the sizer at position index. | |
wxSizerItem * | GetItemById (int id, bool recursive=false) |
Finds item of the sizer which has the given id. | |
wxSize | GetMinSize () |
Returns the minimal size of the sizer. | |
wxPoint | GetPosition () const |
Returns the current position of the sizer. | |
wxSize | GetSize () const |
Returns the current size of the sizer. | |
bool | Hide (wxWindow *window, bool recursive=false) |
Hides the child window. | |
bool | Hide (wxSizer *sizer, bool recursive=false) |
Hides the child sizer. | |
bool | Hide (size_t index) |
Hides the item at position index. | |
wxSizerItem * | Insert (size_t index, wxWindow *window, const wxSizerFlags &flags) |
Insert a child into the sizer before any existing item at index. | |
wxSizerItem * | Insert (size_t index, wxWindow *window, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Insert a child into the sizer before any existing item at index. | |
wxSizerItem * | Insert (size_t index, wxSizer *sizer, const wxSizerFlags &flags) |
Insert a child into the sizer before any existing item at index. | |
wxSizerItem * | Insert (size_t index, wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Insert a child into the sizer before any existing item at index. | |
wxSizerItem * | Insert (size_t index, int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Insert a child into the sizer before any existing item at index. | |
wxSizerItem * | Insert (size_t index, int width, int height, const wxSizerFlags &flags) |
Insert a child into the sizer before any existing item at index. | |
wxSizerItem * | Insert (size_t index, wxSizerItem *item) |
wxSizerItem * | InsertSpacer (size_t index, int size) |
Inserts non-stretchable space to the sizer. | |
wxSizerItem * | InsertStretchSpacer (size_t index, int prop=1) |
Inserts stretchable space to the sizer. | |
bool | IsEmpty () const |
Return true if the sizer has no elements. | |
bool | IsShown (wxWindow *window) const |
Returns true if the window is shown. | |
bool | IsShown (wxSizer *sizer) const |
Returns true if the sizer is shown. | |
bool | IsShown (size_t index) const |
Returns true if the item at index is shown. | |
virtual void | Layout () |
Call this to force layout of the children anew, e.g. after having added a child to or removed a child (window, other sizer or space) from the sizer while keeping the current dimension. | |
wxSizerItem * | Prepend (wxWindow *window, const wxSizerFlags &flags) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer. | |
wxSizerItem * | Prepend (wxWindow *window, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer. | |
wxSizerItem * | Prepend (wxSizer *sizer, const wxSizerFlags &flags) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer. | |
wxSizerItem * | Prepend (wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer. | |
wxSizerItem * | Prepend (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer. | |
wxSizerItem * | Prepend (int width, int height, const wxSizerFlags &flags) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer. | |
wxSizerItem * | Prepend (wxSizerItem *item) |
wxSizerItem * | PrependSpacer (int size) |
Prepends non-stretchable space to the sizer. | |
wxSizerItem * | PrependStretchSpacer (int prop=1) |
Prepends stretchable space to the sizer. | |
virtual void | RecalcSizes ()=0 |
This method is abstract and has to be overwritten by any derived class. | |
virtual bool | Remove (wxWindow *window) |
Removes a child window from the sizer, but does not destroy it (because windows are owned by their parent window, not the sizer). | |
virtual bool | Remove (wxSizer *sizer) |
Removes a sizer child from the sizer and destroys it. | |
virtual bool | Remove (int index) |
Removes a child from the sizer and destroys it if it is a sizer or a spacer, but not if it is a window (because windows are owned by their parent window, not the sizer). | |
virtual bool | Replace (wxWindow *oldwin, wxWindow *newwin, bool recursive=false) |
Detaches the given oldwin from the sizer and replaces it with the given newwin. | |
virtual bool | Replace (wxSizer *oldsz, wxSizer *newsz, bool recursive=false) |
Detaches the given oldsz from the sizer and replaces it with the given newsz. | |
virtual bool | Replace (size_t index, wxSizerItem *newitem) |
Detaches the given item at position index from the sizer and replaces it with the given wxSizerItem newitem. | |
void | SetDimension (int x, int y, int width, int height) |
Call this to force the sizer to take the given dimension and thus force the items owned by the sizer to resize themselves according to the rules defined by the parameter in the Add() and Prepend() methods. | |
void | SetDimension (const wxPoint &pos, const wxSize &size) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | SetMinSize (const wxSize &size) |
Call this to give the sizer a minimal size. | |
void | SetMinSize (int width, int height) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
void | SetSizeHints (wxWindow *window) |
This method first calls Fit() and then wxTopLevelWindow::SetSizeHints() on the window passed to it. | |
void | SetVirtualSizeHints (wxWindow *window) |
Tell the sizer to set the minimal size of the window virtual area to match the sizer's minimal size. | |
bool | Show (wxWindow *window, bool show=true, bool recursive=false) |
Shows or hides the window. | |
bool | Show (wxSizer *sizer, bool show=true, bool recursive=false) |
Shows or hides sizer. | |
bool | Show (size_t index, bool show=true) |
Shows the item at index. | |
virtual void | ShowItems (bool show) |
Show or hide all items managed by the sizer. | |
wxSizerItemList & | GetChildren () |
Returns the list of the items in this sizer. | |
const wxSizerItemList & | GetChildren () const |
Returns the list of the items in this sizer. | |
bool | SetItemMinSize (wxWindow *window, int width, int height) |
Set an item's minimum size by window, sizer, or position. | |
bool | SetItemMinSize (wxWindow *window, const wxSize &size) |
Set an item's minimum size by window, sizer, or position. | |
bool | SetItemMinSize (wxSizer *sizer, int width, int height) |
Set an item's minimum size by window, sizer, or position. | |
bool | SetItemMinSize (wxSizer *sizer, const wxSize &size) |
Set an item's minimum size by window, sizer, or position. | |
bool | SetItemMinSize (size_t index, int width, int height) |
Set an item's minimum size by window, sizer, or position. | |
bool | SetItemMinSize (size_t index, const wxSize &size) |
Set an item's minimum size by window, sizer, or position. | |
Public Member Functions inherited from wxObject | |
wxObject () | |
Default ctor; initializes to NULL the internal reference data. | |
wxObject (const wxObject &other) | |
Copy ctor. | |
virtual | ~wxObject () |
Destructor. | |
virtual wxClassInfo * | GetClassInfo () const |
This virtual function is redefined for every class that requires run-time type information, when using the wxDECLARE_CLASS macro (or similar). | |
wxObjectRefData * | GetRefData () const |
Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. | |
bool | IsKindOf (const wxClassInfo *info) const |
Determines whether this class is a subclass of (or the same class as) the given class. | |
bool | IsSameAs (const wxObject &obj) const |
Returns true if this object has the same data pointer as obj. | |
void | Ref (const wxObject &clone) |
Makes this object refer to the data in clone. | |
void | SetRefData (wxObjectRefData *data) |
Sets the wxObject::m_refData pointer. | |
void | UnRef () |
Decrements the reference count in the associated data, and if it is zero, deletes the data. | |
void | UnShare () |
This is the same of AllocExclusive() but this method is public. | |
void | operator delete (void *buf) |
The delete operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. | |
void * | operator new (size_t size, const wxString &filename=NULL, int lineNum=0) |
The new operator is defined for debugging versions of the library only, when the identifier WXDEBUG is defined. | |
Additional Inherited Members | |
Protected Member Functions inherited from wxObject | |
void | AllocExclusive () |
Ensure that this object's data is not shared with any other object. | |
virtual wxObjectRefData * | CreateRefData () const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. | |
virtual wxObjectRefData * | CloneRefData (const wxObjectRefData *data) const |
Creates a new instance of the wxObjectRefData-derived class specific to this object and initializes it copying data. | |
Protected Attributes inherited from wxObject | |
wxObjectRefData * | m_refData |
Pointer to an object which is the object's reference-counted data. | |
wxSizer::wxSizer | ( | ) |
The constructor.
Note that wxSizer is an abstract base class and may not be instantiated.
|
virtual |
The destructor.
wxSizerItem* wxSizer::Add | ( | wxWindow * | window, |
const wxSizerFlags & | flags | ||
) |
Appends a child to the sizer.
wxSizer itself is an abstract class, but the parameters are equivalent in the derived classes that you will instantiate to use it so they are described here:
window | The window to be added to the sizer. Its initial size (either set explicitly by the user or calculated internally when using wxDefaultSize) is interpreted as the minimal and in many cases also the initial size. |
flags | A wxSizerFlags object that enables you to specify most of the above parameters more conveniently. |
wxSizerItem* wxSizer::Add | ( | wxWindow * | window, |
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Appends a child to the sizer.
wxSizer itself is an abstract class, but the parameters are equivalent in the derived classes that you will instantiate to use it so they are described here:
window | The window to be added to the sizer. Its initial size (either set explicitly by the user or calculated internally when using wxDefaultSize) is interpreted as the minimal and in many cases also the initial size. |
proportion | Although the meaning of this parameter is undefined in wxSizer, it is used in wxBoxSizer to indicate if a child of a sizer can change its size in the main orientation of the wxBoxSizer - where 0 stands for not changeable and a value of more than zero is interpreted relative to the value of other children of the same wxBoxSizer. For example, you might have a horizontal wxBoxSizer with three children, two of which are supposed to change their size with the sizer. Then the two stretchable windows would get a value of 1 each to make them grow and shrink equally with the sizer's horizontal dimension. |
flag | OR-combination of flags affecting sizer's behaviour. See wxSizer flags list for details. |
border | Determines the border width, if the flag parameter is set to include any border flag. |
userData | Allows an extra object to be attached to the sizer item, for use in derived classes when sizing information is more complex than the proportion and flag will allow for. |
wxSizerItem* wxSizer::Add | ( | wxSizer * | sizer, |
const wxSizerFlags & | flags | ||
) |
Appends a child to the sizer.
wxSizer itself is an abstract class, but the parameters are equivalent in the derived classes that you will instantiate to use it so they are described here:
sizer | The (child-)sizer to be added to the sizer. This allows placing a child sizer in a sizer and thus to create hierarchies of sizers (typically a vertical box as the top sizer and several horizontal boxes on the level beneath). |
flags | A wxSizerFlags object that enables you to specify most of the above parameters more conveniently. |
wxSizerItem* wxSizer::Add | ( | wxSizer * | sizer, |
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Appends a child to the sizer.
wxSizer itself is an abstract class, but the parameters are equivalent in the derived classes that you will instantiate to use it so they are described here:
sizer | The (child-)sizer to be added to the sizer. This allows placing a child sizer in a sizer and thus to create hierarchies of sizers (typically a vertical box as the top sizer and several horizontal boxes on the level beneath). |
proportion | Although the meaning of this parameter is undefined in wxSizer, it is used in wxBoxSizer to indicate if a child of a sizer can change its size in the main orientation of the wxBoxSizer - where 0 stands for not changeable and a value of more than zero is interpreted relative to the value of other children of the same wxBoxSizer. For example, you might have a horizontal wxBoxSizer with three children, two of which are supposed to change their size with the sizer. Then the two stretchable windows would get a value of 1 each to make them grow and shrink equally with the sizer's horizontal dimension. |
flag | OR-combination of flags affecting sizer's behaviour. See wxSizer flags list for details. |
border | Determines the border width, if the flag parameter is set to include any border flag. |
userData | Allows an extra object to be attached to the sizer item, for use in derived classes when sizing information is more complex than the proportion and flag will allow for. |
wxSizerItem* wxSizer::Add | ( | int | width, |
int | height, | ||
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Appends a spacer child to the sizer.
wxSizer itself is an abstract class, but the parameters are equivalent in the derived classes that you will instantiate to use it so they are described here.
width and height specify the dimension of a spacer to be added to the sizer. Adding spacers to sizers gives more flexibility in the design of dialogs; imagine for example a horizontal box with two buttons at the bottom of a dialog: you might want to insert a space between the two buttons and make that space stretchable using the proportion flag and the result will be that the left button will be aligned with the left side of the dialog and the right button with the right side - the space in between will shrink and grow with the dialog.
width | Width of the spacer. |
height | Height of the spacer. |
proportion | Although the meaning of this parameter is undefined in wxSizer, it is used in wxBoxSizer to indicate if a child of a sizer can change its size in the main orientation of the wxBoxSizer - where 0 stands for not changeable and a value of more than zero is interpreted relative to the value of other children of the same wxBoxSizer. For example, you might have a horizontal wxBoxSizer with three children, two of which are supposed to change their size with the sizer. Then the two stretchable windows would get a value of 1 each to make them grow and shrink equally with the sizer's horizontal dimension. |
flag | OR-combination of flags affecting sizer's behaviour. See wxSizer flags list for details. |
border | Determines the border width, if the flag parameter is set to include any border flag. |
userData | Allows an extra object to be attached to the sizer item, for use in derived classes when sizing information is more complex than the proportion and flag will allow for. |
wxSizerItem* wxSizer::Add | ( | int | width, |
int | height, | ||
const wxSizerFlags & | flags | ||
) |
Appends a spacer child to the sizer.
width | Width of the spacer. |
height | Height of the spacer. |
flags | A wxSizerFlags object that enables you to specify most of the other parameters more conveniently. |
wxSizerItem* wxSizer::Add | ( | wxSizerItem * | item | ) |
|
virtual |
This base function adds non-stretchable space to both the horizontal and vertical orientation of the sizer.
More readable way of calling:
Reimplemented in wxBoxSizer.
wxSizerItem* wxSizer::AddStretchSpacer | ( | int | prop = 1 | ) |
|
pure virtual |
This method is abstract and has to be overwritten by any derived class.
Here, the sizer will do the actual calculation of its children's minimal sizes.
Implemented in wxBoxSizer, wxStaticBoxSizer, wxGridSizer, wxFlexGridSizer, wxStdDialogButtonSizer, wxGridBagSizer, and wxWrapSizer.
|
virtual |
Detaches all children from the sizer.
If delete_windows is true then child windows will also be deleted.
Notice that child sizers are always deleted, as a general consequence of the principle that sizers own their sizer children, but don't own their window children (because they are already owned by their parent windows).
Computes client area size for window so that it matches the sizer's minimal size.
Unlike GetMinSize(), this method accounts for other constraints imposed on window, namely display's size (returned size will never be too large for the display) and maximum window size if previously set by wxWindow::SetMaxSize().
The returned value is suitable for passing to wxWindow::SetClientSize() or wxWindow::SetMinClientSize().
Like ComputeFittingClientSize(), but converts the result into window size.
The returned value is suitable for passing to wxWindow::SetSize() or wxWindow::SetMinSize().
|
virtual |
Detach the child window from the sizer without destroying it.
This method does not cause any layout or resizing to take place, call Layout() to update the layout "on screen" after detaching a child from the sizer.
Returns true if the child item was found and detached, false otherwise.
|
virtual |
Detach the child sizer from the sizer without destroying it.
This method does not cause any layout or resizing to take place, call Layout() to update the layout "on screen" after detaching a child from the sizer.
Returns true if the child item was found and detached, false otherwise.
|
virtual |
Detach a item at position index from the sizer without destroying it.
This method does not cause any layout or resizing to take place, call Layout() to update the layout "on screen" after detaching a child from the sizer. Returns true if the child item was found and detached, false otherwise.
Tell the sizer to resize the window so that its client area matches the sizer's minimal size (ComputeFittingClientSize() is called to determine it).
This is commonly done in the constructor of the window itself, see sample in the description of wxBoxSizer.
void wxSizer::FitInside | ( | wxWindow * | window | ) |
Tell the sizer to resize the virtual size of the window to match the sizer's minimal size.
This will not alter the on screen size of the window, but may cause the addition/removal/alteration of scrollbars required to view the virtual area in windows which manage it.
wxSizerItemList& wxSizer::GetChildren | ( | ) |
Returns the list of the items in this sizer.
The elements of type-safe wxList wxSizerItemList
are pointers to objects of type wxSizerItem.
const wxSizerItemList& wxSizer::GetChildren | ( | ) | const |
Returns the list of the items in this sizer.
The elements of type-safe wxList wxSizerItemList
are pointers to objects of type wxSizerItem.
wxWindow* wxSizer::GetContainingWindow | ( | ) | const |
Returns the window this sizer is used in or NULL if none.
wxSizerItem* wxSizer::GetItem | ( | wxWindow * | window, |
bool | recursive = false |
||
) |
Finds wxSizerItem which holds the given window.
Use parameter recursive to search in subsizers too. Returns pointer to item or NULL.
wxSizerItem* wxSizer::GetItem | ( | wxSizer * | sizer, |
bool | recursive = false |
||
) |
Finds wxSizerItem which holds the given sizer.
Use parameter recursive to search in subsizers too. Returns pointer to item or NULL.
wxSizerItem* wxSizer::GetItem | ( | size_t | index | ) |
Finds wxSizerItem which is located in the sizer at position index.
Use parameter recursive to search in subsizers too. Returns pointer to item or NULL.
wxSizerItem* wxSizer::GetItemById | ( | int | id, |
bool | recursive = false |
||
) |
Finds item of the sizer which has the given id.
This id is not the window id but the id of the wxSizerItem itself. This is mainly useful for retrieving the sizers created from XRC resources. Use parameter recursive to search in subsizers too. Returns pointer to item or NULL.
size_t wxSizer::GetItemCount | ( | ) | const |
Returns the number of items in the sizer.
If you just need to test whether the sizer is empty or not you can also use IsEmpty() function.
wxSize wxSizer::GetMinSize | ( | ) |
Returns the minimal size of the sizer.
This is either the combined minimal size of all the children and their borders or the minimal size set by SetMinSize(), depending on which is bigger. Note that the returned value is client size, not window size. In particular, if you use the value to set toplevel window's minimal or actual size, use wxWindow::SetMinClientSize() or wxWindow::SetClientSize(), not wxWindow::SetMinSize() or wxWindow::SetSize().
wxPoint wxSizer::GetPosition | ( | ) | const |
Returns the current position of the sizer.
wxSize wxSizer::GetSize | ( | ) | const |
Returns the current size of the sizer.
bool wxSizer::Hide | ( | wxWindow * | window, |
bool | recursive = false |
||
) |
bool wxSizer::Hide | ( | wxSizer * | sizer, |
bool | recursive = false |
||
) |
bool wxSizer::Hide | ( | size_t | index | ) |
|
virtual |
Inform sizer about the first direction that has been decided (by parent item).
Returns true if it made use of the information (and recalculated min size).
Reimplemented in wxWrapSizer.
wxSizerItem* wxSizer::Insert | ( | size_t | index, |
wxWindow * | window, | ||
const wxSizerFlags & | flags | ||
) |
Insert a child into the sizer before any existing item at index.
See Add() for the meaning of the other parameters.
wxSizerItem* wxSizer::Insert | ( | size_t | index, |
wxWindow * | window, | ||
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Insert a child into the sizer before any existing item at index.
See Add() for the meaning of the other parameters.
wxSizerItem* wxSizer::Insert | ( | size_t | index, |
wxSizer * | sizer, | ||
const wxSizerFlags & | flags | ||
) |
Insert a child into the sizer before any existing item at index.
See Add() for the meaning of the other parameters.
wxSizerItem* wxSizer::Insert | ( | size_t | index, |
wxSizer * | sizer, | ||
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Insert a child into the sizer before any existing item at index.
See Add() for the meaning of the other parameters.
wxSizerItem* wxSizer::Insert | ( | size_t | index, |
int | width, | ||
int | height, | ||
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Insert a child into the sizer before any existing item at index.
See Add() for the meaning of the other parameters.
wxSizerItem* wxSizer::Insert | ( | size_t | index, |
int | width, | ||
int | height, | ||
const wxSizerFlags & | flags | ||
) |
Insert a child into the sizer before any existing item at index.
See Add() for the meaning of the other parameters.
wxSizerItem* wxSizer::Insert | ( | size_t | index, |
wxSizerItem * | item | ||
) |
wxSizerItem* wxSizer::InsertSpacer | ( | size_t | index, |
int | size | ||
) |
Inserts non-stretchable space to the sizer.
More readable way of calling wxSizer::Insert(index, size, size).
wxSizerItem* wxSizer::InsertStretchSpacer | ( | size_t | index, |
int | prop = 1 |
||
) |
Inserts stretchable space to the sizer.
More readable way of calling wxSizer::Insert(0, 0, prop).
bool wxSizer::IsEmpty | ( | ) | const |
Return true if the sizer has no elements.
bool wxSizer::IsShown | ( | wxWindow * | window | ) | const |
Returns true if the window is shown.
bool wxSizer::IsShown | ( | wxSizer * | sizer | ) | const |
Returns true if the sizer is shown.
bool wxSizer::IsShown | ( | size_t | index | ) | const |
Returns true if the item at index is shown.
|
virtual |
Call this to force layout of the children anew, e.g. after having added a child to or removed a child (window, other sizer or space) from the sizer while keeping the current dimension.
wxSizerItem* wxSizer::Prepend | ( | wxWindow * | window, |
const wxSizerFlags & | flags | ||
) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem* wxSizer::Prepend | ( | wxWindow * | window, |
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem* wxSizer::Prepend | ( | wxSizer * | sizer, |
const wxSizerFlags & | flags | ||
) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem* wxSizer::Prepend | ( | wxSizer * | sizer, |
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem* wxSizer::Prepend | ( | int | width, |
int | height, | ||
int | proportion = 0 , |
||
int | flag = 0 , |
||
int | border = 0 , |
||
wxObject * | userData = NULL |
||
) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem* wxSizer::Prepend | ( | int | width, |
int | height, | ||
const wxSizerFlags & | flags | ||
) |
Same as Add(), but prepends the items to the beginning of the list of items (windows, subsizers or spaces) owned by this sizer.
wxSizerItem* wxSizer::Prepend | ( | wxSizerItem * | item | ) |
wxSizerItem* wxSizer::PrependSpacer | ( | int | size | ) |
Prepends non-stretchable space to the sizer.
More readable way of calling wxSizer::Prepend(size, size, 0).
wxSizerItem* wxSizer::PrependStretchSpacer | ( | int | prop = 1 | ) |
Prepends stretchable space to the sizer.
More readable way of calling wxSizer::Prepend(0, 0, prop).
|
pure virtual |
This method is abstract and has to be overwritten by any derived class.
Here, the sizer will do the actual calculation of its children's positions and sizes.
Implemented in wxBoxSizer, wxStaticBoxSizer, wxGridSizer, wxFlexGridSizer, wxStdDialogButtonSizer, wxGridBagSizer, and wxWrapSizer.
|
virtual |
Removes a child window from the sizer, but does not destroy it (because windows are owned by their parent window, not the sizer).
|
virtual |
Removes a sizer child from the sizer and destroys it.
sizer | The wxSizer to be removed. |
|
virtual |
Removes a child from the sizer and destroys it if it is a sizer or a spacer, but not if it is a window (because windows are owned by their parent window, not the sizer).
index | The position of the child in the sizer, e.g. 0 for the first item. |
|
virtual |
Detaches the given oldwin from the sizer and replaces it with the given newwin.
The detached child window is not deleted (because windows are owned by their parent window, not the sizer).
Use parameter recursive to search the given element recursively in subsizers.
This method does not cause any layout or resizing to take place, call Layout() to update the layout "on screen" after replacing a child from the sizer.
Returns true if the child item was found and removed, false otherwise.
Detaches the given oldsz from the sizer and replaces it with the given newsz.
The detached child sizer is deleted.
Use parameter recursive to search the given element recursively in subsizers.
This method does not cause any layout or resizing to take place, call Layout() to update the layout "on screen" after replacing a child from the sizer.
Returns true if the child item was found and removed, false otherwise.
|
virtual |
Detaches the given item at position index from the sizer and replaces it with the given wxSizerItem newitem.
The detached child is deleted only if it is a sizer or a spacer (but not if it is a wxWindow because windows are owned by their parent window, not the sizer).
This method does not cause any layout or resizing to take place, call Layout() to update the layout "on screen" after replacing a child from the sizer.
Returns true if the child item was found and removed, false otherwise.
void wxSizer::SetContainingWindow | ( | wxWindow * | window | ) |
Set the window this sizer is used in.
void wxSizer::SetDimension | ( | int | x, |
int | y, | ||
int | width, | ||
int | height | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
bool wxSizer::SetItemMinSize | ( | wxWindow * | window, |
int | width, | ||
int | height | ||
) |
Set an item's minimum size by window, sizer, or position.
This function enables an application to set the size of an item after initial creation.
The window or sizer will be found recursively in the sizer's descendants.
Set an item's minimum size by window, sizer, or position.
This function enables an application to set the size of an item after initial creation.
The window or sizer will be found recursively in the sizer's descendants.
bool wxSizer::SetItemMinSize | ( | wxSizer * | sizer, |
int | width, | ||
int | height | ||
) |
Set an item's minimum size by window, sizer, or position.
This function enables an application to set the size of an item after initial creation.
The window or sizer will be found recursively in the sizer's descendants.
Set an item's minimum size by window, sizer, or position.
This function enables an application to set the size of an item after initial creation.
The window or sizer will be found recursively in the sizer's descendants.
bool wxSizer::SetItemMinSize | ( | size_t | index, |
int | width, | ||
int | height | ||
) |
Set an item's minimum size by window, sizer, or position.
This function enables an application to set the size of an item after initial creation.
The window or sizer will be found recursively in the sizer's descendants.
bool wxSizer::SetItemMinSize | ( | size_t | index, |
const wxSize & | size | ||
) |
Set an item's minimum size by window, sizer, or position.
This function enables an application to set the size of an item after initial creation.
The window or sizer will be found recursively in the sizer's descendants.
void wxSizer::SetMinSize | ( | const wxSize & | size | ) |
Call this to give the sizer a minimal size.
Normally, the sizer will calculate its minimal size based purely on how much space its children need. After calling this method GetMinSize() will return either the minimal size as requested by its children or the minimal size set here, depending on which is bigger.
void wxSizer::SetMinSize | ( | int | width, |
int | height | ||
) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
void wxSizer::SetSizeHints | ( | wxWindow * | window | ) |
This method first calls Fit() and then wxTopLevelWindow::SetSizeHints() on the window passed to it.
This only makes sense when window is actually a wxTopLevelWindow such as a wxFrame or a wxDialog, since SetSizeHints only has any effect in these classes. It does nothing in normal windows or controls.
This method is implicitly used by wxWindow::SetSizerAndFit() which is commonly invoked in the constructor of a toplevel window itself (see the sample in the description of wxBoxSizer) if the toplevel window is resizable.
void wxSizer::SetVirtualSizeHints | ( | wxWindow * | window | ) |
Tell the sizer to set the minimal size of the window virtual area to match the sizer's minimal size.
For windows with managed scrollbars this will set them appropriately.
bool wxSizer::Show | ( | wxWindow * | window, |
bool | show = true , |
||
bool | recursive = false |
||
) |
bool wxSizer::Show | ( | wxSizer * | sizer, |
bool | show = true , |
||
bool | recursive = false |
||
) |
bool wxSizer::Show | ( | size_t | index, |
bool | show = true |
||
) |
|
virtual |
Show or hide all items managed by the sizer.