]> Pileus Git - ~andy/gtk/blob - docs/reference/gtk/tmpl/gtkicontheme.sgml
Make 3.0 parallel-installable to 2.x
[~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 <!-- ##### SECTION Image ##### -->
107
108
109 <!-- ##### STRUCT GtkIconInfo ##### -->
110 <para>
111 Contains information found when looking up an icon in
112 an icon theme.
113 </para>
114
115
116 <!-- ##### STRUCT GtkIconTheme ##### -->
117 <para>
118 Acts as a database of information about an icon theme.
119 Normally, you retrieve the icon theme for a particular
120 screen using gtk_icon_theme_get_for_screen() and it
121 will contain information about current icon theme for
122 that screen, but you can also create a new #GtkIconTheme
123 object and set the icon theme name explicitely using
124 gtk_icon_theme_set_custom_theme().
125 </para>
126
127
128 <!-- ##### SIGNAL GtkIconTheme::changed ##### -->
129 <para>
130
131 </para>
132
133 @icontheme: the object which received the signal.
134
135 <!-- ##### ENUM GtkIconLookupFlags ##### -->
136 <para>
137
138 </para>
139
140 @GTK_ICON_LOOKUP_NO_SVG: 
141 @GTK_ICON_LOOKUP_FORCE_SVG: 
142 @GTK_ICON_LOOKUP_USE_BUILTIN: 
143 @GTK_ICON_LOOKUP_GENERIC_FALLBACK: 
144 @GTK_ICON_LOOKUP_FORCE_SIZE: 
145
146 <!-- ##### MACRO GTK_ICON_THEME_ERROR ##### -->
147 <para>
148 The #GQuark used for #GtkIconThemeError errors.
149 </para>
150
151
152
153 <!-- ##### ENUM GtkIconThemeError ##### -->
154 <para>
155
156 </para>
157
158 @GTK_ICON_THEME_NOT_FOUND: 
159 @GTK_ICON_THEME_FAILED: 
160
161 <!-- ##### FUNCTION gtk_icon_theme_new ##### -->
162 <para>
163
164 </para>
165
166 @void: 
167 @Returns: 
168
169
170 <!-- ##### FUNCTION gtk_icon_theme_get_default ##### -->
171 <para>
172
173 </para>
174
175 @void: 
176 @Returns: 
177
178
179 <!-- ##### FUNCTION gtk_icon_theme_get_for_screen ##### -->
180 <para>
181
182 </para>
183
184 @screen: 
185 @Returns: 
186
187
188 <!-- ##### FUNCTION gtk_icon_theme_set_screen ##### -->
189 <para>
190
191 </para>
192
193 @icon_theme: 
194 @screen: 
195
196
197 <!-- ##### FUNCTION gtk_icon_theme_set_search_path ##### -->
198 <para>
199
200 </para>
201
202 @icon_theme: 
203 @path: 
204 @n_elements: 
205
206
207 <!-- ##### FUNCTION gtk_icon_theme_get_search_path ##### -->
208 <para>
209
210 </para>
211
212 @icon_theme: 
213 @path: 
214 @n_elements: 
215
216
217 <!-- ##### FUNCTION gtk_icon_theme_append_search_path ##### -->
218 <para>
219
220 </para>
221
222 @icon_theme: 
223 @path: 
224
225
226 <!-- ##### FUNCTION gtk_icon_theme_prepend_search_path ##### -->
227 <para>
228
229 </para>
230
231 @icon_theme: 
232 @path: 
233
234
235 <!-- ##### FUNCTION gtk_icon_theme_set_custom_theme ##### -->
236 <para>
237
238 </para>
239
240 @icon_theme: 
241 @theme_name: 
242
243
244 <!-- ##### FUNCTION gtk_icon_theme_has_icon ##### -->
245 <para>
246
247 </para>
248
249 @icon_theme: 
250 @icon_name: 
251 @Returns: 
252
253
254 <!-- ##### FUNCTION gtk_icon_theme_lookup_icon ##### -->
255 <para>
256
257 </para>
258
259 @icon_theme: 
260 @icon_name: 
261 @size: 
262 @flags: 
263 @Returns: 
264
265
266 <!-- ##### FUNCTION gtk_icon_theme_choose_icon ##### -->
267 <para>
268
269 </para>
270
271 @icon_theme: 
272 @icon_names: 
273 @size: 
274 @flags: 
275 @Returns: 
276
277
278 <!-- ##### FUNCTION gtk_icon_theme_lookup_by_gicon ##### -->
279 <para>
280
281 </para>
282
283 @icon_theme: 
284 @icon: 
285 @size: 
286 @flags: 
287 @Returns: 
288
289
290 <!-- ##### FUNCTION gtk_icon_theme_load_icon ##### -->
291 <para>
292
293 </para>
294
295 @icon_theme: 
296 @icon_name: 
297 @size: 
298 @flags: 
299 @error: 
300 @Returns: 
301
302
303 <!-- ##### FUNCTION gtk_icon_theme_list_contexts ##### -->
304 <para>
305
306 </para>
307
308 @icon_theme: 
309 @Returns: 
310
311
312 <!-- ##### FUNCTION gtk_icon_theme_list_icons ##### -->
313 <para>
314
315 </para>
316
317 @icon_theme: 
318 @context: 
319 @Returns: 
320
321
322 <!-- ##### FUNCTION gtk_icon_theme_get_icon_sizes ##### -->
323 <para>
324
325 </para>
326
327 @icon_theme: 
328 @icon_name: 
329 @Returns: 
330
331
332 <!-- ##### FUNCTION gtk_icon_theme_get_example_icon_name ##### -->
333 <para>
334
335 </para>
336
337 @icon_theme: 
338 @Returns: 
339
340
341 <!-- ##### FUNCTION gtk_icon_theme_rescan_if_needed ##### -->
342 <para>
343
344 </para>
345
346 @icon_theme: 
347 @Returns: 
348
349
350 <!-- ##### FUNCTION gtk_icon_theme_add_builtin_icon ##### -->
351 <para>
352
353 </para>
354
355 @icon_name: 
356 @size: 
357 @pixbuf: 
358
359
360 <!-- ##### FUNCTION gtk_icon_info_copy ##### -->
361 <para>
362
363 </para>
364
365 @icon_info: 
366 @Returns: 
367
368
369 <!-- ##### FUNCTION gtk_icon_info_free ##### -->
370 <para>
371
372 </para>
373
374 @icon_info: 
375
376
377 <!-- ##### FUNCTION gtk_icon_info_new_for_pixbuf ##### -->
378 <para>
379
380 </para>
381
382 @icon_theme: 
383 @pixbuf: 
384 @Returns: 
385
386
387 <!-- ##### FUNCTION gtk_icon_info_get_base_size ##### -->
388 <para>
389
390 </para>
391
392 @icon_info: 
393 @Returns: 
394
395
396 <!-- ##### FUNCTION gtk_icon_info_get_filename ##### -->
397 <para>
398
399 </para>
400
401 @icon_info: 
402 @Returns: 
403
404
405 <!-- ##### FUNCTION gtk_icon_info_get_builtin_pixbuf ##### -->
406 <para>
407
408 </para>
409
410 @icon_info: 
411 @Returns: 
412
413
414 <!-- ##### FUNCTION gtk_icon_info_load_icon ##### -->
415 <para>
416
417 </para>
418
419 @icon_info: 
420 @error: 
421 @Returns: 
422
423
424 <!-- ##### FUNCTION gtk_icon_info_load_symbolic ##### -->
425 <para>
426
427 </para>
428
429 @icon_info: 
430 @fg: 
431 @success_color: 
432 @warning_color: 
433 @error_color: 
434 @was_symbolic: 
435 @error: 
436 @Returns: 
437
438
439 <!-- ##### FUNCTION gtk_icon_info_set_raw_coordinates ##### -->
440 <para>
441
442 </para>
443
444 @icon_info: 
445 @raw_coordinates: 
446
447
448 <!-- ##### FUNCTION gtk_icon_info_get_embedded_rect ##### -->
449 <para>
450
451 </para>
452
453 @icon_info: 
454 @rectangle: 
455 @Returns: 
456
457
458 <!-- ##### FUNCTION gtk_icon_info_get_attach_points ##### -->
459 <para>
460
461 </para>
462
463 @icon_info: 
464 @points: 
465 @n_points: 
466 @Returns: 
467
468
469 <!-- ##### FUNCTION gtk_icon_info_get_display_name ##### -->
470 <para>
471
472 </para>
473
474 @icon_info: 
475 @Returns: 
476
477