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


Public Member Functions
Xfc::Gtk::IconSource Class Reference

A GtkIconSource C++ wrapper class. More...

#include <xfc/gtk/iconfactory.hh>

Inheritance diagram for Xfc::Gtk::IconSource:
Xfc::G::Boxed Xfc::Object Xfc::Trackable

List of all members.

Public Member Functions

Constructors

Detailed Description

A GtkIconSource C++ wrapper class.

An IconSource contains a Gdk::Pixbuf (or image filename) that serves as the base image for one or more of the icons in an IconSet, along with a specification for which icons in the icon set will be based on that pixbuf or image file. An icon set contains a set of icons that represent "the same" logical concept in different states, different global text directions, and different sizes.

So for example a web browser's "Back to Previous Page" icon might point in a different direction in Hebrew and in English; it might look different when insensitive; and it might change size depending on toolbar mode (small/large icons). So a single icon set would contain all those variants of the icon. IconSet contains a list of IconSource from which it can derive specific icon variants in the set.

In the simplest case, IconSet contains one source pixbuf from which it derives all variants. The constructor IconSource(Gdk::Pixbuf&) handles this case; if you only have one source pixbuf, just use that constructor. If you want to use a different base pixbuf for different icon variants, you create multiple icon sources, mark which variants they'll be used to create, and add them to the icon set with Gtk::IconSet::add_source(). By default, the icon source has all parameters wildcarded. That is, the icon source will be used as the base icon for any desired text direction, widget state, or icon size.

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::IconSource::IconSource ( GtkIconSource *  source) [explicit]

Construct a new IconSource from an existing GtkIconSource.

Parameters:
sourceA GtkIconSource.

This constructor creates a temporary wrapper for a GtkIconSource. It neither copies the GtkIconSource or takes over its ownership. The IconSource is created with a reference count of 1 that the caller owns.

Xfc::Gtk::IconSource::IconSource ( GtkIconSource *  source,
bool  copy 
)

Construct a new IconSource from an existing GtkIconSource.

Parameters:
sourceA GtkIconSource.
copytrue if a copy of GtkIconSource should be made.

This constructor either takes over the ownership of the GtkIconSource, or makes a copy of the GtkIconSource. The IconSource is created with a reference count of 1 that the caller owns. This constrcutor is primarily intended for use by the G::Boxed::wrap() method.


Member Function Documentation

Obtains the text direction this icon source applies to.

Returns:
The text direction this source matches.

The return value is only useful/meaningful if the text direction is not wildcarded.

Gets the value set by set_direction_wildcarded().

Returns:
true if this icon source is a base for any text direction variant.

Retrieves the source filename.

Returns:
The source filename or a null String if none is set.

Retrieves the source icon name, or null if none is set.

Returns:
The icon name.

Retrieves the source pixbuf, or null if none is set.

The reference count on the pixbuf is not incremented.

Obtains the icon size this icon source applies to.

Returns:
The icon size this source matches.

The return value is only useful/meaningful if the icon size is not wildcarded.

Gets the value set by set_size_wildcarded().

Returns:
true if this icon source is a base for any icon size variant.

Obtains the widget state this icon source applies to.

Returns:
The widget state this source matches.

The return value is only useful/meaningful if the widget state is not wildcarded.

Gets the value set by set_state_wildcarded().

return true if this icon source is a base for any widget state variant.

Sets the text direction this icon source is intended to be used with.

Parameters:
directionThe text direction this source applies to.

Setting the text direction on an icon source makes no difference if the text direction is wildcarded. Therefore, you should usually call set_direction_wildcarded() to un-wildcard it in addition to calling this method.

If the text direction is wildcarded, this source can be used as the base image for an icon in any TextDirection.

Parameters:
settingtrue to wildcard the text direction.

If the text direction is not wildcarded, then the text direction the icon source applies to should be set with set_direction(), and the icon source will only be used with that text direction. IconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible.

void Xfc::Gtk::IconSource::set_filename ( const String filename)

Sets the name of an image file to use as a base image when creating icon variants for IconSet.

Parameters:
filenameThe image file to use.

The filename must be absolute.

void Xfc::Gtk::IconSource::set_icon_name ( const String icon_name)

Sets the name of an icon to look up in the current icon theme, to use as a base image when creating icon variants for Gtk::IconSet.

Parameters:
icon_nameThe name of icon to use.

Sets a pixbuf to use as a base image when creating icon variants for IconSet.

Parameters:
pixbufThe pixbuf to use as a source.

If an icon source has both a filename and a pixbuf set, the pixbuf will take priority.

Sets the icon size this icon source is intended to be used with.

Parameters:
sizeThe icon size this source applies to.

Setting the icon size on an icon source makes no difference if the size is wildcarded. Therefore, you should usually call set_size_wildcarded() to un-wildcard it in addition to calling this method.

If the icon size is wildcarded, this source can be used as the base image for an icon of any size.

Parameters:
settingtrue to wildcard the icon size.

If the size is not wildcarded, then the size the source applies to should be set with set_size() and the icon source will only be used with that specific size. IconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible. IconSet will normally scale wildcarded source images to produce an appropriate icon at a given size, but will not change the size of source images that match exactly.

Sets the widget state this icon source is intended to be used with.

Parameters:
stateThe widget state this source applies to.

Setting the widget state on an icon source makes no difference if the state is wildcarded. Therefore, you should usually call set_state_wildcarded() to un-wildcard it in addition to calling this method.

If the widget state is wildcarded, this source can be used as the base image for an icon in any StateType.

Parameters:
settingtrue to wildcard the widget state.

If the widget state is not wildcarded, then the state the source applies to should be set with set_state() and the icon source will only be used with that specific state. IconSet prefers non-wildcarded sources (exact matches) over wildcarded sources, and will use an exact match when possible. IconSet will normally transform wildcarded source images to produce an appropriate icon for a given state, for example lightening an image on prelight, but will not modify source images that match exactly.


The documentation for this class was generated from the following file:
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC