Ardour  9.0-pre0-384-ga76afae0e9
Gtk::IconSet Class Reference

#include <iconset.h>

Public Member Functions

 IconSet ()
 
 IconSet (GtkIconSet *gobject, bool make_a_copy=true)
 
 IconSet (const IconSet &other)
 
IconSetoperator= (const IconSet &other)
 
 ~IconSet ()
 
void swap (IconSet &other)
 
GtkIconSetgobj ()
 Provides access to the underlying C instance. More...
 
const GtkIconSetgobj () const
 Provides access to the underlying C instance. More...
 
GtkIconSetgobj_copy () const
 Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs. More...
 
 IconSet (const Glib::RefPtr< Gdk::Pixbuf > &pixbuf)
 
IconSet copy () const
 
Glib::RefPtr< Gdk::Pixbufrender_icon (const Glib::RefPtr< Style > &style, TextDirection direction, Gtk::StateType state, IconSize size, Widget &widget, const Glib::ustring &detail)
 
void add_source (const IconSource &source)
 
Glib::ArrayHandle< IconSizeget_sizes () const
 

Static Public Member Functions

static GType get_type () G_GNUC_CONST
 
static IconSet lookup_default (const Gtk::StockID &stock_id)
 

Protected Attributes

GtkIconSetgobject_
 

Related Functions

(Note that these are not member functions.)

void swap (IconSet &lhs, IconSet &rhs)
 
Gtk::IconSet wrap (GtkIconSet *object, bool take_copy=false)
 

Detailed Description

This manages a set of variants of a particular icon An 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 GtkStyle has a list of GtkIconFactory 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.

Definition at line 56 of file iconset.h.

Constructor & Destructor Documentation

◆ IconSet() [1/4]

Gtk::IconSet::IconSet ( )

◆ IconSet() [2/4]

Gtk::IconSet::IconSet ( GtkIconSet gobject,
bool  make_a_copy = true 
)
explicit

◆ IconSet() [3/4]

Gtk::IconSet::IconSet ( const IconSet other)

◆ ~IconSet()

Gtk::IconSet::~IconSet ( )

◆ IconSet() [4/4]

Gtk::IconSet::IconSet ( const Glib::RefPtr< Gdk::Pixbuf > &  pixbuf)
explicit

Member Function Documentation

◆ add_source()

void Gtk::IconSet::add_source ( const IconSource source)

Icon sets have a list of Gtk::IconSource, which they use as base icons for rendering icons in different states and sizes. Icons are scaled, made to look insensitive, etc. in render_icon(), but Gtk::IconSet needs base images to work with. The base images and when to use them are described by a Gtk::IconSource.

This function copies source, so you can reuse the same source immediately without affecting the icon set.

An example of when you'd use this function: 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, and you might add a separate source for each one.

You should nearly always add a "default" icon source with all fields wildcarded, which will be used as a fallback if no more specific source matches. Gtk::IconSet always prefers more specific icon sources to more generic icon sources. The order in which you add the sources to the icon set does not matter.

new_from_pixbuf() creates a new icon set with a default icon source based on the given pixbuf.

Parameters
sourceA Gtk::IconSource.

◆ copy()

IconSet Gtk::IconSet::copy ( ) const

Copies icon_set by value.

Returns
A new Gtk::IconSet identical to the first.

◆ get_sizes()

Glib::ArrayHandle<IconSize> Gtk::IconSet::get_sizes ( ) const

◆ get_type()

static GType Gtk::IconSet::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GtkIconSet* Gtk::IconSet::gobj ( )
inline

Provides access to the underlying C instance.

Definition at line 80 of file iconset.h.

◆ gobj() [2/2]

const GtkIconSet* Gtk::IconSet::gobj ( ) const
inline

Provides access to the underlying C instance.

Definition at line 83 of file iconset.h.

◆ gobj_copy()

GtkIconSet* Gtk::IconSet::gobj_copy ( ) const

Provides access to the underlying C instance. The caller is responsible for freeing it. Use when directly setting fields in structs.

◆ lookup_default()

static IconSet Gtk::IconSet::lookup_default ( const Gtk::StockID stock_id)
static

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

Parameters
stock_idStockID to search for

For display to the user, you should use Style::lookup_icon_set() on the Style for the widget that will display the icon, instead of using this function directly, so that themes are taken into account

Returns
an IconSet

◆ operator=()

IconSet& Gtk::IconSet::operator= ( const IconSet other)

◆ render_icon()

Glib::RefPtr<Gdk::Pixbuf> Gtk::IconSet::render_icon ( const Glib::RefPtr< Style > &  style,
TextDirection  direction,
Gtk::StateType  state,
IconSize  size,
Widget widget,
const Glib::ustring &  detail 
)

Renders an icon using Gtk::Style::render_icon(). In most cases, Gtk::Widget::render_icon() is better, since it automatically provides most of the arguments from the current widget settings. This function never returns 0; if the icon can't be rendered (perhaps because an image file fails to load), a default "missing image" icon will be returned instead.

Parameters
styleA Gtk::Style associated with widget, or 0.
directionText direction.
stateWidget state.
sizeIcon size. A size of (GtkIconSize)-1 means render at the size of the source and don't scale.
widgetWidget that will display the icon, or 0. The only use that is typically made of this is to determine the appropriate Gdk::Screen.
detailDetail to pass to the theme engine, or 0. Note that passing a detail of anything but 0 will disable caching.
Returns
A Gdk::Pixbuf to be displayed.

◆ swap()

void Gtk::IconSet::swap ( IconSet other)

Friends And Related Function Documentation

◆ swap()

void swap ( IconSet lhs,
IconSet rhs 
)
related
Parameters
lhsThe left-hand side
rhsThe right-hand side

Definition at line 185 of file iconset.h.

◆ wrap()

Gtk::IconSet wrap ( GtkIconSet object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.

Member Data Documentation

◆ gobject_

GtkIconSet* Gtk::IconSet::gobject_
protected

Definition at line 89 of file iconset.h.


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