summaryrefslogtreecommitdiff
path: root/docs/reference/pygtk-gtkiconinfo.xml
blob: d1b8665327490e632df670237035b34bc9e85c8a (plain)
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
<?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-gtkiconinfo">
  <refnamediv>
    <refname>gtk.IconInfo</refname> <refpurpose>object containing
    information about and icon in an icon theme (new in PyGTK 2.4)</refpurpose>
  </refnamediv>

  <refsect1>
    <title>Synopsis</title>

    <classsynopsis language="python">
      <ooclass><classname>gtk.IconInfo</classname></ooclass>
      <ooclass><classname>gobject.GBoxed</classname></ooclass>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--copy">copy</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--free">free</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--get-base-size">get_base_size</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--get-filename">get_filename</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--get-builtin-pixbuf">get_builtin_pixbuf</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--load-icon">load_icon</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--set-raw-coordinates">set_raw_coordinates</link></methodname>
	<methodparam><parameter role="keyword">raw_coordinates</parameter></methodparam>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--get-embedded-rect">get_embedded_rect</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--get-attach-points">get_attach_points</link></methodname>
      </methodsynopsis>
      <methodsynopsis language="python">
	<methodname><link linkend="method-gtkiconinfo--get-display-name">get_display_name</link></methodname>
	<methodparam></methodparam>
      </methodsynopsis>
    </classsynopsis>

  </refsect1>

  <refsect1>
    <title>Description</title>

    <note>
      <para>This object is available in PyGTK 2.4 and above.</para>
    </note>

    <para>A <link
linkend="class-gtkiconinfo"><classname>gtk.IconInfo</classname></link>
object contains information about an icon in a <link
linkend="class-gtkicontheme"><classname>gtk.IconTheme</classname></link>. A
<link linkend="class-gtkiconinfo"><classname>gtk.IconInfo</classname></link>
object is created using the <link
linkend="method-gtkicontheme--lookup-icon"><methodname>gtk.IconTheme.lookup_icon</methodname>()</link>
method.</para>

    <para>A <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> can
be rendered with the icon using the <link
linkend="method-gtkiconinfo--load-icon"><methodname>load_icon</methodname>()</link>
method. If you just want to load the pixbuf of an icon you can use the <link
linkend="method-gtkicontheme--load-icon"><methodname>gtk.IconTheme.load_icon</methodname>()</link>
method that combines the <link
linkend="method-gtkicontheme--lookup-icon"><methodname>gtk.IconTheme.lookup_icon</methodname>()</link>
method and the <link
linkend="method-gtkiconinfo--load-icon"><methodname>load_icon</methodname>()</link>
method.</para>

  </refsect1>

  <refsect1>
    <title>Methods</title>

    <refsect2 id="method-gtkiconinfo--copy">
      <title>gtk.IconInfo.copy</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>copy</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the new <link
	  linkend="class-gtkiconinfo"><classname>gtk.IconInfo</classname></link></simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>copy</methodname>() method returns a copy of the
icon info object.</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--free">
      <title>gtk.IconInfo.free</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>free</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <warning>
        <para>This method is deprecated and should not be used since it can
 crash your application.</para>
      </warning>

      <para>The <methodname>free</methodname>() method frees the icon info
and its associated information</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--get-base-size">
      <title>gtk.IconInfo.get_base_size</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_base_size</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the base size, or 0, if no base
size is known for the icon.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>get_base_size</methodname>() method returns the
base size for the icon. The base size is a size for the icon that was
specified by the icon theme creator. This may be different than the actual
size of image; an example of this is small emblem icons that can be attached
to a larger icon. These icons will be given the same base size as the larger
icons to which they are attached.</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--get-filename">
      <title>gtk.IconInfo.get_filename</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_filename</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the filename for the icon, or
	  <literal>None</literal> if the <link
	  linkend="method-gtkiconinfo--get-builtin-pixbuf"><methodname>get_builtin_pixbuf()</methodname></link>
	  should be used instead.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>get_filename</methodname>() method returns the filename for the icon. If
the <literal>gtk.ICON_LOOKUP_USE_BUILTIN</literal> flag was passed to the
<link
linkend="method-gtkicontheme--lookup-icon"><methodname>gtk.IconTheme.lookup_icon()</methodname></link>
method, there may be no filename if a builtin icon is returned. In this
case, you should use the <link
linkend="method-gtkiconinfo--get-builtin-pixbuf"><methodname>get_builtin_pixbuf()</methodname></link>
method.</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--get-builtin-pixbuf">
      <title>gtk.IconInfo.get_builtin_pixbuf</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_builtin_pixbuf</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the built-in image pixbuf, or
	  <literal>None</literal>.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>get_builtin_pixbuf</methodname>() method returns
the built-in image for this icon, if any. To allow <literal>GTK+</literal>
to use built in icon images, you must pass the
<literal>gtk.ICON_LOOKUP_USE_BUILTIN</literal> to the <link
linkend="method-gtkicontheme--lookup-icon"><methodname>gtk.IconTheme.lookup_icon()</methodname></link>
method.</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--load-icon">
      <title>gtk.IconInfo.load_icon</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>load_icon</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the icon rendered into a <link
	  linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link>.
	  This may be a newly created icon or a new reference to an internal
	  icon, so you must not modify the icon.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>load_icon</methodname>() method renders the icon
previously looked up in an icon theme using the <link
linkend="method-gtkicontheme--lookup-icon"><methodname>gtk.IconTheme.lookup_icon()</methodname></link>
method. The icon size will be based on the size passed to the <link
linkend="method-gtkicontheme--lookup-icon"><methodname>gtk.IconTheme.lookup_icon()</methodname></link>
method. Note that the resulting <link
linkend="class-gdkpixbuf"><classname>gtk.gdk.Pixbuf</classname></link> may
not be exactly this size. An icon theme may have icons that differ slightly
from their nominal sizes, and in addition <literal>GTK</literal>+ will avoid
scaling icons that it considers sufficiently close to the requested size to
maintain sharpness.</para>

      <para>This method raise the GError exception if an error occurs during
rendering of the icon.</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--set-raw-coordinates">
      <title>gtk.IconInfo.set_raw_coordinates</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>set_raw_coordinates</methodname>
	  <methodparam><parameter role="keyword">raw_coordinates</parameter></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><parameter role="keyword">raw_coordinates</parameter>&nbsp;:</term>
	  <listitem><simpara>if <literal>True</literal>, the coordinates of
	  embedded rectangles and attached points should be returned in
	  their original (unscaled) form.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>set_raw_coordinates</methodname>() method sets
the internal raw_coordinates flag to the value of
<parameter>raw_coordinates</parameter>. If
<parameter>raw_coordinates</parameter> is <literal>True</literal>, the
coordinates returned by the <link
linkend="method-gtkiconinfo--get-embedded-rect"><methodname>get_embedded_rect()</methodname></link>
and <link
linkend="method-gtkiconinfo--get-attach-points"><methodname>get_attach_points()</methodname></link>
methods will be returned in their original form as specified in the icon
theme, instead of scaled appropriately for the pixbuf returned by the <link
linkend="method-gtkiconinfo--load-icon"><methodname>load_icon()</methodname></link>
method.</para>

      <para>Raw coordinates are somewhat strange; they are specified to be
with respect to the unscaled pixmap for <literal>PNG</literal> and
<literal>XPM</literal> icons, but for <literal>SVG</literal> icons, they are
in a 1000x1000 coordinate space that is scaled to the final size of the
icon.  You can determine if the icon is an <literal>SVG</literal> icon by
using the <link
linkend="method-gtkiconinfo--get-filename"><methodname>get_filename()</methodname></link>
method, and seeing if it is not <literal>None</literal> and ends in '.svg'.</para>

      <para>This method is provided primarily to allow compatibility
wrappers for older API's, and is not expected to be useful for
applications.</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--get-embedded-rect">
      <title>gtk.IconInfo.get_embedded_rect</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_embedded_rect</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a <link
	  linkend="class-gdkrectangle"><classname>gtk.gdk.Rectangle</classname></link>
	  or <literal>None</literal></simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>get_embedded_rect</methodname>() method returns
a <link
linkend="class-gdkrectangle"><classname>gtk.gdk.Rectangle</classname></link>
containing the coordinates of a rectangle within the icon that can be used
for display of information such as a preview of the contents of a text file.
See the <link
linkend="method-gtkiconinfo--set-raw-coordinates"><methodname>set_raw_coordinates()</methodname></link>
method for further information about the coordinate system.</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--get-attach-points">
      <title>gtk.IconInfo.get_attach_points</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_attach_points</methodname>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>a tuple containing a set of 2-tuples for the
	  attach points</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>get_attach_points</methodname>() method returns
a tuple containing the attach points for an icon as a set of 2-tuples. An
attach point is a location in the icon that can be used as anchor points for
attaching emblems or overlays to the icon.</para>

    </refsect2>

    <refsect2 id="method-gtkiconinfo--get-display-name">
      <title>gtk.IconInfo.get_display_name</title>

      <programlisting><methodsynopsis language="python">
	  <methodname>get_display_name</methodname>
	  <methodparam></methodparam>
	</methodsynopsis></programlisting>
      <variablelist>
	<varlistentry>
	  <term><emphasis>Returns</emphasis>&nbsp;:</term>
	  <listitem><simpara>the display name for the icon or <literal>None</literal>, if
the icon doesn't have a specified display name.</simpara></listitem>
	</varlistentry>
      </variablelist>

      <note>
	<para>This method is available in PyGTK 2.4 and above.</para>
      </note>

      <para>The <methodname>get_display_name</methodname>() method returns the display name for an icon. A display name is a
string to be used in place of the icon name in a user
visible context like a list of icons.</para>

    </refsect2>

  </refsect1>

</refentry>