|
From: Andy S. <And...@co...> - 2010-09-05 15:38:14
|
diffing dir...
Sun Sep 5 11:33:44 EDT 2010 Andy Stewart <laz...@gm...>
* Add new module System.GIO.Icons.EmblemedIcon
Ignore-this: 3b9d8eaa2946c878b78b92a32b2c2d99
{
addfile ./gio/System/GIO/Icons/EmblemedIcon.chs
hunk ./gio/System/GIO/Icons/EmblemedIcon.chs 1
+{-# LANGUAGE CPP #-}
+-- GIMP Toolkit (GTK) Binding for Haskell: binding to gio -*-haskell-*-
+--
+-- Author : Andy Stewart
+-- Created: 30-Apirl-2010
+--
+-- Copyright (c) 2010 Andy Stewart
+--
+-- This library is free software: you can redistribute it and/or
+-- modify it under the terms of the GNU Lesser General Public License
+-- as published by the Free Software Foundation, either version 3 of
+-- the License, or (at your option) any later version.
+-- [_$_]
+-- This library is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+-- Lesser General Public License for more details.
+-- [_$_]
+-- You should have received a copy of the GNU Lesser General Public
+-- License along with this program. If not, see
+-- <http://www.gnu.org/licenses/>.
+-- [_$_]
+-- GIO, the C library which this Haskell library depends on, is
+-- available under LGPL Version 2. The documentation included with
+-- this library is based on the original GIO documentation.
+-- [_$_]
+-- | Maintainer : gtk...@li...
+-- Stability : alpha
+-- Portability : portable (depends on GHC)
+module System.GIO.Icons.EmblemedIcon (
+-- * Details
+--
+-- | 'EmblemedIcon' is an implementation of 'Icon' that supports adding an emblem to an icon. Adding
+-- multiple emblems to an icon is ensured via 'emblemedIconAddEmblem'.
+-- [_$_]
+-- Note that 'Emblem'edIcon allows no control over the position of the emblems. See also 'Emblem' for
+-- more information.
hunk ./gio/System/GIO/Icons/EmblemedIcon.chs 39
+#if GLIB_CHECK_VERSION(2,18,0)
+-- * Types [_$_]
+ EmblemedIcon(..),
+ EmblemedIconClass,
+
+-- * Methods
+ emblemedIconNew,
+ emblemedIconGetIcon,
+ emblemedIconGetEmblems,
+ emblemedIconAddEmblem,
+#endif [_$_]
+ ) where
+
+import Control.Monad
+import System.GIO.Enums
+import System.Glib.FFI
+import System.Glib.Flags
+import System.Glib.GError
+import System.Glib.GList
+import System.Glib.GObject
+import System.Glib.UTFString
+{#import System.GIO.Types#}
+
+{# context lib = "gio" prefix = "g" #}
+
+#if GLIB_CHECK_VERSION(2,18,0)
+-------------------
+-- Methods
+-- | Creates a new emblemed icon for icon with the emblem emblem.
+emblemedIconNew :: (IconClass icon, EmblemClass emblem) => icon -> emblem -> IO EmblemedIcon
+emblemedIconNew icon emblem =
+ {#call g_emblemed_icon_new#} [_$_]
+ (toIcon icon) (toEmblem emblem)
+ >>= (constructNewGObject mkEmblemedIcon . return) . castPtr
+
+-- | Gets the main icon for emblemed.
+emblemedIconGetIcon :: EmblemedIconClass emblemed => emblemed
+ -> IO Icon -- ^ returns a 'Icon' that is owned by emblemed [_$_]
+emblemedIconGetIcon emblemed =
+ makeNewGObject mkIcon $
+ {#call g_emblemed_icon_get_icon#} (toEmblemedIcon emblemed) [_$_]
+
+-- | Gets the list of emblems for the icon.
+emblemedIconGetEmblems :: EmblemedIconClass emblemed => emblemed
+ -> IO [Emblem]
+emblemedIconGetEmblems emblemed = do
+ glistPtr <- {#call g_emblemed_icon_get_emblems#} (toEmblemedIcon emblemed)
+ emblemPtrs <- fromGList glistPtr
+ mapM (makeNewGObject mkEmblem . return) emblemPtrs
+
+-- | Adds emblem to the 'Emblem'.
+emblemedIconAddEmblem :: EmblemedIconClass emblemed => emblemed [_$_]
+ -> Emblem
+ -> IO ()
+emblemedIconAddEmblem emblemed emblem = [_$_]
+ {#call g_emblemed_icon_add_emblem#}
+ (toEmblemedIcon emblemed)
+ emblem
+
+#endif
}
|