<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<!--ENTITY index-Objects-Grouped SYSTEM "objects_grouped.sgml"-->
<refentry id="GtkSizeGroup">
<refmeta>
<refentrytitle role="top_of_page" id="GtkSizeGroup.top_of_page">GtkSizeGroup</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GtkSizeGroup</refname>
<refpurpose>Grouping widgets so they request the same size</refpurpose>
</refnamediv>

<refsynopsisdiv id="GtkSizeGroup.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gtk/gtk.h&gt;

                    <link linkend="GtkSizeGroup-struct">GtkSizeGroup</link>;
enum                <link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link>;
<link linkend="GtkSizeGroup">GtkSizeGroup</link> *      <link linkend="gtk-size-group-new">gtk_size_group_new</link>                  (<link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link> mode);
<link linkend="void">void</link>                <link linkend="gtk-size-group-set-mode">gtk_size_group_set_mode</link>             (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group,
                                                         <link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link> mode);
<link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link>    <link linkend="gtk-size-group-get-mode">gtk_size_group_get_mode</link>             (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group);
<link linkend="void">void</link>                <link linkend="gtk-size-group-set-ignore-hidden">gtk_size_group_set_ignore_hidden</link>    (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group,
                                                         <link linkend="gboolean">gboolean</link> ignore_hidden);
<link linkend="gboolean">gboolean</link>            <link linkend="gtk-size-group-get-ignore-hidden">gtk_size_group_get_ignore_hidden</link>    (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group);
<link linkend="void">void</link>                <link linkend="gtk-size-group-add-widget">gtk_size_group_add_widget</link>           (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group,
                                                         <link linkend="GtkWidget">GtkWidget</link> *widget);
<link linkend="void">void</link>                <link linkend="gtk-size-group-remove-widget">gtk_size_group_remove_widget</link>        (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group,
                                                         <link linkend="GtkWidget">GtkWidget</link> *widget);
<link linkend="GSList">GSList</link> *            <link linkend="gtk-size-group-get-widgets">gtk_size_group_get_widgets</link>          (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group);
</synopsis>
</refsynopsisdiv>

<refsect1 id="GtkSizeGroup.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----GtkSizeGroup
</synopsis>
</refsect1>



<refsect1 id="GtkSizeGroup.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkSizeGroup implements
 <link linkend="GtkBuildable">GtkBuildable</link>.</para>
</refsect1>


<refsect1 id="GtkSizeGroup.properties" role="properties">
<title role="properties.title">Properties</title>
<synopsis>
  &quot;<link linkend="GtkSizeGroup--ignore-hidden">ignore-hidden</link>&quot;            <link linkend="gboolean">gboolean</link>              : Read / Write
  &quot;<link linkend="GtkSizeGroup--mode">mode</link>&quot;                     <link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link>      : Read / Write
</synopsis>
</refsect1>



<refsect1 id="GtkSizeGroup.description" role="desc">
<title role="desc.title">Description</title>
<para>
<link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link> 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 <link linkend="GtkTable"><type>GtkTable</type></link> widget.
</para>
<para>
In detail, the size requested for each widget in a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link> 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 <link linkend="gtk-size-group-set-mode"><function>gtk_size_group_set_mode()</function></link>) determines whether
this applies to the horizontal size, the vertical size, or both sizes.
</para>
<para>
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 <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link> 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 <link linkend="GTK-FILL--CAPS"><literal>GTK_FILL</literal></link> flag.
</para>
<para>
<link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link> objects are referenced by each widget in the size group,
so once you have added all widgets to a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>, you can drop
the initial reference to the size group with <link linkend="g-object-unref"><function>g_object_unref()</function></link>. 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.
</para>
<para>
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 <link linkend="GTK-SIZE-GROUP-HORIZONTAL--CAPS"><literal>GTK_SIZE_GROUP_HORIZONTAL</literal></link> or <link linkend="GTK-SIZE-GROUP-BOTH--CAPS"><literal>GTK_SIZE_GROUP_BOTH</literal></link>, 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
<link linkend="GTK-SIZE-GROUP-VERTICAL--CAPS"><literal>GTK_SIZE_GROUP_VERTICAL</literal></link> or <link linkend="GTK-SIZE-GROUP-BOTH--CAPS"><literal>GTK_SIZE_GROUP_BOTH</literal></link>.
</para>
<refsect2 id="GtkSizeGroup-BUILDER-UI">
<title>GtkSizeGroup as GtkBuildable</title>
<para>
Size groups can be specified in a UI definition by placing an
&lt;object&gt; element with <literal>class="GtkSizeGroup"</literal>
somewhere in the UI definition. The widgets that belong to the
size group are specified by a &lt;widgets&gt; element that may
contain multiple &lt;widget&gt; elements, one for each member
of the size group. The name attribute gives the id of the widget.
</para>
<example>
<title>A UI definition fragment with GtkSizeGroup</title>
<programlisting><![CDATA[
<object class="GtkSizeGroup">
  <property name="mode">GTK_SIZE_GROUP_HORIZONTAL</property>
  <widgets>
    <widget name="radio1"/>
    <widget name="radio2"/>
  </widgets>
</object>
]]></programlisting>
</example>
</refsect2>
</refsect1>

<refsect1 id="GtkSizeGroup.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GtkSizeGroup-struct" role="struct">
<title>GtkSizeGroup</title>
<indexterm zone="GtkSizeGroup-struct"><primary sortas="SizeGroup">GtkSizeGroup</primary></indexterm><programlisting>typedef struct _GtkSizeGroup GtkSizeGroup;</programlisting>
<para>
</para></refsect2>
<refsect2 id="GtkSizeGroupMode" role="enum">
<title>enum GtkSizeGroupMode</title>
<indexterm zone="GtkSizeGroupMode"><primary sortas="SizeGroupMode">GtkSizeGroupMode</primary></indexterm><programlisting>typedef enum {
  GTK_SIZE_GROUP_NONE,
  GTK_SIZE_GROUP_HORIZONTAL,
  GTK_SIZE_GROUP_VERTICAL,
  GTK_SIZE_GROUP_BOTH
} GtkSizeGroupMode;
</programlisting>
<para>
The mode of the size group determines the directions in which the size
group affects the requested sizes of its component widgets.</para>
<para>
</para><variablelist role="enum">
<varlistentry id="GTK-SIZE-GROUP-NONE--CAPS" role="constant">
<term><literal>GTK_SIZE_GROUP_NONE</literal></term>
<listitem><simpara> group has no effect
</simpara></listitem>
</varlistentry>
<varlistentry id="GTK-SIZE-GROUP-HORIZONTAL--CAPS" role="constant">
<term><literal>GTK_SIZE_GROUP_HORIZONTAL</literal></term>
<listitem><simpara> group affects horizontal requisition
</simpara></listitem>
</varlistentry>
<varlistentry id="GTK-SIZE-GROUP-VERTICAL--CAPS" role="constant">
<term><literal>GTK_SIZE_GROUP_VERTICAL</literal></term>
<listitem><simpara> group affects vertical requisition
</simpara></listitem>
</varlistentry>
<varlistentry id="GTK-SIZE-GROUP-BOTH--CAPS" role="constant">
<term><literal>GTK_SIZE_GROUP_BOTH</literal></term>
<listitem><simpara> group affects both horizontal and vertical requisition
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-size-group-new" role="function">
<title>gtk_size_group_new ()</title>
<indexterm zone="gtk-size-group-new"><primary sortas="size_group_new">gtk_size_group_new</primary></indexterm><programlisting><link linkend="GtkSizeGroup">GtkSizeGroup</link> *      gtk_size_group_new                  (<link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link> mode);</programlisting>
<para>
Create a new <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>mode</parameter>&#160;:</term>
<listitem><simpara> the mode for the new size group.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly created <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-size-group-set-mode" role="function">
<title>gtk_size_group_set_mode ()</title>
<indexterm zone="gtk-size-group-set-mode"><primary sortas="size_group_set_mode">gtk_size_group_set_mode</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_size_group_set_mode             (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group,
                                                         <link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link> mode);</programlisting>
<para>
Sets the <link linkend="GtkSizeGroupMode"><type>GtkSizeGroupMode</type></link> 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 (<link linkend="GTK-SIZE-GROUP-MODE-HORIZONTAL--CAPS"><literal>GTK_SIZE_GROUP_MODE_HORIZONTAL</literal></link>)
all have the same vertical requisition (<link linkend="GTK-SIZE-GROUP-MODE-VERTICAL--CAPS"><literal>GTK_SIZE_GROUP_MODE_VERTICAL</literal></link>),
or should all have the same requisition in both directions
(<link linkend="GTK-SIZE-GROUP-MODE-BOTH--CAPS"><literal>GTK_SIZE_GROUP_MODE_BOTH</literal></link>).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>size_group</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>mode</parameter>&#160;:</term>
<listitem><simpara> the mode to set for the size group.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-size-group-get-mode" role="function">
<title>gtk_size_group_get_mode ()</title>
<indexterm zone="gtk-size-group-get-mode"><primary sortas="size_group_get_mode">gtk_size_group_get_mode</primary></indexterm><programlisting><link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link>    gtk_size_group_get_mode             (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group);</programlisting>
<para>
Gets the current mode of the size group. See <link linkend="gtk-size-group-set-mode"><function>gtk_size_group_set_mode()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>size_group</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the current mode of the size group.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-size-group-set-ignore-hidden" role="function" condition="since:2.8">
<title>gtk_size_group_set_ignore_hidden ()</title>
<indexterm zone="gtk-size-group-set-ignore-hidden" role="2.8"><primary sortas="size_group_set_ignore_hidden">gtk_size_group_set_ignore_hidden</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_size_group_set_ignore_hidden    (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group,
                                                         <link linkend="gboolean">gboolean</link> ignore_hidden);</programlisting>
<para>
Sets whether unmapped widgets should be ignored when
calculating the size.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>size_group</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ignore_hidden</parameter>&#160;:</term>
<listitem><simpara> whether unmapped widgets should be ignored
  when calculating the size
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.8</para></refsect2>
<refsect2 id="gtk-size-group-get-ignore-hidden" role="function" condition="since:2.8">
<title>gtk_size_group_get_ignore_hidden ()</title>
<indexterm zone="gtk-size-group-get-ignore-hidden" role="2.8"><primary sortas="size_group_get_ignore_hidden">gtk_size_group_get_ignore_hidden</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            gtk_size_group_get_ignore_hidden    (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group);</programlisting>
<para>
Returns if invisible widgets are ignored when calculating the size.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>size_group</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if invisible widgets are ignored.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.8</para></refsect2>
<refsect2 id="gtk-size-group-add-widget" role="function">
<title>gtk_size_group_add_widget ()</title>
<indexterm zone="gtk-size-group-add-widget"><primary sortas="size_group_add_widget">gtk_size_group_add_widget</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_size_group_add_widget           (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group,
                                                         <link linkend="GtkWidget">GtkWidget</link> *widget);</programlisting>
<para>
Adds a widget to a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>. 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 <link linkend="gtk-size-group-set-mode"><function>gtk_size_group_set_mode()</function></link>.
</para>
<para>
When the widget is destroyed or no longer referenced elsewhere, it will 
be removed from the size group.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>size_group</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>widget</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="GtkWidget"><type>GtkWidget</type></link> to add
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-size-group-remove-widget" role="function">
<title>gtk_size_group_remove_widget ()</title>
<indexterm zone="gtk-size-group-remove-widget"><primary sortas="size_group_remove_widget">gtk_size_group_remove_widget</primary></indexterm><programlisting><link linkend="void">void</link>                gtk_size_group_remove_widget        (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group,
                                                         <link linkend="GtkWidget">GtkWidget</link> *widget);</programlisting>
<para>
Removes a widget from a <link linkend="GtkSizeGroup"><type>GtkSizeGroup</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>size_group</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkSizeGrup"><type>GtkSizeGrup</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>widget</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="GtkWidget"><type>GtkWidget</type></link> to remove
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-size-group-get-widgets" role="function" condition="since:2.10">
<title>gtk_size_group_get_widgets ()</title>
<indexterm zone="gtk-size-group-get-widgets" role="2.10"><primary sortas="size_group_get_widgets">gtk_size_group_get_widgets</primary></indexterm><programlisting><link linkend="GSList">GSList</link> *            gtk_size_group_get_widgets          (<link linkend="GtkSizeGroup">GtkSizeGroup</link> *size_group);</programlisting>
<para>
Returns the list of widgets associated with <parameter>size_group</parameter>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>size_group</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkSizeGrup"><type>GtkSizeGrup</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a <link linkend="GSList"><type>GSList</type></link> of widgets. The list is owned by GTK+ 
  and should not be modified.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.10</para></refsect2>

</refsect1>
<refsect1 id="GtkSizeGroup.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkSizeGroup--ignore-hidden" role="property"><title>The <literal>&quot;ignore-hidden&quot;</literal> property</title>
<indexterm zone="GtkSizeGroup--ignore-hidden" role="2.8"><primary sortas="SizeGroup:ignore-hidden">GtkSizeGroup:ignore-hidden</primary></indexterm><programlisting>  &quot;ignore-hidden&quot;            <link linkend="gboolean">gboolean</link>              : Read / Write</programlisting>
<para>
If <link linkend="TRUE--CAPS"><literal>TRUE</literal></link>, unmapped widgets are ignored when determining
the size of the group.</para>
<para>
</para><para>Default value: FALSE</para>
<para>Since 2.8</para>
</refsect2>
<refsect2 id="GtkSizeGroup--mode" role="property"><title>The <literal>&quot;mode&quot;</literal> property</title>
<indexterm zone="GtkSizeGroup--mode"><primary sortas="SizeGroup:mode">GtkSizeGroup:mode</primary></indexterm><programlisting>  &quot;mode&quot;                     <link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link>      : Read / Write</programlisting>
<para>The directions in which the size group affects the requested sizes of its component widgets.</para><para>Default value: GTK_SIZE_GROUP_HORIZONTAL</para>
</refsect2>

</refsect1>




</refentry>
