Package: gtk

Class gtk-icon-factory

Superclasses

gtk-buildable, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

None

Details

An icon factory manages a collection of gtk-icon-set instances. A gtk-icon-set instance manages a set of variants of a particular icon, i.e. a gtk-icon-set instance 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 GtkStyle object has a list of gtk-icon-factory objects derived from the current theme. Those icon factories are consulted first when searching for an icon. If the theme does not set a particular icon, GTK looks for the icon in a list of default icon factories, maintained by the functions gtk-icon-factory-add-default and gtk-icon-factory-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, use the function gtk-widget-render-icon on the widget that will display the icon. This function takes the theme into account when looking up the icon to use for a given stock ID.

GtkIconFactory as GtkBuildable

The gtk-icon-factory object supports a custom <sources> element, which can contain multiple <source> elements. The following attributes are allowed:
stock-id
A string with the stock ID of the source. This attribute is mandatory.
filename
A string with the filename of the source. This attribute is optional.
icon-name
A string with the icon name for the source. This attribute is optional.
size
A value of the gtk-icon-size enumeration with the size of the icon. This attribute is optional.
direction
A value of the gtk-text-direction enumeration with the direction of the source. This attribute is optional.
state
A value of the gtk-state-type enumeration with the state of the source. This attribute is optional.
Example: A gtk-icon-factory UI definition fragment.
<object class="GtkIconFactory" id="iconfactory1">
  <sources>
    <source stock-id="apple-red" filename="apple-red.png"/>
  </sources>
</object>
<object class="GtkWindow" id="window1">
  <child>
    <object class="GtkButton" id="apple_button">
      <property name="label">apple-red</property>
      <property name="use-stock">True</property>
    </object>
  </child>
</object>    
 

Inherited Slot Access Functions

See also

*2021-7-24