Maintainer | gtk2hs-devel@lists.sourceforge.net |
---|---|
Stability | alpha |
Portability | portable (depends on GHC) |
Safe Haskell | None |
Language | Haskell98 |
- newtype Icon = Icon (ForeignPtr Icon)
- class GObjectClass o => IconClass o
- iconEqual :: (IconClass icon1, IconClass icon2) => icon1 -> icon2 -> IO Bool
- iconToString :: IconClass icon => icon -> IO ByteString
- iconNewForString :: ByteString -> IO Icon
Details
Icon
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.
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 GLoadableIcon).
To obtain a hash of a Icon
, see iconHash
.
To check if two Icon
s are equal, see iconEqual
.
For serializing a Icon
, use iconToString
.
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
.
Types
class GObjectClass o => IconClass o Source
Methods
iconToString :: IconClass icon => icon -> IO ByteString Source
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 a
FileIcon
, the returned string is a native path (such as pathto/my icon.png) without escaping if theFile
for icon is a native file. If the file is not native, the returned string is the result offileGetUri
. - If icon is a
ThemedIcon
with exactly one name, the encoding is simply the name (such as network-server).
iconNewForString :: ByteString -> IO Icon Source
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
.