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 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411
|
<?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> :</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> :</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> :</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> :</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> :</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> :</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> :</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> :</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> :</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> :</term>
<listitem><simpara> the padding at the top of the
widget</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">padding_bottom</parameter> :</term>
<listitem><simpara> the padding at the bottom of the
widget</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">padding_left</parameter> :</term>
<listitem><simpara> the padding at the left of the
widget</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">padding_right</parameter> :</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> :</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>
|