wxErlang

Reference Manual

Version 2.1

Table of Contents

wxSizerItem

Module

wxSizerItem

Module Summary

Functions for wxSizerItem class

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.

wxWidgets docs: wxSizerItem

new(Window) -> wxSizerItem()
new(Width, Height) -> wxSizerItem()
new(Window, Flags) -> wxSizerItem()
new(Window, Height :: [Option]) -> wxSizerItem()

Types

Option =
    {proportion, integer()} |
    {flag, integer()} |
    {border, integer()} |
    {userData, wx:wx_object()}

new(Width, Height, Options :: [Option]) -> wxSizerItem()

Types

Width = Height = integer()
Option =
    {proportion, integer()} |
    {flag, integer()} |
    {border, integer()} |
    {userData, wx:wx_object()}

Construct a sizer item for tracking a spacer.

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

Deletes the user data and subsizer, if any.

calcMin(This) -> {W :: integer(), H :: integer()}

Types

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

deleteWindows(This) -> ok

Types

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

detachSizer(This) -> ok

Types

Enable deleting the SizerItem without destroying the contained sizer.

getBorder(This) -> integer()

Types

Return the border attribute.

getFlag(This) -> integer()

Types

Return the flags attribute.

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

getMinSize(This) -> {W :: integer(), H :: integer()}

Types

Get the minimum size needed for the item.

getPosition(This) -> {X :: integer(), Y :: integer()}

Types

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

getProportion(This) -> integer()

Types

Get the proportion item attribute.

getRatio(This) -> number()

Types

Get the ratio item attribute.

getRect(This) ->
           {X :: integer(),
            Y :: integer(),
            W :: integer(),
            H :: integer()}

Types

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

getSize(This) -> {W :: integer(), H :: integer()}

Types

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

getSizer(This) -> wxSizer:wxSizer()

Types

If this item is tracking a sizer, return it.

NULL otherwise.

getSpacer(This) -> {W :: integer(), H :: integer()}

Types

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

getUserData(This) -> wx:wx_object()

Types

Get the userData item attribute.

getWindow(This) -> wxWindow:wxWindow()

Types

If this item is tracking a window then return it.

NULL otherwise.

isSizer(This) -> boolean()

Types

Is this item a sizer?

isShown(This) -> boolean()

Types

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

isSpacer(This) -> boolean()

Types

Is this item a spacer?

isWindow(This) -> boolean()

Types

Is this item a window?

setBorder(This, Border) -> ok

Types

Border = integer()

Set the border item attribute.

setDimension(This, Pos, Size) -> ok

Types

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.

setFlag(This, Flag) -> ok

Types

Flag = integer()

Set the flag item attribute.

setInitSize(This, X, Y) -> ok

Types

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

setMinSize(This, Size) -> ok

Types

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.

setMinSize(This, X, Y) -> ok

Types

X = Y = integer()

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) -> ok

Types

Proportion = integer()

Set the proportion item attribute.

setRatio(This, Ratio) -> ok
setRatio(This, Size) -> ok

Types

Size = {W :: integer(), H :: integer()}

setRatio(This, Width, Height) -> ok

Types

Width = Height = integer()

Set the ratio item attribute.

assignSizer(This, Sizer) -> ok

Types

Set the sizer tracked by this item.

Old sizer, if any, is deleted.

assignSpacer(This, Size) -> ok

Types

Size = {W :: integer(), H :: integer()}

Set the size of the spacer tracked by this item.

Old spacer, if any, is deleted.

assignSpacer(This, W, H) -> ok

Types

W = H = integer()

assignWindow(This, Window) -> ok

Types

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.

show(This, Show) -> ok

Types

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.