gtkmm: Gtk::IconInfo Class Reference

gtkmm 3.95.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::IconInfo Class Reference

`#include <gtkmm/iconinfo.h>`

Inheritance diagram for Gtk::IconInfo:
[legend]

## Public Member Functions
| IconInfo (IconInfo&& src) noexcept
IconInfo& | operator= (IconInfo&& src) noexcept
| ~IconInfo () noexcept override
GtkIconInfo* | gobj ()
| Provides access to the underlying C GObject. More...
const GtkIconInfo* | gobj () const
| Provides access to the underlying C GObject. More...
GtkIconInfo* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
int | get_base_size () const
| Gets the base size for the icon. More...
int | get_base_scale () const
| Gets the base scale for the icon. More...
Glib::ustring | get_filename () const
| Gets the filename for the icon. More...
bool | is_symbolic () const
| Checks if the icon is symbolic or not. More...
Glib::RefPtr< const Gdk::Pixbuf > | load_icon () const
| Renders an icon previously looked up in an icon theme using Gtk::IconTheme::lookup_icon(); the size will be based on the size passed to Gtk::IconTheme::lookup_icon(). More...
Glib::RefPtr< const Gdk::Texture > | load_texture () const
| Returns a texture object that can be used to render the icon with GSK. More...
void | load_icon_async (const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable) const
| Asynchronously load, render and scale an icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon(). More...
void | load_icon_async (const Gio::SlotAsyncReady& slot) const
| A load_icon_async() convenience overload. More...
Glib::RefPtr< const Gdk::Pixbuf > | load_icon_finish (const Glib::RefPtr< Gio::AsyncResult >& result) const
| Finishes an async icon load, see load_icon_async(). More...
Glib::RefPtr< const Gdk::Pixbuf > | load_symbolic (const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, bool& was_symbolic) const
| Loads an icon, modifying it to match the system colours for the foreground, success, warning and error colors provided. More...
void | load_symbolic_async (const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable) const
| Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon(). More...
void | load_symbolic_async (const Gdk::RGBA& fg, const Gdk::RGBA& success_color, const Gdk::RGBA& warning_color, const Gdk::RGBA& error_color, const Gio::SlotAsyncReady& slot) const
| A load_symbolic_async() convenience overload. More...
Glib::RefPtr< const Gdk::Pixbuf > | load_symbolic_finish (const Glib::RefPtr< Gio::AsyncResult >& result, bool& was_symbolic) const
| Finishes an async icon load, see load_symbolic_async(). More...
Glib::RefPtr< const Gdk::Pixbuf > | load_symbolic_for_context (const Glib::RefPtr< StyleContext >& context, bool& was_symbolic) const
| Loads an icon, modifying it to match the system colors for the foreground, success, warning and error colors provided. More...
void | load_symbolic_for_context_async (const Glib::RefPtr< StyleContext >& context, const Gio::SlotAsyncReady& slot, const Glib::RefPtr< Gio::Cancellable >& cancellable) const
| Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon(). More...
void | load_symbolic_for_context_async (const Glib::RefPtr< StyleContext >& context, const Gio::SlotAsyncReady& slot) const
| A load_symbolic_for_context_async() convenience overload. More...
Glib::RefPtr< const Gdk::Pixbuf > | load_symbolic_for_context_finish (const Glib::RefPtr< Gio::AsyncResult >& result, bool& was_symbolic) const
| Finishes an async icon load, see load_symbolic_for_context_async(). More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< IconInfo > | create (const Glib::RefPtr< IconTheme >& icon_theme, const Glib::RefPtr< Gdk::Pixbuf >& pixbuf)
| Creates an IconInfo for a Gdk::Pixbuf. More...

## Protected Member Functions
| IconInfo (const Glib::RefPtr< IconTheme >& icon_theme, const Glib::RefPtr< Gdk::Pixbuf >& pixbuf)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::IconInfo > | wrap (GtkIconInfo* object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## Constructor & Destructor Documentation

Gtk::IconInfo::IconInfo | ( | IconInfo&& | src | ) |
| noexcept

Gtk::IconInfo::~IconInfo | ( |  | ) |
| overridenoexcept

Gtk::IconInfo::IconInfo | ( | const Glib::RefPtr< IconTheme >& | icon_theme,
|  | const Glib::RefPtr< Gdk::Pixbuf >& | pixbuf
| ) |  |
| protected

## Member Function Documentation

static Glib::RefPtr<IconInfo> Gtk::IconInfo::create | ( | const Glib::RefPtr< IconTheme >& | icon_theme,
|  | const Glib::RefPtr< Gdk::Pixbuf >& | pixbuf
| ) |  |
| static

Creates an IconInfo for a Gdk::Pixbuf.

Since gtkmm 3.92:

Parameters

  icon_theme | A Gtk::IconTheme.
  pixbuf | The pixbuf to wrap in an IconInfo.

Returns
  A RefPtr to a new IconInfo.

int Gtk::IconInfo::get_base_scale | ( |  | ) | const

Gets the base scale for the icon.

The base scale is a scale for the icon that was specified by the icon theme creator. For instance an icon drawn for a high-dpi monitor with window scale 2 for a base size of 32 will be 64 pixels tall and have a base scale of 2.

Returns
  The base scale.

int Gtk::IconInfo::get_base_size | ( |  | ) | const

Gets the base size for the icon.

The base size is a size for the icon that was specified by the icon theme creator. This may be different than the actual size of image; These icons will be given the same base size as the larger icons to which they are attached.

Note that for scaled icons the base size does not include the base scale.

Returns
  The base size, or 0, if no base size is known for the icon.

Glib::ustring Gtk::IconInfo::get_filename | ( |  | ) | const

Gets the filename for the icon.

If the Gtk::IconLookupFlags::USE_BUILTIN flag was passed to Gtk::IconTheme::lookup_icon(), there may be no filename if a builtin icon is returned; in this case, you should use gtk_icon_info_get_builtin_pixbuf().

Returns
  The filename for the icon, or `nullptr` if gtk_icon_info_get_builtin_pixbuf() should be used instead.

static GType Gtk::IconInfo::get_type | ( |  | ) |
| static

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

GtkIconInfo* Gtk::IconInfo::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

const GtkIconInfo* Gtk::IconInfo::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

GtkIconInfo* Gtk::IconInfo::gobj_copy | ( |  | ) |

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

bool Gtk::IconInfo::is_symbolic | ( |  | ) | const

Checks if the icon is symbolic or not.

This currently uses only the file name and not the file contents for determining this. This behaviour may change in the future.

Returns
  `true` if the icon is symbolic, `false` otherwise.

Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_icon | ( |  | ) | const

Renders an icon previously looked up in an icon theme using Gtk::IconTheme::lookup_icon(); the size will be based on the size passed to Gtk::IconTheme::lookup_icon().

Note that the resulting pixbuf may not be exactly this size; an icon theme may have icons that differ slightly from their nominal sizes, and in addition GTK+ will avoid scaling icons that it considers sufficiently close to the requested size or for which the source image would have to be scaled up too far. (This maintains sharpness.). This behaviour can be changed by passing the Gtk::IconLookupFlags::FORCE_SIZE flag when obtaining the Gtk::IconInfo. If this flag has been specified, the pixbuf returned by this function will be scaled to the exact size.

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.

Exceptions

  Glib::Error |

void Gtk::IconInfo::load_icon_async | ( | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable
| ) |  | const

Asynchronously load, render and scale an icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon().

For more details, see load_icon() which is the synchronous version of this call.

Parameters

  cancellable | Optional Cancellable object, `nullptr` to ignore.
  slot | A SlotAsyncReady to call when the request is satisfied.

void Gtk::IconInfo::load_icon_async | ( | const Gio::SlotAsyncReady & | slot | ) | const

A load_icon_async() convenience overload.

Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_icon_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const

Finishes an async icon load, see load_icon_async().

Parameters

  result | A Gio::AsyncResult.

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.

Exceptions

  Glib::Error |

Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_symbolic | ( | const Gdk::RGBA& | fg,
|  | const Gdk::RGBA& | success_color,
|  | const Gdk::RGBA& | warning_color,
|  | const Gdk::RGBA& | error_color,
|  | bool & | was_symbolic
| ) |  | const

Loads an icon, modifying it to match the system colours for the foreground, success, warning and error colors provided.

If the icon is not a symbolic one, the function will return the result from load_icon().

This allows loading symbolic icons that will match the system theme.

Unless you are implementing a widget, you will want to use Glib::themed_icon_new_with_default_fallbacks() to load the icon.

As implementation details, the icon loaded needs to be of SVG type, contain the “symbolic” term as the last component of the icon name, and use the “fg”, “success”, “warning” and “error” CSS styles in the SVG file itself.

See the Symbolic Icons Specification for more information about symbolic icons.

Parameters

  fg | A Gdk::RGBA representing the foreground color of the icon.
  success_color | A Gdk::RGBA representing the warning color of the icon or `nullptr` to use the default color.
  warning_color | A Gdk::RGBA representing the warning color of the icon or `nullptr` to use the default color.
  error_color | A Gdk::RGBA representing the error color of the icon or `nullptr` to use the default color (allow-none).
  was_symbolic | A `bool`, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.

Returns
  A Gdk::Pixbuf representing the loaded icon.

Exceptions

  Glib::Error |

void Gtk::IconInfo::load_symbolic_async | ( | const Gdk::RGBA& | fg,
|  | const Gdk::RGBA& | success_color,
|  | const Gdk::RGBA& | warning_color,
|  | const Gdk::RGBA& | error_color,
|  | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable
| ) |  | const

Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon().

For more details, see load_symbolic() which is the synchronous version of this call.

Parameters

  fg | A Gdk::RGBA representing the foreground color of the icon.
  success_color | A Gdk::RGBA representing the warning color of the icon or `nullptr` to use the default color.
  warning_color | A Gdk::RGBA representing the warning color of the icon or `nullptr` to use the default color.
  error_color | A Gdk::RGBA representing the error color of the icon or `nullptr` to use the default color (allow-none).
  cancellable | Optional Cancellable object, `nullptr` to ignore.
  slot | A SlotAsyncReady to call when the request is satisfied.

void Gtk::IconInfo::load_symbolic_async | ( | const Gdk::RGBA& | fg,
|  | const Gdk::RGBA& | success_color,
|  | const Gdk::RGBA& | warning_color,
|  | const Gdk::RGBA& | error_color,
|  | const Gio::SlotAsyncReady & | slot
| ) |  | const

A load_symbolic_async() convenience overload.

Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_symbolic_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result,
|  | bool & | was_symbolic
| ) |  | const

Finishes an async icon load, see load_symbolic_async().

Parameters

  result | A Gio::AsyncResult.
  was_symbolic | A `bool`, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.

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.

Exceptions

  Glib::Error |

Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_symbolic_for_context | ( | const Glib::RefPtr< StyleContext >& | context,
|  | bool & | was_symbolic
| ) |  | const

Loads an icon, modifying it to match the system colors for the foreground, success, warning and error colors provided.

If the icon is not a symbolic one, the function will return the result from load_icon(). This function uses the regular foreground color and the symbolic colors with the names “success_color”, “warning_color” and “error_color” from the context.

This allows loading symbolic icons that will match the system theme.

See load_symbolic() for more details.

Parameters

  context | A Gtk::StyleContext.
  was_symbolic | A `bool`, returns whether the loaded icon was a symbolic one and whether the foreground color was applied to it.

Returns
  A Gdk::Pixbuf representing the loaded icon.

Exceptions

  Glib::Error |

void Gtk::IconInfo::load_symbolic_for_context_async | ( | const Glib::RefPtr< StyleContext >& | context,
|  | const Gio::SlotAsyncReady & | slot,
|  | const Glib::RefPtr< Gio::Cancellable > & | cancellable
| ) |  | const

Asynchronously load, render and scale a symbolic icon previously looked up from the icon theme using Gtk::IconTheme::lookup_icon().

For more details, see load_symbolic_for_context() which is the synchronous version of this call.

Parameters

  context | A Gtk::StyleContext.
  cancellable | Optional Cancellable object, `nullptr` to ignore.
  slot | A SlotAsyncReady to call when the request is satisfied.

void Gtk::IconInfo::load_symbolic_for_context_async | ( | const Glib::RefPtr< StyleContext >& | context,
|  | const Gio::SlotAsyncReady & | slot
| ) |  | const

A load_symbolic_for_context_async() convenience overload.

Glib::RefPtr<const Gdk::Pixbuf> Gtk::IconInfo::load_symbolic_for_context_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result,
|  | bool & | was_symbolic
| ) |  | const

Finishes an async icon load, see load_symbolic_for_context_async().

Parameters

  result | A Gio::AsyncResult.
  was_symbolic | A `bool`, returns whether the loaded icon was a symbolic one and whether the fg color was applied to it.

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.

Exceptions

  Glib::Error |

Glib::RefPtr<const Gdk::Texture> Gtk::IconInfo::load_texture | ( |  | ) | const

Returns a texture object that can be used to render the icon with GSK.

Returns
  The icon texture; this may be a newly created texture or a new reference to an exiting texture. Use Glib::object_unref() to release your reference.

IconInfo& Gtk::IconInfo::operator= | ( | IconInfo&& | src | ) |
| noexcept

## Friends And Related Function Documentation

Glib::RefPtr< Gtk::IconInfo > wrap | ( | GtkIconInfo * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

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

Parameters

  object | The C instance.
  take_copy | False 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.