{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (garetxe@gmail.com) -} module GI.Gtk.Structs.IconSet ( -- * Exported types IconSet(..) , noIconSet , -- * Methods -- ** iconSetAddSource iconSetAddSource , -- ** iconSetCopy iconSetCopy , -- ** iconSetGetSizes iconSetGetSizes , -- ** iconSetNew iconSetNew , -- ** iconSetNewFromPixbuf iconSetNewFromPixbuf , -- ** iconSetRef iconSetRef , -- ** iconSetRenderIcon iconSetRenderIcon , -- ** iconSetRenderIconPixbuf iconSetRenderIconPixbuf , -- ** iconSetRenderIconSurface iconSetRenderIconSurface , -- ** iconSetUnref iconSetUnref , ) where import Prelude () import Data.GI.Base.ShortPrelude import qualified Data.Text as T import qualified Data.ByteString.Char8 as B import qualified Data.Map as Map import GI.Gtk.Types import GI.Gtk.Callbacks import qualified GI.Gdk as Gdk import qualified GI.GdkPixbuf as GdkPixbuf import qualified GI.Cairo as Cairo newtype IconSet = IconSet (ForeignPtr IconSet) foreign import ccall "gtk_icon_set_get_type" c_gtk_icon_set_get_type :: IO GType instance BoxedObject IconSet where boxedType _ = c_gtk_icon_set_get_type noIconSet :: Maybe IconSet noIconSet = Nothing -- method IconSet::new -- method type : Constructor -- Args : [] -- Lengths : [] -- hInArgs : [] -- returnType : TInterface "Gtk" "IconSet" -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_new" gtk_icon_set_new :: IO (Ptr IconSet) {-# DEPRECATED iconSetNew ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetNew :: (MonadIO m) => m IconSet iconSetNew = liftIO $ do result <- gtk_icon_set_new checkUnexpectedReturnNULL "gtk_icon_set_new" result result' <- (wrapBoxed IconSet) result return result' -- method IconSet::new_from_pixbuf -- method type : Constructor -- Args : [Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "IconSet" -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_new_from_pixbuf" gtk_icon_set_new_from_pixbuf :: Ptr GdkPixbuf.Pixbuf -> -- pixbuf : TInterface "GdkPixbuf" "Pixbuf" IO (Ptr IconSet) {-# DEPRECATED iconSetNewFromPixbuf ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetNewFromPixbuf :: (MonadIO m, GdkPixbuf.PixbufK a) => a -> -- pixbuf m IconSet iconSetNewFromPixbuf pixbuf = liftIO $ do let pixbuf' = unsafeManagedPtrCastPtr pixbuf result <- gtk_icon_set_new_from_pixbuf pixbuf' checkUnexpectedReturnNULL "gtk_icon_set_new_from_pixbuf" result result' <- (wrapBoxed IconSet) result touchManagedPtr pixbuf return result' -- method IconSet::add_source -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source", argType = TInterface "Gtk" "IconSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "source", argType = TInterface "Gtk" "IconSource", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_add_source" gtk_icon_set_add_source :: Ptr IconSet -> -- _obj : TInterface "Gtk" "IconSet" Ptr IconSource -> -- source : TInterface "Gtk" "IconSource" IO () {-# DEPRECATED iconSetAddSource ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetAddSource :: (MonadIO m) => IconSet -> -- _obj IconSource -> -- source m () iconSetAddSource _obj source = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let source' = unsafeManagedPtrGetPtr source gtk_icon_set_add_source _obj' source' touchManagedPtr _obj touchManagedPtr source return () -- method IconSet::copy -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "IconSet" -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_copy" gtk_icon_set_copy :: Ptr IconSet -> -- _obj : TInterface "Gtk" "IconSet" IO (Ptr IconSet) {-# DEPRECATED iconSetCopy ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetCopy :: (MonadIO m) => IconSet -> -- _obj m IconSet iconSetCopy _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- gtk_icon_set_copy _obj' checkUnexpectedReturnNULL "gtk_icon_set_copy" result result' <- (wrapBoxed IconSet) result touchManagedPtr _obj return result' -- method IconSet::get_sizes -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "sizes", argType = TCArray False (-1) 2 (TBasicType TInt32), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "n_sizes", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- Lengths : [Arg {argName = "n_sizes", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_get_sizes" gtk_icon_set_get_sizes :: Ptr IconSet -> -- _obj : TInterface "Gtk" "IconSet" Ptr (Ptr Int32) -> -- sizes : TCArray False (-1) 2 (TBasicType TInt32) Ptr Int32 -> -- n_sizes : TBasicType TInt32 IO () {-# DEPRECATED iconSetGetSizes ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetGetSizes :: (MonadIO m) => IconSet -> -- _obj m ([Int32]) iconSetGetSizes _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj sizes <- allocMem :: IO (Ptr (Ptr Int32)) n_sizes <- allocMem :: IO (Ptr Int32) gtk_icon_set_get_sizes _obj' sizes n_sizes n_sizes' <- peek n_sizes sizes' <- peek sizes sizes'' <- (unpackStorableArrayWithLength n_sizes') sizes' freeMem sizes' touchManagedPtr _obj freeMem sizes freeMem n_sizes return sizes'' -- method IconSet::ref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Gtk" "IconSet" -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_ref" gtk_icon_set_ref :: Ptr IconSet -> -- _obj : TInterface "Gtk" "IconSet" IO (Ptr IconSet) {-# DEPRECATED iconSetRef ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetRef :: (MonadIO m) => IconSet -> -- _obj m IconSet iconSetRef _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj result <- gtk_icon_set_ref _obj' checkUnexpectedReturnNULL "gtk_icon_set_ref" result result' <- (wrapBoxed IconSet) result touchManagedPtr _obj return result' -- method IconSet::render_icon -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "direction", argType = TInterface "Gtk" "TextDirection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TInterface "Gtk" "StateType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "widget", argType = TInterface "Gtk" "Widget", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detail", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "style", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "direction", argType = TInterface "Gtk" "TextDirection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TInterface "Gtk" "StateType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "widget", argType = TInterface "Gtk" "Widget", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "detail", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GdkPixbuf" "Pixbuf" -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_render_icon" gtk_icon_set_render_icon :: Ptr IconSet -> -- _obj : TInterface "Gtk" "IconSet" Ptr Style -> -- style : TInterface "Gtk" "Style" CUInt -> -- direction : TInterface "Gtk" "TextDirection" CUInt -> -- state : TInterface "Gtk" "StateType" Int32 -> -- size : TBasicType TInt32 Ptr Widget -> -- widget : TInterface "Gtk" "Widget" CString -> -- detail : TBasicType TUTF8 IO (Ptr GdkPixbuf.Pixbuf) {-# DEPRECATED iconSetRenderIcon ["(Since version 3.0)","Use gtk_icon_set_render_icon_pixbuf() instead"]#-} iconSetRenderIcon :: (MonadIO m, StyleK a, WidgetK b) => IconSet -> -- _obj Maybe (a) -> -- style TextDirection -> -- direction StateType -> -- state Int32 -> -- size Maybe (b) -> -- widget Maybe (T.Text) -> -- detail m GdkPixbuf.Pixbuf iconSetRenderIcon _obj style direction state size widget detail = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj maybeStyle <- case style of Nothing -> return nullPtr Just jStyle -> do let jStyle' = unsafeManagedPtrCastPtr jStyle return jStyle' let direction' = (fromIntegral . fromEnum) direction let state' = (fromIntegral . fromEnum) state maybeWidget <- case widget of Nothing -> return nullPtr Just jWidget -> do let jWidget' = unsafeManagedPtrCastPtr jWidget return jWidget' maybeDetail <- case detail of Nothing -> return nullPtr Just jDetail -> do jDetail' <- textToCString jDetail return jDetail' result <- gtk_icon_set_render_icon _obj' maybeStyle direction' state' size maybeWidget maybeDetail checkUnexpectedReturnNULL "gtk_icon_set_render_icon" result result' <- (wrapObject GdkPixbuf.Pixbuf) result touchManagedPtr _obj whenJust style touchManagedPtr whenJust widget touchManagedPtr freeMem maybeDetail return result' -- method IconSet::render_icon_pixbuf -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "context", argType = TInterface "Gtk" "StyleContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "context", argType = TInterface "Gtk" "StyleContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "GdkPixbuf" "Pixbuf" -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_render_icon_pixbuf" gtk_icon_set_render_icon_pixbuf :: Ptr IconSet -> -- _obj : TInterface "Gtk" "IconSet" Ptr StyleContext -> -- context : TInterface "Gtk" "StyleContext" Int32 -> -- size : TBasicType TInt32 IO (Ptr GdkPixbuf.Pixbuf) {-# DEPRECATED iconSetRenderIconPixbuf ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetRenderIconPixbuf :: (MonadIO m, StyleContextK a) => IconSet -> -- _obj a -> -- context Int32 -> -- size m GdkPixbuf.Pixbuf iconSetRenderIconPixbuf _obj context size = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let context' = unsafeManagedPtrCastPtr context result <- gtk_icon_set_render_icon_pixbuf _obj' context' size checkUnexpectedReturnNULL "gtk_icon_set_render_icon_pixbuf" result result' <- (wrapObject GdkPixbuf.Pixbuf) result touchManagedPtr _obj touchManagedPtr context return result' -- method IconSet::render_icon_surface -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "context", argType = TInterface "Gtk" "StyleContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scale", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "for_window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "context", argType = TInterface "Gtk" "StyleContext", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "size", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "scale", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "for_window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "cairo" "Surface" -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_render_icon_surface" gtk_icon_set_render_icon_surface :: Ptr IconSet -> -- _obj : TInterface "Gtk" "IconSet" Ptr StyleContext -> -- context : TInterface "Gtk" "StyleContext" Int32 -> -- size : TBasicType TInt32 Int32 -> -- scale : TBasicType TInt32 Ptr Gdk.Window -> -- for_window : TInterface "Gdk" "Window" IO (Ptr Cairo.Surface) {-# DEPRECATED iconSetRenderIconSurface ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetRenderIconSurface :: (MonadIO m, StyleContextK a, Gdk.WindowK b) => IconSet -> -- _obj a -> -- context Int32 -> -- size Int32 -> -- scale Maybe (b) -> -- for_window m Cairo.Surface iconSetRenderIconSurface _obj context size scale for_window = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj let context' = unsafeManagedPtrCastPtr context maybeFor_window <- case for_window of Nothing -> return nullPtr Just jFor_window -> do let jFor_window' = unsafeManagedPtrCastPtr jFor_window return jFor_window' result <- gtk_icon_set_render_icon_surface _obj' context' size scale maybeFor_window checkUnexpectedReturnNULL "gtk_icon_set_render_icon_surface" result result' <- (wrapBoxed Cairo.Surface) result touchManagedPtr _obj touchManagedPtr context whenJust for_window touchManagedPtr return result' -- method IconSet::unref -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "gtk_icon_set_unref" gtk_icon_set_unref :: Ptr IconSet -> -- _obj : TInterface "Gtk" "IconSet" IO () {-# DEPRECATED iconSetUnref ["(Since version 3.10)","Use #GtkIconTheme instead."]#-} iconSetUnref :: (MonadIO m) => IconSet -> -- _obj m () iconSetUnref _obj = liftIO $ do let _obj' = unsafeManagedPtrGetPtr _obj gtk_icon_set_unref _obj' touchManagedPtr _obj return ()