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 <!-- ##### STRUCT GtkIconSource ##### -->
123 <!-- ##### STRUCT GtkIconFactory ##### -->
129 <!-- ##### STRUCT GtkIconSet ##### -->
135 <!-- ##### ENUM GtkIconSize ##### -->
140 @GTK_ICON_SIZE_INVALID:
142 @GTK_ICON_SIZE_SMALL_TOOLBAR:
143 @GTK_ICON_SIZE_LARGE_TOOLBAR:
144 @GTK_ICON_SIZE_BUTTON:
146 @GTK_ICON_SIZE_DIALOG:
148 <!-- ##### FUNCTION gtk_icon_source_copy ##### -->
157 <!-- ##### FUNCTION gtk_icon_source_free ##### -->
165 <!-- ##### FUNCTION gtk_icon_factory_add ##### -->
175 <!-- ##### FUNCTION gtk_icon_factory_add_default ##### -->
183 <!-- ##### FUNCTION gtk_icon_factory_lookup ##### -->
193 <!-- ##### FUNCTION gtk_icon_factory_lookup_default ##### -->
202 <!-- ##### FUNCTION gtk_icon_factory_new ##### -->
210 <!-- ##### FUNCTION gtk_icon_factory_remove_default ##### -->
218 <!-- ##### FUNCTION gtk_icon_set_add_source ##### -->
227 <!-- ##### FUNCTION gtk_icon_set_copy ##### -->
236 <!-- ##### FUNCTION gtk_icon_set_new ##### -->
244 <!-- ##### FUNCTION gtk_icon_set_new_from_pixbuf ##### -->
253 <!-- ##### FUNCTION gtk_icon_set_ref ##### -->
262 <!-- ##### FUNCTION gtk_icon_set_render_icon ##### -->
277 <!-- ##### FUNCTION gtk_icon_set_unref ##### -->
285 <!-- ##### FUNCTION gtk_icon_size_lookup ##### -->
296 <!-- ##### FUNCTION gtk_icon_size_lookup_for_settings ##### -->
308 <!-- ##### FUNCTION gtk_icon_size_register ##### -->
319 <!-- ##### FUNCTION gtk_icon_size_register_alias ##### -->
328 <!-- ##### FUNCTION gtk_icon_size_from_name ##### -->
337 <!-- ##### FUNCTION gtk_icon_size_get_name ##### -->
346 <!-- ##### FUNCTION gtk_icon_set_get_sizes ##### -->
356 <!-- ##### FUNCTION gtk_icon_source_get_direction ##### -->
365 <!-- ##### FUNCTION gtk_icon_source_get_direction_wildcarded ##### -->
374 <!-- ##### FUNCTION gtk_icon_source_get_filename ##### -->
383 <!-- ##### FUNCTION gtk_icon_source_get_pixbuf ##### -->
392 <!-- ##### FUNCTION gtk_icon_source_get_icon_name ##### -->
401 <!-- ##### FUNCTION gtk_icon_source_get_size ##### -->
410 <!-- ##### FUNCTION gtk_icon_source_get_size_wildcarded ##### -->
419 <!-- ##### FUNCTION gtk_icon_source_get_state ##### -->
428 <!-- ##### FUNCTION gtk_icon_source_get_state_wildcarded ##### -->
437 <!-- ##### FUNCTION gtk_icon_source_new ##### -->
445 <!-- ##### FUNCTION gtk_icon_source_set_direction ##### -->
454 <!-- ##### FUNCTION gtk_icon_source_set_direction_wildcarded ##### -->
463 <!-- ##### FUNCTION gtk_icon_source_set_filename ##### -->
472 <!-- ##### FUNCTION gtk_icon_source_set_pixbuf ##### -->
481 <!-- ##### FUNCTION gtk_icon_source_set_icon_name ##### -->
490 <!-- ##### FUNCTION gtk_icon_source_set_size ##### -->
499 <!-- ##### FUNCTION gtk_icon_source_set_size_wildcarded ##### -->
508 <!-- ##### FUNCTION gtk_icon_source_set_state ##### -->
517 <!-- ##### FUNCTION gtk_icon_source_set_state_wildcarded ##### -->