Gtk2HsContentsIndex
Graphics.UI.Gtk.General.IconFactory
Description

This module provides access to IconFactory, IconSet and IconSource.

TODO

  • The following functions are not bound: iconFactoryLookup, iconFactoryLookupDefault It is not a good idea to lookup an IconSet directly. If an Icon needs to be displayed it happends always in the context of a widget. The best practice is to get the widgets Style and call styleLookupIconSet.
Synopsis
data IconFactory
iconFactoryNew :: IO IconFactory
iconFactoryAdd :: IconFactory -> String -> IconSet -> IO ()
iconFactoryAddDefault :: IconFactory -> IO ()
iconFactoryLookup :: IconFactory -> String -> IO (Maybe IconSet)
iconFactoryLookupDefault :: String -> IO (Maybe IconSet)
iconFactoryRemoveDefault :: IconFactory -> IO ()
data IconSet
iconSetNew :: IO IconSet
iconSetNewFromPixbuf :: Pixbuf -> IO IconSet
iconSetAddSource :: IconSet -> IconSource -> IO ()
iconSetRenderIcon :: WidgetClass widget => IconSet -> TextDirection -> StateType -> IconSize -> widget -> IO Pixbuf
iconSetGetSizes :: IconSet -> IO [IconSize]
data IconSource
iconSourceNew :: IO IconSource
data TextDirection
= TextDirNone
| TextDirLtr
| TextDirRtl
iconSourceGetDirection :: IconSource -> IO (Maybe TextDirection)
iconSourceSetDirection :: IconSource -> TextDirection -> IO ()
iconSourceGetFilename :: IconSource -> IO (Maybe String)
iconSourceSetFilename :: IconSource -> FilePath -> IO ()
iconSourceGetPixbuf :: IconSource -> IO (Maybe Pixbuf)
iconSourceSetPixbuf :: IconSource -> Pixbuf -> IO ()
iconSourceGetSize :: IconSource -> IO (Maybe IconSize)
iconSourceSetSize :: IconSource -> IconSize -> IO ()
iconSourceResetSize :: IconSource -> IO ()
data StateType
= StateNormal
| StateActive
| StatePrelight
| StateSelected
| StateInsensitive
iconSourceGetState :: IconSource -> IO (Maybe StateType)
iconSourceSetState :: IconSource -> StateType -> IO ()
iconSourceResetState :: IconSource -> IO ()
type IconSize = Int
iconSizeMenu :: IconSize
iconSizeSmallToolbar :: IconSize
iconSizeLargeToolbar :: IconSize
iconSizeButton :: IconSize
iconSizeDialog :: IconSize
iconSizeCheck :: IconSize -> IO Bool
iconSizeRegister :: Int -> String -> Int -> IO IconSize
iconSizeRegisterAlias :: IconSize -> String -> IO ()
iconSizeFromName :: String -> IO IconSize
iconSizeGetName :: IconSize -> IO (Maybe String)
Documentation
data IconFactory
Instances
IconFactoryClass IconFactory
GObjectClass IconFactory
iconFactoryNew :: IO IconFactory

Create a new IconFactory.

  • An application should create a new IconFactory and add all needed icons. By calling iconFactoryAddDefault these icons become available as stock objects and can easily be displayed by Image. Furthermore, a theme can override the icons defined by the application.
iconFactoryAdd :: IconFactory -> String -> IconSet -> IO ()

Add an IconSet to an IconFactory.

  • In order to use the new stock object, the factory as to be added to the default factories by iconFactoryAddDefault.
iconFactoryAddDefault :: IconFactory -> IO ()
Add all entries of the IconFactory to the applications stock object database.
iconFactoryLookup :: IconFactory -> String -> IO (Maybe IconSet)

Looks up the stock id in the icon factory, returning an icon set if found, otherwise Nothing.

  • For display to the user, you should use styleLookupIconSet on the Style for the widget that will display the icon, instead of using this function directly, so that themes are taken into account.
iconFactoryLookupDefault :: String -> IO (Maybe IconSet)

Looks for an icon in the list of default icon factories.

  • For display to the user, you should use styleLookupIconSet on the Style for the widget that will display the icon, instead of using this function directly, so that themes are taken into account.
iconFactoryRemoveDefault :: IconFactory -> IO ()
Remove an IconFactory from the application's stock database.
data IconSet
iconSetNew :: IO IconSet

Create a new IconSet.

  • Each icon in an application is contained in an IconSet. The IconSet contains several variants (IconSources) to accomodate for different sizes and states.
iconSetNewFromPixbuf :: Pixbuf -> IO IconSet
Creates a new IconSet with the given pixbuf as the default/fallback source image. If you don't add any additional IconSource to the icon set, all variants of the icon will be created from the pixbuf, using scaling, pixelation, etc. as required to adjust the icon size or make the icon look insensitive/prelighted.
iconSetAddSource :: IconSet -> IconSource -> IO ()

Add an IconSource (an Icon with attributes) to an IconSet.

  • If an icon is looked up in the IconSet set the best matching IconSource will be taken. It is therefore advisable to add a default (wildcarded) icon, than can be used if no exact match is found.
iconSetRenderIcon :: WidgetClass widget => IconSet -> TextDirection -> StateType -> IconSize -> widget -> IO Pixbuf
iconSetGetSizes :: IconSet -> IO [IconSize]
Obtains a list of icon sizes this icon set can render.
data IconSource
iconSourceNew :: IO IconSource

Create a new IconSource.

  • An IconSource is a single image that is usually added to an IconSet. Next to the image it contains information about which state, text direction and size it should apply.
data TextDirection
Is the text written from left to right or the awkward way?
Constructors
TextDirNone
TextDirLtr
TextDirRtl
Instances
Enum TextDirection
iconSourceGetDirection :: IconSource -> IO (Maybe TextDirection)

Retrieve the TextDirection of this IconSource.

  • Nothing is returned if no explicit direction was set.
iconSourceSetDirection :: IconSource -> TextDirection -> IO ()
Mark this IconSource that it should only apply to the specified TextDirection.
iconSourceGetFilename :: IconSource -> IO (Maybe String)

Retrieve the filename this IconSource was based on.

  • Returns Nothing if the IconSource was generated by a Pixbuf.
iconSourceSetFilename :: IconSource -> FilePath -> IO ()
Load an icon picture from this filename.
iconSourceGetPixbuf :: IconSource -> IO (Maybe Pixbuf)
Retrieves the source pixbuf, or Nothing if none is set.
iconSourceSetPixbuf :: IconSource -> Pixbuf -> IO ()
Sets a pixbuf to use as a base image when creating icon variants for IconSet.
iconSourceGetSize :: IconSource -> IO (Maybe IconSize)

Retrieve the IconSize of this IconSource.

  • Nothing is returned if no explicit size was set (i.e. this IconSource matches all sizes).
iconSourceSetSize :: IconSource -> IconSize -> IO ()
Set this IconSource to a specific size.
iconSourceResetSize :: IconSource -> IO ()
Reset the IconSize of this IconSource so that is matches anything.
data StateType
Widget states
Constructors
StateNormal
StateActive
StatePrelight
StateSelected
StateInsensitive
Instances
Enum StateType
iconSourceGetState :: IconSource -> IO (Maybe StateType)

Retrieve the StateType of this IconSource.

  • Nothing is returned if the IconSource matches all states.
iconSourceSetState :: IconSource -> StateType -> IO ()
Mark this icon to be used only with this specific state.
iconSourceResetState :: IconSource -> IO ()
Reset the StateType of this IconSource so that is matches anything.
type IconSize = Int
iconSizeMenu :: IconSize
iconSizeSmallToolbar :: IconSize
iconSizeLargeToolbar :: IconSize
iconSizeButton :: IconSize
iconSizeDialog :: IconSize
iconSizeCheck :: IconSize -> IO Bool

Check if a given IconSize is registered.

  • Useful if your application expects a theme to install a set with a specific size. You can test if this actually happend and use another size if not.
iconSizeRegister :: Int -> String -> Int -> IO IconSize
Register a new IconSize.
iconSizeRegisterAlias :: IconSize -> String -> IO ()
Register an additional alias for a name.
iconSizeFromName :: String -> IO IconSize

Lookup an IconSize by name.

iconSizeGetName :: IconSize -> IO (Maybe String)

Lookup the name of an IconSize.

  • Returns Nothing if the name was not found.
Produced by Haddock version 0.6