gtkmm 4.16.0
|
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>
Public Types | |
enum class | Mode { NONE , HORIZONTAL , VERTICAL , BOTH } |
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 (Mode mode) |
Sets the Gtk::SizeGroup::Mode of the size group. | |
Mode | get_mode () const |
Gets the current mode of the size group. | |
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< Mode > | property_mode () |
The direction in which the size group affects requested sizes. | |
Glib::PropertyProxy_ReadOnly< Mode > | property_mode () const |
The direction in which the size group affects requested sizes. | |
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. | |
Glib::ustring | get_buildable_id () const |
Gets the ID of the buildable object. | |
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 (Mode 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 (Mode mode) | |
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. | |
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::SizeGroup::Mode::HORIZONTAL or Gtk::SizeGroup::Mode::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::Mode::VERTICAL or Gtk::SizeGroup::Mode::BOTH.
|
strong |
|
noexcept |
|
overridenoexcept |
|
explicitprotected |
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.
widget | The Gtk::Widget to add. |
Mode Gtk::SizeGroup::get_mode | ( | ) | const |
Gets the current mode of the size group.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
std::vector< Widget * > Gtk::SizeGroup::get_widgets | ( | ) |
Returns the list of widgets associated with size_group.
SList
of widgets. The list is owned by GTK and should not be modified. std::vector< const Widget * > Gtk::SizeGroup::get_widgets | ( | ) | const |
Returns the list of widgets associated with size_group.
SList
of widgets. The list is owned by GTK and should not be modified.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
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.
Glib::PropertyProxy< Mode > Gtk::SizeGroup::property_mode | ( | ) |
The direction in which the size group affects requested sizes.
Default value: Gtk::SizeGroup::Mode::HORIZONTAL
Glib::PropertyProxy_ReadOnly< Mode > Gtk::SizeGroup::property_mode | ( | ) | const |
The direction in which the size group affects requested sizes.
Default value: Gtk::SizeGroup::Mode::HORIZONTAL
Removes a widget from a Gtk::SizeGroup
.
widget | The Gtk::Widget to remove. |
Sets the Gtk::SizeGroup::Mode
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::Mode::HORIZONTAL) all have the same vertical requisition (Gtk::SizeGroup::Mode::VERTICAL), or should all have the same requisition in both directions (Gtk::SizeGroup::Mode::BOTH).
mode | The mode to set for the size group. |
|
related |
A Glib::wrap() method for this object.
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. |