glibmm: Gio::Icon Class Reference

glibmm 2.30.1

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

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

Public Member Functions | Static Public Member Functions | Related Functions
Gio::Icon Class Reference

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

`#include <giomm/icon.h>`

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

Virtual: hash

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 `/path/to/my icon.png`) 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 `sftp://path/to/my%%20icon.png`). </listitem> <listitem> If icon is a ThemedIcon with exactly one name, the encoding is simply the name (such as `network-server`). </listitem> </itemizedlist>

Virtual: to_tokens

Since glibmm 2.20:

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

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