]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkicontheme.sgml
9e2d6bb53ad4004855199d7e3e869c6f1fbca3c5
[~andy/gtk] / docs / reference / gtk / tmpl / gtkicontheme.sgml
1 <!-- ##### SECTION Title ##### -->
2 GtkIconTheme
3
4 <!-- ##### SECTION Short_Description ##### -->
5 Looking up icons by name
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 #GtkIconTheme provides a facility for looking up icons by name
10 and size. The main reason for using a name rather than simply
11 providing a filename is to allow different icons to be used
12 depending on what <firstterm>icon theme</firstterm> is selected
13 by the user. The operation of icon themes on Linux and Unix
14 follows the <ulink
15 url="http://www.freedesktop.org/Standards/icon-theme-spec">Icon
16 Theme Specification</ulink>. There is a default icon theme,
17 named <literal>hicolor</literal> where applications should install
18 their icons, but more additional application themes can be
19 installed as operating system vendors and users choose.
20 </para>
21 <para>
22 Named icons are similar to the <xref linkend="gtk-Themeable-Stock-Images"/>
23 facility, and the distinction between the two may be a bit confusing.
24 A few things to keep in mind:
25 </para>
26 <itemizedlist>
27 <listitem>
28 <para>
29 Stock images usually are used in conjunction with
30 <xref linkend="gtk-Stock-Items"/>., such as %GTK_STOCK_OK or
31 %GTK_STOCK_OPEN. Named icons are easier to set up and therefore
32 are more useful for new icons that an application wants to
33 add, such as application icons or window icons.
34 </para>
35 </listitem>
36 <listitem>
37 <para>
38 Stock images can only be loaded at the symbolic sizes defined
39 by the #GtkIconSize enumeration, or by custom sizes defined
40 by gtk_icon_size_register(), while named icons are more flexible
41 and any pixel size can be specified.
42 </para>
43 </listitem>
44 <listitem>
45 <para>
46 Because stock images are closely tied to stock items, and thus
47 to actions in the user interface, stock images may come in
48 multiple variants for different widget states or writing
49 directions. 
50 </para>
51 </listitem>
52 </itemizedlist>
53 <para>
54 A good rule of thumb is that if there is a stock image for what
55 you want to use, use it, otherwise use a named icon. It turns
56 out that internally stock images are generally defined in
57 terms of one or more named icons. (An example of the
58 more than one case is icons that depend on writing direction;
59 GTK_STOCK_GO_FORWARD uses the two themed icons
60 "gtk-stock-go-forward-ltr" and "gtk-stock-go-forward-rtl".)
61 </para>
62 <para>
63 In many cases, named themes are used indirectly, via #GtkImage
64 or stock items, rather than directly, but looking up icons
65 directly is also simple. The #GtkIconTheme object acts
66 as a database of all the icons in the current theme. You
67 can create new #GtkIconTheme objects, but its much more
68 efficient to use the standard icon theme for the #GdkScreen
69 so that the icon information is shared with other people
70 looking up icons. In the case where the default screen is
71 being used, looking up an icon can be as simple as:
72 </para>
73 <informalexample>
74 <programlisting>
75 GError *error = NULL;
76 GtkIconTheme *icon_theme;
77 GdkPixbuf *pixbuf;
78
79 icon_theme = gtk_icon_theme_get_default ();
80 pixbuf = gtk_icon_theme_load_icon (icon_theme,
81                                    "my-icon-name", /* icon name */
82                                    48, /* size */
83                                    0,  /* flags */
84                                    &amp;error);
85 if (!pixbuf)
86   {
87     g_warning ("Couldn't load icon: &percnt;s", error-&gt;message);
88     g_error_free (error);
89   }
90 else
91   {
92     /* Use the pixbuf */
93     g_object_unref (pixbuf);
94   }
95 </programlisting>
96 </informalexample>
97
98 <!-- ##### SECTION See_Also ##### -->
99 <para>
100
101 </para>
102
103 <!-- ##### SECTION Stability_Level ##### -->
104
105
106 <!-- ##### STRUCT GtkIconInfo ##### -->
107 <para>
108 Contains information found when looking up an icon in
109 an icon theme.
110 </para>
111
112
113 <!-- ##### STRUCT GtkIconTheme ##### -->
114 <para>
115 Acts as a database of information about an icon theme.
116 Normally, you retrieve the icon theme for a particular
117 screen using gtk_icon_theme_get_for_screen() and it
118 will contain information about current icon theme for
119 that screen, but you can also create a new #GtkIconTheme
120 object and set the icon theme name explicitely using
121 gtk_icon_theme_set_custom_theme().
122 </para>
123
124
125 <!-- ##### SIGNAL GtkIconTheme::changed ##### -->
126 <para>
127
128 </para>
129
130 @icontheme: the object which received the signal.
131
132 <!-- ##### ENUM GtkIconLookupFlags ##### -->
133 <para>
134
135 </para>
136
137 @GTK_ICON_LOOKUP_NO_SVG: 
138 @GTK_ICON_LOOKUP_FORCE_SVG: 
139 @GTK_ICON_LOOKUP_USE_BUILTIN: 
140 @GTK_ICON_LOOKUP_GENERIC_FALLBACK: 
141 @GTK_ICON_LOOKUP_FORCE_SIZE: 
142
143 <!-- ##### MACRO GTK_ICON_THEME_ERROR ##### -->
144 <para>
145 The #GQuark used for #GtkIconThemeError errors.
146 </para>
147
148
149
150 <!-- ##### ENUM GtkIconThemeError ##### -->
151 <para>
152
153 </para>
154
155 @GTK_ICON_THEME_NOT_FOUND: 
156 @GTK_ICON_THEME_FAILED: 
157
158 <!-- ##### FUNCTION gtk_icon_theme_new ##### -->
159 <para>
160
161 </para>
162
163 @Returns: 
164
165
166 <!-- ##### FUNCTION gtk_icon_theme_get_default ##### -->
167 <para>
168
169 </para>
170
171 @Returns: 
172
173
174 <!-- ##### FUNCTION gtk_icon_theme_get_for_screen ##### -->
175 <para>
176
177 </para>
178
179 @screen: 
180 @Returns: 
181
182
183 <!-- ##### FUNCTION gtk_icon_theme_set_screen ##### -->
184 <para>
185
186 </para>
187
188 @icon_theme: 
189 @screen: 
190
191
192 <!-- ##### FUNCTION gtk_icon_theme_set_search_path ##### -->
193 <para>
194
195 </para>
196
197 @icon_theme: 
198 @path: 
199 @n_elements: 
200
201
202 <!-- ##### FUNCTION gtk_icon_theme_get_search_path ##### -->
203 <para>
204
205 </para>
206
207 @icon_theme: 
208 @path: 
209 @n_elements: 
210
211
212 <!-- ##### FUNCTION gtk_icon_theme_append_search_path ##### -->
213 <para>
214
215 </para>
216
217 @icon_theme: 
218 @path: 
219
220
221 <!-- ##### FUNCTION gtk_icon_theme_prepend_search_path ##### -->
222 <para>
223
224 </para>
225
226 @icon_theme: 
227 @path: 
228
229
230 <!-- ##### FUNCTION gtk_icon_theme_set_custom_theme ##### -->
231 <para>
232
233 </para>
234
235 @icon_theme: 
236 @theme_name: 
237
238
239 <!-- ##### FUNCTION gtk_icon_theme_has_icon ##### -->
240 <para>
241
242 </para>
243
244 @icon_theme: 
245 @icon_name: 
246 @Returns: 
247
248
249 <!-- ##### FUNCTION gtk_icon_theme_lookup_icon ##### -->
250 <para>
251
252 </para>
253
254 @icon_theme: 
255 @icon_name: 
256 @size: 
257 @flags: 
258 @Returns: 
259
260
261 <!-- ##### FUNCTION gtk_icon_theme_choose_icon ##### -->
262 <para>
263
264 </para>
265
266 @icon_theme: 
267 @icon_names: 
268 @size: 
269 @flags: 
270 @Returns: 
271
272
273 <!-- ##### FUNCTION gtk_icon_theme_lookup_by_gicon ##### -->
274 <para>
275
276 </para>
277
278 @icon_theme: 
279 @icon: 
280 @size: 
281 @flags: 
282 @Returns: 
283
284
285 <!-- ##### FUNCTION gtk_icon_theme_load_icon ##### -->
286 <para>
287
288 </para>
289
290 @icon_theme: 
291 @icon_name: 
292 @size: 
293 @flags: 
294 @error: 
295 @Returns: 
296
297
298 <!-- ##### FUNCTION gtk_icon_theme_list_contexts ##### -->
299 <para>
300
301 </para>
302
303 @icon_theme: 
304 @Returns: 
305
306
307 <!-- ##### FUNCTION gtk_icon_theme_list_icons ##### -->
308 <para>
309
310 </para>
311
312 @icon_theme: 
313 @context: 
314 @Returns: 
315
316
317 <!-- ##### FUNCTION gtk_icon_theme_get_icon_sizes ##### -->
318 <para>
319
320 </para>
321
322 @icon_theme: 
323 @icon_name: 
324 @Returns: 
325
326
327 <!-- ##### FUNCTION gtk_icon_theme_get_example_icon_name ##### -->
328 <para>
329
330 </para>
331
332 @icon_theme: 
333 @Returns: 
334
335
336 <!-- ##### FUNCTION gtk_icon_theme_rescan_if_needed ##### -->
337 <para>
338
339 </para>
340
341 @icon_theme: 
342 @Returns: 
343
344
345 <!-- ##### FUNCTION gtk_icon_theme_add_builtin_icon ##### -->
346 <para>
347
348 </para>
349
350 @icon_name: 
351 @size: 
352 @pixbuf: 
353
354
355 <!-- ##### FUNCTION gtk_icon_info_copy ##### -->
356 <para>
357
358 </para>
359
360 @icon_info: 
361 @Returns: 
362
363
364 <!-- ##### FUNCTION gtk_icon_info_free ##### -->
365 <para>
366
367 </para>
368
369 @icon_info: 
370
371
372 <!-- ##### FUNCTION gtk_icon_info_new_for_pixbuf ##### -->
373 <para>
374
375 </para>
376
377 @icon_theme: 
378 @pixbuf: 
379 @Returns: 
380
381
382 <!-- ##### FUNCTION gtk_icon_info_get_base_size ##### -->
383 <para>
384
385 </para>
386
387 @icon_info: 
388 @Returns: 
389
390
391 <!-- ##### FUNCTION gtk_icon_info_get_filename ##### -->
392 <para>
393
394 </para>
395
396 @icon_info: 
397 @Returns: 
398
399
400 <!-- ##### FUNCTION gtk_icon_info_get_builtin_pixbuf ##### -->
401 <para>
402
403 </para>
404
405 @icon_info: 
406 @Returns: 
407
408
409 <!-- ##### FUNCTION gtk_icon_info_load_icon ##### -->
410 <para>
411
412 </para>
413
414 @icon_info: 
415 @error: 
416 @Returns: 
417
418
419 <!-- ##### FUNCTION gtk_icon_info_set_raw_coordinates ##### -->
420 <para>
421
422 </para>
423
424 @icon_info: 
425 @raw_coordinates: 
426
427
428 <!-- ##### FUNCTION gtk_icon_info_get_embedded_rect ##### -->
429 <para>
430
431 </para>
432
433 @icon_info: 
434 @rectangle: 
435 @Returns: 
436
437
438 <!-- ##### FUNCTION gtk_icon_info_get_attach_points ##### -->
439 <para>
440
441 </para>
442
443 @icon_info: 
444 @points: 
445 @n_points: 
446 @Returns: 
447
448
449 <!-- ##### FUNCTION gtk_icon_info_get_display_name ##### -->
450 <para>
451
452 </para>
453
454 @icon_info: 
455 @Returns: 
456
457