Ardour  8.7-14-g57a6773833
Gtk::IconTheme Class Reference

#include <icontheme.h>

Inheritance diagram for Gtk::IconTheme:
[legend]

Public Member Functions

virtual ~IconTheme ()
 
GtkIconThemegobj ()
 Provides access to the underlying C GObject. More...
 
const GtkIconThemegobj () const
 Provides access to the underlying C GObject. More...
 
GtkIconThemegobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
void set_screen (const Glib::RefPtr< Gdk::Screen > &screen)
 
void set_search_path (const Glib::ArrayHandle< Glib::ustring > &path)
 
Glib::ArrayHandle< Glib::ustring > get_search_path () const
 
void append_search_path (const Glib::ustring &path)
 
void prepend_search_path (const Glib::ustring &path)
 
void set_custom_theme (const Glib::ustring &theme_name)
 
bool has_icon (const Glib::ustring &icon_name) const
 
Glib::ArrayHandle< int > get_icon_sizes (const Glib::ustring &icon_name) const
 
IconInfo lookup_icon (const Glib::ustring &icon_name, int size, IconLookupFlags flags) const
 
IconInfo lookup_icon (const Glib::RefPtr< const Gio::Icon > &icon, int size, IconLookupFlags flags) const
 
IconInfo choose_icon (const Glib::StringArrayHandle &icon_names, int size, IconLookupFlags flags)
 
Glib::RefPtr< Gdk::Pixbufload_icon (const Glib::ustring &icon_name, int size, IconLookupFlags flags=(IconLookupFlags) 0) const
 
Glib::ListHandle< Glib::ustring > list_icons (const Glib::ustring &context) const
 
Glib::ListHandle< Glib::ustring > list_icons () const
 
Glib::ListHandle< Glib::ustring > list_contexts () const
 
Glib::ustring get_example_icon_name () const
 
bool rescan_if_needed ()
 
Glib::SignalProxy0< void > signal_changed ()
 

Static Public Member Functions

static GType get_type () G_GNUC_CONST
 
static Glib::RefPtr< IconThemecreate ()
 
static Glib::RefPtr< IconThemeget_default ()
 
static Glib::RefPtr< IconThemeget_for_screen (const Glib::RefPtr< Gdk::Screen > &screen)
 
static void add_builtin_icon (const Glib::ustring &icon_name, int size, const Glib::RefPtr< Gdk::Pixbuf > &pixbuf)
 

Protected Member Functions

 IconTheme ()
 
virtual void on_changed ()
 This is a default handler for the signal signal_changed(). More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::IconThemewrap (GtkIconTheme *object, bool take_copy=false)
 

Detailed Description

Definition at line 148 of file icontheme.h.

Constructor & Destructor Documentation

◆ ~IconTheme()

virtual Gtk::IconTheme::~IconTheme ( )
virtual

◆ IconTheme()

Gtk::IconTheme::IconTheme ( )
protected

Member Function Documentation

◆ add_builtin_icon()

static void Gtk::IconTheme::add_builtin_icon ( const Glib::ustring &  icon_name,
int  size,
const Glib::RefPtr< Gdk::Pixbuf > &  pixbuf 
)
static

Registers a built-in icon for icon theme lookups. The idea of built-in icons is to allow an application or library that uses themed icons to function requiring files to be present in the file system. For instance, the default images for all of GTK+'s stock icons are registered as built-icons.

In general, if you use add_builtin_icon() you should also install the icon in the icon theme, so that the icon is generally available.

This function will generally be used with pixbufs loaded via gdk_pixbuf_new_from_inline().

Parameters
icon_nameThe name of the icon to register.
sizeThe size at which to register the icon (different images can be registered for the same icon name at different sizes.).
pixbufGdk::Pixbuf that contains the image to use for icon_name.

◆ append_search_path()

void Gtk::IconTheme::append_search_path ( const Glib::ustring &  path)

Appends a directory to the search path. See set_search_path().

Parameters
pathDirectory name to append to the icon path.

◆ choose_icon()

IconInfo Gtk::IconTheme::choose_icon ( const Glib::StringArrayHandle &  icon_names,
int  size,
IconLookupFlags  flags 
)

Looks up a named icon and returns a structure containing information such as the filename of the icon. The icon can then be rendered into a pixbuf using Gtk::IconInfo::load_icon(). (load_icon() combines these two steps if all you need is the pixbuf.)

If icon_names contains more than one name, this function tries them all in the given order before falling back to inherited icon themes.

Parameters
icon_namesArray of icon names to lookup.
sizeDesired icon size.
flagsFlags modifying the behavior of the icon lookup.
Returns
A Gtk::IconInfo structure containing information about the icon. IconInfo::operator bool() will be false if the icon wasn't found - for instance, if (icon_info) { ... }.

◆ create()

static Glib::RefPtr<IconTheme> Gtk::IconTheme::create ( )
static

◆ get_default()

static Glib::RefPtr<IconTheme> Gtk::IconTheme::get_default ( )
static

Gets the icon theme for the default screen. See get_for_screen().

Returns
A unique Gtk::IconTheme associated with the default screen. This icon theme is associated with the screen and can be used as long as the screen is open. Do not ref or unref it.

◆ get_example_icon_name()

Glib::ustring Gtk::IconTheme::get_example_icon_name ( ) const

Gets the name of an icon that is representative of the current theme (for instance, to use when presenting a list of themes to the user.)

◆ get_for_screen()

static Glib::RefPtr<IconTheme> Gtk::IconTheme::get_for_screen ( const Glib::RefPtr< Gdk::Screen > &  screen)
static

Gets the icon theme object associated with screen; if this function has not previously been called for the given screen, a new icon theme object will be created and associated with the screen. Icon theme objects are fairly expensive to create, so using this function is usually a better choice than calling than new() and setting the screen yourself; by using this function a single icon theme object will be shared between users.

Parameters
screenA Gdk::Screen.
Returns
A unique Gtk::IconTheme associated with the given screen. This icon theme is associated with the screen and can be used as long as the screen is open. Do not ref or unref it.

◆ get_icon_sizes()

Glib::ArrayHandle<int> Gtk::IconTheme::get_icon_sizes ( const Glib::ustring &  icon_name) const

◆ get_search_path()

Glib::ArrayHandle<Glib::ustring> Gtk::IconTheme::get_search_path ( ) const

◆ get_type()

static GType Gtk::IconTheme::get_type ( )
static

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

◆ gobj() [1/2]

GtkIconTheme* Gtk::IconTheme::gobj ( )
inline

Provides access to the underlying C GObject.

Definition at line 187 of file icontheme.h.

◆ gobj() [2/2]

const GtkIconTheme* Gtk::IconTheme::gobj ( ) const
inline

Provides access to the underlying C GObject.

Definition at line 190 of file icontheme.h.

◆ gobj_copy()

GtkIconTheme* Gtk::IconTheme::gobj_copy ( )

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

◆ has_icon()

bool Gtk::IconTheme::has_icon ( const Glib::ustring &  icon_name) const

Checks whether an icon theme includes an icon for a particular name.

Parameters
icon_nameThe name of an icon.
Returns
true if icon_theme includes an icon for icon_name.

◆ list_contexts()

Glib::ListHandle<Glib::ustring> Gtk::IconTheme::list_contexts ( ) const

Gets the list of contexts available within the current hierarchy of icon themes.

Returns
A list holding the names of all the contexts in the theme.

◆ list_icons() [1/2]

Glib::ListHandle<Glib::ustring> Gtk::IconTheme::list_icons ( ) const

Lists the icons in the current icon theme.

Returns
A list holding the names of all the icons in the theme.

◆ list_icons() [2/2]

Glib::ListHandle<Glib::ustring> Gtk::IconTheme::list_icons ( const Glib::ustring &  context) const

Lists a subset of icons in the current icon theme, by providing a context string. The set of values for the context string is system dependent, but will typically include such values as 'Applications' and 'MimeTypes'.

Parameters
contextA string identifying a particular type of icon.
Returns
The names of all the icons in the theme.

◆ load_icon()

Glib::RefPtr<Gdk::Pixbuf> Gtk::IconTheme::load_icon ( const Glib::ustring &  icon_name,
int  size,
IconLookupFlags  flags = (IconLookupFlags) 0 
) const

Looks up an icon in an icon theme, scales it to the given size and renders it into a pixbuf. This is a convenience function; if more details about the icon are needed, use lookup_icon() followed by Gtk::IconInfo::load_icon().

Note that you probably want to listen for icon theme changes and update the icon. This is usually done by connecting to the GtkWidget::style-set signal. If for some reason you do not want to update the icon when the icon theme changes, you should consider using gdk_pixbuf_copy() to make a private copy of the pixbuf returned by this function. Otherwise GTK+ may need to keep the old icon theme loaded, which would be a waste of memory.

Parameters
icon_nameThe name of the icon to lookup.
sizeThe desired icon size. The resulting icon may not be exactly this size; see Gtk::IconInfo::load_icon().
flagsFlags modifying the behavior of the icon lookup.
Returns
The rendered icon; this may be a newly created icon or a new reference to an internal icon, so you must not modify the icon. Use Glib::object_unref() to release your reference to the icon. 0 if the icon isn't found.

◆ lookup_icon() [1/2]

IconInfo Gtk::IconTheme::lookup_icon ( const Glib::RefPtr< const Gio::Icon > &  icon,
int  size,
IconLookupFlags  flags 
) const

Looks up an icon and returns a structure containing information such as the filename of the icon. The icon can then be rendered into a pixbuf using Gtk::IconInfo::load_icon().

Parameters
iconThe Icon to look up.
sizeDesired icon size.
flagsFlags modifying the behavior of the icon lookup.
Returns
A Gtk::IconInfo structure containing information about the icon, or 0 if the icon wasn't found. Free with Gtk::IconInfo::free().

◆ lookup_icon() [2/2]

IconInfo Gtk::IconTheme::lookup_icon ( const Glib::ustring &  icon_name,
int  size,
IconLookupFlags  flags 
) const

Looks up a named icon and returns a structure containing information such as the filename of the icon. The icon can then be rendered into a pixbuf using Gtk::IconInfo::load_icon(). (load_icon() combines these two steps if all you need is the pixbuf.)

Parameters
icon_nameThe name of the icon to lookup.
sizeDesired icon size.
flagsFlags modifying the behavior of the icon lookup.
Returns
An IconInfo structure containing information about the icon. IconInfo::operator bool() will return false if the icon wasn't found. For instance, if (icon_info) { ... }.

◆ on_changed()

virtual void Gtk::IconTheme::on_changed ( )
protectedvirtual

This is a default handler for the signal signal_changed().

◆ prepend_search_path()

void Gtk::IconTheme::prepend_search_path ( const Glib::ustring &  path)

Prepends a directory to the search path. See set_search_path().

Parameters
pathDirectory name to prepend to the icon path.

◆ rescan_if_needed()

bool Gtk::IconTheme::rescan_if_needed ( )

Checks to see if the icon theme has changed; if it has, any currently cached information is discarded and will be reloaded next time icon_theme is accessed.

Returns
true if the icon theme has changed and needed to be reloaded.

◆ set_custom_theme()

void Gtk::IconTheme::set_custom_theme ( const Glib::ustring &  theme_name)

Sets the name of the icon theme that the Gtk::IconTheme object uses overriding system configuration. This function cannot be called on the icon theme objects returned from get_default() and get_for_screen().

Parameters
theme_nameName of icon theme to use instead of configured theme, or 0 to unset a previously set custom theme.

◆ set_screen()

void Gtk::IconTheme::set_screen ( const Glib::RefPtr< Gdk::Screen > &  screen)

Sets the screen for an icon theme; the screen is used to track the user's currently configured icon theme, which might be different for different screens.

Parameters
screenA Gdk::Screen.

◆ set_search_path()

void Gtk::IconTheme::set_search_path ( const Glib::ArrayHandle< Glib::ustring > &  path)

◆ signal_changed()

Glib::SignalProxy0< void > Gtk::IconTheme::signal_changed ( )
Slot Prototype:
void on_my_changed()

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gtk::IconTheme > wrap ( GtkIconTheme 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.

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