wxSizerItem — wx v2.4.3

Search documentation of wx

# View Source wxSizerItem (wx v2.4.3)

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.

wxWidgets docs: wxSizerItem

# Summary

## Types

wxSizerItem()

## Functions

assignSizer(This, Sizer)

Set the sizer tracked by this item.

assignSpacer(This, Size)

Set the size of the spacer tracked by this item.

assignSpacer(This, W, H)
assignWindow(This, Window)

Set the window to be tracked by this item.

calcMin(This)

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

deleteWindows(This)

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

destroy(This)

Destroys the object

detachSizer(This)

Enable deleting the SizerItem without destroying the contained sizer.

getBorder(This)

Return the border attribute.

getFlag(This)

Return the flags attribute.

getMinSize(This)

Get the minimum size needed for the item.

getPosition(This)

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

getProportion(This)

Get the proportion item attribute.

getRatio(This)

Get the ratio item attribute.

getRect(This)

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

getSize(This)

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

getSizer(This)

If this item is tracking a sizer, return it.

getSpacer(This)

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

getUserData(This)

Get the userData item attribute.

getWindow(This)

If this item is tracking a window then return it.

isShown(This)

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.

isSizer(This)

Is this item a sizer?

isSpacer(This)

Is this item a spacer?

isWindow(This)

Is this item a window?

new(Window)

Equivalent to `new(Window, [])`.

new/2
new(Width, Height, Options)

Construct a sizer item for tracking a spacer.

setBorder(This, Border)

Set the border item attribute.

setDimension(This, Pos, 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.

setFlag(This, Flag)

Set the flag item attribute.

setInitSize(This, X, Y)

Sets the minimum size to be allocated for this item.

setMinSize(This, Size)

Sets the minimum size to be allocated for this item.

setMinSize(This, X, Y)

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

setProportion(This, Proportion)

Set the proportion item attribute.

setRatio/2
setRatio(This, Width, Height)

Set the ratio item attribute.

show(This, Show)

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

# Types

Link to this type

# wxSizerItem()

View Source

    -type wxSizerItem() :: wx:wx_object().

# Functions

Link to this function

# assignSizer(This, Sizer)

View Source

    -spec assignSizer(This, Sizer) -> ok when This :: wxSizerItem(), Sizer :: wxSizer:wxSizer().

Set the sizer tracked by this item.

Old sizer, if any, is deleted.

Link to this function

# assignSpacer(This, Size)

View Source

    -spec assignSpacer(This, Size) -> ok
                          when This :: wxSizerItem(), Size :: {W :: integer(), H :: integer()}.

Set the size of the spacer tracked by this item.

Old spacer, if any, is deleted.

Link to this function

# assignSpacer(This, W, H)

View Source

    -spec assignSpacer(This, W, H) -> ok when This :: wxSizerItem(), W :: integer(), H :: integer().

Link to this function

# assignWindow(This, Window)

View Source

    -spec assignWindow(This, Window) -> ok when This :: wxSizerItem(), Window :: wxWindow:wxWindow().

Set the window to be tracked by this item.

Note: This is a low-level method which is dangerous if used incorrectly, avoid using it if possible, i.e. if higher level methods such as `wxSizer:replace/4` can be used instead.

If the sizer item previously contained a window, it is dissociated from the sizer containing this sizer item (if any), but this object doesn't have the pointer to the containing sizer and so it's the caller's responsibility to call `wxWindow:setContainingSizer/2` on `window`. Failure to do this can result in memory corruption when the window is destroyed later, so it is crucial to not forget to do it.

Also note that the previously contained window is `not` deleted, so it's also the callers responsibility to do it, if necessary.

Link to this function

# calcMin(This)

View Source

    -spec calcMin(This) -> {W :: integer(), H :: integer()} when This :: wxSizerItem().

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

Link to this function

# deleteWindows(This)

View Source

    -spec deleteWindows(This) -> ok when This :: wxSizerItem().

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

Link to this function

# destroy(This)

View Source

    -spec destroy(This :: wxSizerItem()) -> ok.

Destroys the object

Link to this function

# detachSizer(This)

View Source

    -spec detachSizer(This) -> ok when This :: wxSizerItem().

Enable deleting the SizerItem without destroying the contained sizer.

Link to this function

# getBorder(This)

View Source

    -spec getBorder(This) -> integer() when This :: wxSizerItem().

Return the border attribute.

Link to this function

# getFlag(This)

View Source

    -spec getFlag(This) -> integer() when This :: wxSizerItem().

Return the flags attribute.

See `wxSizer flags list` (not implemented in wx) for details.

Link to this function

# getMinSize(This)

View Source

    -spec getMinSize(This) -> {W :: integer(), H :: integer()} when This :: wxSizerItem().

Get the minimum size needed for the item.

Link to this function

# getPosition(This)

View Source

    -spec getPosition(This) -> {X :: integer(), Y :: integer()} when This :: wxSizerItem().

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

Link to this function

# getProportion(This)

View Source

    -spec getProportion(This) -> integer() when This :: wxSizerItem().

Get the proportion item attribute.

Link to this function

# getRatio(This)

View Source

    -spec getRatio(This) -> number() when This :: wxSizerItem().

Get the ratio item attribute.

Link to this function

# getRect(This)

View Source

    -spec getRect(This) -> {X :: integer(), Y :: integer(), W :: integer(), H :: integer()}
                     when This :: wxSizerItem().

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

Link to this function

# getSize(This)

View Source

    -spec getSize(This) -> {W :: integer(), H :: integer()} when This :: wxSizerItem().

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

Link to this function

# getSizer(This)

View Source

    -spec getSizer(This) -> wxSizer:wxSizer() when This :: wxSizerItem().

If this item is tracking a sizer, return it.

NULL otherwise.

Link to this function

# getSpacer(This)

View Source

    -spec getSpacer(This) -> {W :: integer(), H :: integer()} when This :: wxSizerItem().

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

Link to this function

# getUserData(This)

View Source

    -spec getUserData(This) -> wx:wx_object() when This :: wxSizerItem().

Get the userData item attribute.

Link to this function

# getWindow(This)

View Source

    -spec getWindow(This) -> wxWindow:wxWindow() when This :: wxSizerItem().

If this item is tracking a window then return it.

NULL otherwise.

Link to this function

# isShown(This)

View Source

    -spec isShown(This) -> boolean() when This :: wxSizerItem().

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/1` always returns true for it (see `wxSizerFlags::ReserveSpaceEvenIfHidden()` (not implemented in wx)).

Link to this function

# isSizer(This)

View Source

    -spec isSizer(This) -> boolean() when This :: wxSizerItem().

Is this item a sizer?

Link to this function

# isSpacer(This)

View Source

    -spec isSpacer(This) -> boolean() when This :: wxSizerItem().

Is this item a spacer?

Link to this function

# isWindow(This)

View Source

    -spec isWindow(This) -> boolean() when This :: wxSizerItem().

Is this item a window?

Link to this function

# new(Window)

View Source

    -spec new(Window) -> wxSizerItem() when Window :: wxWindow:wxWindow() | wxSizer:wxSizer().

Equivalent to `new(Window, [])`.

Link to this function

# new/2

View Source

    -spec new(Width, Height) -> wxSizerItem() when Width :: integer(), Height :: integer();
             (Window, Flags) -> wxSizerItem()
                 when
                     Window :: wxWindow:wxWindow() | wxSizer:wxSizer(), Flags :: wxSizerFlags:wxSizerFlags();
             (Window, [Option]) -> wxSizerItem()
                 when
                     Window :: wxWindow:wxWindow() | wxSizer:wxSizer(),
                     Option ::
                         {proportion, integer()} |
                         {flag, integer()} |
                         {border, integer()} |
                         {userData, wx:wx_object()}.

Link to this function

# new(Width, Height, Options)

View Source

    -spec new(Width, Height, [Option]) -> wxSizerItem()
                 when
                     Width :: integer(),
                     Height :: integer(),
                     Option ::
                         {proportion, integer()} |
                         {flag, integer()} |
                         {border, integer()} |
                         {userData, wx:wx_object()}.

Construct a sizer item for tracking a spacer.

Link to this function

# setBorder(This, Border)

View Source

    -spec setBorder(This, Border) -> ok when This :: wxSizerItem(), Border :: integer().

Set the border item attribute.

Link to this function

# setDimension(This, Pos, Size)

View Source

    -spec setDimension(This, Pos, Size) -> ok
                          when
                              This :: wxSizerItem(),
                              Pos :: {X :: integer(), Y :: integer()},
                              Size :: {W :: integer(), H :: integer()}.

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.

Link to this function

# setFlag(This, Flag)

View Source

    -spec setFlag(This, Flag) -> ok when This :: wxSizerItem(), Flag :: integer().

Set the flag item attribute.

Link to this function

# setInitSize(This, X, Y)

View Source

    -spec setInitSize(This, X, Y) -> ok when This :: wxSizerItem(), X :: integer(), Y :: integer().

Sets the minimum size to be allocated for this item.

This is identical to `setMinSize/3`, prefer to use the other function, as its name is more clear.

Link to this function

# setMinSize(This, Size)

View Source

    -spec setMinSize(This, Size) -> ok when This :: wxSizerItem(), Size :: {W :: integer(), H :: integer()}.

Sets the minimum size to be allocated for this item.

If this item is a window, the `size` is also passed to `wxWindow:setMinSize/2`.

Link to this function

# setMinSize(This, X, Y)

View Source

    -spec setMinSize(This, X, Y) -> ok when This :: wxSizerItem(), X :: integer(), Y :: integer().

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

Link to this function

# setProportion(This, Proportion)

View Source

    -spec setProportion(This, Proportion) -> ok when This :: wxSizerItem(), Proportion :: integer().

Set the proportion item attribute.

Link to this function

# setRatio/2

View Source

    -spec setRatio(This, Ratio) -> ok when This :: wxSizerItem(), Ratio :: number();
                  (This, Size) -> ok when This :: wxSizerItem(), Size :: {W :: integer(), H :: integer()}.

Link to this function

# setRatio(This, Width, Height)

View Source

    -spec setRatio(This, Width, Height) -> ok
                      when This :: wxSizerItem(), Width :: integer(), Height :: integer().

Set the ratio item attribute.

Link to this function

# show(This, Show)

View Source

    -spec show(This, Show) -> ok when This :: wxSizerItem(), Show :: boolean().

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.