<?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="GtkAspectFrame">
<refmeta>
<refentrytitle role="top_of_page" id="GtkAspectFrame.top_of_page">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 id="GtkAspectFrame.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

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

                    <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);
<link linkend="void">void</link>                <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 id="GtkAspectFrame.object-hierarchy" role="object_hierarchy">
<title role="object_hierarchy.title">Object Hierarchy</title>
<synopsis>
  <link linkend="GObject">GObject</link>
   +----<link linkend="GInitiallyUnowned">GInitiallyUnowned</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 id="GtkAspectFrame.implemented-interfaces" role="impl_interfaces">
<title role="impl_interfaces.title">Implemented Interfaces</title>
<para>
GtkAspectFrame implements
 <link linkend="AtkImplementorIface">AtkImplementorIface</link> and  <link linkend="GtkBuildable">GtkBuildable</link>.</para>
</refsect1>


<refsect1 id="GtkAspectFrame.properties" role="properties">
<title role="properties.title">Properties</title>
<synopsis>
  &quot;<link linkend="GtkAspectFrame--obey-child">obey-child</link>&quot;               <link linkend="gboolean">gboolean</link>              : Read / Write
  &quot;<link linkend="GtkAspectFrame--ratio">ratio</link>&quot;                    <link linkend="gfloat">gfloat</link>                : Read / Write
  &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
</synopsis>
</refsect1>



<refsect1 id="GtkAspectFrame.description" role="desc">
<title role="desc.title">Description</title>
<para>
The <link linkend="GtkAspectFrame"><type>GtkAspectFrame</type></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"><type>GtkAspectFrame</type></link>
derives from <link linkend="GtkFrame"><type>GtkFrame</type></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 id="GtkAspectFrame.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="GtkAspectFrame-struct" role="struct">
<title>GtkAspectFrame</title>
<indexterm zone="GtkAspectFrame-struct"><primary sortas="AspectFrame">GtkAspectFrame</primary></indexterm><programlisting>typedef struct _GtkAspectFrame GtkAspectFrame;</programlisting>
<para>
</para></refsect2>
<refsect2 id="gtk-aspect-frame-new" role="function">
<title>gtk_aspect_frame_new ()</title>
<indexterm zone="gtk-aspect-frame-new"><primary sortas="aspect_frame_new">gtk_aspect_frame_new</primary></indexterm><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"><type>GtkAspectFrame</type></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>label</parameter>&#160;:</term>
<listitem><simpara>Label text.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>xalign</parameter>&#160;:</term>
<listitem><simpara>Horizontal alignment of the child within the allocation of
the <link linkend="GtkAspectFrame"><type>GtkAspectFrame</type></link>. This ranges from 0.0 (left aligned)
to 1.0 (right aligned)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>yalign</parameter>&#160;:</term>
<listitem><simpara>Vertical alignment of the child within the allocation of
the <link linkend="GtkAspectFrame"><type>GtkAspectFrame</type></link>. This ranges from 0.0 (left aligned)
to 1.0 (right aligned)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ratio</parameter>&#160;:</term>
<listitem><simpara>The desired aspect ratio.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>obey_child</parameter>&#160;:</term>
<listitem><simpara>If <link linkend="TRUE--CAPS"><literal>TRUE</literal></link>, <parameter>ratio</parameter> is ignored, and the aspect
    ratio is taken from the requistion of the child.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara>the new <link linkend="GtkAspectFrame"><type>GtkAspectFrame</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gtk-aspect-frame-set" role="function">
<title>gtk_aspect_frame_set ()</title>
<indexterm zone="gtk-aspect-frame-set"><primary sortas="aspect_frame_set">gtk_aspect_frame_set</primary></indexterm><programlisting><link linkend="void">void</link>                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"><type>GtkAspectFrame</type></link>.
</para><variablelist role="params">
<varlistentry><term><parameter>aspect_frame</parameter>&#160;:</term>
<listitem><simpara>a <link linkend="GtkAspectFrame"><type>GtkAspectFrame</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>xalign</parameter>&#160;:</term>
<listitem><simpara>Horizontal alignment of the child within the allocation of
the <link linkend="GtkAspectFrame"><type>GtkAspectFrame</type></link>. This ranges from 0.0 (left aligned)
to 1.0 (right aligned)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>yalign</parameter>&#160;:</term>
<listitem><simpara>Vertical alignment of the child within the allocation of
the <link linkend="GtkAspectFrame"><type>GtkAspectFrame</type></link>. This ranges from 0.0 (left aligned)
to 1.0 (right aligned)
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ratio</parameter>&#160;:</term>
<listitem><simpara>The desired aspect ratio.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>obey_child</parameter>&#160;:</term>
<listitem><simpara>If <link linkend="TRUE--CAPS"><literal>TRUE</literal></link>, <parameter>ratio</parameter> is ignored, and the aspect
    ratio is taken from the requistion of the child.
</simpara></listitem></varlistentry>
</variablelist></refsect2>

</refsect1>
<refsect1 id="GtkAspectFrame.property-details" role="property_details">
<title role="property_details.title">Property Details</title>
<refsect2 id="GtkAspectFrame--obey-child" role="property"><title>The <literal>&quot;obey-child&quot;</literal> property</title>
<indexterm zone="GtkAspectFrame--obey-child"><primary sortas="AspectFrame:obey-child">GtkAspectFrame:obey-child</primary></indexterm><programlisting>  &quot;obey-child&quot;               <link linkend="gboolean">gboolean</link>              : Read / Write</programlisting>
<para>Force aspect ratio to match that of the frame's child.</para><para>Default value: TRUE</para>
</refsect2>
<refsect2 id="GtkAspectFrame--ratio" role="property"><title>The <literal>&quot;ratio&quot;</literal> property</title>
<indexterm zone="GtkAspectFrame--ratio"><primary sortas="AspectFrame:ratio">GtkAspectFrame:ratio</primary></indexterm><programlisting>  &quot;ratio&quot;                    <link linkend="gfloat">gfloat</link>                : Read / Write</programlisting>
<para>Aspect ratio if obey_child is FALSE.</para><para>Allowed values: [0.0001,10000]</para>
<para>Default value: 1</para>
</refsect2>
<refsect2 id="GtkAspectFrame--xalign" role="property"><title>The <literal>&quot;xalign&quot;</literal> property</title>
<indexterm zone="GtkAspectFrame--xalign"><primary sortas="AspectFrame:xalign">GtkAspectFrame:xalign</primary></indexterm><programlisting>  &quot;xalign&quot;                   <link linkend="gfloat">gfloat</link>                : Read / Write</programlisting>
<para>X alignment of the child.</para><para>Allowed values: [0,1]</para>
<para>Default value: 0.5</para>
</refsect2>
<refsect2 id="GtkAspectFrame--yalign" role="property"><title>The <literal>&quot;yalign&quot;</literal> property</title>
<indexterm zone="GtkAspectFrame--yalign"><primary sortas="AspectFrame:yalign">GtkAspectFrame:yalign</primary></indexterm><programlisting>  &quot;yalign&quot;                   <link linkend="gfloat">gfloat</link>                : Read / Write</programlisting>
<para>Y alignment of the child.</para><para>Allowed values: [0,1]</para>
<para>Default value: 0.5</para>
</refsect2>
</refsect1>




</refentry>
