<refentry id="GtkAspectFrame">
<refmeta>
<refentrytitle>GtkAspectFrame</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GTK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>GtkAspectFrame</refname><refpurpose>A frame that constrains its child to a particular aspect ratio.</refpurpose>
</refnamediv>

<refsynopsisdiv><title>Synopsis</title>
<synopsis>

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


struct      <link linkend="GtkAspectFrame-struct">GtkAspectFrame</link>;
<link linkend="GtkWidget">GtkWidget</link>*  <link linkend="gtk-aspect-frame-new">gtk_aspect_frame_new</link>            (const <link linkend="gchar">gchar</link> *label,
                                             <link linkend="gfloat">gfloat</link> xalign,
                                             <link linkend="gfloat">gfloat</link> yalign,
                                             <link linkend="gfloat">gfloat</link> ratio,
                                             <link linkend="gboolean">gboolean</link> obey_child);
void        <link linkend="gtk-aspect-frame-set">gtk_aspect_frame_set</link>            (<link linkend="GtkAspectFrame">GtkAspectFrame</link> *aspect_frame,
                                             <link linkend="gfloat">gfloat</link> xalign,
                                             <link linkend="gfloat">gfloat</link> yalign,
                                             <link linkend="gfloat">gfloat</link> ratio,
                                             <link linkend="gboolean">gboolean</link> obey_child);


</synopsis>
</refsynopsisdiv>

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

  <link linkend="GObject">GObject</link>
   +----<link linkend="GtkObject">GtkObject</link>
         +----<link linkend="GtkWidget">GtkWidget</link>
               +----<link linkend="GtkContainer">GtkContainer</link>
                     +----<link linkend="GtkBin">GtkBin</link>
                           +----<link linkend="GtkFrame">GtkFrame</link>
                                 +----GtkAspectFrame
</synopsis>

</refsect1>

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

  &quot;<link linkend="GtkAspectFrame--xalign">xalign</link>&quot;               <link linkend="gfloat">gfloat</link>               : Read / Write
  &quot;<link linkend="GtkAspectFrame--yalign">yalign</link>&quot;               <link linkend="gfloat">gfloat</link>               : Read / Write
  &quot;<link linkend="GtkAspectFrame--ratio">ratio</link>&quot;                <link linkend="gfloat">gfloat</link>               : Read / Write
  &quot;<link linkend="GtkAspectFrame--obey-child">obey-child</link>&quot;           <link linkend="gboolean">gboolean</link>             : Read / Write
</synopsis>
</refsect1>



<refsect1>
<title>Description</title>
<para>
The <link linkend="GtkAspectFrame">GtkAspectFrame</link> is useful when you want
pack a widget so that it can resize but always retains
the same aspect ratio. For instance, one might be
drawing a small preview of a larger image. <link linkend="GtkAspectFrame">GtkAspectFrame</link>
derives from <link linkend="GtkFrame">GtkFrame</link>, so it can draw a label and
a frame around the child. The frame will be
"shrink-wrapped" to the size of the child.
</para>
</refsect1>

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

</para></refsect2>
<refsect2>
<title><anchor id="gtk-aspect-frame-new">gtk_aspect_frame_new ()</title>
<programlisting><link linkend="GtkWidget">GtkWidget</link>*  gtk_aspect_frame_new            (const <link linkend="gchar">gchar</link> *label,
                                             <link linkend="gfloat">gfloat</link> xalign,
                                             <link linkend="gfloat">gfloat</link> yalign,
                                             <link linkend="gfloat">gfloat</link> ratio,
                                             <link linkend="gboolean">gboolean</link> obey_child);</programlisting>
<para>
Create a new <link linkend="GtkAspectFrame">GtkAspectFrame</link>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>label</parameter>&nbsp;:</entry>
<entry>Label text.
</entry></row>
<row><entry align="right"><parameter>xalign</parameter>&nbsp;:</entry>
<entry>Horizontal alignment of the child within the allocation of
the <link linkend="GtkAspectFrame">GtkAspectFrame</link>. This ranges from 0.0 (left aligned)
to 1.0 (right aligned)
</entry></row>
<row><entry align="right"><parameter>yalign</parameter>&nbsp;:</entry>
<entry>Vertical alignment of the child within the allocation of
the <link linkend="GtkAspectFrame">GtkAspectFrame</link>. This ranges from 0.0 (left aligned)
to 1.0 (right aligned)
</entry></row>
<row><entry align="right"><parameter>ratio</parameter>&nbsp;:</entry>
<entry>The desired aspect ratio.
</entry></row>
<row><entry align="right"><parameter>obey_child</parameter>&nbsp;:</entry>
<entry>If <literal>TRUE</literal>, <parameter>ratio</parameter> is ignored, and the aspect
    ratio is taken from the requistion of the child.
</entry></row>
<row><entry align="right"><emphasis>Returns</emphasis> :</entry><entry>the new <link linkend="GtkAspectFrame">GtkAspectFrame</link>.
</entry></row>
</tbody></tgroup></informaltable></refsect2>
<refsect2>
<title><anchor id="gtk-aspect-frame-set">gtk_aspect_frame_set ()</title>
<programlisting>void        gtk_aspect_frame_set            (<link linkend="GtkAspectFrame">GtkAspectFrame</link> *aspect_frame,
                                             <link linkend="gfloat">gfloat</link> xalign,
                                             <link linkend="gfloat">gfloat</link> yalign,
                                             <link linkend="gfloat">gfloat</link> ratio,
                                             <link linkend="gboolean">gboolean</link> obey_child);</programlisting>
<para>
Set parameters for an existing <link linkend="GtkAspectFrame">GtkAspectFrame</link>.
</para><informaltable pgwide="1" frame="none" role="params">
<tgroup cols="2">
<colspec colwidth="2*">
<colspec colwidth="8*">
<tbody>
<row><entry align="right"><parameter>aspect_frame</parameter>&nbsp;:</entry>
<entry>a <link linkend="GtkAspectFrame">GtkAspectFrame</link>
</entry></row>
<row><entry align="right"><parameter>xalign</parameter>&nbsp;:</entry>
<entry>Horizontal alignment of the child within the allocation of
the <link linkend="GtkAspectFrame">GtkAspectFrame</link>. This ranges from 0.0 (left aligned)
to 1.0 (right aligned)
</entry></row>
<row><entry align="right"><parameter>yalign</parameter>&nbsp;:</entry>
<entry>Vertical alignment of the child within the allocation of
the <link linkend="GtkAspectFrame">GtkAspectFrame</link>. This ranges from 0.0 (left aligned)
to 1.0 (right aligned)
</entry></row>
<row><entry align="right"><parameter>ratio</parameter>&nbsp;:</entry>
<entry>The desired aspect ratio.
</entry></row>
<row><entry align="right"><parameter>obey_child</parameter>&nbsp;:</entry>
<entry>If <literal>TRUE</literal>, <parameter>ratio</parameter> is ignored, and the aspect
    ratio is taken from the requistion of the child.


</entry></row>
</tbody></tgroup></informaltable></refsect2>

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

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkAspectFrame--yalign">&quot;<literal>yalign</literal>&quot; (<link linkend="gfloat">gfloat</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkAspectFrame--ratio">&quot;<literal>ratio</literal>&quot; (<link linkend="gfloat">gfloat</link> : Read / Write)</term>
<listitem>
<para>

</para></listitem></varlistentry>
<varlistentry><term><anchor id="GtkAspectFrame--obey-child">&quot;<literal>obey-child</literal>&quot; (<link linkend="gboolean">gboolean</link> : Read / Write)</term>
<listitem>
<para>

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

</variablelist>
</refsect1>




</refentry>
