Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Interfaces.Icon
Description
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 ThemedIcon
), or the path to an icon
(see LoadableIcon
).
To obtain a hash of a GIcon
, see iconHash
.
To check if two GIcon
s are equal, see iconEqual
.
For serializing a GIcon
, use iconSerialize
and
iconDeserialize
.
If you want to consume GIcon
(for example, in a toolkit) you must
be prepared to handle at least the three following cases:
LoadableIcon
, ThemedIcon
and EmblemedIcon
.
It may also make sense to have fast-paths for other cases (like handling
`GdkPixbuf` directly,
for example) but all compliant GIcon
implementations outside of GIO must
implement LoadableIcon
.
If your application or library provides one or more GIcon
implementations you need to ensure that your new implementation also
implements LoadableIcon
. Additionally, you must provide an
implementation of iconSerialize
that gives a result that is
understood by iconDeserialize
, yielding one of the built-in
icon types.
Synopsis
- newtype Icon = Icon (ManagedPtr Icon)
- class (GObject o, IsDescendantOf Icon o) => IsIcon o
- toIcon :: (MonadIO m, IsIcon o) => o -> m Icon
- type family ResolveIconMethod (t :: Symbol) o where ...
- iconDeserialize :: (HasCallStack, MonadIO m) => GVariant -> m (Maybe Icon)
- data IconEqualMethodInfo
- iconEqual :: (HasCallStack, MonadIO m, IsIcon a, IsIcon b) => Maybe a -> Maybe b -> m Bool
- data IconHashMethodInfo
- iconHash :: (HasCallStack, MonadIO m, IsIcon a) => a -> m Word32
- iconNewForString :: (HasCallStack, MonadIO m) => Text -> m Icon
- data IconSerializeMethodInfo
- iconSerialize :: (HasCallStack, MonadIO m, IsIcon a) => a -> m (Maybe GVariant)
- data IconToStringMethodInfo
- iconToString :: (HasCallStack, MonadIO m, IsIcon a) => a -> m (Maybe Text)
Exported types
Memory-managed wrapper type.
Constructors
Icon (ManagedPtr Icon) |
Instances
class (GObject o, IsDescendantOf Icon o) => IsIcon o Source #
Instances
(GObject o, IsDescendantOf Icon o) => IsIcon o Source # | |
Defined in GI.Gio.Interfaces.Icon |
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, equal, forceFloating, freezeNotify, getv, hash, isFloating, notify, notifyByPspec, ref, refSink, runDispose, serialize, stealData, stealQdata, thawNotify, toString, unref, watchClosure.
Getters
getData, getProperty, getQdata.
Setters
type family ResolveIconMethod (t :: Symbol) o where ... Source #
Equations
deserialize
Arguments
:: (HasCallStack, MonadIO m) | |
=> GVariant |
|
-> m (Maybe Icon) |
Deserializes a Icon
previously serialized using iconSerialize
.
Since: 2.38
equal
data IconEqualMethodInfo Source #
Instances
(signature ~ (Maybe b -> m Bool), MonadIO m, IsIcon a, IsIcon b) => OverloadedMethod IconEqualMethodInfo a signature Source # | |
Defined in GI.Gio.Interfaces.Icon Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo IconEqualMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Interfaces.Icon Methods |
Arguments
:: (HasCallStack, MonadIO m, IsIcon a, IsIcon b) | |
=> Maybe a |
|
-> Maybe b |
|
-> m Bool |
Checks if two icons are equal.
hash
data IconHashMethodInfo Source #
Instances
(signature ~ m Word32, MonadIO m, IsIcon a) => OverloadedMethod IconHashMethodInfo a signature Source # | |
Defined in GI.Gio.Interfaces.Icon Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo IconHashMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Interfaces.Icon Methods |
Arguments
:: (HasCallStack, MonadIO m, IsIcon a) | |
=> a |
|
-> m Word32 | Returns: a |
Gets a hash for an icon.
newForString
Arguments
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m Icon | Returns: An object implementing the |
Generate a Icon
instance from str
. This function can fail if
str
is not valid - see iconToString
for discussion.
If your application or library provides one or more Icon
implementations you need to ensure that each GType
is registered
with the type system prior to calling iconNewForString
.
Since: 2.20
serialize
data IconSerializeMethodInfo Source #
Instances
(signature ~ m (Maybe GVariant), MonadIO m, IsIcon a) => OverloadedMethod IconSerializeMethodInfo a signature Source # | |
Defined in GI.Gio.Interfaces.Icon Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo IconSerializeMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Interfaces.Icon Methods |
Arguments
:: (HasCallStack, MonadIO m, IsIcon a) | |
=> a |
|
-> m (Maybe GVariant) | Returns: a |
Serializes a Icon
into a GVariant
. An equivalent Icon
can be retrieved
back by calling iconDeserialize
on the returned value.
As serialization will avoid using raw icon data when possible, it only
makes sense to transfer the GVariant
between processes on the same machine,
(as opposed to over the network), and within the same file system namespace.
Since: 2.38
toString
data IconToStringMethodInfo Source #
Instances
(signature ~ m (Maybe Text), MonadIO m, IsIcon a) => OverloadedMethod IconToStringMethodInfo a signature Source # | |
Defined in GI.Gio.Interfaces.Icon Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo IconToStringMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Interfaces.Icon Methods |
Arguments
:: (HasCallStack, MonadIO m, IsIcon a) | |
=> a |
|
-> m (Maybe Text) | Returns: An allocated NUL-terminated UTF8 string or
|
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 iconNewForString
to
get icon
back from the returned string.
The encoding of the returned string is proprietary to Icon
except
in the following two cases
- If
icon
is aFileIcon
, the returned string is a native path (such as/path/to/my icon.png
) without escaping if theFile
foricon
is a native file. If the file is not native, the returned string is the result offileGetUri
(such assftp://path/to/my%20icon.png
). - If
icon
is aThemedIcon
with exactly one name and no fallbacks, the encoding is simply the name (such asnetwork-server
).
Since: 2.20