Class: Gtk::IconFactory

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Instance Method Summary collapse

Instance Method Details

#add(stock_id, icon_set) ⇒ nil

Adds the given icon_set to the icon factory, under the name stock_id. stock_id should be namespaced for your application, e.g. “myapp-whatever-icon”. Normally applications create a Gtk::IconFactory, then add it to the list of default factories with gtk_icon_factory_add_default(). Then they pass the stock_id to widgets such as Gtk::Image to display the icon. Themes can provide an icon with the same name (such as “myapp-whatever-icon”) to override your application’s default icons. If an icon already existed in factory for stock_id, it is unreferenced and replaced with the new icon_set.

Parameters:

  • stock_id (String)

    icon name

  • icon_set (Gtk::IconSet)

    icon set

Returns:

  • (nil)

#add_defaultnil

Adds an icon factory to the list of icon factories searched by gtk_style_lookup_icon_set(). This means that, for example, gtk_image_new_from_stock() will be able to find icons in factory. There will normally be an icon factory added for each library or application that comes with icons. The default icon factories can be overridden by themes.

Returns:

  • (nil)

#lookup(stock_id) ⇒ Gtk::IconSet

Looks up stock_id in the icon factory, returning an icon set if found, otherwise nil. For display to the user, you should use gtk_style_lookup_icon_set() on the Gtk::Style for the widget that will display the icon, instead of using this function directly, so that themes are taken into account.

Parameters:

  • stock_id (String)

    an icon name

Returns:

  • (Gtk::IconSet)

    icon set of stock_id.

#newGtk::IconFactory

Creates a new Gtk::IconFactory. An icon factory manages a collection of Gtk::IconSets; a #GtkIconSet manages a set of variants of a particular icon (i.e. a Gtk::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 Gtk::Style has a list of #GtkIconFactorys 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 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.

Returns:

#remove_defaultnil

Removes an icon factory from the list of default icon factories. Not normally used; you might use it for a library that can be unloaded or shut down.

Returns:

  • (nil)