Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Xfc::Gtk::IconFactory Class Reference

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

#include <xfc/gtk/iconfactory.hh>

Inheritance diagram for Xfc::Gtk::IconFactory:

Xfc::G::Object Xfc::G::TypeInstance Xfc::Trackable List of all members.

Public Member Functions

Constructors
Accessors
Methods

Static Public Member Functions

Methods

Protected Member Functions

Constructors

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 gfc-demo demo program).

Note: dynamically allocated objects must either be unreferenced or assigned to a smart pointer. Stack objects are automatically unreferenced when they go out of scope.


Constructor & Destructor Documentation

Xfc::Gtk::IconFactory::IconFactory GtkIconFactory *  icon_factory,
bool  owns_reference = true
[explicit, protected]
 

Construct a new IconFactory from an existing GtkIconFactory.

Parameters:
icon_factory A pointer to a GtkIconFactory.
owns_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 Xfc::Gtk::IconFactory::add const StockId stock_id,
IconSet icon_set
 

Adds the given icon_set to the icon factory, under the name stock_id.

Parameters:
stock_id The stock icon identifier.
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 Xfc::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> Xfc::Gtk::IconFactory::lookup const StockId stock_id  ) 
 

Looks up stock_id in the icon factory, returning an icon set if found, otherwise null.

Parameters:
stock_id The stock icon identifier.
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> Xfc::Gtk::IconFactory::lookup_default const StockId stock_id  )  [static]
 

Looks for an icon set in the list of default icon factories.

Parameters:
stock_id The stock icon identifier.
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: Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC 4.3