<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
    "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">

<refentry id="class-gtkalignment">
  <refnamediv>
    <refname>gtk.Alignment</refname>
    <refpurpose>a widget that controls the alignment and size of its
child</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.Alignment</classname></ooclass>
      <ooclass><classname><link
linkend="class-gtkbin">gtk.Bin</link></classname></ooclass>
      <constructorsynopsis language="python">
	<methodname><link linkend="constructor-gtkalignment">gtk.Alignment</link></methodname>
	<methodparam><parameter
		       role="keyword">xalign</parameter><initializer>0.0</initializer></methodparam>
	<methodparam><parameter
		       role="keyword">yalign</parameter><initializer>0.0</initializer></methodparam>
	<methodparam><parameter
		       role="keyword">xscale</parameter><initializer>0.0</initializer></methodparam>
	<methodparam><parameter
		       role="keyword">yscale</parameter><initializer>0.0</initializer></methodparam>
      </constructorsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkalignment--set">set</link></methodname>
	<methodparam><parameter
		       role="keyword">xalign</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">yalign</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">xscale</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">yscale</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkalignment--set-padding">set_padding</link></methodname>
	<methodparam><parameter
		       role="keyword">padding_top</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">padding_bottom</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">padding_left</parameter></methodparam>
	<methodparam><parameter
		       role="keyword">padding_right</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link
linkend="method-gtkalignment--get-padding">get_padding</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>

    </classsynopsis>

  </refsect1>
  <refsect1>
    <title>Ancestry</title>

<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
  +-- <link linkend="class-gtkobject">gtk.Object</link>
    +-- <link linkend="class-gtkwidget">gtk.Widget</link>
      +-- <link linkend="class-gtkcontainer">gtk.Container</link>
        +-- <link linkend="class-gtkbin">gtk.Bin</link>
          +-- <link linkend="class-gtkalignment">gtk.Alignment</link>
</synopsis>

  </refsect1>
  
  <refsect1>
		<title>Implemented Interfaces</title>
		<para>
			<link linkend="class-gtkalignment"><classname>gtk.Alignment</classname></link>
			implements 
			<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
		</para>
	</refsect1>

  <refsect1 id="properties-gtkalignment">
    <title>gtk.Alignment Properties</title>

    <para><link linkend="properties-gtkobject">gtk.Object Properties</link></para>
    <para><link linkend="properties-gtkwidget">gtk.Widget Properties</link></para>
    <para><link linkend="properties-gtkcontainer">gtk.Container Properties</link></para>


    <blockquote role="properties">
      <informaltable pgwide="1" frame="none">
	<tgroup cols="3">
	  <colspec column="1" colwidth="1in"/>
	  <colspec column="2" colwidth="1in"/>
	  <colspec column="3" colwidth="3.5in"/>
	  <tbody>

	<row valign="top">
	  <entry>"bottom-padding"</entry> <entry>Read/Write</entry>
	  <entry>The padding to insert at the bottom of the widget. GTK+ 2.4
	  and above.</entry>
	</row>

	<row valign="top">
	  <entry>"left-padding"</entry>
	  <entry>Read/Write</entry>
	  <entry>The padding to insert at the left of the widget. GTK+ 2.4
	  and above.</entry>
	</row>

	<row valign="top">
	  <entry>"right-padding"</entry>
	  <entry>Read/Write</entry>
	  <entry>The padding to insert at the right of the widget. GTK+ 2.4
	  and above.</entry>
	</row>

	<row valign="top">
	  <entry>"top-padding"</entry>
	  <entry>Read/Write</entry>
	  <entry>The padding to insert at the top of the widget. GTK+ 2.4
	  and above.</entry>
	</row>

        <row valign="top">
          <entry>"xalign"</entry>
          <entry>Read/Write</entry>
          <entry>The fraction of horizontal <emphasis>free</emphasis> space
          to the left of the child. 0.0 means no <emphasis>free</emphasis>
          space to the left, 1.0 means all <emphasis>free</emphasis> space
          to the left.</entry>
        </row>

	<row valign="top">
	  <entry>"xscale"</entry>
	  <entry>Read/Write</entry>
	  <entry>The fraction of horizontal <emphasis>free</emphasis> space
(beyond that needed by the child) that the child will absorb. 0.0 means the
child will absorb none, 1.0 means the child will absorb all</entry>
	</row>

	<row valign="top">
	  <entry>"yalign"</entry>
	  <entry>Read/Write</entry>
	  <entry>The fraction of vertical <emphasis>free</emphasis> space
	  above the child. 0.0 means no <emphasis>free</emphasis> space
	  above, 1.0 means all <emphasis>free</emphasis> space
	  above.</entry>
	</row>

	<row valign="top">
	  <entry>"yscale"</entry>
	  <entry>Read/Write</entry>
	  <entry>The fraction of vertical <emphasis>free</emphasis> space
(beyond that needed by the child) that the child will absorb. 0.0 means the
child will absorb none, 1.0 means the child will absorb all</entry>
	</row>

	</tbody>
      </tgroup>
      </informaltable>
    </blockquote>

  </refsect1>

  <refsect1 id="style-properties-gtkalignment">
    <title>gtk.Alignment Style Properties</title>

    <para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>


  </refsect1>

  <refsect1 id="signal-prototypes-gtkalignment">
    <title>gtk.Alignment Signal Prototypes</title>

    <para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkobject">gtk.Object Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkwidget">gtk.Widget Signal Prototypes</link></para>
    <para><link linkend="signal-prototypes-gtkcontainer">gtk.Container Signal Prototypes</link></para>
</refsect1>

  <refsect1>
    <title>Description</title>

    <para>The <link
linkend="class-gtkalignment"><classname>gtk.Alignment</classname></link>
widget controls the alignment and size of its child widget. It has four
properties: xscale, yscale, xalign, and yalign. The scale properties are
used to specify how much of the <emphasis>free</emphasis> (extra) space
allocated to the <link
linkend="class-gtkalignment"><classname>gtk.Alignment</classname></link>
should be absorbed by the child widget. The values can range from 0.0
(meaning the child absorbs none) to 1.0 (meaning the child absorbs all of
the <emphasis>free</emphasis> space). If the value is 0.5, the child widget
absorbs half the <emphasis>free</emphasis> space. The align properties are
used to place the child widget within the available area by specifying the
fraction of <emphasis>free</emphasis> space that will be placed above or to
the left of the child widget. The values range from 0.0 (no
<emphasis>free</emphasis> space above or to the left of the child) to 1.0
(all <emphasis>free</emphasis> space above or to the left of the child). Of
course, if the scale properties are both set to 1.0, the alignment
properties have no effect.</para>

    <para>An example may make this clearer. A <link
linkend="class-gtkimage"><classname>gtk.Button</classname></link> widget (32
pixels wide by 32 pixels high) is placed inside a <link
linkend="class-gtkalignment"><classname>gtk.Alignment</classname></link>
widget (256 pixels wide by 128 pixels high) which has xalign of 0.25, yalign
of 0.25, xscale of 0.25 and yscale of 0.25. The horizontal
<emphasis>free</emphasis> space is 256-32=224 pixels and the vertical
<emphasis>free</emphasis> space is 128-32=96 pixels. The button will absorb
0.25x224=56 pixels horizontally and 0.25x96=24 pixels vertically since the
xscale and yscale are 0.25 thus becoming 32+56=88 pixels wide by 32+24=56
pixels high. This will leave 256-88=168 pixels of horizontal
<emphasis>free</emphasis> space and 128-56=72 pixels of vertical
<emphasis>free</emphasis> space. Since the xalign value is 0.25 the
horizontal <emphasis>free</emphasis> space will be allocated as 0.25x168=42
pixels to the left of the button and 0.72x168=126 pixels to the right.
Likewise since the yalign is 0.25 the vertical <emphasis>free</emphasis>
space is allocated as 0.25x72=18 pixels above the button and 0.75*72=54
pixels below.</para>

  </refsect1>

  <refsect1 id="constructor-gtkalignment">
    <title>Constructor</title>

    <programlisting><constructorsynopsis language="python">
	<methodname>gtk.Alignment</methodname>
	<methodparam><parameter
		       role="keyword">xalign</parameter><initializer>0.0</initializer></methodparam>
	<methodparam><parameter
		       role="keyword">yalign</parameter><initializer>0.0</initializer></methodparam>
	<methodparam><parameter
		       role="keyword">xscale</parameter><initializer>0.0</initializer></methodparam>
	<methodparam><parameter
		       role="keyword">yscale</parameter><initializer>0.0</initializer></methodparam>
      </constructorsynopsis></programlisting>
    <variablelist>
      <varlistentry>
	<term><parameter role="keyword">xalign</parameter>&nbsp;:</term>
	<listitem><simpara>the fraction of horizontal
<emphasis>free</emphasis> space to the left of the child widget. Ranges from
0.0 to 1.0</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">yalign</parameter>&nbsp;:</term>
	<listitem><simpara>the fraction of  vertical
<emphasis>free</emphasis> space above the child widget. Ranges from 0.0 to
1.0</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">xscale</parameter>&nbsp;:</term>
	<listitem><simpara>the fraction of horizontal
<emphasis>free</emphasis> space that the child widget absorbs, from 0.0 to
1.0</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><parameter role="keyword">yscale</parameter>&nbsp;:</term>
	<listitem><simpara>the fraction of vertical
<emphasis>free</emphasis> space that the child widget absorbs, from 0.0 to
1.0</simpara></listitem>
      </varlistentry>
      <varlistentry>
	<term><emphasis>Returns</emphasis>&nbsp;:</term>
	<listitem><simpara>a new alignment object</simpara></listitem>
      </varlistentry>
    </variablelist>

    <para>Creates a new alignment widget with the specified properties. If
the scale and alignment parameters are not specified they default to
0.0.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkalignment--set">
      <title>gtk.Alignment.set</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set</methodname>
	  <methodparam><parameter
			 role="keyword">xalign</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">yalign</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">xscale</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">yscale</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">xalign</parameter>&nbsp;:</term>
	  <listitem><simpara>the fraction of horizontal
<emphasis>free</emphasis> space to the left of the child widget. Ranges from
0.0 to 1.0</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">yalign</parameter>&nbsp;:</term>
	  <listitem><simpara>the fraction of  vertical
<emphasis>free</emphasis> space above the child widget. Ranges from 0.0 to
1.0</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">xscale</parameter>&nbsp;:</term>
	  <listitem><simpara>the fraction of horizontal
<emphasis>free</emphasis> space that the child widget absorbs, from 0.0 to
1.0</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter role="keyword">yscale</parameter>&nbsp;:</term>
	  <listitem><simpara>the fraction of vertical
<emphasis>free</emphasis> space that the child widget absorbs, from 0.0 to
1.0</simpara></listitem>
	</varlistentry>
      </variablelist>

      <para>The <methodname>set</methodname>() method sets the properties of
the alignment widget to the specified values.</para>

    </refsect2>

    <refsect2 id="method-gtkalignment--set-padding">
      <title>gtk.Alignment.set_padding</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_padding</methodname>
	  <methodparam><parameter
			 role="keyword">padding_top</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">padding_bottom</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">padding_left</parameter></methodparam>
	  <methodparam><parameter
			 role="keyword">padding_right</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter
	  role="keyword">padding_top</parameter>&nbsp;:</term>
	  <listitem><simpara> the padding at the top of the
	  widget</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
	  role="keyword">padding_bottom</parameter>&nbsp;:</term>
	  <listitem><simpara> the padding at the bottom of the
	  widget</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
	  role="keyword">padding_left</parameter>&nbsp;:</term>
	  <listitem><simpara> the padding at the left of the
	  widget</simpara></listitem>
	</varlistentry>
	<varlistentry>
	  <term><parameter
	  role="keyword">padding_right</parameter>&nbsp;:</term>
	  <listitem><simpara> the padding at the right of the
	  widget.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>set_padding</methodname>() method sets the
padding around the sides of the alignment widget to the values specified by
<parameter>padding_top</parameter>, <parameter>padding_bottom</parameter>,
<parameter>padding_left</parameter> and
<parameter>padding_right</parameter>. The padding adds blank space to the
sides of the widget. For instance, this can be used to indent the child
widget toward the right by adding padding on the left.</para>

    </refsect2>

    <refsect2 id="method-gtkalignment--get-padding">
      <title>gtk.Alignment.get_padding</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_padding</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a 4-tuple containing the padding set on the
	  top, bottom, left and right sides of the
	  widget</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>get_padding</methodname>() method returns a
      4-tuple containing the padding set on the sides of the widget.</para>

    </refsect2>

  </refsect1>

</refentry>
