Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Login

Gtk::SizeGroup

class Gtk::SizeGroup

Gtk::SizeGroup provides a mechanism for grouping a number of widgets together so they all request the same amount of space. This is typically useful when you want a column of widgets to have the same size, but you can't use a Gtk::Table widget.

In detail, the size requested for each widget in a Gtk::SizeGroup is the maximum of the sizes that would have been requested for each widget in the size group if they were not in the size group. The mode of the size group (see Gtk::SizeGroup#mode=) determines whether this applies to the horizontal size, the vertical size, or both sizes.

Note that size groups only affect the amount of space requested, not the size that the widgets finally receive. If you want the widgets in a Gtk::SizeGroup to actually be the same size, you need to pack them in such a way that they get the size they request and not more. For example, if you are packing your widgets into a table, you would not include the GtkAttachOptions flag.

Widgets can be part of multiple size groups; GTK+ will compute the horizontal size of a widget from the horizontal requisition of all widgets that can be reached from the widget by a chain of size groups of type Gtk::SizeGroup::HORIZONTAL or Gtk::SizeGroup::BOTH, and the vertical size from the vertical requisition of all widgets that can be reached from the widget by a chain of size groups of type Gtk::SizeGroup::VERTICAL or Gtk::SizeGroup::BOTH.

Class Methods

Gtk::SizeGroup.new(mode)
Create a new Gtk::SizeGroup.

Instance Methods

mode
Gets the current mode of the size group. See Gtk::SizeGroup#mode=.
  • Returns : the current mode of the size group.
mode=(mode)
Sets the GtkSizeGroupMode of the size group. The mode of the size group determines whether the widgets in the size group should all have the same horizontal requisition (Gtk::SizeGroup::HORIZONTAL) all have the same vertical requisition (Gtk::SizeGroup::VERTICAL), or should all have the same requisition in both directions (Gtk::SizeGroup::BOTH).
set_mode(mode)
Same as Gtk::SizeGroup#mode=.
add_widget(widget)
Adds a widget to a Gtk::SizeGroup. In the future, the requisition of the widget will be determined as the maximum of its requisition and the requisition of the other widgets in the size group. Whether this applies horizontally, vertically, or in both directions depends on the mode of the size group. See Gtk::SizeGroup#mode=.
remove_widget(widget)
Removes a widget from a Gtk::SizeGroup.
ignore_hidden
Returns if invisible widgets are ignored when calculating the size. Since 2.8
ignore_hidden=(ignore_hidden)
Sets whether invisible widgets should be ignored when calculating the size. Since 2.8
  • ignore_hidden: the new value (true or false)
  • Returns: ignore_hidden
set_ignore_hidden(ignore_hidden)
Same as Gtk::SizeGroup#ignore_hidden=(ignore_hidden). Since 2.8
  • ignore_hidden: the new value (true or false)
  • Returns: self
ignore_hidden?
Gets the value if true, unmapped widgets are ignored when determining the size of the group.
  • Returns: true if true, unmapped widgets are ignored when determining the size of the group
widgets
  • Returns: self: FIXME
add_child
See Gtk::Buildable#add_child.
construct_child
See Gtk::Buildable#construct_child.
get_internal_child
See Gtk::Buildable#get_internal_child.
name
See Gtk::Buildable#name.
name=
See Gtk::Buildable#name=.
set_buildable_property
See Gtk::Buildable#set_buildable_property.
set_name
See Gtk::Buildable#set_name.
builder_name
See Gtk::Buildable#builder_name.
builder_name=
See Gtk::Buildable#builder_name=.
set_builder_name
See Gtk::Buildable#set_builder_name.

Constants

GtkSizeGroupMode

The mode of the size group determines the directions in which the size group effects the requested sizes of its component widgets.

NONE
group has no effect
HORIZONTAL
group effects horizontal requisition
VERTICAL
group effects vertical requisition
BOTH
group effects both horizontal and vertical requisition

Properties

mode: Integer (Read/Write)
The directions in which the size group effects the requested sizes of its component widgets
ignore-hidden: true or false (Read/Write)
If true, hidden widgets are ignored when determining the size of the group. Default value: false. Since 2.8