Class: Wx::FlexGridSizer
- Defined in:
- lib/wx/doc/gen/flex_grid_sizer.rb
Overview
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 GridSizer.
Since wxWidgets 2.5.0, FlexGridSizer 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 #set_flexible_direction), it needs to be decided how the sizer should grow in the other (“non-flexible”) direction in order to fill the available space. The #set_non_flexible_grow_mode method serves this purpose.
Category: Window Layout
Direct Known Subclasses
Instance Method Summary collapse
-
#add_growable_col(idx, proportion = 0) ⇒ void
Specifies that column idx (starting from zero) should be grown if there is extra space available to the sizer.
-
#add_growable_row(idx, proportion = 0) ⇒ void
Specifies that row idx (starting from zero) should be grown if there is extra space available to the sizer.
-
#calc_min ⇒ Wx::Size
This method is abstract and has to be overwritten by any derived class.
-
#get_col_widths ⇒ Wx::ArrayInt
(also: #col_widths)
Returns a read-only array containing the widths of the columns in the sizer.
-
#get_flexible_direction ⇒ Integer
(also: #flexible_direction)
Returns a Orientation value that specifies whether the sizer flexibly resizes its columns, rows, or both (default).
-
#get_non_flexible_grow_mode ⇒ Wx::FlexSizerGrowMode
(also: #non_flexible_grow_mode)
Returns the value that specifies how the sizer grows in the “non-flexible” direction if there is one.
-
#get_row_heights ⇒ Wx::ArrayInt
(also: #row_heights)
Returns a read-only array containing the heights of the rows in the sizer.
-
#initialize(*args) ⇒ FlexGridSizer
constructor
A new instance of FlexGridSizer.
-
#is_col_growable(idx) ⇒ Boolean
(also: #col_growable?)
Returns true if column idx is growable.
-
#is_row_growable(idx) ⇒ Boolean
(also: #row_growable?)
Returns true if row idx is growable.
-
#remove_growable_col(idx) ⇒ void
Specifies that the idx column index is no longer growable.
-
#remove_growable_row(idx) ⇒ void
Specifies that the idx row index is no longer growable.
-
#reposition_children(minSize) ⇒ void
Method which must be overridden in the derived sizer classes.
-
#set_flexible_direction(direction) ⇒ void
(also: #flexible_direction=)
Specifies whether the sizer should flexibly resize its columns, rows, or both.
-
#set_non_flexible_grow_mode(mode) ⇒ void
(also: #non_flexible_grow_mode=)
Specifies how the sizer should grow in the non-flexible direction if there is one (so #set_flexible_direction must have been called previously).
Methods inherited from GridSizer
#get_cols, #get_effective_cols_count, #get_effective_rows_count, #get_h_gap, #get_rows, #get_v_gap, #set_cols, #set_h_gap, #set_rows, #set_v_gap
Methods inherited from Sizer
#add, #add_spacer, #add_stretch_spacer, #clear, #compute_fitting_client_size, #compute_fitting_window_size, #detach, #each_child, #fit, #fit_inside, #get_children, #get_containing_window, #get_item, #get_item_by_id, #get_item_count, #get_min_size, #get_position, #get_size, #hide, #inform_first_direction, #insert, #insert_spacer, #insert_stretch_spacer, #is_empty, #layout, #prepend, #prepend_spacer, #prepend_stretch_spacer, #remove, #replace, #set_containing_window, #set_dimension, #set_item_min_size, #set_min_size, #set_size_hints, #show, #show_items
Methods inherited from Object
#clone, #dup, #is_same_as, #un_share
Constructor Details
#initialize(cols, vgap, hgap) ⇒ Wx::FlexGridSizer #initialize(cols, gap = (Wx::Size.new(0, 0))) ⇒ Wx::FlexGridSizer #initialize(rows, cols, vgap, hgap) ⇒ Wx::FlexGridSizer #initialize(rows, cols, gap) ⇒ Wx::FlexGridSizer
Returns a new instance of FlexGridSizer.
52 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 52 def initialize(*args) end |
Instance Method Details
#add_growable_col(idx, proportion = 0) ⇒ void
This method returns an undefined value.
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 BoxSizer) 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 #remove_growable_col first and then make it growable (with a different proportion) again. You can use #is_col_growable to check whether a column is already growable.
61 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 61 def add_growable_col(idx, proportion=0) end |
#add_growable_row(idx, proportion = 0) ⇒ void
This method returns an undefined value.
Specifies that row idx (starting from zero) should be grown if there is extra space available to the sizer.
This is identical to #add_growable_col except that it works with rows and not columns.
69 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 69 def add_growable_row(idx, proportion=0) end |
#calc_min ⇒ Wx::Size
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.
158 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 158 def calc_min; end |
#get_col_widths ⇒ Wx::ArrayInt Also known as: col_widths
Returns a read-only array containing the widths of the columns in the sizer.
143 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 143 def get_col_widths; end |
#get_flexible_direction ⇒ Integer Also known as: flexible_direction
Returns a Orientation value that specifies whether the sizer flexibly resizes its columns, rows, or both (default).
One of the following values:
-
Orientation::VERTICAL: Rows are flexibly sized.
-
Orientation::HORIZONTAL: Columns are flexibly sized.
-
Orientation::BOTH: Both rows and columns are flexibly sized (this is the default value).
80 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 80 def get_flexible_direction; end |
#get_non_flexible_grow_mode ⇒ Wx::FlexSizerGrowMode Also known as: non_flexible_grow_mode
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 #get_flexible_direction is Orientation::VERTICAL or columns only if it is Orientation::HORIZONTAL) is always governed by their proportion as specified in the call to #add_growable_row or #add_growable_col. What happens in the other direction depends on the value of returned by this function as described below. One of the following values:
-
Wx::FlexSizerGrowMode::FLEX_GROWMODE_NONE: Sizer doesn’t grow its elements at all in the non-flexible direction.
-
Wx::FlexSizerGrowMode::FLEX_GROWMODE_SPECIFIED: Sizer honors growable columns/rows set with #add_growable_col and #add_growable_row 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).
-
Wx::FlexSizerGrowMode::FLEX_GROWMODE_ALL: Sizer equally stretches all columns or rows in the non-flexible direction, independently of the proportions applied in the flexible direction.
94 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 94 def get_non_flexible_grow_mode; end |
#get_row_heights ⇒ Wx::ArrayInt Also known as: row_heights
Returns a read-only array containing the heights of the rows in the sizer.
138 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 138 def get_row_heights; end |
#is_col_growable(idx) ⇒ Boolean Also known as: col_growable?
Returns true if column idx is growable.
100 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 100 def is_col_growable(idx) end |
#is_row_growable(idx) ⇒ Boolean Also known as: row_growable?
Returns true if row idx is growable.
106 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 106 def is_row_growable(idx) end |
#remove_growable_col(idx) ⇒ void
This method returns an undefined value.
Specifies that the idx column index is no longer growable.
112 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 112 def remove_growable_col(idx) end |
#remove_growable_row(idx) ⇒ void
This method returns an undefined value.
Specifies that the idx row index is no longer growable.
117 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 117 def remove_growable_row(idx) end |
#reposition_children(minSize) ⇒ void
This method returns an undefined value.
Method which must be overridden in the derived sizer classes.
The implementation should reposition the children using the current total size available to the sizer (m_size) and the size computed by the last call to #calc_min. Note that you should never call this method directly, call Sizer#layout instead if you need to manually update the sizer elements positions. This method is only called by wxWidgets itself.
152 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 152 def reposition_children(minSize) end |
#set_flexible_direction(direction) ⇒ void Also known as: flexible_direction=
This method returns an undefined value.
Specifies whether the sizer should flexibly resize its columns, rows, or both.
Argument direction can be Orientation::VERTICAL, Orientation::HORIZONTAL or Orientation::BOTH (which is the default value). Any other value is ignored. See #get_flexible_direction for the explanation of these values. Note that this method does not trigger relayout.
125 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 125 def set_flexible_direction(direction) end |
#set_non_flexible_grow_mode(mode) ⇒ void Also known as: non_flexible_grow_mode=
This method returns an undefined value.
Specifies how the sizer should grow in the non-flexible direction if there is one (so #set_flexible_direction must have been called previously).
Argument mode can be one of those documented in #get_non_flexible_grow_mode, please see there for their explanation. Note that this method does not trigger relayout.
133 |
# File 'lib/wx/doc/gen/flex_grid_sizer.rb', line 133 def set_non_flexible_grow_mode(mode) end |