File: class-gtkiconfactory.html

package info (click to toggle)
pygtk 2.24.0-5.1
  • links: PTS, VCS
  • area: main
  • in suites: buster, stretch
  • size: 26,760 kB
  • ctags: 8,260
  • sloc: xml: 182,079; sh: 10,297; python: 10,161; ansic: 2,861; makefile: 1,358
file content (55 lines) | stat: -rw-r--r-- 14,206 bytes parent folder | download | duplicates (3)
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
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>gtk.IconFactory</title><link rel="stylesheet" href="style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.75.2"><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="prev" href="class-gtkhseparator.html" title="gtk.HSeparator"><link rel="next" href="class-gtkiconinfo.html" title="gtk.IconInfo"></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.IconFactory</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="class-gtkhseparator.html">Prev</a> </td><th width="60%" align="center">The gtk Class Reference</th><td width="20%" align="right"> <a accesskey="n" href="class-gtkiconinfo.html">Next</a></td></tr></table><hr></div><div class="refentry" title="gtk.IconFactory"><a name="class-gtkiconfactory"></a><div class="titlepage"></div><div class="refnamediv"><h2>gtk.IconFactory</h2><p>gtk.IconFactory — an object that manages a group of icon sets.</p></div><div class="refsect1" title="Synopsis"><a name="id3730584"></a><h2>Synopsis</h2><table bgcolor="#D0E0F0" width="100%"><tr><td><pre class="classsynopsis">class <span class="ooclass"><span class="classname">gtk.IconFactory</span></span>(<span class="ooclass"><span class="classname"><PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK></span></span>):
<code class="constructorsynopsis">    <span class="methodname"><a class="link" href="class-gtkiconfactory.html#constructor-gtkiconfactory" title="Constructor">gtk.IconFactory</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add" title="gtk.IconFactory.add">add</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon_set</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--lookup" title="gtk.IconFactory.lookup">lookup</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default">add_default</a></span>(<span class="methodparam"></span>)</code><br><code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--remove-default" title="gtk.IconFactory.remove_default">remove_default</a></span>(<span class="methodparam"></span>)</code><br></pre></td></tr></table><pre class="programlisting">
<span class="bold"><strong>Functions</strong></span>

<code class="methodsynopsis">    def <span class="methodname"><a class="link" href="class-gtkiconfactory.html#function-gtk--icon-factory-lookup-default" title="gtk.icon_factory_lookup_default">gtk.icon_factory_lookup_default</a></span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>)</code></pre></div><div class="refsect1" title="Ancestry"><a name="id3730782"></a><h2>Ancestry</h2><pre class="synopsis">+-- <PYGTKDOCLINK HREF="class-gobject">gobject.GObject</PYGTKDOCLINK>
  +-- <a class="link" href="class-gtkiconfactory.html" title="gtk.IconFactory">gtk.IconFactory</a>
</pre></div><div class="refsect1" title="gtk.IconFactory Signal Prototypes"><a name="signal-prototypes-gtkiconfactory"></a><h2>gtk.IconFactory Signal Prototypes</h2><p><PYGTKDOCLINK HREF="signal-prototypes-gobject">gobject.GObject Signal Prototypes</PYGTKDOCLINK></p></div><div class="refsect1" title="Description"><a name="id3730828"></a><h2>Description</h2><p>A <a class="link" href="class-gtkiconfactory.html" title="gtk.IconFactory"><code class="classname">gtk.IconFactory</code></a>
manages a group of <a class="link" href="class-gtkiconset.html" title="gtk.IconSet"><code class="classname">gtk.IconSet</code></a>s that
manage a set of variants (for different sizes and states) of a specific
icon. Icons in an icon factory are named by a stock ID, which is a simple
string identifying the icon e.g "gtk-ok". Each <a class="link" href="class-gtkstyle.html" title="gtk.Style"><code class="classname">gtk.Style</code></a> has a list
of <a class="link" href="class-gtkiconfactory.html" title="gtk.IconFactory"><code class="classname">gtk.IconFactory</code></a>s 
derived from the current theme; those icon factories are consulted first
when searching for an icon. If the theme doesn't set a particular icon, the
search continues for the icon in a list of default icon factories,
maintained by the <a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default"><code class="methodname">add_default</code>()</a>() 
and <a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--remove-default" title="gtk.IconFactory.remove_default"><code class="methodname">remove_default</code>()</a>() 
methods. Applications with icons should add a default icon factory with
their icons, which will allow themes to override the icons for the
application.</p><p>To display an icon, always use <a class="link" href="class-gtkstyle.html#method-gtkstyle--lookup-icon-set" title="gtk.Style.lookup_icon_set"><code class="methodname">gtk.Style.lookup_icon_set</code>()</a> 
on the widget that will display the icon, or the convenience function <a class="link" href="class-gtkwidget.html#method-gtkwidget--render-icon" title="gtk.Widget.render_icon"><code class="methodname">gtk.Widget.render_icon</code>()</a>. 
These functions take the theme into account when looking up the icon to use
for a given stock ID. </p></div><div class="refsect1" title="Constructor"><a name="constructor-gtkiconfactory"></a><h2>Constructor</h2><pre class="programlisting"><code class="constructorsynopsis">    <span class="methodname">gtk.IconFactory</span>(<span class="methodparam"></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>a new <a class="link" href="class-gtkiconfactory.html" title="gtk.IconFactory"><code class="classname">gtk.IconFactory</code></a>
object</td></tr></tbody></table><p>Creates a new <a class="link" href="class-gtkiconfactory.html" title="gtk.IconFactory"><code class="classname">gtk.IconFactory</code></a>.</p></div><div class="refsect1" title="Methods"><a name="id3730990"></a><h2>Methods</h2><div class="refsect2" title="gtk.IconFactory.add"><a name="method-gtkiconfactory--add"></a><h3>gtk.IconFactory.add</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">add</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>, <span class="methodparam"><span class="parameter"><strong class="parameter"><code>icon_set</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>stock_id</code></strong> :</span></p></td><td>an icon name</td></tr><tr><td><p><span class="term"><strong class="parameter"><code>icon_set</code></strong> :</span></p></td><td>an icon set</td></tr></tbody></table><p>The <code class="methodname">add</code>() method adds the specified
<em class="parameter"><code>icon_set</code></em> to the icon factory, under the name
<em class="parameter"><code>stock_id</code></em>.  the <em class="parameter"><code>stock_id</code></em> string
should include the name of your application, e.g. "myapp-whatever-icon".
Normally applications create a <a class="link" href="class-gtkiconfactory.html" title="gtk.IconFactory"><code class="classname">gtk.IconFactory</code></a>, 
then add it to the list of default factories with the <a class="link" href="class-gtkiconfactory.html#method-gtkiconfactory--add-default" title="gtk.IconFactory.add_default"><code class="methodname">add_default</code>()</a>. 
Then they pass the <em class="parameter"><code>stock_id</code></em> to widgets such as <a class="link" href="class-gtkimage.html" title="gtk.Image"><code class="classname">gtk.Image</code></a> to display
the icon. Themes can provide an icon with the same name (such as
"myapp-whatever-icon") to override your application's default icons. If an
icon already existed in the icon factory for
<em class="parameter"><code>stock_id</code></em>, it is unreferenced and replaced with the
new <em class="parameter"><code>icon_set</code></em>.</p></div><div class="refsect2" title="gtk.IconFactory.lookup"><a name="method-gtkiconfactory--lookup"></a><h3>gtk.IconFactory.lookup</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">lookup</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>stock_id</code></strong> :</span></p></td><td>an icon name</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the icon set named
<em class="parameter"><code>stock_id</code></em>.</td></tr></tbody></table><p>The <code class="methodname">lookup</code>() method looks up
<em class="parameter"><code>stock_id</code></em> in the icon factory, returning an icon set
if found, otherwise <code class="literal">None</code>. For display to the user, you
should use <a class="link" href="class-gtkstyle.html#method-gtkstyle--lookup-icon-set" title="gtk.Style.lookup_icon_set"><code class="methodname">gtk.Style.lookup_icon_set</code>()</a> 
on the <a class="link" href="class-gtkstyle.html" title="gtk.Style"><code class="classname">gtk.Style</code></a> for the
widget that will display the icon, instead of using this function directly,
so that themes are taken into account.</p></div><div class="refsect2" title="gtk.IconFactory.add_default"><a name="method-gtkiconfactory--add-default"></a><h3>gtk.IconFactory.add_default</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">add_default</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">add_default</code>() method adds the icon
factory to the list of icon factories searched by <a class="link" href="class-gtkstyle.html#method-gtkstyle--lookup-icon-set" title="gtk.Style.lookup_icon_set"><code class="methodname">gtk.Style.lookup_icon_set</code>()</a>. 
This means that, for example, <a class="link" href="class-gtkimage.html#method-gtkimage--set-from-stock" title="gtk.Image.set_from_stock"><code class="methodname">gtk.Image.set_from_stock</code>()</a> 
will be able to find icons in the icon factory. There will normally be an
icon factory added for each library or application that comes with icons.
The default icon factories can be overridden by themes.</p></div><div class="refsect2" title="gtk.IconFactory.remove_default"><a name="method-gtkiconfactory--remove-default"></a><h3>gtk.IconFactory.remove_default</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">remove_default</span>(<span class="methodparam"></span>)</code></pre><p>The <code class="methodname">remove_default</code>() method removes an
icon factory from the list of default icon factories. Not normally used
though you might use it for a library that can be unloaded or shut
down.</p></div></div><div class="refsect1" title="Functions"><a name="id3731395"></a><h2>Functions</h2><div class="refsect2" title="gtk.icon_factory_lookup_default"><a name="function-gtk--icon-factory-lookup-default"></a><h3>gtk.icon_factory_lookup_default</h3><pre class="programlisting"><code class="methodsynopsis">    def <span class="methodname">gtk.icon_factory_lookup_default</span>(<span class="methodparam"><span class="parameter"><strong class="parameter"><code>stock_id</code></strong></span></span>)</code></pre><table border="0" width="100%" bgcolor="#FFECCE"><col align="left" valign="top" width="0*"><tbody><tr><td><p><span class="term"><strong class="parameter"><code>stock_id</code></strong> :</span></p></td><td>the stock ID to lookup</td></tr><tr><td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td><td>the icon set matching
<em class="parameter"><code>stock_id</code></em> or <code class="literal">None</code> if no icon set
matches</td></tr></tbody></table><p>The <code class="function">gtk.icon_factory_lookup_default</code>()
function returns the <a class="link" href="class-gtkiconset.html" title="gtk.IconSet"><code class="classname">gtk.IconSet</code></a> that
has the name specified by <em class="parameter"><code>stock_id</code></em>. If the icon set
cannot be found the function returns <code class="literal">None</code>.</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-gtkhseparator.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-gtkiconinfo.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">gtk.HSeparator </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> gtk.IconInfo</td></tr></table></div></body></html>