Reference Manual

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

# Inti::Gtk::IconSource Class Reference

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

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

Inheritance diagram for Inti::Gtk::IconSource:

List of all members.

## Public Member Functions

Constructors

- IconSource ()
    Construct a new IconSource.
- IconSource (GtkIconSource *source)
    Construct a new IconSource from an existing GtkIconSource.
- IconSource (GtkIconSource *source, bool copy)
    Construct a new IconSource from an existing GtkIconSource.
- IconSource (const IconSource &src)
    Copy constructor.
- ~IconSource ()
    Destructor.
- IconSource & operator= (const IconSource &src)
    Assignment operator.

Accessors

- GtkIconSource * gtk_icon_source () const
    Get a pointer to the GtkIconSource structure.
- operator GtkIconSource * () const
    Conversion operator; safely converts an IconSource to a GtkIconSource pointer.
- String get_filename () const
    Retrieves the source filename.
- Gdk::Pixbuf * get_pixbuf () const
    Retrieves the source pixbuf, or null if none is set.
- bool get_size_wildcarded () const
    Gets the value set by set_size_wildcarded().
- bool get_state_wildcarded () const
    Gets the value set by set_state_wildcarded().
- bool get_direction_wildcarded () const
    Gets the value set by set_direction_wildcarded().
- TextDirection get_direction () const
    Obtains the text direction this icon source applies to.
- StateType get_state () const
    Obtains the widget state this icon source applies to.
- IconSize get_size () const
    Obtains the icon size this icon source applies to.

Methods

- void set_filename (const String &filename)
    Sets the name of an image file to use as a base image when creating icon variants for IconSet.
- void set_pixbuf (Gdk::Pixbuf *pixbuf)
    Sets a pixbuf to use as a base image when creating icon variants for IconSet.
- void set_direction_wildcarded (bool setting)
    If the text direction is wildcarded, this source can be used as the base image for an icon in any TextDirection.
- void set_state_wildcarded (bool setting)
    If the widget state is wildcarded, this source can be used as the base image for an icon in any StateType.
- void set_size_wildcarded (bool setting)
    If the icon size is wildcarded, this source can be used as the base image for an icon of any size.
- void set_direction (TextDirection direction)
    Sets the text direction this icon source is intended to be used with.
- void set_state (StateType state)
    Sets the widget state this icon source is intended to be used with.
- void set_size (IconSize size)
    Sets the icon size this icon source is intended to be used with.

## 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.

## Constructor & Destructor Documentation

Inti::Gtk::IconSource::IconSource | ( | GtkIconSource * | source | ) | `[explicit]`

Construct a new IconSource from an existing GtkIconSource.

Parameters:

  source | A GtkIconSource.

This constructor creates a temporary wrapper for a GtkIconSource. It neither copies the GtkIconSource or takes over its ownership.

Inti::Gtk::IconSource::IconSource | ( | GtkIconSource * | source,
|  | bool | copy
| ) |

Construct a new IconSource from an existing GtkIconSource.

Parameters:

  source | A GtkIconSource.
  copy | true 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. It is primarily intended for use by the G::Boxed::wrap() method.

## Member Function Documentation

TextDirection Inti::Gtk::IconSource::get_direction | ( |  | ) | const

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.

bool Inti::Gtk::IconSource::get_direction_wildcarded | ( |  | ) | const

Gets the value set by set_direction_wildcarded().

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

String Inti::Gtk::IconSource::get_filename | ( |  | ) | const

Retrieves the source filename.

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

Gdk::Pixbuf* Inti::Gtk::IconSource::get_pixbuf | ( |  | ) | const

| Retrieves the source pixbuf, or null if none is set. The reference count on the pixbuf is not incremented.

IconSize Inti::Gtk::IconSource::get_size | ( |  | ) | const

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.

bool Inti::Gtk::IconSource::get_size_wildcarded | ( |  | ) | const

Gets the value set by set_size_wildcarded().

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

StateType Inti::Gtk::IconSource::get_state | ( |  | ) | const

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.

bool Inti::Gtk::IconSource::get_state_wildcarded | ( |  | ) | const

| Gets the value set by set_state_wildcarded(). return true if this icon source is a base for any widget state variant.

void Inti::Gtk::IconSource::set_direction | ( | TextDirection | direction | ) |

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

Parameters:

  direction | The 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.

void Inti::Gtk::IconSource::set_direction_wildcarded | ( | bool | setting | ) |

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

Parameters:

  setting | true 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 Inti::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:

  filename | The image file to use.

The filename must be absolute.

void Inti::Gtk::IconSource::set_pixbuf | ( | Gdk::Pixbuf * | pixbuf | ) |

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

Parameters:

  pixbuf | The pixbuf to use as a source.

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

void Inti::Gtk::IconSource::set_size | ( | IconSize | size | ) |

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

Parameters:

  size | The 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.

void Inti::Gtk::IconSource::set_size_wildcarded | ( | bool | setting | ) |

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

Parameters:

  setting | true 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.

void Inti::Gtk::IconSource::set_state | ( | StateType | state | ) |

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

Parameters:

  state | The 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.

void Inti::Gtk::IconSource::set_state_wildcarded | ( | bool | setting | ) |

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

Parameters:

  setting | true 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:

- iconfactory.h

Main Page - Footer