Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::SizeGroup Class Reference

A GtkSizeGroup C++ wrapper class. More...

`#include <inti/gtk/sizegroup.h>`

Inheritance diagram for Inti::Gtk::SizeGroup:

List of all members.

## Public Member Functions

Constructors

- SizeGroup (SizeGroupMode mode=SIZE_GROUP_HORIZONTAL)
    Construct a new size group.

Accessors

- GtkSizeGroup * gtk_size_group () const
    Get a pointer to the GtkSizeGroup structure.
- GtkSizeGroupClass * gtk_size_group_class () const
    Get a pointer to the GtkSizeGroupClass structure.
- operator GtkSizeGroup * () const
    Conversion operator; safely converts a SizeGroup to a GtkSizeGroup pointer.
- SizeGroupMode get_mode () const
    Gets the current mode of the size group (see set_mode()).

Methods

- void set_mode (SizeGroupMode mode)
    Sets the SizeGroupMode of the size group.
- void add_widget (Widget &widget)
    Adds a widget to the SizeGroup.
- void remove_widget (Widget &widget)
    Removes a widget from the SizeGroup.

Property Proxies

- const ModePropertyProxy prop_mode ()
    The directions in which the size group effects the requested sizes of its component widgets (SizeGroupMode : Read / Write).

## Protected Member Functions

Constructors

- SizeGroup (GtkSizeGroup *size_group, bool reference=true)
    Construct a new SizeGroup from an existing GtkSizeGroup.

## Detailed Description

A GtkSizeGroup C++ wrapper class.

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 Table widget.

In detail, the size requested for each widget in a 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 set_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 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 FILL flag.

SizeGroup objects are referenced by each widget in the size group, so once you have added all widgets to a SizeGroup, you can drop the initial reference to the size group with unref(). If the widgets in the size group are subsequently destroyed, then they will be removed from the size group and drop their references on the size group; when all widgets have been removed, the size group will be freed.

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 SIZE_GROUP_HORIZONTAL or SIZE_GROUP_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 SIZE_GROUP_VERTICAL or SIZE_GROUP_BOTH.

## Constructor & Destructor Documentation

Inti::Gtk::SizeGroup::SizeGroup | ( | GtkSizeGroup * | size_group,
|  | bool | reference = true
| ) | `[explicit, protected]`

  | Construct a new SizeGroup from an existing GtkSizeGroup. Parameters:
  size_group | A pointer to a GtkSizeGroup.
  reference | Set false if the initial reference count is floating, set true if it's not.
The size_group can be a newly created GtkSizeGroup or an existing GtkSizeGroup (see G::Object::Object).

Inti::Gtk::SizeGroup::SizeGroup | ( | SizeGroupMode | mode = SIZE_GROUP_HORIZONTAL | ) | `[explicit]`

  | Construct a new size group. Parameters:
  mode | The mode for the new size group.

## Member Function Documentation

void Inti::Gtk::SizeGroup::add_widget | ( | Widget & | widget | ) |

  | Adds a widget to the SizeGroup. Parameters:
  widget | The Widget to add.
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 set_mode()).

SizeGroupMode Inti::Gtk::SizeGroup::get_mode | ( |  | ) | const

| Gets the current mode of the size group (see set_mode()). Returns: The current mode of the size group.

void Inti::Gtk::SizeGroup::remove_widget | ( | Widget & | widget | ) |

  | Removes a widget from the SizeGroup. Parameters:
  widget | The Widget to remove.

void Inti::Gtk::SizeGroup::set_mode | ( | SizeGroupMode | mode | ) |

  | Sets the SizeGroupMode of the size group. Parameters:
  mode | The mode to set for the size group.
The mode of the size group determines whether the widgets in the size group should all have the same horizontal requisition (SIZE_GROUP_MODE_HORIZONTAL), all have the same vertical requisition (SIZE_GROUP_MODE_VERTICAL), or should all have the same requisition in both directions (SIZE_GROUP_MODE_BOTH).

The documentation for this class was generated from the following file:

- sizegroup.h

Main Page - Footer