Public Member Functions

# wxFlexGridSizer Class Reference
[Window Layout]

`#include <wx/sizer.h>`

Inheritance diagram for wxFlexGridSizer:
[legend]

## Detailed Description

A flex grid sizer is a sizer which lays out its children in a two-dimensional table with all table fields in one row having the same height and all fields in one column having the same width, but all rows or all columns are not necessarily the same height or width as in the wxGridSizer.

Since wxWidgets 2.5.0, wxFlexGridSizer can also size items equally in one direction but unequally ("flexibly") in the other. If the sizer is only flexible in one direction (this can be changed using wxFlexGridSizer::SetFlexibleDirection), it needs to be decided how the sizer should grow in the other ("non-flexible") direction in order to fill the available space. The wxFlexGridSizer::SetNonFlexibleGrowMode() method serves this purpose.

##

Library: wxCore
Category: Window Layout

See also:
  wxSizer, Sizers Overview

## Public Member Functions
void | AddGrowableCol (size_t idx, int proportion=0)
| Specifies that column idx (starting from zero) should be grown if there is extra space available to the sizer.
void | AddGrowableRow (size_t idx, int proportion=0)
| Specifies that row idx (starting from zero) should be grown if there is extra space available to the sizer.
int | GetFlexibleDirection () const
| Returns a wxOrientation value that specifies whether the sizer flexibly resizes its columns, rows, or both (default).
wxFlexSizerGrowMode | GetNonFlexibleGrowMode () const
| Returns the value that specifies how the sizer grows in the "non-flexible" direction if there is one.
bool | IsColGrowable (size_t idx)
| Returns true if column idx is growable.
bool | IsRowGrowable (size_t idx)
| Returns true if row idx is growable.
void | RemoveGrowableCol (size_t idx)
| Specifies that the idx column index is no longer growable.
void | RemoveGrowableRow (size_t idx)
| Specifies that the idx row index is no longer growable.
void | SetFlexibleDirection (int direction)
| Specifies whether the sizer should flexibly resize its columns, rows, or both.
void | SetNonFlexibleGrowMode (wxFlexSizerGrowMode mode)
| Specifies how the sizer should grow in the non-flexible direction if there is one (so SetFlexibleDirection() must have been called previously).
virtual void | RecalcSizes ()
| This method is abstract and has to be overwritten by any derived class.
virtual wxSize | CalcMin ()
| This method is abstract and has to be overwritten by any derived class.
| wxFlexGridSizer (int cols, int vgap, int hgap)
| wxFlexGridSizer constructors.
| wxFlexGridSizer (int cols, const wxSize &gap=wxSize(0, 0))
| wxFlexGridSizer constructors.
| wxFlexGridSizer (int rows, int cols, int vgap, int hgap)
| wxFlexGridSizer constructors.
| wxFlexGridSizer (int rows, int cols, const wxSize &gap)
| wxFlexGridSizer constructors.

List of all members.

## Constructor & Destructor Documentation

wxFlexGridSizer::wxFlexGridSizer | ( | int | cols,
|  | int | vgap,
|  | int | hgap |
| ) |  |  |

wxFlexGridSizer constructors.

Please see wxGridSizer::wxGridSizer documentation.

Since:
  2.9.1 (except for the four argument overload)

wxFlexGridSizer::wxFlexGridSizer | ( | int | cols,
|  | const wxSize & | gap = `wxSize(0, 0)` |
| ) |  |  |

wxFlexGridSizer constructors.

Please see wxGridSizer::wxGridSizer documentation.

Since:
  2.9.1 (except for the four argument overload)

wxFlexGridSizer::wxFlexGridSizer | ( | int | rows,
|  | int | cols,
|  | int | vgap,
|  | int | hgap |
| ) |  |  |

wxFlexGridSizer constructors.

Please see wxGridSizer::wxGridSizer documentation.

Since:
  2.9.1 (except for the four argument overload)

wxFlexGridSizer::wxFlexGridSizer | ( | int | rows,
|  | int | cols,
|  | const wxSize & | gap |
| ) |  |  |

wxFlexGridSizer constructors.

Please see wxGridSizer::wxGridSizer documentation.

Since:
  2.9.1 (except for the four argument overload)

## Member Function Documentation

void wxFlexGridSizer::AddGrowableCol | ( | size_t | idx,
|  | int | proportion = `0` |
| ) |  |  |

Specifies that column idx (starting from zero) should be grown if there is extra space available to the sizer.

The proportion parameter has the same meaning as the stretch factor for the sizers (see wxBoxSizer) except that if all proportions are 0, then all columns are resized equally (instead of not being resized at all).

Notice that the column must not be already growable, if you need to change the proportion you must call RemoveGrowableCol() first and then make it growable (with a different proportion) again. You can use IsColGrowable() to check whether a column is already growable.

void wxFlexGridSizer::AddGrowableRow | ( | size_t | idx,
|  | int | proportion = `0` |
| ) |  |  |

Specifies that row idx (starting from zero) should be grown if there is extra space available to the sizer.

This is identical to AddGrowableCol() except that it works with rows and not columns.

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

This method is abstract and has to be overwritten by any derived class.

Here, the sizer will do the actual calculation of its children's minimal sizes.

Implements wxSizer.

Reimplemented in wxGridBagSizer.

int wxFlexGridSizer::GetFlexibleDirection | ( |  | ) | const

Returns a wxOrientation value that specifies whether the sizer flexibly resizes its columns, rows, or both (default).

Returns:
  One of the following values:
  - wxVERTICAL: Rows are flexibly sized.
  - wxHORIZONTAL: Columns are flexibly sized.
  - wxBOTH: Both rows and columns are flexibly sized (this is the default value).

See also:
  SetFlexibleDirection()

wxFlexSizerGrowMode wxFlexGridSizer::GetNonFlexibleGrowMode | ( |  | ) | const

Returns the value that specifies how the sizer grows in the "non-flexible" direction if there is one.

The behaviour of the elements in the flexible direction (i.e. both rows and columns by default, or rows only if GetFlexibleDirection() is `wxVERTICAL` or columns only if it is `wxHORIZONTAL`) is always governed by their proportion as specified in the call to AddGrowableRow() or AddGrowableCol(). What happens in the other direction depends on the value of returned by this function as described below.

Returns:
  One of the following values:
  - wxFLEX_GROWMODE_NONE: Sizer doesn't grow its elements at all in the non-flexible direction.
  - wxFLEX_GROWMODE_SPECIFIED: Sizer honors growable columns/rows set with AddGrowableCol() and AddGrowableRow() in the non-flexible direction as well. In this case equal sizing applies to minimum sizes of columns or rows (this is the default value).
  - wxFLEX_GROWMODE_ALL: Sizer equally stretches all columns or rows in the non-flexible direction, independently of the proportions applied in the flexible direction.

See also:
  SetFlexibleDirection(), SetNonFlexibleGrowMode()

bool wxFlexGridSizer::IsColGrowable | ( | size_t | idx | ) |

Returns true if column idx is growable.

Since:
  2.9.0

bool wxFlexGridSizer::IsRowGrowable | ( | size_t | idx | ) |

Returns true if row idx is growable.

Since:
  2.9.0

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

This method is abstract and has to be overwritten by any derived class.

Here, the sizer will do the actual calculation of its children's positions and sizes.

Implements wxSizer.

Reimplemented in wxGridBagSizer.

void wxFlexGridSizer::RemoveGrowableCol | ( | size_t | idx | ) |

Specifies that the idx column index is no longer growable.

void wxFlexGridSizer::RemoveGrowableRow | ( | size_t | idx | ) |

Specifies that the idx row index is no longer growable.

void wxFlexGridSizer::SetFlexibleDirection | ( | int | direction | ) |

Specifies whether the sizer should flexibly resize its columns, rows, or both.

Argument direction can be `wxVERTICAL`, `wxHORIZONTAL` or `wxBOTH` (which is the default value). Any other value is ignored.

See GetFlexibleDirection() for the explanation of these values. Note that this method does not trigger relayout.

void wxFlexGridSizer::SetNonFlexibleGrowMode | ( | wxFlexSizerGrowMode | mode | ) |

Specifies how the sizer should grow in the non-flexible direction if there is one (so SetFlexibleDirection() must have been called previously).

Argument mode can be one of those documented in GetNonFlexibleGrowMode(), please see there for their explanation. Note that this method does not trigger relayout.

|  | [ top ]