wxRuby Documentation Home

# Wx::GridBagSizer

A Sizer that can lay out items in a virtual grid
like a FlexGridSizer but in this case
explicit positioning of the items is allowed using
GBPosition, and items can optionally span
more than one row and/or column using GBSpan.

## Derived from

FlexGridSizer

GridSizer

Sizer

Object

## Methods

- GridBagSizer.new
- GridBagSizer#add
- GridBagSizer#calc_min
- GridBagSizer#check_for_intersection
- GridBagSizer#find_item
- GridBagSizer#find_item_at_point
- GridBagSizer#find_item_at_position
- GridBagSizer#find_item_with_data
- GridBagSizer#get_cell_size
- GridBagSizer#get_empty_cell_size
- GridBagSizer#get_item_position
- GridBagSizer#get_item_span
- GridBagSizer#recalc_sizes
- GridBagSizer#set_empty_cell_size
- GridBagSizer#set_item_position
- GridBagSizer#set_item_span

### GridBagSizer.new

GridBagSizer.new(%(arg-type)Integer% vgap = 0, Integer hgap = 0)

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

### GridBagSizer#add

SizerItem add(%(arg-type)Window% window, GBPosition pos, GBSpan span = DefaultSpan, Integer flag = 0, Integer border = 0, Object userData = nil) SizerItem add(%(arg-type)Sizer% sizer, GBPosition pos, GBSpan span = DefaultSpan, Integer flag = 0, Integer border = 0, Object userData = nil) SizerItem add(%(arg-type)Integer% width, Integer height, GBPosition pos, GBSpan span = DefaultSpan, Integer flag = 0, Integer border = 0, Object userData = nil) SizerItem add(%(arg-type)GBSizerItem% item)

The Add methods return a valid pointer if the item was successfully placed at the
given position, NULL if something was already there.

### GridBagSizer#calc_min

Size calc_min()

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

### GridBagSizer#check_for_intersection

Boolean check_for_intersection(%(arg-type)GBSizerItem% item, GBSizerItem excludeItem = nil) Boolean check_for_intersection(%(arg-type)GBPosition% pos, GBSpan span, GBSizerItem excludeItem = nil)

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.

### GridBagSizer#find_item

GBSizerItem find_item(%(arg-type)Window% window) GBSizerItem find_item(%(arg-type)Sizer% sizer)

Find the sizer item for the given window or subsizer, returns NULL if
not found. (non-recursive)

### GridBagSizer#find_item_at_point

GBSizerItem find_item_at_point(%(arg-type)Point% pt)

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)

### GridBagSizer#find_item_at_position

GBSizerItem find_item_at_position(%(arg-type)GBPosition% pos)

Return the sizer item for the given grid cell, or NULL if there is no
item at that position. (non-recursive)

### GridBagSizer#find_item_with_data

GBSizerItem find_item_with_data(%(arg-type)Object% userData)

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

### GridBagSizer#get_cell_size

Size get_cell_size(%(arg-type)Integer% row, Integer col)

Get the size of the specified cell, including hgap and vgap. Only
valid after a Layout.

### GridBagSizer#get_empty_cell_size

Size get_empty_cell_size()

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

### GridBagSizer#get_item_position

GBPosition get_item_position(%(arg-type)Window% window) GBPosition get_item_position(%(arg-type)Sizer% sizer) GBPosition get_item_position(%(arg-type)Integer% index)

Get the grid position of the specified item.

### GridBagSizer#get_item_span

GBSpan get_item_span(%(arg-type)Window% window) GBSpan get_item_span(%(arg-type)Sizer% sizer) GBSpan get_item_span(%(arg-type)Integer% index)

Get the row/col spanning of the specified item

### GridBagSizer#recalc_sizes

recalc_sizes()

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

### GridBagSizer#set_empty_cell_size

set_empty_cell_size(%(arg-type)Size% sz)

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

### GridBagSizer#set_item_position

Boolean set_item_position(%(arg-type)Window% window, GBPosition pos) Boolean set_item_position(%(arg-type)Sizer% sizer, GBPosition pos) Boolean set_item_position(%(arg-type)Integer% index, GBPosition pos)

Set the grid position of the specified item. Returns true on success.
If the move is not allowed (because an item is already there) then
false is returned.

### GridBagSizer#set_item_span

Boolean set_item_span(%(arg-type)Window% window, GBSpan span) Boolean set_item_span(%(arg-type)Sizer% sizer, GBSpan span) Boolean set_item_span(%(arg-type)Integer% index, GBSpan span)

Set the row/col spanning of the specified item. Returns true on
success. If the move is not allowed (because an item is already there)
then false is returned.

[This page automatically generated from the Textile source at 2023-06-09 00:45:25 +0000]