Search documentation of wx

# View Source wxGridBagSizer (wx v2.4.3)

A `wxSizer` that can lay out items in a virtual grid like a `wxFlexGridSizer` but in this case explicit positioning of the items is allowed using `wxGBPosition` (not implemented in wx), and items can optionally span more than one row and/or column using `wxGBSpan` (not implemented in wx).

This class is derived, and can use functions, from:

- `wxFlexGridSizer`

- `wxGridSizer`

- `wxSizer`

wxWidgets docs: wxGridBagSizer

# Summary

## Types

wxGridBagSizer()

## Functions

add(This, Item)
add(This, Window, Pos)

Equivalent to `add(This, Window, Pos, [])`.

add/4

Adds the given item to the given position.

add/5

Adds a spacer to the given position.

calcMin(This)

Called when the managed size of the sizer is needed or when layout needs done.

checkForIntersection(This, Item)

Equivalent to `checkForIntersection(This, Item, [])`.

checkForIntersection/3

Look at all items and see if any intersect (or would overlap) the given item.

checkForIntersection/4
destroy(This)

Destroys the object

findItem(This, Window)

Find the sizer item for the given window or subsizer, returns NULL if not found.

findItemAtPoint(This, Pt)

Return the sizer item located at the point given in pt, or NULL if there is no item at that point.

findItemAtPosition(This, Pos)

Return the sizer item for the given grid cell, or NULL if there is no item at that position.

findItemWithData(This, UserData)

Return the sizer item that has a matching user data (it only compares pointer values) or NULL if not found.

getCellSize(This, Row, Col)

Get the size of the specified cell, including hgap and vgap.

getEmptyCellSize(This)

Get the size used for cells in the grid with no item.

getItemPosition/2
getItemSpan/2
new()

Equivalent to `new([])`.

new(Options)

Constructor, with optional parameters to specify the gap between the rows and columns.

setEmptyCellSize(This, Sz)

Set the size used for cells in the grid with no item.

setItemPosition/3
setItemSpan/3

# Types

Link to this type

# wxGridBagSizer()

View Source

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

# Functions

Link to this function

# add(This, Item)

View Source

    -spec add(This, Item) -> wxSizerItem:wxSizerItem()
                 when This :: wxGridBagSizer(), Item :: wxGBSizerItem:wxGBSizerItem().

Link to this function

# add(This, Window, Pos)

View Source

    -spec add(This, Window, Pos) -> wxSizerItem:wxSizerItem()
                 when
                     This :: wxGridBagSizer(),
                     Window :: wxWindow:wxWindow() | wxSizer:wxSizer(),
                     Pos :: {R :: integer(), C :: integer()}.

Equivalent to `add(This, Window, Pos, [])`.

Link to this function

# add/4

View Source

    -spec add(This, Width, Height, Pos) -> wxSizerItem:wxSizerItem()
                 when
                     This :: wxGridBagSizer(),
                     Width :: integer(),
                     Height :: integer(),
                     Pos :: {R :: integer(), C :: integer()};
             (This, Window, Pos, [Option]) -> wxSizerItem:wxSizerItem()
                 when
                     This :: wxGridBagSizer(),
                     Window :: wxWindow:wxWindow() | wxSizer:wxSizer(),
                     Pos :: {R :: integer(), C :: integer()},
                     Option ::
                         {span, {RS :: integer(), CS :: integer()}} |
                         {flag, integer()} |
                         {border, integer()} |
                         {userData, wx:wx_object()}.

Adds the given item to the given position.

Return: A valid pointer if the item was successfully placed at the given position, or NULL if something was already there.

Link to this function

# add/5

View Source

    -spec add(This, Width, Height, Pos, [Option]) -> wxSizerItem:wxSizerItem()
                 when
                     This :: wxGridBagSizer(),
                     Width :: integer(),
                     Height :: integer(),
                     Pos :: {R :: integer(), C :: integer()},
                     Option ::
                         {span, {RS :: integer(), CS :: integer()}} |
                         {flag, integer()} |
                         {border, integer()} |
                         {userData, wx:wx_object()}.

Adds a spacer to the given position.

`width` and `height` specify the dimension of the spacer to be added.

Return: A valid pointer if the spacer was successfully placed at the given position, or NULL if something was already there.

Link to this function

# calcMin(This)

View Source

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

Called when the managed size of the sizer is needed or when layout needs done.

Link to this function

# checkForIntersection(This, Item)

View Source

    -spec checkForIntersection(This, Item) -> boolean()
                                  when This :: wxGridBagSizer(), Item :: wxGBSizerItem:wxGBSizerItem().

Equivalent to `checkForIntersection(This, Item, [])`.

Link to this function

# checkForIntersection/3

View Source

    -spec checkForIntersection(This, Pos, Span) -> boolean()
                                  when
                                      This :: wxGridBagSizer(),
                                      Pos :: {R :: integer(), C :: integer()},
                                      Span :: {RS :: integer(), CS :: integer()};
                              (This, Item, [Option]) -> boolean()
                                  when
                                      This :: wxGridBagSizer(),
                                      Item :: wxGBSizerItem:wxGBSizerItem(),
                                      Option :: {excludeItem, wxGBSizerItem:wxGBSizerItem()}.

Look at all items and see if any intersect (or would overlap) the given item.

Returns true if so, false if there would be no overlap. If an `excludeItem` is given then it will not be checked for intersection, for example it may be the item we are checking the position of.

Link to this function

# checkForIntersection/4

View Source

    -spec checkForIntersection(This, Pos, Span, [Option]) -> boolean()
                                  when
                                      This :: wxGridBagSizer(),
                                      Pos :: {R :: integer(), C :: integer()},
                                      Span :: {RS :: integer(), CS :: integer()},
                                      Option :: {excludeItem, wxGBSizerItem:wxGBSizerItem()}.

Link to this function

# destroy(This)

View Source

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

Destroys the object

Link to this function

# findItem(This, Window)

View Source

    -spec findItem(This, Window) -> wxGBSizerItem:wxGBSizerItem()
                      when This :: wxGridBagSizer(), Window :: wxWindow:wxWindow() | wxSizer:wxSizer().

Find the sizer item for the given window or subsizer, returns NULL if not found.

(non-recursive)

Link to this function

# findItemAtPoint(This, Pt)

View Source

    -spec findItemAtPoint(This, Pt) -> wxGBSizerItem:wxGBSizerItem()
                             when This :: wxGridBagSizer(), Pt :: {X :: integer(), Y :: integer()}.

Return the sizer item located at the point given in pt, or NULL if there is no item at that point.

The (x,y) coordinates in `pt` correspond to the client coordinates of the window using the sizer for layout. (non-recursive)

Link to this function

# findItemAtPosition(This, Pos)

View Source

    -spec findItemAtPosition(This, Pos) -> wxGBSizerItem:wxGBSizerItem()
                                when This :: wxGridBagSizer(), Pos :: {R :: integer(), C :: integer()}.

Return the sizer item for the given grid cell, or NULL if there is no item at that position.

(non-recursive)

Link to this function

# findItemWithData(This, UserData)

View Source

    -spec findItemWithData(This, UserData) -> wxGBSizerItem:wxGBSizerItem()
                              when This :: wxGridBagSizer(), UserData :: wx:wx_object().

Return the sizer item that has a matching user data (it only compares pointer values) or NULL if not found.

(non-recursive)

Link to this function

# getCellSize(This, Row, Col)

View Source

    -spec getCellSize(This, Row, Col) -> {W :: integer(), H :: integer()}
                         when This :: wxGridBagSizer(), Row :: integer(), Col :: integer().

Get the size of the specified cell, including hgap and vgap.

Only valid after window layout has been performed.

Link to this function

# getEmptyCellSize(This)

View Source

    -spec getEmptyCellSize(This) -> {W :: integer(), H :: integer()} when This :: wxGridBagSizer().

Get the size used for cells in the grid with no item.

Link to this function

# getItemPosition/2

View Source

    -spec getItemPosition(This, Window) -> {R :: integer(), C :: integer()}
                             when
                                 This :: wxGridBagSizer(), Window :: wxWindow:wxWindow() | wxSizer:wxSizer();
                         (This, Index) -> {R :: integer(), C :: integer()}
                             when This :: wxGridBagSizer(), Index :: integer().

Link to this function

# getItemSpan/2

View Source

    -spec getItemSpan(This, Window) -> {RS :: integer(), CS :: integer()}
                         when This :: wxGridBagSizer(), Window :: wxWindow:wxWindow() | wxSizer:wxSizer();
                     (This, Index) -> {RS :: integer(), CS :: integer()}
                         when This :: wxGridBagSizer(), Index :: integer().

Link to this function

# new()

View Source

    -spec new() -> wxGridBagSizer().

Equivalent to `new([])`.

Link to this function

# new(Options)

View Source

    -spec new([Option]) -> wxGridBagSizer() when Option :: {vgap, integer()} | {hgap, integer()}.

Constructor, with optional parameters to specify the gap between the rows and columns.

Link to this function

# setEmptyCellSize(This, Sz)

View Source

    -spec setEmptyCellSize(This, Sz) -> ok
                              when This :: wxGridBagSizer(), Sz :: {W :: integer(), H :: integer()}.

Set the size used for cells in the grid with no item.

Link to this function

# setItemPosition/3

View Source

    -spec setItemPosition(This, Window, Pos) -> boolean()
                             when
                                 This :: wxGridBagSizer(),
                                 Window :: wxWindow:wxWindow() | wxSizer:wxSizer(),
                                 Pos :: {R :: integer(), C :: integer()};
                         (This, Index, Pos) -> boolean()
                             when
                                 This :: wxGridBagSizer(),
                                 Index :: integer(),
                                 Pos :: {R :: integer(), C :: integer()}.

Link to this function

# setItemSpan/3

View Source

    -spec setItemSpan(This, Window, Span) -> boolean()
                         when
                             This :: wxGridBagSizer(),
                             Window :: wxWindow:wxWindow() | wxSizer:wxSizer(),
                             Span :: {RS :: integer(), CS :: integer()};
                     (This, Index, Span) -> boolean()
                         when
                             This :: wxGridBagSizer(),
                             Index :: integer(),
                             Span :: {RS :: integer(), CS :: integer()}.