gtkmm 3.24.9

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::SizeGroup Class Reference

Gtk::SizeGroup provides a mechanism for grouping a number of widgets together so they all request the same amount of space. More...

`#include <gtkmm/sizegroup.h>`

Inheritance diagram for Gtk::SizeGroup:
[legend]

## Public Member Functions
| SizeGroup (SizeGroup &&src) noexcept
SizeGroup & | operator= (SizeGroup &&src) noexcept
| ~SizeGroup () noexcept override
GtkSizeGroup * | gobj ()
| Provides access to the underlying C GObject.
const GtkSizeGroup * | gobj () const
| Provides access to the underlying C GObject.
GtkSizeGroup * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void | set_mode (SizeGroupMode mode)
| Sets the Gtk::SizeGroupMode of the size group.
SizeGroupMode | get_mode () const
| Gets the current mode of the size group.
void | set_ignore_hidden (bool ignore_hidden=true)
| Sets whether unmapped widgets should be ignored when calculating the size.
bool | get_ignore_hidden () const
| Returns if invisible widgets are ignored when calculating the size.
void | add_widget (Widget &widget)
| Adds a widget to a Gtk::SizeGroup.
void | remove_widget (Widget &widget)
| Removes a widget from a Gtk::SizeGroup.
std::vector< Widget * > | get_widgets ()
| Returns the list of widgets associated with size_group.
std::vector< const Widget * > | get_widgets () const
| Returns the list of widgets associated with size_group.
Glib::PropertyProxy< SizeGroupMode > | property_mode ()
| The directions in which the size group affects the requested sizes of its component widgets.
Glib::PropertyProxy_ReadOnly< SizeGroupMode > | property_mode () const
| The directions in which the size group affects the requested sizes of its component widgets.
Glib::PropertyProxy< bool > | property_ignore_hidden ()
| If `true`, unmapped widgets are ignored when determining the size of the group.
Glib::PropertyProxy_ReadOnly< bool > | property_ignore_hidden () const
| If `true`, unmapped widgets are ignored when determining the size of the group.
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
void | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void > &slot)
void | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void > &&slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, const sigc::slot< void > &slot)
sigc::connection | connect_property_changed_with_return (const Glib::ustring &property_name, sigc::slot< void > &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src)
| ~trackable ()
void | add_destroy_notify_callback (void *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src)
void | remove_destroy_notify_callback (void *data) const
Public Member Functions inherited from Gtk::Buildable
| Buildable (Buildable &&src) noexcept
Buildable & | operator= (Buildable &&src) noexcept
| ~Buildable () noexcept override
GtkBuildable * | gobj ()
| Provides access to the underlying C GObject.
const GtkBuildable * | gobj () const
| Provides access to the underlying C GObject.
void | set_name (const Glib::ustring & name)
| Sets the name of the buildable object.
Glib::ustring | get_name () const
| Gets the name of the buildable object.
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Glib::RefPtr< SizeGroup > | create (SizeGroupMode mode)
Static Public Member Functions inherited from Gtk::Buildable
static void | add_interface (GType gtype_implementer)
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.

## Protected Member Functions
| SizeGroup (SizeGroupMode mode)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)
Protected Member Functions inherited from Gtk::Buildable
| Buildable ()
| You should derive from this class to use it.

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::SizeGroup > | wrap (GtkSizeGroup *object, bool take_copy=false)
| A Glib::wrap() method for this object.
Related Symbols inherited from Gtk::Buildable
Glib::RefPtr< Gtk::Buildable > | wrap (GtkBuildable *object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

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::Grid 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 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 GtkSizeGroup 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 Gtk::FILL 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::SIZE_GROUP_HORIZONTAL or Gtk::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 Gtk::SIZE_GROUP_VERTICAL or Gtk::SIZE_GROUP_BOTH.

## Constructor & Destructor Documentation

## ◆ SizeGroup() [1/2]

Gtk::SizeGroup::SizeGroup | ( | SizeGroup && | src | ) |
| noexcept

## ◆ ~SizeGroup()

Gtk::SizeGroup::~SizeGroup | ( |  | ) |
| override noexcept

## ◆ SizeGroup() [2/2]

Gtk::SizeGroup::SizeGroup | ( | SizeGroupMode | mode | ) |
| explicit protected

## Member Function Documentation

## ◆ add_widget()

void Gtk::SizeGroup::add_widget | ( | 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 set_mode().

When the widget is destroyed or no longer referenced elsewhere, it will be removed from the size group.

Parameters

  widget | The Gtk::Widget to add.

## ◆ create()

static Glib::RefPtr< SizeGroup > Gtk::SizeGroup::create | ( | SizeGroupMode | mode | ) |
| static

## ◆ get_ignore_hidden()

bool Gtk::SizeGroup::get_ignore_hidden | ( |  | ) | const

Returns if invisible widgets are ignored when calculating the size.

Since gtkmm 2.8

Deprecated: 3.22: Measuring the size of hidden widgets has not worked reliably for a long time. In most cases, they will report a size of 0 nowadays, and thus, their size will not affect the other size group members. In effect, size groups will always operate as if this property was `true`. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.

Deprecated
  Does not work reliably. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.

Returns
  `true` if invisible widgets are ignored.

## ◆ get_mode()

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

Gets the current mode of the size group.

See set_mode().

Returns
  The current mode of the size group.

## ◆ get_type()

static GType Gtk::SizeGroup::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_widgets() [1/2]

std::vector< Widget * > Gtk::SizeGroup::get_widgets | ( |  | ) |

Returns the list of widgets associated with size_group.

Since gtkmm 2.10

Returns
  A SList of widgets. The list is owned by GTK+ and should not be modified.

## ◆ get_widgets() [2/2]

std::vector< const Widget * > Gtk::SizeGroup::get_widgets | ( |  | ) | const

Returns the list of widgets associated with size_group.

Since gtkmm 2.10

Returns
  A SList of widgets. The list is owned by GTK+ and should not be modified.

## ◆ gobj() [1/2]

GtkSizeGroup * Gtk::SizeGroup::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkSizeGroup * Gtk::SizeGroup::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkSizeGroup * Gtk::SizeGroup::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ operator=()

SizeGroup & Gtk::SizeGroup::operator= | ( | SizeGroup && | src | ) |
| noexcept

## ◆ property_ignore_hidden() [1/2]

Glib::PropertyProxy< bool > Gtk::SizeGroup::property_ignore_hidden | ( |  | ) |

If `true`, unmapped widgets are ignored when determining the size of the group.

Since gtkmm 2.8

Deprecated: 3.22: Measuring the size of hidden widgets has not worked reliably for a long time. In most cases, they will report a size of 0 nowadays, and thus, their size will not affect the other size group members. In effect, size groups will always operate as if this property was `true`. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.

Deprecated
  Does not work reliably. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.

Default value: `false`

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_ignore_hidden() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gtk::SizeGroup::property_ignore_hidden | ( |  | ) | const

If `true`, unmapped widgets are ignored when determining the size of the group.

Since gtkmm 2.8

Deprecated: 3.22: Measuring the size of hidden widgets has not worked reliably for a long time. In most cases, they will report a size of 0 nowadays, and thus, their size will not affect the other size group members. In effect, size groups will always operate as if this property was `true`. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.

Deprecated
  Does not work reliably. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.

Default value: `false`

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_mode() [1/2]

Glib::PropertyProxy< SizeGroupMode > Gtk::SizeGroup::property_mode | ( |  | ) |

The directions in which the size group affects the requested sizes of its component widgets.

Default value: Gtk::SIZE_GROUP_HORIZONTAL

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_mode() [2/2]

Glib::PropertyProxy_ReadOnly< SizeGroupMode > Gtk::SizeGroup::property_mode | ( |  | ) | const

The directions in which the size group affects the requested sizes of its component widgets.

Default value: Gtk::SIZE_GROUP_HORIZONTAL

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ remove_widget()

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

Removes a widget from a Gtk::SizeGroup.

Parameters

  widget | The Gtk::Widget to remove.

## ◆ set_ignore_hidden()

void Gtk::SizeGroup::set_ignore_hidden | ( | bool | ignore_hidden = true | ) |

Sets whether unmapped widgets should be ignored when calculating the size.

Since gtkmm 2.8

Deprecated: 3.22: Measuring the size of hidden widgets has not worked reliably for a long time. In most cases, they will report a size of 0 nowadays, and thus, their size will not affect the other size group members. In effect, size groups will always operate as if this property was `true`. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.

Deprecated
  Does not work reliably. Use a Gtk::Stack instead to hide widgets while still having their size taken into account.

Parameters

  ignore_hidden | Whether unmapped widgets should be ignored when calculating the size.

## ◆ set_mode()

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

Sets the Gtk::SizeGroupMode 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::SIZE_GROUP_HORIZONTAL) all have the same vertical requisition (Gtk::SIZE_GROUP_VERTICAL), or should all have the same requisition in both directions (Gtk::SIZE_GROUP_BOTH).

Parameters

  mode | The mode to set for the size group.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::SizeGroup > wrap | ( | GtkSizeGroup * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.