File: class-gtkiconset.html

package info (click to toggle)
python-gtk2-doc 2.5.2-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 8,304 kB
  • ctags: 3,741
  • sloc: makefile: 38
file content (58 lines) | stat: -rw-r--r-- 13,990 bytes parent folder | download
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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>gtk.IconSet</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="PyGTK 2.0 Reference Manual"><link rel="up" href="gtk-class-reference.html" title="The gtk Class Reference"><link rel="previous" href="class-gtkiconinfo.html" title="gtk.IconInfo"><link rel="next" href="class-gtkiconsource.html" title="gtk.IconSource"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">gtk.IconSet</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkiconinfo.html">Prev</a></td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"><a accesskey="n" href="class-gtkiconsource.html">Next</a></td></tr></table><hr></div><div class="refentry" lang="en"><a name="class-gtkiconset"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2>gtk.IconSet</h2><p>gtk.IconSet &#8212; contains a set of variants for an icon</p></div><div class="refsect1" lang="en"><a name="id3433654"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.IconSet</span></span>(<span class="ooclass"><span class="classname">gobject.GBoxed</span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a href="class-gtkiconset.html#constructor-gtkiconset" title="Constructor">gtk.IconSet</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixbuf</tt></b></span><span class="initializer">=None</span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkiconset.html#method-gtkiconset--copy" title="gtk.IconSet.copy">copy</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkiconset.html#method-gtkiconset--render-icon" title="gtk.IconSet.render_icon">render_icon</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>style</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>direction</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>state</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>widget</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>detail</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkiconset.html#method-gtkiconset--add-source" title="gtk.IconSet.add_source">add_source</a></span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>source</tt></b></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a href="class-gtkiconset.html#method-gtkiconset--get-sizes" title="gtk.IconSet.get_sizes">get_sizes</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table></div><div class="refsect1" lang="en"><a name="id3433788"></a><h2>Description</h2><p>A <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a>
contains a set of variants for a single icon. The variants provide icons of
different sizes and for different widget states. The variants can be added
with the <a href="class-gtkiconset.html#method-gtkiconset--add-source" title="gtk.IconSet.add_source"><tt class="methodname">add_source</tt>()</a> 
method.</p></div><div class="refsect1" lang="en"><a name="constructor-gtkiconset"></a><h2>Constructor</h2><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.IconSet</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>pixbuf</tt></b></span><span class="initializer">=None</span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>pixbuf</tt></b>:</span></td><td>a <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><tt class="classname">gtk.gdk.Pixbuf</tt></a></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a></td></tr></tbody></table><p>Creates a new <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a> with
<i class="parameter"><tt>pixbuf</tt></i> as the default fallback source image. If
<i class="parameter"><tt>pixbuf</tt></i> is <tt class="literal">None</tt> there is no default
fallback source image. If you don't add any additional <a href="class-gtkiconsource.html" title="gtk.IconSource"><tt class="classname">gtk.IconSource</tt></a>s
to the icon set, all variants of the icon will be created from
<i class="parameter"><tt>pixbuf</tt></i>, using scaling, pixelation, etc. as required
to adjust the icon size or make the icon look insensitive/prelighted.</p></div><div class="refsect1" lang="en"><a name="id3433915"></a><h2>Methods</h2><div class="refsect2" lang="en"><a name="method-gtkiconset--copy"></a><h3>gtk.IconSet.copy</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">copy</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a new <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a>
identical to the first.</td></tr></tbody></table><p>The <tt class="methodname">copy</tt>() method returns a copy of the
icon set.</p></div><div class="refsect2" lang="en"><a name="method-gtkiconset--render-icon"></a><h3>gtk.IconSet.render_icon</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">render_icon</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>style</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>direction</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>state</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>size</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>widget</tt></b></span></span>, <span class="methodparam"><span class="parameter"><b class="parameter"><tt>detail</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>style</tt></b>:</span></td><td>a <a href="class-gtkstyle.html" title="gtk.Style"><tt class="classname">gtk.Style</tt></a> associated
with <i class="parameter"><tt>widget</tt></i>, or
<tt class="literal">None</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>direction</tt></b>:</span></td><td>the text direction; one of:
<tt class="literal">gtk.TEXT_DIR_NONE</tt>, <tt class="literal">gtk.TEXT_DIR_LTR</tt>,
<tt class="literal">gtk.TEXT_DIR_RTL</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>state</tt></b>:</span></td><td>the widget state; one of:
<tt class="literal">gtk.STATE_NORMAL</tt>, <tt class="literal">gtk.STATE_ACTIVE</tt>,
<tt class="literal">gtk.STATE_PRELIGHT</tt>,
<tt class="literal">gtk.STATE_SELECTED</tt>,
<tt class="literal">gtk.STATE_INSENSITIVE</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>size</tt></b>:</span></td><td>the icon size; one of:
<tt class="literal">gtk.ICON_SIZE_INVALID</tt>,
<tt class="literal">gtk.ICON_SIZE_MENU</tt>,
<tt class="literal">gtk.ICON_SIZE_SMALL_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_LARGE_TOOLBAR</tt>,
<tt class="literal">gtk.ICON_SIZE_BUTTON</tt>,
<tt class="literal">gtk.ICON_SIZE_DND</tt>,
<tt class="literal">gtk.ICON_SIZE_DIALOG</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>widget</tt></b>:</span></td><td>the widget that will display the icon, or
<tt class="literal">None</tt></td></tr><tr><td><span class="term"><b class="parameter"><tt>detail</tt></b>:</span></td><td>the detail to pass to the theme engine, or
<tt class="literal">None</tt></td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a <a href="class-gdkpixbuf.html" title="gtk.gdk.Pixbuf"><tt class="classname">gtk.gdk.Pixbuf</tt></a> to be
displayed</td></tr></tbody></table><p>The <tt class="methodname">render_icon</tt>() method renders an
icon using <a href="class-gtkstyle.html#method-gtkstyle--render-icon" title="gtk.Style.render_icon"><tt class="function">gtk.Style.render_icon()</tt></a>. 
In most cases, <a href="class-gtkwidget.html#method-gtkwidget--render-icon" title="gtk.Widget.render_icon"><tt class="function">gtk.Widget.render_icon()</tt></a> 
is better, since it automatically provides most of the arguments from the
current widget settings.  This method never returns <tt class="literal">None</tt>;
if the icon can't be rendered (perhaps because an image file fails to load),
a default "missing image" icon will be returned instead.</p></div><div class="refsect2" lang="en"><a name="method-gtkiconset--add-source"></a><h3>gtk.IconSet.add_source</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">add_source</span>(<span class="methodparam"><span class="parameter"><b class="parameter"><tt>source</tt></b></span></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><b class="parameter"><tt>source</tt></b>:</span></td><td>a <a href="class-gtkiconsource.html" title="gtk.IconSource"><tt class="classname">gtk.IconSource</tt></a></td></tr></tbody></table><p>The <tt class="methodname">add_source</tt>() method adds the <a href="class-gtkiconsource.html" title="gtk.IconSource"><tt class="classname">gtk.IconSource</tt></a>
specified by <i class="parameter"><tt>source</tt></i> to the icon set.  Icon sets have
a list of <a href="class-gtkiconsource.html" title="gtk.IconSource"><tt class="classname">gtk.IconSource</tt></a>,
which they use as base icons for rendering icons in different states and
sizes. Icons are scaled, made to look insensitive, etc. in the <a href="class-gtkiconset.html#method-gtkiconset--render-icon" title="gtk.IconSet.render_icon"><tt class="methodname">render_icon</tt>()</a>
method, but <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a> needs
base images to work with. The base images and when to use them are described
by a <a href="class-gtkiconsource.html" title="gtk.IconSource"><tt class="classname">gtk.IconSource</tt></a>.</p><p>An example of when you'd use this method: a web browser's
"<span class="guibutton">Back to Previous Page</span>" icon might point in a
different direction in Hebrew and in English; it might look different when
insensitive; and it might change size depending on toolbar mode (small
or large icons). So a single icon set would contain all those variants of the
icon, and you might add a separate source for each one.</p><p>You should nearly always add a "default" icon source with all
fields wildcarded, which will be used as a fallback if no more specific
source matches. <a href="class-gtkiconset.html" title="gtk.IconSet"><tt class="classname">gtk.IconSet</tt></a> always
prefers more specific icon sources to more generic icon sources. The order
in which you add the sources to the icon set does not matter.</p><p>The <a href="class-gtkiconset.html#constructor-gtkiconset" title="Constructor"><tt class="methodname">gtk.IconSet</tt>()</a> 
constructor creates a new icon set with a default icon source based on the
given pixbuf.</p></div><div class="refsect2" lang="en"><a name="method-gtkiconset--get-sizes"></a><h3>gtk.IconSet.get_sizes</h3><table border="0" bgcolor="#E0E0E0" width="100%"><tr><td><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">get_sizes</span>(<span class="methodparam"></span>)</code></pre></td></tr></table><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span>:</span></td><td>a tuple containing all the icon sizes supported
by the icon set</td></tr></tbody></table><p>The <tt class="methodname">get_sizes</tt>() method returns a tuple
containing all the icon sizes this icon set can render.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="class-gtkiconinfo.html">Prev</a></td><td width="20%" align="center"><a accesskey="u" href="gtk-class-reference.html">Up</a></td><td width="40%" align="right"><a accesskey="n" href="class-gtkiconsource.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.IconInfo</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">gtk.IconSource</td></tr></table></div></body></html>