# wxGridBagSizer Class Reference
[Window Layout]

`#include </home/work/projects/wx/2.9/wx/interface/wx/gbsizer.h>`

Inheritance diagram for wxGridBagSizer:
[legend]

## Detailed Description

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, and items can optionally span more than one row and/or column using wxGBSpan.

##

Library: wxCore
Category: Window Layout

## Public Member Functions

| wxGridBagSizer (int vgap=0, int hgap=0)
| Constructor, with optional parameters to specify the gap between the rows and columns.
wxSize | CalcMin ()
| Called when the managed size of the sizer is needed or when layout needs done.
wxGBSizerItem * | FindItemAtPoint (const wxPoint &pt)
| Return the sizer item located at the point given in pt, or NULL if there is no item at that point.
wxGBSizerItem * | FindItemAtPosition (const wxGBPosition &pos)
| Return the sizer item for the given grid cell, or NULL if there is no item at that position.
wxGBSizerItem * | FindItemWithData (const wxObject *userData)
| Return the sizer item that has a matching user data (it only compares pointer values) or NULL if not found.
wxSize | GetCellSize (int row, int col) const
| Get the size of the specified cell, including hgap and vgap.
wxSize | GetEmptyCellSize () const
| Get the size used for cells in the grid with no item.
void | RecalcSizes ()
| Called when the managed size of the sizer is needed or when layout needs done.
void | SetEmptyCellSize (const wxSize &sz)
| Set the size used for cells in the grid with no item.
wxSizerItem * | Add (wxWindow *window, const wxGBPosition &pos, const wxGBSpan &span=wxDefaultSpan, int flag=0, int border=0, wxObject *userData=NULL)
| Adds the given item to the given position.
wxSizerItem * | Add (wxSizer *sizer, const wxGBPosition &pos, const wxGBSpan &span=wxDefaultSpan, int flag=0, int border=0, wxObject *userData=NULL)
| Adds the given item to the given position.
wxSizerItem * | Add (int width, int height, const wxGBPosition &pos, const wxGBSpan &span=wxDefaultSpan, int flag=0, int border=0, wxObject *userData=NULL)
| Adds the given item to the given position.
wxSizerItem * | Add (wxGBSizerItem *item)
| Adds the given item to the given position.
bool | CheckForIntersection (wxGBSizerItem *item, wxGBSizerItem *excludeItem=NULL)
| Look at all items and see if any intersect (or would overlap) the given item.
bool | CheckForIntersection (const wxGBPosition &pos, const wxGBSpan &span, wxGBSizerItem *excludeItem=NULL)
| Look at all items and see if any intersect (or would overlap) the given item.
wxGBSizerItem * | FindItem (wxWindow *window)
| Find the sizer item for the given window or subsizer, returns NULL if not found.
wxGBSizerItem * | FindItem (wxSizer *sizer)
| Find the sizer item for the given window or subsizer, returns NULL if not found.
wxGBPosition | GetItemPosition (wxWindow *window)
| Get the grid position of the specified item.
wxGBPosition | GetItemPosition (wxSizer *sizer)
| Get the grid position of the specified item.
wxGBPosition | GetItemPosition (size_t index)
| Get the grid position of the specified item.
wxGBSpan | GetItemSpan (wxWindow *window)
| Get the row/col spanning of the specified item.
wxGBSpan | GetItemSpan (wxSizer *sizer)
| Get the row/col spanning of the specified item.
wxGBSpan | GetItemSpan (size_t index)
| Get the row/col spanning of the specified item.
bool | SetItemPosition (wxWindow *window, const wxGBPosition &pos)
| Set the grid position of the specified item.
bool | SetItemPosition (wxSizer *sizer, const wxGBPosition &pos)
| Set the grid position of the specified item.
bool | SetItemPosition (size_t index, const wxGBPosition &pos)
| Set the grid position of the specified item.
bool | SetItemSpan (wxWindow *window, const wxGBSpan &span)
| Set the row/col spanning of the specified item.
bool | SetItemSpan (wxSizer *sizer, const wxGBSpan &span)
| Set the row/col spanning of the specified item.
bool | SetItemSpan (size_t index, const wxGBSpan &span)
| Set the row/col spanning of the specified item.

List of all members.

## Constructor & Destructor Documentation

wxGridBagSizer::wxGridBagSizer | ( | int | vgap = `0`,
|  | int | hgap = `0` |
| ) |  |  |

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

## Member Function Documentation

wxSizerItem* wxGridBagSizer::Add | ( | wxWindow * | window,
|  | const wxGBPosition & | pos,
|  | const wxGBSpan & | span = `wxDefaultSpan`,
|  | int | flag = `0`,
|  | int | border = `0`,
|  | wxObject * | userData = `NULL` |
| ) |  |  |

Adds the given item to the given position.

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

wxSizerItem* wxGridBagSizer::Add | ( | wxSizer * | sizer,
|  | const wxGBPosition & | pos,
|  | const wxGBSpan & | span = `wxDefaultSpan`,
|  | int | flag = `0`,
|  | int | border = `0`,
|  | wxObject * | userData = `NULL` |
| ) |  |  |

Adds the given item to the given position.

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

wxSizerItem* wxGridBagSizer::Add | ( | wxGBSizerItem * | item | ) |

Adds the given item to the given position.

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

wxSizerItem* wxGridBagSizer::Add | ( | int | width,
|  | int | height,
|  | const wxGBPosition & | pos,
|  | const wxGBSpan & | span = `wxDefaultSpan`,
|  | int | flag = `0`,
|  | int | border = `0`,
|  | wxObject * | userData = `NULL` |
| ) |  |  |

Adds the given item to the given position.

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

wxSize wxGridBagSizer::CalcMin | ( |  | ) | `[virtual]`

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

Implements wxSizer.

bool wxGridBagSizer::CheckForIntersection | ( | wxGBSizerItem * | item,
|  | wxGBSizerItem * | excludeItem = `NULL` |
| ) |  |  |

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.

bool wxGridBagSizer::CheckForIntersection | ( | const wxGBPosition & | pos,
|  | const wxGBSpan & | span,
|  | wxGBSizerItem * | excludeItem = `NULL` |
| ) |  |  |

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.

wxGBSizerItem* wxGridBagSizer::FindItem | ( | wxWindow * | window | ) |

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

(non-recursive)

wxGBSizerItem* wxGridBagSizer::FindItem | ( | wxSizer * | sizer | ) |

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

(non-recursive)

wxGBSizerItem* wxGridBagSizer::FindItemAtPoint | ( | const wxPoint & | 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)

wxGBSizerItem* wxGridBagSizer::FindItemAtPosition | ( | const wxGBPosition & | pos | ) |

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

(non-recursive)

wxGBSizerItem* wxGridBagSizer::FindItemWithData | ( | const wxObject * | userData | ) |

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

(non-recursive)

wxSize wxGridBagSizer::GetCellSize | ( | int | row,
|  | int | col |
| ) |  |  | const

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

Only valid after window layout has been performed.

wxSize wxGridBagSizer::GetEmptyCellSize | ( |  | ) | const

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

wxGBPosition wxGridBagSizer::GetItemPosition | ( | wxSizer * | sizer | ) |

Get the grid position of the specified item.

wxGBPosition wxGridBagSizer::GetItemPosition | ( | size_t | index | ) |

Get the grid position of the specified item.

wxGBPosition wxGridBagSizer::GetItemPosition | ( | wxWindow * | window | ) |

Get the grid position of the specified item.

wxGBSpan wxGridBagSizer::GetItemSpan | ( | wxSizer * | sizer | ) |

Get the row/col spanning of the specified item.

wxGBSpan wxGridBagSizer::GetItemSpan | ( | wxWindow * | window | ) |

Get the row/col spanning of the specified item.

wxGBSpan wxGridBagSizer::GetItemSpan | ( | size_t | index | ) |

Get the row/col spanning of the specified item.

void wxGridBagSizer::RecalcSizes | ( |  | ) | `[virtual]`

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

Implements wxSizer.

void wxGridBagSizer::SetEmptyCellSize | ( | const wxSize & | sz | ) |

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

bool wxGridBagSizer::SetItemPosition | ( | wxWindow * | window,
|  | const wxGBPosition & | 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.

bool wxGridBagSizer::SetItemPosition | ( | wxSizer * | sizer,
|  | const wxGBPosition & | 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.

bool wxGridBagSizer::SetItemPosition | ( | size_t | index,
|  | const wxGBPosition & | 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.

bool wxGridBagSizer::SetItemSpan | ( | wxWindow * | window,
|  | const wxGBSpan & | 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.

bool wxGridBagSizer::SetItemSpan | ( | wxSizer * | sizer,
|  | const wxGBSpan & | 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.

bool wxGridBagSizer::SetItemSpan | ( | size_t | index,
|  | const wxGBSpan & | 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.

|  | [ top ]