Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::IconFactory Class Reference

A GtkIconFactory C++ wrapper class. More...

`#include <inti/gtk/iconfactory.h>`

Inheritance diagram for Inti::Gtk::IconFactory:

List of all members.

## Public Member Functions

Constructors

- IconFactory ()
    Construct a new IconFactory.
- virtual ~IconFactory ()
    Destructor.

Accessors

- GtkIconFactory * gtk_icon_factory () const
    Get a pointer to the GtkIconFactory structure.
- GtkIconFactoryClass * gtk_icon_factory_class () const
    Get a pointer to the GtkIconFactoryClass structure.
- operator GtkIconFactory * () const
    Conversion operator; safely converts an IconFactory to a GtkIconFactory pointer.

Methods

- void add (const char *stock_id, IconSet &icon_set)
    Adds the given icon_set to the icon factory, under the name stock_id.
- Pointer< IconSet > lookup (const char *stock_id)
    Looks up stock_id in the icon factory, returning an icon set if found, otherwise null.
- void add_default ()
    Adds the IconFactory to the list of icon factories searched by Gtk::Style::lookup_icon_set().
- void remove_default ()
    Removes the IconFactory from the list of default icon factories.

## Static Public Member Functions

- Pointer< IconSet > lookup_default (const char *stock_id)
    Looks for an icon set in the list of default icon factories.

## Protected Member Functions

Constructors

- IconFactory (GtkIconFactory *icon_factory, bool reference=true)
    Construct a new IconFactory from an existing GtkIconFactory.

## Detailed Description

A GtkIconFactory C++ wrapper class.

An icon factory manages a collection of IconSets; an 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 IconFactorys 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 IconFactory's add_default() and remove_default() methods. Applications with icons should add a default icon factory with their icons, which will allow themes to override the icons for the application (see application.cc in the inti-demo demo program).

## Constructor & Destructor Documentation

Inti::Gtk::IconFactory::IconFactory | ( | GtkIconFactory * | icon_factory,
|  | bool | reference = true
| ) | `[explicit, protected]`

  | Construct a new IconFactory from an existing GtkIconFactory. Parameters:
  icon_factory | A pointer to a GtkIconFactory.
  reference | Set false if the initial reference count is floating, set true if it's not.
The icon_factory can be a newly created GtkIconFactory or an existing GtkIconFactory (see G::Object::Object).

## Member Function Documentation

void Inti::Gtk::IconFactory::add | ( | const char * | stock_id,
|  | IconSet & | icon_set
| ) |

  | Adds the given icon_set to the icon factory, under the name stock_id. Parameters:
  stock_id | The icon name.
  icon_set | The icon set.
The stock_id should be namespaced for your application, e.g. "myapp-whatever-icon". Normally applications create an IconFactory, then add it to the list of default factories with add_default(). Then they pass the stock_id to widgets such as 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.

void Inti::Gtk::IconFactory::add_default | ( |  | ) |

| Adds the IconFactory to the list of icon factories searched by Gtk::Style::lookup_icon_set(). This means that, for example, a stock Image widget will be able to find icons in an icon 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.

Pointer<IconSet> Inti::Gtk::IconFactory::lookup | ( | const char * | stock_id | ) |

  | Looks up stock_id in the icon factory, returning an icon set if found, otherwise null. Parameters:
  stock_id | The icon name.
Returns: The icon set of stock_id. For display to the user, use Gtk::Style::lookup_icon_set() for the widget that will display the icon instead of using this method directly, so that themes are taken into account.

Pointer<IconSet> Inti::Gtk::IconFactory::lookup_default | ( | const char * | stock_id | ) | `[static]`

  | Looks for an icon set in the list of default icon factories. Parameters:
  stock_id | The icon name.
Returns: The icon set of stock_id. For display to the user, use Gtk::Style::lookup_icon_set() for the widget that will display the icon instead of using this method directly, so that themes are taken into account.

The documentation for this class was generated from the following file:

- iconfactory.h

Main Page - Footer