wxWidgets: wxSizerItem Class Reference

| Version: 3.0.4

Public Member Functions | List of all members
wxSizerItem Class Reference
Class List by Category » Window Layout

`#include </usr/src/ports/wxWidgets3.0/wxWidgets3.0-3.0.4-1.x86_64/src/wxWidgets-3.0.4/interface/wx/sizer.h>`

Inheritance diagram for wxSizerItem:
[legend]

## Detailed Description

The wxSizerItem class is used to track the position, size and other attributes of each item managed by a wxSizer.

It is not usually necessary to use this class because the sizer elements can also be identified by their positions or window or sizer pointers but sometimes it may be more convenient to use it directly.

##

Library: wxCore

<>< =''>:</>&;&;< =''>\ </></>

## Public Member Functions
| wxSizerItem (int width, int height, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Construct a sizer item for tracking a spacer. More...
virtual | ~wxSizerItem ()
| Deletes the user data and subsizer, if any. More...
void | AssignWindow (wxWindow *window)
| Set the window to be tracked by this item. More...
void | AssignSizer (wxSizer *sizer)
| Set the sizer tracked by this item. More...
virtual wxSize | CalcMin ()
| Calculates the minimum desired size for the item, including any space needed by borders. More...
virtual void | DeleteWindows ()
| Destroy the window or the windows in a subsizer, depending on the type of item. More...
void | DetachSizer ()
| Enable deleting the SizerItem without destroying the contained sizer. More...
int | GetBorder () const
| Return the border attribute. More...
int | GetFlag () const
| Return the flags attribute. More...
int | GetId () const
| Return the numeric id of wxSizerItem, or `wxID_NONE` if the id has not been set. More...
wxSize | GetMinSize () const
| Get the minimum size needed for the item. More...
void | SetMinSize (const wxSize &size)
| Sets the minimum size to be allocated for this item. More...
void | SetMinSize (int x, int y)
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. More...
wxPoint | GetPosition () const
| What is the current position of the item, as set in the last Layout. More...
int | GetProportion () const
| Get the proportion item attribute. More...
float | GetRatio () const
| Get the ration item attribute. More...
virtual wxRect | GetRect ()
| Get the rectangle of the item on the parent window, excluding borders. More...
virtual wxSize | GetSize () const
| Get the current size of the item, as set in the last Layout. More...
wxSizer * | GetSizer () const
| If this item is tracking a sizer, return it. More...
wxSize | GetSpacer () const
| If this item is tracking a spacer, return its size. More...
wxObject * | GetUserData () const
| Get the userData item attribute. More...
wxWindow * | GetWindow () const
| If this item is tracking a window then return it. More...
bool | IsShown () const
| Returns true if this item is a window or a spacer and it is shown or if this item is a sizer and not all of its elements are hidden. More...
bool | IsSizer () const
| Is this item a sizer? More...
bool | IsSpacer () const
| Is this item a spacer? More...
bool | IsWindow () const
| Is this item a window? More...
void | SetBorder (int border)
| Set the border item attribute. More...
virtual void | SetDimension (const wxPoint &pos, const wxSize &size)
| Set the position and size of the space allocated to the sizer, and adjust the position and size of the item to be within that space taking alignment and borders into account. More...
void | SetFlag (int flag)
| Set the flag item attribute. More...
void | SetId (int id)
| Sets the numeric id of the wxSizerItem to id. More...
void | SetInitSize (int x, int y)
void | SetProportion (int proportion)
| Set the proportion item attribute. More...
void | SetSizer (wxSizer *sizer)
| Set the sizer tracked by this item. More...
void | SetSpacer (const wxSize &size)
| Set the size of the spacer tracked by this item. More...
void | SetUserData (wxObject *userData)
void | SetWindow (wxWindow *window)
| Set the window to be tracked by this item. More...
void | Show (bool show)
| Set the show item attribute, which sizers use to determine if the item is to be made part of the layout or not. More...
| wxSizerItem (wxWindow *window, const wxSizerFlags &flags)
| Construct a sizer item for tracking a window. More...
| wxSizerItem (wxWindow *window, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Construct a sizer item for tracking a window. More...
| wxSizerItem (wxSizer *sizer, const wxSizerFlags &flags)
| Construct a sizer item for tracking a subsizer. More...
| wxSizerItem (wxSizer *sizer, int proportion=0, int flag=0, int border=0, wxObject *userData=NULL)
| Construct a sizer item for tracking a subsizer. More...
void | AssignSpacer (const wxSize &size)
| Set the size of the spacer tracked by this item. More...
void | AssignSpacer (int w, int h)
| Set the size of the spacer tracked by this item. More...
void | SetRatio (int width, int height)
| Set the ratio item attribute. More...
void | SetRatio (wxSize size)
| Set the ratio item attribute. More...
void | SetRatio (float ratio)
| Set the ratio item attribute. More...
Public Member Functions inherited from wxObject
| wxObject ()
| Default ctor; initializes to NULL the internal reference data. More...
| wxObject (const wxObject &other)
| Copy ctor. More...
virtual | ~wxObject ()
| Destructor. More...
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). More...
wxObjectRefData * | GetRefData () const
| Returns the wxObject::m_refData pointer, i.e. the data referenced by this object. More...
bool | IsKindOf (const wxClassInfo *info) const
| Determines whether this class is a subclass of (or the same class as) the given class. More...
bool | IsSameAs (const wxObject &obj) const
| Returns true if this object has the same data pointer as obj. More...
void | Ref (const wxObject &clone)
| Makes this object refer to the data in clone. More...
void | SetRefData (wxObjectRefData *data)
| Sets the wxObject::m_refData pointer. More...
void | UnRef ()
| Decrements the reference count in the associated data, and if it is zero, deletes the data. More...
void | UnShare ()
| This is the same of AllocExclusive() but this method is public. More...
void | operator delete (void *buf)
| The delete operator is defined for debugging versions of the library only, when the identifier `WXDEBUG` is defined. More...
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. More...

## Additional Inherited Members
Protected Member Functions inherited from wxObject
void | AllocExclusive ()
| Ensure that this object's data is not shared with any other object. More...
virtual wxObjectRefData * | CreateRefData () const
| Creates a new instance of the wxObjectRefData-derived class specific to this object and returns it. More...
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. More...
Protected Attributes inherited from wxObject
wxObjectRefData * | m_refData
| Pointer to an object which is the object's reference-counted data. More...

## Constructor & Destructor Documentation

## ◆ wxSizerItem() [1/5]

wxSizerItem::wxSizerItem | ( | int | width,
|  | int | height,
|  | int | proportion = `0`,
|  | int | flag = `0`,
|  | int | border = `0`,
|  | wxObject * | userData = `NULL`
| ) |  |

Construct a sizer item for tracking a spacer.

## ◆ wxSizerItem() [2/5]

wxSizerItem::wxSizerItem | ( | wxWindow * | window,
|  | const wxSizerFlags & | flags
| ) |  |

Construct a sizer item for tracking a window.

## ◆ wxSizerItem() [3/5]

wxSizerItem::wxSizerItem | ( | wxWindow * | window,
|  | int | proportion = `0`,
|  | int | flag = `0`,
|  | int | border = `0`,
|  | wxObject * | userData = `NULL`
| ) |  |

Construct a sizer item for tracking a window.

## ◆ wxSizerItem() [4/5]

wxSizerItem::wxSizerItem | ( | wxSizer * | sizer,
|  | const wxSizerFlags & | flags
| ) |  |

Construct a sizer item for tracking a subsizer.

## ◆ wxSizerItem() [5/5]

wxSizerItem::wxSizerItem | ( | wxSizer * | sizer,
|  | int | proportion = `0`,
|  | int | flag = `0`,
|  | int | border = `0`,
|  | wxObject * | userData = `NULL`
| ) |  |

Construct a sizer item for tracking a subsizer.

## ◆ ~wxSizerItem()

virtual wxSizerItem::~wxSizerItem | ( |  | ) |
| virtual

Deletes the user data and subsizer, if any.

## Member Function Documentation

## ◆ AssignSizer()

void wxSizerItem::AssignSizer | ( | wxSizer * | sizer | ) |

Set the sizer tracked by this item.

Old sizer, if any, is deleted.

## ◆ AssignSpacer() [1/2]

void wxSizerItem::AssignSpacer | ( | const wxSize & | size | ) |

Set the size of the spacer tracked by this item.

Old spacer, if any, is deleted.

## ◆ AssignSpacer() [2/2]

void wxSizerItem::AssignSpacer | ( | int | w,
|  | int | h
| ) |  |

Set the size of the spacer tracked by this item.

Old spacer, if any, is deleted.

## ◆ AssignWindow()

void wxSizerItem::AssignWindow | ( | wxWindow * | window | ) |

Set the window to be tracked by this item.

The old window isn't deleted as it is now owned by the sizer item.

## ◆ CalcMin()

virtual wxSize wxSizerItem::CalcMin | ( |  | ) |
| virtual

Calculates the minimum desired size for the item, including any space needed by borders.

## ◆ DeleteWindows()

virtual void wxSizerItem::DeleteWindows | ( |  | ) |
| virtual

Destroy the window or the windows in a subsizer, depending on the type of item.

## ◆ DetachSizer()

void wxSizerItem::DetachSizer | ( |  | ) |

Enable deleting the SizerItem without destroying the contained sizer.

## ◆ GetBorder()

int wxSizerItem::GetBorder | ( |  | ) | const

Return the border attribute.

## ◆ GetFlag()

int wxSizerItem::GetFlag | ( |  | ) | const

Return the flags attribute.

See wxSizer flags list for details.

## ◆ GetId()

int wxSizerItem::GetId | ( |  | ) | const

Return the numeric id of wxSizerItem, or `wxID_NONE` if the id has not been set.

## ◆ GetMinSize()

wxSize wxSizerItem::GetMinSize | ( |  | ) | const

Get the minimum size needed for the item.

## ◆ GetPosition()

wxPoint wxSizerItem::GetPosition | ( |  | ) | const

What is the current position of the item, as set in the last Layout.

## ◆ GetProportion()

int wxSizerItem::GetProportion | ( |  | ) | const

Get the proportion item attribute.

## ◆ GetRatio()

float wxSizerItem::GetRatio | ( |  | ) | const

Get the ration item attribute.

## ◆ GetRect()

virtual wxRect wxSizerItem::GetRect | ( |  | ) |
| virtual

Get the rectangle of the item on the parent window, excluding borders.

## ◆ GetSize()

virtual wxSize wxSizerItem::GetSize | ( |  | ) | const
| virtual

Get the current size of the item, as set in the last Layout.

## ◆ GetSizer()

wxSizer* wxSizerItem::GetSizer | ( |  | ) | const

If this item is tracking a sizer, return it.

NULL otherwise.

## ◆ GetSpacer()

wxSize wxSizerItem::GetSpacer | ( |  | ) | const

If this item is tracking a spacer, return its size.

## ◆ GetUserData()

wxObject* wxSizerItem::GetUserData | ( |  | ) | const

Get the userData item attribute.

## ◆ GetWindow()

wxWindow* wxSizerItem::GetWindow | ( |  | ) | const

If this item is tracking a window then return it.

NULL otherwise.

## ◆ IsShown()

bool wxSizerItem::IsShown | ( |  | ) | const

Returns true if this item is a window or a spacer and it is shown or if this item is a sizer and not all of its elements are hidden.

In other words, for sizer items, all of the child elements must be hidden for the sizer itself to be considered hidden.

As an exception, if the `wxRESERVE_SPACE_EVEN_IF_HIDDEN` flag was used for this sizer item, then IsShown() always returns true for it (see wxSizerFlags::ReserveSpaceEvenIfHidden()).

## ◆ IsSizer()

bool wxSizerItem::IsSizer | ( |  | ) | const

Is this item a sizer?

## ◆ IsSpacer()

bool wxSizerItem::IsSpacer | ( |  | ) | const

Is this item a spacer?

## ◆ IsWindow()

bool wxSizerItem::IsWindow | ( |  | ) | const

Is this item a window?

## ◆ SetBorder()

void wxSizerItem::SetBorder | ( | int | border | ) |

Set the border item attribute.

## ◆ SetDimension()

virtual void wxSizerItem::SetDimension | ( | const wxPoint & | pos,
|  | const wxSize & | size
| ) |  |
| virtual

Set the position and size of the space allocated to the sizer, and adjust the position and size of the item to be within that space taking alignment and borders into account.

## ◆ SetFlag()

void wxSizerItem::SetFlag | ( | int | flag | ) |

Set the flag item attribute.

## ◆ SetId()

void wxSizerItem::SetId | ( | int | id | ) |

Sets the numeric id of the wxSizerItem to id.

## ◆ SetInitSize()

void wxSizerItem::SetInitSize | ( | int | x,
|  | int | y
| ) |  |

Todo:
  docme.

## ◆ SetMinSize() [1/2]

void wxSizerItem::SetMinSize | ( | const wxSize & | size | ) |

Sets the minimum size to be allocated for this item.

If this item is a window, the size is also passed to wxWindow::SetMinSize().

## ◆ SetMinSize() [2/2]

void wxSizerItem::SetMinSize | ( | int | x,
|  | int | y
| ) |  |

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

## ◆ SetProportion()

void wxSizerItem::SetProportion | ( | int | proportion | ) |

Set the proportion item attribute.

## ◆ SetRatio() [1/3]

void wxSizerItem::SetRatio | ( | int | width,
|  | int | height
| ) |  |

Set the ratio item attribute.

## ◆ SetRatio() [2/3]

void wxSizerItem::SetRatio | ( | wxSize | size | ) |

Set the ratio item attribute.

## ◆ SetRatio() [3/3]

void wxSizerItem::SetRatio | ( | float | ratio | ) |

Set the ratio item attribute.

## ◆ SetSizer()

void wxSizerItem::SetSizer | ( | wxSizer * | sizer | ) |

Set the sizer tracked by this item.

Deprecated:
  This function does not free the old sizer which may result in memory leaks, use AssignSizer() which does free it instead.

## ◆ SetSpacer()

void wxSizerItem::SetSpacer | ( | const wxSize & | size | ) |

Set the size of the spacer tracked by this item.

Deprecated:
  This function does not free the old spacer which may result in memory leaks, use AssignSpacer() which does free it instead.

## ◆ SetUserData()

void wxSizerItem::SetUserData | ( | wxObject * | userData | ) |

## ◆ SetWindow()

void wxSizerItem::SetWindow | ( | wxWindow * | window | ) |

Set the window to be tracked by this item.

Deprecated:

Todo:
  provide deprecation description

## ◆ Show()

void wxSizerItem::Show | ( | bool | show | ) |

Set the show item attribute, which sizers use to determine if the item is to be made part of the layout or not.

If the item is tracking a window then it is shown or hidden as needed.