## wxSizerItem

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.

Derived from

wxObject

Include files

<wx/sizer.h>

Members

wxSizerItem::wxSizerItem
wxSizerItem::~wxSizerItem
wxSizerItem::CalcMin
wxSizerItem::DeleteWindows
wxSizerItem::DetachSizer
wxSizerItem::GetBorder
wxSizerItem::GetFlag
wxSizerItem::GetMinSize
wxSizerItem::GetPosition
wxSizerItem::GetProportion
wxSizerItem::GetRatio
wxSizerItem::GetRect
wxSizerItem::GetSize
wxSizerItem::GetSizer
wxSizerItem::GetSpacer
wxSizerItem::GetUserData
wxSizerItem::GetWindow
wxSizerItem::IsSizer
wxSizerItem::IsShown
wxSizerItem::IsSpacer
wxSizerItem::IsWindow
wxSizerItem::SetBorder
wxSizerItem::SetDimension
wxSizerItem::SetFlag
wxSizerItem::SetInitSize
wxSizerItem::SetProportion
wxSizerItem::SetRatio
wxSizerItem::SetSizer
wxSizerItem::SetSpacer
wxSizerItem::SetWindow
wxSizerItem::Show

### wxSizerItem::wxSizerItem

wxSizerItem(int width, int height, int proportion, int flag, int border, wxObject* userData)

Construct a sizer item for tracking a spacer.

wxSizerItem(wxWindow* window, const wxSizerFlags& flags)

wxSizerItem(wxWindow* window, int proportion, int flag, int border, wxObject* userData)

Construct a sizer item for tracking a window.

wxSizerItem(wxSizer* window, const wxSizerFlags& flags)

wxSizerItem(wxSizer* sizer, int proportion, int flag, int border, wxObject* userData)

Construct a sizer item for tracking a subsizer.

### wxSizerItem::~wxSizerItem

~wxSizerItem()

Deletes the user data and subsizer, if any.

### wxSizerItem::CalcMin

wxSize CalcMin()

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

### wxSizerItem::DeleteWindows

void DeleteWindows()

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

### wxSizerItem::DetachSizer

void DetachSizer()

Enable deleting the SizerItem without destroying the contained sizer.

### wxSizerItem::GetBorder

int GetBorder() const

Return the border attribute.

### wxSizerItem::GetFlag

int GetFlag() const

Return the flags attribute.

### wxSizerItem::GetMinSize

wxSize GetMinSize() const

Get the minimum size needed for the item.

### wxSizerItem::GetPosition

wxPoint GetPosition() const

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

### wxSizerItem::GetProportion

int GetProportion() const

Get the proportion item attribute.

### wxSizerItem::GetRatio

float GetRatio() const

Get the ration item attribute.

### wxSizerItem::GetRect

wxRect GetRect()

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

### wxSizerItem::GetSize

wxSize GetSize() const

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

### wxSizerItem::GetSizer

wxSizer* GetSizer() const

If this item is tracking a sizer, return it. NULL otherwise.

### wxSizerItem::GetSpacer

const wxSize& GetSpacer() const

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

### wxSizerItem::GetUserData

wxObject* GetUserData() const

Get the userData item attribute.

### wxSizerItem::GetWindow

wxWindow* GetWindow() const

If this item is tracking a window then return it. NULL otherwise.

### wxSizerItem::IsSizer

bool IsSizer() const

Is this item a sizer?

### wxSizerItem::IsShown

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 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.

### wxSizerItem::IsSpacer

bool IsSpacer() const

Is this item a spacer?

### wxSizerItem::IsWindow

bool IsWindow() const

Is this item a window?

### wxSizerItem::SetBorder

void SetBorder(int border)

Set the border item attribute.

### wxSizerItem::SetDimension

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.

### wxSizerItem::SetFlag

void SetFlag(int flag)

Set the flag item attribute.

### wxSizerItem::SetInitSize

void SetInitSize(int x, int y)

### wxSizerItem::SetProportion

void SetProportion(int proportion)

Set the proportion item attribute.

### wxSizerItem::SetRatio

void SetRatio(int width, int height)

void SetRatio(wxSize size)

void SetRatio(float ratio)

Set the ratio item attribute.

### wxSizerItem::SetSizer

void SetSizer(wxSizer* sizer)

Set the sizer tracked by this item.

### wxSizerItem::SetSpacer

void SetSpacer(const wxSize& size)

Set the size of the spacer tracked by this item.

### wxSizerItem::SetWindow

void SetWindow(wxWindow* window)

Set the window to be tracked by thsi item.

### wxSizerItem::Show

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. If the item is tracking a window then it is shown or hidden as needed.