1
<!-- ##### SECTION Title ##### -->
4
<!-- ##### SECTION Short_Description ##### -->
6
Manipulating stock icons
8
<!-- ##### SECTION Long_Description ##### -->
12
Browse the available stock icons in the list of stock IDs found <link
13
linkend="gtk-Stock-Items">here</link>. You can also use
14
the <application>gtk-demo</application> application for this purpose.
18
An icon factory manages a collection of #GtkIconSet; a #GtkIconSet manages a
19
set of variants of a particular icon (i.e. a #GtkIconSet contains variants for
20
different sizes and widget states). Icons in an icon factory are named by a
21
stock ID, which is a simple string identifying the icon. Each #GtkStyle has a
22
list of #GtkIconFactory derived from the current theme; those icon factories
23
are consulted first when searching for an icon. If the theme doesn't set a
24
particular icon, GTK+ looks for the icon in a list of default icon factories,
25
maintained by gtk_icon_factory_add_default() and
26
gtk_icon_factory_remove_default(). Applications with icons should add a default
27
icon factory with their icons, which will allow themes to override the icons
32
To display an icon, always use gtk_style_lookup_icon_set() on the widget that
33
will display the icon, or the convenience function
34
gtk_widget_render_icon(). These functions take the theme into account when
35
looking up the icon to use for a given stock ID.
38
<refsect2 id="GtkIconFactory-BUILDER-UI"><title>GtkIconFactory as GtkBuildable</title>
40
GtkIconFactory supports a custom <sources> element, which
41
can contain multiple <source> elements.
42
The following attributes are allowed:
47
<listitem><para>The stock id of the source, a string.
48
This attribute is mandatory</para></listitem>
53
<listitem><para>The filename of the source, a string.
54
This attribute is optional</para>
59
<term>icon-name</term>
60
<listitem><para>The icon name for the source, a string.
61
This attribute is optional.</para>
67
<listitem><para>Size of the icon, a #GtkIconSize enum value.
68
This attribute is optional.</para>
73
<term>direction</term>
74
<listitem><para>Direction of the source, a #GtkTextDirection enum value.
75
This attribute is optional.</para>
81
<listitem><para>State of the source, a #GtkStateType enum value.
82
This attribute is optional.</para>
90
<title>A <structname>GtkIconFactory</structname> UI definition fragment.</title>
91
<programlisting><![CDATA[
92
<object class="GtkIconFactory" id="iconfactory1">
94
<source stock-id="apple-red" filename="apple-red.png"/>
97
<object class="GtkWindow" id="window1">
99
<object class="GtkButton" id="apple_button">
100
<property name="label">apple-red</property>
101
<property name="use-stock">True</property>
109
<!-- ##### SECTION See_Also ##### -->
114
<!-- ##### SECTION Stability_Level ##### -->
117
<!-- ##### SECTION Image ##### -->
120
<!-- ##### STRUCT GtkIconSource ##### -->
126
<!-- ##### STRUCT GtkIconFactory ##### -->
132
<!-- ##### STRUCT GtkIconSet ##### -->
138
<!-- ##### ENUM GtkIconSize ##### -->
143
@GTK_ICON_SIZE_INVALID:
145
@GTK_ICON_SIZE_SMALL_TOOLBAR:
146
@GTK_ICON_SIZE_LARGE_TOOLBAR:
147
@GTK_ICON_SIZE_BUTTON:
149
@GTK_ICON_SIZE_DIALOG:
151
<!-- ##### FUNCTION gtk_icon_source_copy ##### -->
160
<!-- ##### FUNCTION gtk_icon_source_free ##### -->
168
<!-- ##### FUNCTION gtk_icon_factory_add ##### -->
178
<!-- ##### FUNCTION gtk_icon_factory_add_default ##### -->
186
<!-- ##### FUNCTION gtk_icon_factory_lookup ##### -->
196
<!-- ##### FUNCTION gtk_icon_factory_lookup_default ##### -->
205
<!-- ##### FUNCTION gtk_icon_factory_new ##### -->
214
<!-- ##### FUNCTION gtk_icon_factory_remove_default ##### -->
222
<!-- ##### FUNCTION gtk_icon_set_add_source ##### -->
231
<!-- ##### FUNCTION gtk_icon_set_copy ##### -->
240
<!-- ##### FUNCTION gtk_icon_set_new ##### -->
249
<!-- ##### FUNCTION gtk_icon_set_new_from_pixbuf ##### -->
258
<!-- ##### FUNCTION gtk_icon_set_ref ##### -->
267
<!-- ##### FUNCTION gtk_icon_set_render_icon ##### -->
282
<!-- ##### FUNCTION gtk_icon_set_unref ##### -->
290
<!-- ##### FUNCTION gtk_icon_size_lookup ##### -->
301
<!-- ##### FUNCTION gtk_icon_size_lookup_for_settings ##### -->
313
<!-- ##### FUNCTION gtk_icon_size_register ##### -->
324
<!-- ##### FUNCTION gtk_icon_size_register_alias ##### -->
333
<!-- ##### FUNCTION gtk_icon_size_from_name ##### -->
342
<!-- ##### FUNCTION gtk_icon_size_get_name ##### -->
351
<!-- ##### FUNCTION gtk_icon_set_get_sizes ##### -->
361
<!-- ##### FUNCTION gtk_icon_source_get_direction ##### -->
370
<!-- ##### FUNCTION gtk_icon_source_get_direction_wildcarded ##### -->
379
<!-- ##### MACRO gtk_icon_source_get_filename ##### -->
387
<!-- ##### FUNCTION gtk_icon_source_get_pixbuf ##### -->
396
<!-- ##### FUNCTION gtk_icon_source_get_icon_name ##### -->
405
<!-- ##### FUNCTION gtk_icon_source_get_size ##### -->
414
<!-- ##### FUNCTION gtk_icon_source_get_size_wildcarded ##### -->
423
<!-- ##### FUNCTION gtk_icon_source_get_state ##### -->
432
<!-- ##### FUNCTION gtk_icon_source_get_state_wildcarded ##### -->
441
<!-- ##### FUNCTION gtk_icon_source_new ##### -->
450
<!-- ##### FUNCTION gtk_icon_source_set_direction ##### -->
459
<!-- ##### FUNCTION gtk_icon_source_set_direction_wildcarded ##### -->
468
<!-- ##### MACRO gtk_icon_source_set_filename ##### -->
475
<!-- ##### FUNCTION gtk_icon_source_set_pixbuf ##### -->
484
<!-- ##### FUNCTION gtk_icon_source_set_icon_name ##### -->
493
<!-- ##### FUNCTION gtk_icon_source_set_size ##### -->
502
<!-- ##### FUNCTION gtk_icon_source_set_size_wildcarded ##### -->
511
<!-- ##### FUNCTION gtk_icon_source_set_state ##### -->
520
<!-- ##### FUNCTION gtk_icon_source_set_state_wildcarded ##### -->