Object Hierarchy:

Gtk.IconFactory Gtk.IconFactory Gtk.IconFactory GLib.Object GLib.Object GLib.Object->Gtk.IconFactory Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.IconFactory


[ CCode ( type_id = "gtk_icon_factory_get_type ()" ) ]
[ Version ( deprecated = true , deprecated_since = "3.10" , replacement = "IconTheme" ) ]
public class IconFactory : Object, Buildable

Warning: IconFactory is deprecated since 3.10. Use IconTheme.

An icon factory manages a collection of IconSet; a IconSet manages a set of variants of a particular icon (i.

e. a IconSet contains variants for different sizes and widget states). Icons in an icon factory are named by a stock ID, which is a simple string identifying the icon. Each Style has a list of IconFactory derived from the current theme; those icon factories are consulted first when searching for an icon. If the theme doesn’t set a particular icon, GTK+ looks for the icon in a list of default icon factories, maintained by add_default and remove_default. Applications with icons should add a default icon factory with their icons, which will allow themes to override the icons for the application.

To display an icon, always use lookup_icon_set on the widget that will display the icon, or the convenience function render_icon. These functions take the theme into account when looking up the icon to use for a given stock ID.

GtkIconFactory as GtkBuildable

GtkIconFactory supports a custom `<sources>` element, which can contain multiple `<source>` elements. The following attributes are allowed:

  • stock-id

    The stock id of the source, a string. This attribute is mandatory

  • filename

    The filename of the source, a string. This attribute is optional

  • icon-name

    The icon name for the source, a string. This attribute is optional.

  • size

    Size of the icon, a IconSize enum value. This attribute is optional.

  • direction

    Direction of the source, a TextDirection enum value. This attribute is optional.

  • state

    State of the source, a StateType enum value. This attribute is optional.

A IconFactory UI definition fragment.

<object class="GtkIconFactory" id="iconfactory1">
<source stock-id="apple-red" filename="apple-red.png"/>
<object class="GtkWindow" id="window1">
<object class="GtkButton" id="apple_button">
<property name="label">apple-red</property>
<property name="use-stock">True</property>

Namespace: Gtk
Package: gtk+-3.0


Static methods:

Creation methods:


Inherited Members: