module Gio::Icon
Overview
GIcon
is a very minimal interface for icons. It provides functions
for checking the equality of two icons, hashing of icons and
serializing an icon to and from strings.
GIcon
does not provide the actual pixmap for the icon as this is out
of GIO's scope, however implementations of GIcon
may contain the name
of an icon (see Gio::ThemedIcon
), or the path to an icon
(see Gio::LoadableIcon
).
To obtain a hash of a GIcon
, see Gio::Icon#hash
.
To check if two GIcon
s are equal, see Gio::Icon#equal
.
For serializing a GIcon
, use Gio::Icon#serialize
and
Gio::Icon#deserialize
.
If you want to consume GIcon
(for example, in a toolkit) you must
be prepared to handle at least the three following cases:
Gio::LoadableIcon
, Gio::ThemedIcon
and Gio::EmblemedIcon
.
It may also make sense to have fast-paths for other cases (like handling
Gdk::Pixbuf
directly,
for example) but all compliant GIcon
implementations outside of GIO must
implement Gio::LoadableIcon
.
If your application or library provides one or more GIcon
implementations you need to ensure that your new implementation also
implements Gio::LoadableIcon
. Additionally, you must provide an
implementation of Gio::Icon#serialize
that gives a result that is
understood by Gio::Icon#deserialize
, yielding one of the built-in
icon types.
Direct including types
- Gdk::DmabufTexture
- Gdk::GLTexture
- Gdk::MemoryTexture
- Gdk::Texture
- GdkPixbuf::Pixbuf
- Gio::BytesIcon
- Gio::Emblem
- Gio::EmblemedIcon
- Gio::FileIcon
- Gio::ThemedIcon
Defined in:
lib/gi-crystal/src/auto/gio-2.0/icon.crConstructors
-
.cast(obj : GObject::Object) : self
Cast a
GObject::Object
toself
, throws aTypeCastError
if the cast can't be made.
Class Method Summary
- .cast?(obj : GObject::Object) : self | Nil
- .deserialize(value : _) : Gio::Icon | Nil
- .g_type : UInt64
Instance Method Summary
- #equal(icon2 : Gio::Icon | Nil) : Bool
- #hash : UInt32
- #new_for_string(str : String) : Gio::Icon
- #serialize : GLib::Variant | Nil
- #to_string : String | Nil
- #to_unsafe