# Gio::Icon Class Reference

This is a very minimal interface for icons. More...

Inherits Glib::Interface.

Inherited by Gio::Emblem, Gio::EmblemedIcon, Gio::LoadableIcon, and Gio::ThemedIcon.

Collaboration diagram for Gio::Icon:
[legend]

List of all members.

## Public Member Functions

virtual | ~Icon ()
GIcon* | gobj ()
| Provides access to the underlying C GObject.
const GIcon* | gobj () const
| Provides access to the underlying C GObject.
guint | hash () const
| Gets a hash for an icon.
std::string | to_string () const
| Generates a textual representation of icon that can be used for serialization such as when passing icon to a different process or saving it to persistent storage.
bool | equal (const Glib::RefPtr< Icon >& other) const

## Static Public Member Functions

static void | add_interface (GType gtype_implementer)
static Glib::RefPtr< Icon > | create (const std::string& str)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr< Gio::Icon > | wrap (GIcon* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

This is a very minimal interface for icons.

It provides functions for checking the equality of two icons and hashing of icons. Glib::Icon does not provide the actual pixmap for the icon as this is out of GIO's scope. However implementations of Icon may contain the name of an icon (see ThemedIcon), or the path to an icon (see LoadableIcon).

To obtain a hash of an Icon instance, see hash().

To check if two Icon instances are equal, see equal().

Since glibmm 2.16:

## Constructor & Destructor Documentation

virtual Gio::Icon::~Icon | ( |  | ) | `[virtual]`

## Member Function Documentation

static void Gio::Icon::add_interface | ( | GType | gtype_implementer | ) | `[static]`

Reimplemented in Gio::LoadableIcon.

static Glib::RefPtr<Icon> Gio::Icon::create | ( | const std::string & | str | ) | `[static]`

bool Gio::Icon::equal | ( | const Glib::RefPtr< Icon >& | other | ) | const

const GIcon* Gio::Icon::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

Reimplemented in Gio::Emblem, Gio::EmblemedIcon, Gio::FileIcon, Gio::LoadableIcon, and Gio::ThemedIcon.

GIcon* Gio::Icon::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::Interface.

Reimplemented in Gio::Emblem, Gio::EmblemedIcon, Gio::FileIcon, Gio::LoadableIcon, and Gio::ThemedIcon.

guint Gio::Icon::hash | ( |  | ) | const

Gets a hash for an icon.

Parameters:

  | icon | gconstpointer to an icon object.

Returns:
  A `unsigned int` containing a hash for the icon, suitable for use in a HashTable or similar data structure.

std::string Gio::Icon::to_string | ( |  | ) | const

Generates a textual representation of icon that can be used for serialization such as when passing icon to a different process or saving it to persistent storage.

Use g_icon_new_for_string() to get icon back from the returned string.

The encoding of the returned string is proprietary to Icon except in the following two cases

<itemizedlist> <listitem>

If icon is a FileIcon, the returned string is a native path (such as <literal>/path/to/my icon.png</literal>) without escaping if the File for icon is a native file. If the file is not native, the returned string is the result of g_file_get_uri() (such as <literal>sftp://path/to/my%20icon.png</literal>).

</listitem> <listitem>

If icon is a ThemedIcon with exactly one name, the encoding is simply the name (such as <literal>network-server</literal>).

</listitem> </itemizedlist>

Returns:
  An allocated NUL-terminated UTF8 string or `0` if icon can't be serialized. Use Glib::free() to free.

Since glibmm 2.20:

## Friends And Related Function Documentation

Glib::RefPtr< Gio::Icon > wrap | ( | GIcon * | 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.

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

- giomm/icon.h