W Wrapl, The Programming Language

Libraries:Gtk:Gtk:SizeGroup

Types

T

Inherits from:

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

In detail, the size requested for each widget in a T 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 SetMode) 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 T 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.Gtk.AttachOptions.Fill flag.

T objects are referenced by each widget in the size group, so once you have added all widgets to a T, you can drop the initial reference to the size group with g_object_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 Gtk.Gtk.SizeGroupMode.Horizontal or Gtk.Gtk.SizeGroupMode.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.Gtk.SizeGroupMode.Vertical or Gtk.Gtk.SizeGroupMode.Both.

GtkSizeGroup as GtkBuildable

Size groups can be specified in a UI definition by placing an <object> element with class="GtkSizeGroup" somewhere in the UI definition. The widgets that belong to the size group are specified by a <widgets> element that may contain multiple <widget> elements, one for each member of the size group. The name attribute gives the id of the widget.

Example 54. A UI definition fragment with GtkSizeGroup

1
2
3
4
5
6
7
<object class="GtkSizeGroup">
  <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
  <widgets>
    <widget name="radio1"/>
    <widget name="radio2"/>
  </widgets>
</object>




Constants

Nil : T

Functions

GetType() : Gtk.GObject.Type.T



New(mode @ Gtk.Gtk.SizeGroupMode.T) : Gtk.Gtk.SizeGroup.T

Create a new T.

mode the mode for the new size group.
Returns a newly created T


Methods

:AddWidget(self @ T, widget @ Gtk.Gtk.Widget.T) : Std.Object.T

Adds a widget to a T. 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 SetMode.

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

size_group a T
widget the Gtk.Gtk.Widget.T to add


:GetIgnoreHidden(self @ T) : Std.Symbol.T

Returns if invisible widgets are ignored when calculating the size.

size_group a T
Returns TRUE if invisible widgets are ignored.


:GetMode(self @ T) : Gtk.Gtk.SizeGroupMode.T

Gets the current mode of the size group. See SetMode.

size_group a T
Returns the current mode of the size group.


:GetWidgets(self @ T) : Std.Object.T

Returns the list of widgets associated with size_group.

size_group a GtkSizeGrup
Returns a GSList of widgets. The list is owned by GTK+ and should not be modified. [element-type GtkWidget][transfer none]


:RemoveWidget(self @ T, widget @ Gtk.Gtk.Widget.T) : Std.Object.T

Removes a widget from a T.

size_group a GtkSizeGrup
widget the Gtk.Gtk.Widget.T to remove


:SetIgnoreHidden(self @ T, ignore_hidden @ Std.Symbol.T) : Std.Object.T

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

size_group a T
ignore_hidden whether unmapped widgets should be ignored when calculating the size


:SetMode(self @ T, mode @ Gtk.Gtk.SizeGroupMode.T) : Std.Object.T

Sets the Gtk.Gtk.SizeGroupMode.T 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_MODE_HORIZONTAL) all have the same vertical requisition (GTK_SIZE_GROUP_MODE_VERTICAL), or should all have the same requisition in both directions (GTK_SIZE_GROUP_MODE_BOTH).

size_group a T
mode the mode to set for the size group.