1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303
|
<?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-gtkaspectframe">
<refnamediv>
<refname>gtk.AspectFrame</refname>
<refpurpose>A frame that constrains its child to a particular aspect
ratio.</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gtk.AspectFrame</classname></ooclass>
<ooclass><classname><link
linkend="class-gtkframe">gtk.Frame</link></classname></ooclass>
<constructorsynopsis language="python">
<methodname><link linkend="constructor-gtkaspectframe">gtk.AspectFrame</link></methodname>
<methodparam><parameter
role="keyword">label</parameter><initializer>None</initializer></methodparam>
<methodparam><parameter
role="keyword">xalign</parameter><initializer>0.5</initializer></methodparam>
<methodparam><parameter
role="keyword">yalign</parameter><initializer>0.5</initializer></methodparam>
<methodparam><parameter
role="keyword">ratio</parameter><initializer>1.0</initializer></methodparam>
<methodparam><parameter
role="keyword">obey_child</parameter><initializer>True</initializer></methodparam>
</constructorsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkaspectframe--set">set</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">ratio</parameter><initializer>1.0</initializer></methodparam>
<methodparam><parameter
role="keyword">obey_child</parameter><initializer>True</initializer></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-gtkframe">gtk.Frame</link>
+-- <link linkend="class-gtkaspectframe">gtk.AspectFrame</link>
</synopsis>
</refsect1>
<refsect1>
<title>Implemented Interfaces</title>
<para>
<link linkend="class-gtkaspectframe"><classname>gtk.AspectFrame</classname></link>
implements
<link linkend="class-gtkbuildable"><classname>gtk.Buildable</classname></link>
</para>
</refsect1>
<refsect1 id="properties-gtkaspectframe">
<title>gtk.AspectFrame 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>
<para><link linkend="properties-gtkframe">gtk.Frame 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="4.5in"/>
<tbody>
<row valign="top">
<entry>"obey-child"</entry>
<entry>Read/Write</entry>
<entry>Make aspect ratio match that of the child widget</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>"ratio"</entry>
<entry>Read/Write</entry>
<entry>The aspect ratio of the widget in the range of 0.0001 to
10000.0 if "obey-child" is <literal>False</literal>.</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>
</tbody>
</tgroup>
</informaltable>
</blockquote>
</refsect1>
<refsect1 id="style-properties-gtkaspectframe">
<title>gtk.AspectFrame Style Properties</title>
<para><link linkend="style-properties-gtkwidget">gtk.Widget Style Properties</link></para>
</refsect1>
<refsect1 id="signal-prototypes-gtkaspectframe">
<title>gtk.AspectFrame 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-gtkaspectframe"><classname>gtk.AspectFrame</classname></link>
packs 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="class-gtkaspectframe"><classname>gtk.AspectFrame</classname></link>
derives from <link
linkend="class-gtkframe"><classname>gtk.Frame</classname></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>
<para>The aspect frame "ratio" property determines the widget
width:height ratio. An aspect ratio of 0.5 means the width is one half the
height; an aspect ratio of 2.0 means the width is twice the height. The
default value for the "ratio" property is 1.0.</para>
<para>The align properties are used to place the child widget within the
available area by specifying the fraction of <emphasis>free</emphasis> space
(space in the aspect frame that is not used by the child widget) that is
placed above or to the left of the child widget. The values range from 0.0
(meaning no <emphasis>free</emphasis> space above or to the left of the
child) to 1.0 (meaning all <emphasis>free</emphasis> space above or to the
left of the child) . The default value for both align properties is
0.5.</para>
<para>If the "obey-child" property is True (the default value), the
"ratio" property is ignored and the aspect ratio is set by the child
widget.</para>
</refsect1>
<refsect1 id="constructor-gtkaspectframe">
<title>Constructor</title>
<programlisting><constructorsynopsis language="python">
<methodname>gtk.AspectFrame</methodname>
<methodparam><parameter
role="keyword">label</parameter><initializer>None</initializer></methodparam>
<methodparam><parameter
role="keyword">xalign</parameter><initializer>0.5</initializer></methodparam>
<methodparam><parameter
role="keyword">yalign</parameter><initializer>0.5</initializer></methodparam>
<methodparam><parameter
role="keyword">ratio</parameter><initializer>1.0</initializer></methodparam>
<methodparam><parameter
role="keyword">obey_child</parameter><initializer>True</initializer></methodparam>
</constructorsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">label</parameter> :</term>
<listitem><simpara>a string used to set the aspect frame
label</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">xalign</parameter> :</term>
<listitem><simpara>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.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">yalign</parameter> :</term>
<listitem><simpara>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.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">ratio</parameter> :</term>
<listitem><simpara>the ratio of the child width to height (in the
range 0.0001 to 10000.0) if <parameter>obey_child</parameter> is
False</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">obey_child</parameter> :</term>
<listitem><simpara>if True, <parameter>ratio</parameter> is ignored,
and the aspect ratio is taken from the requisition of the
child.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new aspect frame object</simpara></listitem>
</varlistentry>
</variablelist>
<para>Creates a new aspect frame object with the specified
<parameter>label</parameter>, <parameter>xalign</parameter> and
<parameter>yalign</parameter> values. The default values are:
<parameter>label</parameter>, None; <parameter>xalign</parameter>, 0.5; and,
<parameter>yalign</parameter>, 0.5. If <parameter>obey_child</parameter> is
True the <parameter>ratio</parameter> value is ignored. If
<parameter>obey_child</parameter> is False, <parameter>ratio</parameter>
sets the aspect ratio for the child widget. The default value for
<parameter>ratio</parameter> is 1.0. The default value for
<parameter>obey_child</parameter> is True.</para>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-gtkaspectframe--set">
<title>gtk.AspectFrame.set</title>
<programlisting><methodsynopsis language="python">
<methodname>set</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">ratio</parameter><initializer>1.0</initializer></methodparam>
<methodparam><parameter
role="keyword">obey_child</parameter><initializer>True</initializer></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">xalign</parameter> :</term>
<listitem><simpara>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.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">yalign</parameter> :</term>
<listitem><simpara>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.</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">ratio</parameter> :</term>
<listitem><simpara>the ratio of the child width to height (in the
range 0.0001 to 10000.0) if <parameter>obey_child</parameter> is
False</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">obey_child</parameter> :</term>
<listitem><simpara>if True, <parameter>ratio</parameter> is
ignored, and the aspect ratio is taken from the requisition of the
child</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>set</methodname>() method changes the aspect
frame properties to the values specified by <parameter>xalign</parameter>,
<parameter>yalign</parameter>, <parameter>ratio</parameter> and
<parameter>obey_child</parameter>. The default values are:
<parameter>xalign</parameter>, 0; <parameter>yalign</parameter>, 0.0;
<parameter>ratio</parameter>, 1.0; and, <parameter>obey_child</parameter>,
True.</para>
</refsect2>
</refsect1>
</refentry>
|