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
|
<?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-gtkiconset">
<refnamediv>
<refname>gtk.IconSet</refname>
<refpurpose>contains a set of variants for an icon</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gtk.IconSet</classname></ooclass>
<ooclass><classname>gobject.GBoxed</classname></ooclass>
<constructorsynopsis language="python">
<methodname><link
linkend="constructor-gtkiconset">gtk.IconSet</link></methodname>
<methodparam><parameter
role="keyword">pixbuf</parameter><initializer>None</initializer></methodparam>
</constructorsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkiconset--copy">copy</link></methodname>
<methodparam></methodparam> </methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkiconset--render-icon">render_icon</link></methodname>
<methodparam><parameter
role="keyword">style</parameter></methodparam>
<methodparam><parameter
role="keyword">direction</parameter></methodparam>
<methodparam><parameter
role="keyword">state</parameter></methodparam>
<methodparam><parameter
role="keyword">size</parameter></methodparam>
<methodparam><parameter
role="keyword">widget</parameter></methodparam>
<methodparam><parameter
role="keyword">detail</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkiconset--add-source">add_source</link></methodname>
<methodparam><parameter
role="keyword">source</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link
linkend="method-gtkiconset--get-sizes">get_sizes</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
</classsynopsis>
</refsect1>
<refsect1>
<title>Description</title>
<para>A <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link>
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 <link
linkend="method-gtkiconset--add-source"><methodname>add_source</methodname>()</link>
method.</para>
</refsect1>
<refsect1 id="constructor-gtkiconset">
<title>Constructor</title>
<programlisting><constructorsynopsis language="python">
<methodname>gtk.IconSet</methodname>
<methodparam><parameter
role="keyword">pixbuf</parameter><initializer>None</initializer></methodparam>
</constructorsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">pixbuf</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link></simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<para>Creates a new <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link> with
<parameter>pixbuf</parameter> as the default fallback source image. If
<parameter>pixbuf</parameter> is <literal>None</literal> there is no default
fallback source image. If you don't add any additional <link
linkend="class-gtkiconsource"><classname>gtk.IconSource</classname></link>s
to the icon set, all variants of the icon will be created from
<parameter>pixbuf</parameter>, using scaling, pixelation, etc. as required
to adjust the icon size or make the icon look insensitive/prelighted.</para>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-gtkiconset--copy">
<title>gtk.IconSet.copy</title>
<programlisting><methodsynopsis language="python">
<methodname>copy</methodname>
<methodparam></methodparam> </methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link>
identical to the first.</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>copy</methodname>() method returns a copy of the
icon set.</para>
</refsect2>
<refsect2 id="method-gtkiconset--render-icon">
<title>gtk.IconSet.render_icon</title>
<programlisting><methodsynopsis language="python">
<methodname>render_icon</methodname>
<methodparam><parameter
role="keyword">style</parameter></methodparam>
<methodparam><parameter
role="keyword">direction</parameter></methodparam>
<methodparam><parameter
role="keyword">state</parameter></methodparam>
<methodparam><parameter
role="keyword">size</parameter></methodparam>
<methodparam><parameter
role="keyword">widget</parameter></methodparam>
<methodparam><parameter
role="keyword">detail</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">style</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gtkstyle"><classname>gtk.Style</classname></link> associated
with <parameter>widget</parameter>, or
<literal>None</literal></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter
role="keyword">direction</parameter> :</term>
<listitem><simpara>the text direction; one of:
<literal>gtk.TEXT_DIR_NONE</literal>, <literal>gtk.TEXT_DIR_LTR</literal>,
<literal>gtk.TEXT_DIR_RTL</literal></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">state</parameter> :</term>
<listitem><simpara>the widget state; one of:
<literal>gtk.STATE_NORMAL</literal>, <literal>gtk.STATE_ACTIVE</literal>,
<literal>gtk.STATE_PRELIGHT</literal>,
<literal>gtk.STATE_SELECTED</literal>,
<literal>gtk.STATE_INSENSITIVE</literal></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">size</parameter> :</term>
<listitem><simpara>the icon size; one of:
<literal>gtk.ICON_SIZE_INVALID</literal>,
<literal>gtk.ICON_SIZE_MENU</literal>,
<literal>gtk.ICON_SIZE_SMALL_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_LARGE_TOOLBAR</literal>,
<literal>gtk.ICON_SIZE_BUTTON</literal>,
<literal>gtk.ICON_SIZE_DND</literal>,
<literal>gtk.ICON_SIZE_DIALOG</literal></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">widget</parameter> :</term>
<listitem><simpara>the widget that will display the icon, or
<literal>None</literal></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">detail</parameter> :</term>
<listitem><simpara>the detail to pass to the theme engine, or
<literal>None</literal></simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> to be
displayed</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>render_icon</methodname>() method renders an
icon using <link
linkend="method-gtkstyle--render-icon"><function>gtk.Style.render_icon()</function></link>.
In most cases, <link
linkend="method-gtkwidget--render-icon"><function>gtk.Widget.render_icon()</function></link>
is better, since it automatically provides most of the arguments from the
current widget settings. This method never returns <literal>None</literal>;
if the icon can't be rendered (perhaps because an image file fails to load),
a default "missing image" icon will be returned instead.</para>
</refsect2>
<refsect2 id="method-gtkiconset--add-source">
<title>gtk.IconSet.add_source</title>
<programlisting><methodsynopsis language="python">
<methodname>add_source</methodname>
<methodparam><parameter
role="keyword">source</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">source</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gtkiconsource"><classname>gtk.IconSource</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>add_source</methodname>() method adds the <link
linkend="class-gtkiconsource"><classname>gtk.IconSource</classname></link>
specified by <parameter>source</parameter> to the icon set. Icon sets have
a list of <link
linkend="class-gtkiconsource"><classname>gtk.IconSource</classname></link>,
which they use as base icons for rendering icons in different states and
sizes. Icons are scaled, made to look insensitive, etc. in the <link
linkend="method-gtkiconset--render-icon"><methodname>render_icon</methodname>()</link>
method, but <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link> needs
base images to work with. The base images and when to use them are described
by a <link
linkend="class-gtkiconsource"><classname>gtk.IconSource</classname></link>.</para>
<para>An example of when you'd use this method: a web browser's
"<guibutton>Back to Previous Page</guibutton>" 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.</para>
<para>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. <link
linkend="class-gtkiconset"><classname>gtk.IconSet</classname></link> 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.</para>
<para>The <link
linkend="constructor-gtkiconset"><methodname>gtk.IconSet</methodname>()</link>
constructor creates a new icon set with a default icon source based on the
given pixbuf.</para>
</refsect2>
<refsect2 id="method-gtkiconset--get-sizes">
<title>gtk.IconSet.get_sizes</title>
<programlisting><methodsynopsis language="python">
<methodname>get_sizes</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a tuple containing all the icon sizes supported
by the icon set</simpara></listitem>
</varlistentry>
</variablelist>
<para>The <methodname>get_sizes</methodname>() method returns a tuple
containing all the icon sizes this icon set can render.</para>
</refsect2>
</refsect1>
</refentry>
|