<refentry id="GtkSizeGroup">
<refmeta>
<refentrytitle>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><title>Synopsis</title>
<synopsis>

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


struct      <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);
void        <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);
void        <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);
void        <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);


</synopsis>
</refsynopsisdiv>

<refsect1>
<title>Object Hierarchy</title>
<synopsis>

  <link linkend="GObject">GObject</link>
   +----GtkSizeGroup
</synopsis>

</refsect1>

<refsect1>
<title>Properties</title>
<synopsis>

  &quot;<link linkend="GtkSizeGroup--mode">mode</link>&quot;                 <link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link>     : Read / Write
</synopsis>
</refsect1>



<refsect1>
<title>Description</title>
<para>
<link linkend="GtkSizeGroup">GtkSizeGroup</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">GtkTable</link> widget.
</para>
<para>
In detail, the size requested for each widget in a <link linkend="GtkSizeGroup">GtkSizeGroup</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">gtk_size_group_set_mode</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">GtkSizeGroup</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 <literal>GTK_FILL</literal> flag.
</para>
<para>
<link linkend="GtkSizeGroup">GtkSizeGroup</link> objects are referenced by each widget in the size group,
so once you have added all widgets to a <link linkend="GtkSizeGroup">GtkSizeGroup</link>, you can drop
the initial reference to the size group with <link linkend="g-object-unref">g_object_unref</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 <literal>GTK_SIZE_GROUP_HORIZONTAL</literal> or <literal>GTK_SIZE_GROUP_BOTH</literal>, 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
<literal>GTK_SIZE_GROUP_VERTICAL</literal> or <literal>GTK_SIZE_GROUP_BOTH</literal>.
</para>
</refsect1>

<refsect1>
<title>Details</title>
<refsect2>
<title><anchor id="GtkSizeGroup-struct">struct GtkSizeGroup</title>
<programlisting>struct GtkSizeGroup;</programlisting>
<para>

</para></refsect2>
<refsect2>
<title><anchor id="GtkSizeGroupMode">enum GtkSizeGroupMode</title>
<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 effects the requested sizes of its component widgets.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="enum">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row>
<entry><literal>GTK_SIZE_GROUP_NONE</literal></entry>
<entry> group has no effect  
</entry>
</row>
<row>
<entry><literal>GTK_SIZE_GROUP_HORIZONTAL</literal></entry>
<entry> group effects horizontal requisition
</entry>
</row>
<row>
<entry><literal>GTK_SIZE_GROUP_VERTICAL</literal></entry>
<entry> group effects vertical requisition
</entry>
</row>
<row>
<entry><literal>GTK_SIZE_GROUP_BOTH</literal></entry>
<entry> group effects both horizontal and vertical requisition
</entry>
</row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-size-group-new">gtk_size_group_new ()</title>
<programlisting><link linkend="GtkSizeGroup">GtkSizeGroup</link>* gtk_size_group_new            (<link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link> mode);</programlisting>
<para>
Create a new <link linkend="GtkSizeGroup">GtkSizeGroup</link>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>mode</parameter>&nbsp;:</entry>
<entry> the mode for the new size group.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> a newly created <link linkend="GtkSizeGroup">GtkSizeGroup</link>
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-size-group-set-mode">gtk_size_group_set_mode ()</title>
<programlisting>void        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">GtkSizeGroupMode</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 (<literal>GTK_SIZE_GROUP_MODE_HORIZONTAL</literal>)
all have the same vertical requisition (<literal>GTK_SIZE_GROUP_MODE_VERTICAL</literal>),
or should all have the same requisition in both directions
(<literal>GTK_SIZE_GROUP_MODE_BOTH</literal>).</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>size_group</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkSizeGroup">GtkSizeGroup</link>
</entry></row>
<row><entry align="right"><parameter>mode</parameter>&nbsp;:</entry>
<entry> the mode to set for the size group.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-size-group-get-mode">gtk_size_group_get_mode ()</title>
<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">gtk_size_group_set_mode</link>().</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>size_group</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkSizeGroup">GtkSizeGroup</link>
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry> the current mode of the size group.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-size-group-add-widget">gtk_size_group_add_widget ()</title>
<programlisting>void        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">GtkSizeGroup</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">gtk_size_group_set_mode</link>().</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>size_group</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkSizeGroup">GtkSizeGroup</link>
</entry></row>
<row><entry align="right"><parameter>widget</parameter>&nbsp;:</entry>
<entry> the <link linkend="GtkWidget">GtkWidget</link> to add
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-size-group-remove-widget">gtk_size_group_remove_widget ()</title>
<programlisting>void        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">GtkSizeGroup</link>.</para>
<para>

</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>size_group</parameter>&nbsp;:</entry>
<entry> a <link linkend="GtkSizeGrup">GtkSizeGrup</link>
</entry></row>
<row><entry align="right"><parameter>widget</parameter>&nbsp;:</entry>
<entry> the <link linkend="GtkWidget">GtkWidget</link> to remove
</entry></row>
</tbody></tgroup></informaltable></refsect2>

</refsect1>
<refsect1>
<title>Properties</title>
<variablelist>
<varlistentry><term><anchor id="GtkSizeGroup--mode">&quot;<literal>mode</literal>&quot; (<link linkend="GtkSizeGroupMode">GtkSizeGroupMode</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>

</variablelist>
</refsect1>




</refentry>
