{- |
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.Objects.IconTheme
    ( 

-- * Exported types
    IconTheme(..)                           ,
    IconThemeK                              ,
    toIconTheme                             ,
    noIconTheme                             ,


 -- * Methods
-- ** iconThemeAddBuiltinIcon
    iconThemeAddBuiltinIcon                 ,


-- ** iconThemeAddResourcePath
    iconThemeAddResourcePath                ,


-- ** iconThemeAppendSearchPath
    iconThemeAppendSearchPath               ,


-- ** iconThemeChooseIcon
    iconThemeChooseIcon                     ,


-- ** iconThemeChooseIconForScale
    iconThemeChooseIconForScale             ,


-- ** iconThemeGetDefault
    iconThemeGetDefault                     ,


-- ** iconThemeGetExampleIconName
    iconThemeGetExampleIconName             ,


-- ** iconThemeGetForScreen
    iconThemeGetForScreen                   ,


-- ** iconThemeGetIconSizes
    iconThemeGetIconSizes                   ,


-- ** iconThemeGetSearchPath
    iconThemeGetSearchPath                  ,


-- ** iconThemeHasIcon
    iconThemeHasIcon                        ,


-- ** iconThemeListContexts
    iconThemeListContexts                   ,


-- ** iconThemeListIcons
    iconThemeListIcons                      ,


-- ** iconThemeLoadIcon
    iconThemeLoadIcon                       ,


-- ** iconThemeLoadIconForScale
    iconThemeLoadIconForScale               ,


-- ** iconThemeLoadSurface
    iconThemeLoadSurface                    ,


-- ** iconThemeLookupByGicon
    iconThemeLookupByGicon                  ,


-- ** iconThemeLookupByGiconForScale
    iconThemeLookupByGiconForScale          ,


-- ** iconThemeLookupIcon
    iconThemeLookupIcon                     ,


-- ** iconThemeLookupIconForScale
    iconThemeLookupIconForScale             ,


-- ** iconThemeNew
    iconThemeNew                            ,


-- ** iconThemePrependSearchPath
    iconThemePrependSearchPath              ,


-- ** iconThemeRescanIfNeeded
    iconThemeRescanIfNeeded                 ,


-- ** iconThemeSetCustomTheme
    iconThemeSetCustomTheme                 ,


-- ** iconThemeSetScreen
    iconThemeSetScreen                      ,


-- ** iconThemeSetSearchPath
    iconThemeSetSearchPath                  ,




 -- * Signals
-- ** Changed
    IconThemeChangedCallback                ,
    IconThemeChangedCallbackC               ,
    IconThemeChangedSignalInfo              ,
    afterIconThemeChanged                   ,
    iconThemeChangedCallbackWrapper         ,
    iconThemeChangedClosure                 ,
    mkIconThemeChangedCallback              ,
    noIconThemeChangedCallback              ,
    onIconThemeChanged                      ,




    ) 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.GObject as GObject
import qualified GI.Gdk as Gdk
import qualified GI.GdkPixbuf as GdkPixbuf
import qualified GI.Gio as Gio
import qualified GI.Cairo as Cairo

newtype IconTheme = IconTheme (ForeignPtr IconTheme)
foreign import ccall "gtk_icon_theme_get_type"
    c_gtk_icon_theme_get_type :: IO GType

type instance ParentTypes IconTheme = IconThemeParentTypes
type IconThemeParentTypes = '[GObject.Object]

instance GObject IconTheme where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_icon_theme_get_type
    

class GObject o => IconThemeK o
instance (GObject o, IsDescendantOf IconTheme o) => IconThemeK o

toIconTheme :: IconThemeK o => o -> IO IconTheme
toIconTheme = unsafeCastTo IconTheme

noIconTheme :: Maybe IconTheme
noIconTheme = Nothing

-- signal IconTheme::changed
type IconThemeChangedCallback =
    IO ()

noIconThemeChangedCallback :: Maybe IconThemeChangedCallback
noIconThemeChangedCallback = Nothing

type IconThemeChangedCallbackC =
    Ptr () ->                               -- object
    Ptr () ->                               -- user_data
    IO ()

foreign import ccall "wrapper"
    mkIconThemeChangedCallback :: IconThemeChangedCallbackC -> IO (FunPtr IconThemeChangedCallbackC)

iconThemeChangedClosure :: IconThemeChangedCallback -> IO Closure
iconThemeChangedClosure cb = newCClosure =<< mkIconThemeChangedCallback wrapped
    where wrapped = iconThemeChangedCallbackWrapper cb

iconThemeChangedCallbackWrapper ::
    IconThemeChangedCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
iconThemeChangedCallbackWrapper _cb _ _ = do
    _cb 

onIconThemeChanged :: (GObject a, MonadIO m) => a -> IconThemeChangedCallback -> m SignalHandlerId
onIconThemeChanged obj cb = liftIO $ connectIconThemeChanged obj cb SignalConnectBefore
afterIconThemeChanged :: (GObject a, MonadIO m) => a -> IconThemeChangedCallback -> m SignalHandlerId
afterIconThemeChanged obj cb = connectIconThemeChanged obj cb SignalConnectAfter

connectIconThemeChanged :: (GObject a, MonadIO m) =>
                           a -> IconThemeChangedCallback -> SignalConnectMode -> m SignalHandlerId
connectIconThemeChanged obj cb after = liftIO $ do
    cb' <- mkIconThemeChangedCallback (iconThemeChangedCallbackWrapper cb)
    connectSignalFunPtr obj "changed" cb' after

type instance AttributeList IconTheme = IconThemeAttributeList
type IconThemeAttributeList = ('[ ] :: [(Symbol, *)])

data IconThemeChangedSignalInfo
instance SignalInfo IconThemeChangedSignalInfo where
    type HaskellCallbackType IconThemeChangedSignalInfo = IconThemeChangedCallback
    connectSignal _ = connectIconThemeChanged

type instance SignalList IconTheme = IconThemeSignalList
type IconThemeSignalList = ('[ '("changed", IconThemeChangedSignalInfo), '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method IconTheme::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gtk" "IconTheme"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_new" gtk_icon_theme_new :: 
    IO (Ptr IconTheme)


iconThemeNew ::
    (MonadIO m) =>
    m IconTheme
iconThemeNew  = liftIO $ do
    result <- gtk_icon_theme_new
    checkUnexpectedReturnNULL "gtk_icon_theme_new" result
    result' <- (wrapObject IconTheme) result
    return result'

-- method IconTheme::add_resource_path
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TUTF8, 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_theme_add_resource_path" gtk_icon_theme_add_resource_path :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- path : TBasicType TUTF8
    IO ()


iconThemeAddResourcePath ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- path
    m ()
iconThemeAddResourcePath _obj path = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    path' <- textToCString path
    gtk_icon_theme_add_resource_path _obj' path'
    touchManagedPtr _obj
    freeMem path'
    return ()

-- method IconTheme::append_search_path
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TFileName, 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_theme_append_search_path" gtk_icon_theme_append_search_path :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- path : TBasicType TFileName
    IO ()


iconThemeAppendSearchPath ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    [Char] ->                               -- path
    m ()
iconThemeAppendSearchPath _obj path = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    path' <- stringToCString path
    gtk_icon_theme_append_search_path _obj' path'
    touchManagedPtr _obj
    freeMem path'
    return ()

-- method IconTheme::choose_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_names", argType = TCArray True (-1) (-1) (TBasicType TUTF8), 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_names", argType = TCArray True (-1) (-1) (TBasicType TUTF8), 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "IconInfo"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_choose_icon" gtk_icon_theme_choose_icon :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    Ptr CString ->                          -- icon_names : TCArray True (-1) (-1) (TBasicType TUTF8)
    Int32 ->                                -- size : TBasicType TInt32
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    IO (Ptr IconInfo)


iconThemeChooseIcon ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    [T.Text] ->                             -- icon_names
    Int32 ->                                -- size
    [IconLookupFlags] ->                    -- flags
    m IconInfo
iconThemeChooseIcon _obj icon_names size flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_names' <- packZeroTerminatedUTF8CArray icon_names
    let flags' = gflagsToWord flags
    result <- gtk_icon_theme_choose_icon _obj' icon_names' size flags'
    checkUnexpectedReturnNULL "gtk_icon_theme_choose_icon" result
    result' <- (wrapObject IconInfo) result
    touchManagedPtr _obj
    mapZeroTerminatedCArray freeMem icon_names'
    freeMem icon_names'
    return result'

-- method IconTheme::choose_icon_for_scale
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_names", argType = TCArray True (-1) (-1) (TBasicType TUTF8), 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_names", argType = TCArray True (-1) (-1) (TBasicType TUTF8), 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "IconInfo"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_choose_icon_for_scale" gtk_icon_theme_choose_icon_for_scale :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    Ptr CString ->                          -- icon_names : TCArray True (-1) (-1) (TBasicType TUTF8)
    Int32 ->                                -- size : TBasicType TInt32
    Int32 ->                                -- scale : TBasicType TInt32
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    IO (Ptr IconInfo)


iconThemeChooseIconForScale ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    [T.Text] ->                             -- icon_names
    Int32 ->                                -- size
    Int32 ->                                -- scale
    [IconLookupFlags] ->                    -- flags
    m IconInfo
iconThemeChooseIconForScale _obj icon_names size scale flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_names' <- packZeroTerminatedUTF8CArray icon_names
    let flags' = gflagsToWord flags
    result <- gtk_icon_theme_choose_icon_for_scale _obj' icon_names' size scale flags'
    checkUnexpectedReturnNULL "gtk_icon_theme_choose_icon_for_scale" result
    result' <- (wrapObject IconInfo) result
    touchManagedPtr _obj
    mapZeroTerminatedCArray freeMem icon_names'
    freeMem icon_names'
    return result'

-- method IconTheme::get_example_icon_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_get_example_icon_name" gtk_icon_theme_get_example_icon_name :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    IO CString


iconThemeGetExampleIconName ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    m T.Text
iconThemeGetExampleIconName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_icon_theme_get_example_icon_name _obj'
    checkUnexpectedReturnNULL "gtk_icon_theme_get_example_icon_name" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

-- method IconTheme::get_icon_sizes
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TCArray True (-1) (-1) (TBasicType TInt32)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_get_icon_sizes" gtk_icon_theme_get_icon_sizes :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- icon_name : TBasicType TUTF8
    IO (Ptr Int32)


iconThemeGetIconSizes ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- icon_name
    m [Int32]
iconThemeGetIconSizes _obj icon_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_name' <- textToCString icon_name
    result <- gtk_icon_theme_get_icon_sizes _obj' icon_name'
    checkUnexpectedReturnNULL "gtk_icon_theme_get_icon_sizes" result
    result' <- unpackZeroTerminatedStorableArray result
    freeMem result
    touchManagedPtr _obj
    freeMem icon_name'
    return result'

-- method IconTheme::get_search_path
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TCArray False (-1) 2 (TBasicType TFileName), direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything},Arg {argName = "n_elements", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- Lengths : [Arg {argName = "n_elements", argType = TBasicType TInt32, direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferEverything}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", 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_theme_get_search_path" gtk_icon_theme_get_search_path :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    Ptr (Ptr CString) ->                    -- path : TCArray False (-1) 2 (TBasicType TFileName)
    Ptr Int32 ->                            -- n_elements : TBasicType TInt32
    IO ()


iconThemeGetSearchPath ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    m ([[Char]])
iconThemeGetSearchPath _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    path <- allocMem :: IO (Ptr (Ptr CString))
    n_elements <- allocMem :: IO (Ptr Int32)
    gtk_icon_theme_get_search_path _obj' path n_elements
    n_elements' <- peek n_elements
    path' <- peek path
    path'' <- (unpackFileNameArrayWithLength n_elements') path'
    (mapCArrayWithLength n_elements') freeMem path'
    freeMem path'
    touchManagedPtr _obj
    freeMem path
    freeMem n_elements
    return path''

-- method IconTheme::has_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_has_icon" gtk_icon_theme_has_icon :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- icon_name : TBasicType TUTF8
    IO CInt


iconThemeHasIcon ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- icon_name
    m Bool
iconThemeHasIcon _obj icon_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_name' <- textToCString icon_name
    result <- gtk_icon_theme_has_icon _obj' icon_name'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem icon_name'
    return result'

-- method IconTheme::list_contexts
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_list_contexts" gtk_icon_theme_list_contexts :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    IO (Ptr (GList CString))


iconThemeListContexts ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    m [T.Text]
iconThemeListContexts _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_icon_theme_list_contexts _obj'
    checkUnexpectedReturnNULL "gtk_icon_theme_list_contexts" result
    result' <- unpackGList result
    result'' <- mapM cstringToText result'
    mapGList freeMem result
    g_list_free result
    touchManagedPtr _obj
    return result''

-- method IconTheme::list_icons
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "context", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "context", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TGList (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_list_icons" gtk_icon_theme_list_icons :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- context : TBasicType TUTF8
    IO (Ptr (GList CString))


iconThemeListIcons ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- context
    m [T.Text]
iconThemeListIcons _obj context = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeContext <- case context of
        Nothing -> return nullPtr
        Just jContext -> do
            jContext' <- textToCString jContext
            return jContext'
    result <- gtk_icon_theme_list_icons _obj' maybeContext
    checkUnexpectedReturnNULL "gtk_icon_theme_list_icons" result
    result' <- unpackGList result
    result'' <- mapM cstringToText result'
    mapGList freeMem result
    g_list_free result
    touchManagedPtr _obj
    freeMem maybeContext
    return result''

-- method IconTheme::load_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GdkPixbuf" "Pixbuf"
-- throws : True
-- Skip return : False

foreign import ccall "gtk_icon_theme_load_icon" gtk_icon_theme_load_icon :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- icon_name : TBasicType TUTF8
    Int32 ->                                -- size : TBasicType TInt32
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GdkPixbuf.Pixbuf)


iconThemeLoadIcon ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- icon_name
    Int32 ->                                -- size
    [IconLookupFlags] ->                    -- flags
    m GdkPixbuf.Pixbuf
iconThemeLoadIcon _obj icon_name size flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_name' <- textToCString icon_name
    let flags' = gflagsToWord flags
    onException (do
        result <- propagateGError $ gtk_icon_theme_load_icon _obj' icon_name' size flags'
        checkUnexpectedReturnNULL "gtk_icon_theme_load_icon" result
        result' <- (wrapObject GdkPixbuf.Pixbuf) result
        touchManagedPtr _obj
        freeMem icon_name'
        return result'
     ) (do
        freeMem icon_name'
     )

-- method IconTheme::load_icon_for_scale
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "GdkPixbuf" "Pixbuf"
-- throws : True
-- Skip return : False

foreign import ccall "gtk_icon_theme_load_icon_for_scale" gtk_icon_theme_load_icon_for_scale :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- icon_name : TBasicType TUTF8
    Int32 ->                                -- size : TBasicType TInt32
    Int32 ->                                -- scale : TBasicType TInt32
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr GdkPixbuf.Pixbuf)


iconThemeLoadIconForScale ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- icon_name
    Int32 ->                                -- size
    Int32 ->                                -- scale
    [IconLookupFlags] ->                    -- flags
    m GdkPixbuf.Pixbuf
iconThemeLoadIconForScale _obj icon_name size scale flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_name' <- textToCString icon_name
    let flags' = gflagsToWord flags
    onException (do
        result <- propagateGError $ gtk_icon_theme_load_icon_for_scale _obj' icon_name' size scale flags'
        checkUnexpectedReturnNULL "gtk_icon_theme_load_icon_for_scale" result
        result' <- (wrapObject GdkPixbuf.Pixbuf) result
        touchManagedPtr _obj
        freeMem icon_name'
        return result'
     ) (do
        freeMem icon_name'
     )

-- method IconTheme::load_surface
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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},Arg {argName = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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},Arg {argName = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "cairo" "Surface"
-- throws : True
-- Skip return : False

foreign import ccall "gtk_icon_theme_load_surface" gtk_icon_theme_load_surface :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- icon_name : TBasicType TUTF8
    Int32 ->                                -- size : TBasicType TInt32
    Int32 ->                                -- scale : TBasicType TInt32
    Ptr Gdk.Window ->                       -- for_window : TInterface "Gdk" "Window"
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    Ptr (Ptr GError) ->                     -- error
    IO (Ptr Cairo.Surface)


iconThemeLoadSurface ::
    (MonadIO m, IconThemeK a, Gdk.WindowK b) =>
    a ->                                    -- _obj
    T.Text ->                               -- icon_name
    Int32 ->                                -- size
    Int32 ->                                -- scale
    Maybe (b) ->                            -- for_window
    [IconLookupFlags] ->                    -- flags
    m Cairo.Surface
iconThemeLoadSurface _obj icon_name size scale for_window flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_name' <- textToCString icon_name
    maybeFor_window <- case for_window of
        Nothing -> return nullPtr
        Just jFor_window -> do
            let jFor_window' = unsafeManagedPtrCastPtr jFor_window
            return jFor_window'
    let flags' = gflagsToWord flags
    onException (do
        result <- propagateGError $ gtk_icon_theme_load_surface _obj' icon_name' size scale maybeFor_window flags'
        checkUnexpectedReturnNULL "gtk_icon_theme_load_surface" result
        result' <- (wrapBoxed Cairo.Surface) result
        touchManagedPtr _obj
        whenJust for_window touchManagedPtr
        freeMem icon_name'
        return result'
     ) (do
        freeMem icon_name'
     )

-- method IconTheme::lookup_by_gicon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TInterface "Gio" "Icon", 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TInterface "Gio" "Icon", 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "IconInfo"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_lookup_by_gicon" gtk_icon_theme_lookup_by_gicon :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    Ptr Gio.Icon ->                         -- icon : TInterface "Gio" "Icon"
    Int32 ->                                -- size : TBasicType TInt32
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    IO (Ptr IconInfo)


iconThemeLookupByGicon ::
    (MonadIO m, IconThemeK a, Gio.IconK b) =>
    a ->                                    -- _obj
    b ->                                    -- icon
    Int32 ->                                -- size
    [IconLookupFlags] ->                    -- flags
    m IconInfo
iconThemeLookupByGicon _obj icon size flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let icon' = unsafeManagedPtrCastPtr icon
    let flags' = gflagsToWord flags
    result <- gtk_icon_theme_lookup_by_gicon _obj' icon' size flags'
    checkUnexpectedReturnNULL "gtk_icon_theme_lookup_by_gicon" result
    result' <- (wrapObject IconInfo) result
    touchManagedPtr _obj
    touchManagedPtr icon
    return result'

-- method IconTheme::lookup_by_gicon_for_scale
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TInterface "Gio" "Icon", 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TInterface "Gio" "Icon", 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "IconInfo"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_lookup_by_gicon_for_scale" gtk_icon_theme_lookup_by_gicon_for_scale :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    Ptr Gio.Icon ->                         -- icon : TInterface "Gio" "Icon"
    Int32 ->                                -- size : TBasicType TInt32
    Int32 ->                                -- scale : TBasicType TInt32
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    IO (Ptr IconInfo)


iconThemeLookupByGiconForScale ::
    (MonadIO m, IconThemeK a, Gio.IconK b) =>
    a ->                                    -- _obj
    b ->                                    -- icon
    Int32 ->                                -- size
    Int32 ->                                -- scale
    [IconLookupFlags] ->                    -- flags
    m IconInfo
iconThemeLookupByGiconForScale _obj icon size scale flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let icon' = unsafeManagedPtrCastPtr icon
    let flags' = gflagsToWord flags
    result <- gtk_icon_theme_lookup_by_gicon_for_scale _obj' icon' size scale flags'
    checkUnexpectedReturnNULL "gtk_icon_theme_lookup_by_gicon_for_scale" result
    result' <- (wrapObject IconInfo) result
    touchManagedPtr _obj
    touchManagedPtr icon
    return result'

-- method IconTheme::lookup_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "IconInfo"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_lookup_icon" gtk_icon_theme_lookup_icon :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- icon_name : TBasicType TUTF8
    Int32 ->                                -- size : TBasicType TInt32
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    IO (Ptr IconInfo)


iconThemeLookupIcon ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- icon_name
    Int32 ->                                -- size
    [IconLookupFlags] ->                    -- flags
    m IconInfo
iconThemeLookupIcon _obj icon_name size flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_name' <- textToCString icon_name
    let flags' = gflagsToWord flags
    result <- gtk_icon_theme_lookup_icon _obj' icon_name' size flags'
    checkUnexpectedReturnNULL "gtk_icon_theme_lookup_icon" result
    result' <- (wrapObject IconInfo) result
    touchManagedPtr _obj
    freeMem icon_name'
    return result'

-- method IconTheme::lookup_icon_for_scale
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "flags", argType = TInterface "Gtk" "IconLookupFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "IconInfo"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_lookup_icon_for_scale" gtk_icon_theme_lookup_icon_for_scale :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- icon_name : TBasicType TUTF8
    Int32 ->                                -- size : TBasicType TInt32
    Int32 ->                                -- scale : TBasicType TInt32
    CUInt ->                                -- flags : TInterface "Gtk" "IconLookupFlags"
    IO (Ptr IconInfo)


iconThemeLookupIconForScale ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- icon_name
    Int32 ->                                -- size
    Int32 ->                                -- scale
    [IconLookupFlags] ->                    -- flags
    m IconInfo
iconThemeLookupIconForScale _obj icon_name size scale flags = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    icon_name' <- textToCString icon_name
    let flags' = gflagsToWord flags
    result <- gtk_icon_theme_lookup_icon_for_scale _obj' icon_name' size scale flags'
    checkUnexpectedReturnNULL "gtk_icon_theme_lookup_icon_for_scale" result
    result' <- (wrapObject IconInfo) result
    touchManagedPtr _obj
    freeMem icon_name'
    return result'

-- method IconTheme::prepend_search_path
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TFileName, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TBasicType TFileName, 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_theme_prepend_search_path" gtk_icon_theme_prepend_search_path :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- path : TBasicType TFileName
    IO ()


iconThemePrependSearchPath ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    [Char] ->                               -- path
    m ()
iconThemePrependSearchPath _obj path = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    path' <- stringToCString path
    gtk_icon_theme_prepend_search_path _obj' path'
    touchManagedPtr _obj
    freeMem path'
    return ()

-- method IconTheme::rescan_if_needed
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_rescan_if_needed" gtk_icon_theme_rescan_if_needed :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    IO CInt


iconThemeRescanIfNeeded ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    m Bool
iconThemeRescanIfNeeded _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_icon_theme_rescan_if_needed _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method IconTheme::set_custom_theme
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "theme_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "theme_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_set_custom_theme" gtk_icon_theme_set_custom_theme :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    CString ->                              -- theme_name : TBasicType TUTF8
    IO ()


iconThemeSetCustomTheme ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    Maybe (T.Text) ->                       -- theme_name
    m ()
iconThemeSetCustomTheme _obj theme_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    maybeTheme_name <- case theme_name of
        Nothing -> return nullPtr
        Just jTheme_name -> do
            jTheme_name' <- textToCString jTheme_name
            return jTheme_name'
    gtk_icon_theme_set_custom_theme _obj' maybeTheme_name
    touchManagedPtr _obj
    freeMem maybeTheme_name
    return ()

-- method IconTheme::set_screen
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "screen", argType = TInterface "Gdk" "Screen", 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_theme_set_screen" gtk_icon_theme_set_screen :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    Ptr Gdk.Screen ->                       -- screen : TInterface "Gdk" "Screen"
    IO ()


iconThemeSetScreen ::
    (MonadIO m, IconThemeK a, Gdk.ScreenK b) =>
    a ->                                    -- _obj
    b ->                                    -- screen
    m ()
iconThemeSetScreen _obj screen = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let screen' = unsafeManagedPtrCastPtr screen
    gtk_icon_theme_set_screen _obj' screen'
    touchManagedPtr _obj
    touchManagedPtr screen
    return ()

-- method IconTheme::set_search_path
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TCArray False (-1) 2 (TBasicType TFileName), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_elements", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_elements", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "IconTheme", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "path", argType = TCArray False (-1) 2 (TBasicType TFileName), 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_theme_set_search_path" gtk_icon_theme_set_search_path :: 
    Ptr IconTheme ->                        -- _obj : TInterface "Gtk" "IconTheme"
    Ptr CString ->                          -- path : TCArray False (-1) 2 (TBasicType TFileName)
    Int32 ->                                -- n_elements : TBasicType TInt32
    IO ()


iconThemeSetSearchPath ::
    (MonadIO m, IconThemeK a) =>
    a ->                                    -- _obj
    [[Char]] ->                             -- path
    m ()
iconThemeSetSearchPath _obj path = liftIO $ do
    let n_elements = fromIntegral $ length path
    let _obj' = unsafeManagedPtrCastPtr _obj
    path' <- packFileNameArray path
    gtk_icon_theme_set_search_path _obj' path' n_elements
    touchManagedPtr _obj
    (mapCArrayWithLength n_elements) freeMem path'
    freeMem path'
    return ()

-- method IconTheme::add_builtin_icon
-- method type : MemberFunction
-- Args : [Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "icon_name", argType = TBasicType TUTF8, 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 = "pixbuf", argType = TInterface "GdkPixbuf" "Pixbuf", 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_theme_add_builtin_icon" gtk_icon_theme_add_builtin_icon :: 
    CString ->                              -- icon_name : TBasicType TUTF8
    Int32 ->                                -- size : TBasicType TInt32
    Ptr GdkPixbuf.Pixbuf ->                 -- pixbuf : TInterface "GdkPixbuf" "Pixbuf"
    IO ()

{-# DEPRECATED iconThemeAddBuiltinIcon ["(Since version 3.14)","Use gtk_icon_theme_add_resource_path()","    to add application-specific icons to the icon theme."]#-}
iconThemeAddBuiltinIcon ::
    (MonadIO m, GdkPixbuf.PixbufK a) =>
    T.Text ->                               -- icon_name
    Int32 ->                                -- size
    a ->                                    -- pixbuf
    m ()
iconThemeAddBuiltinIcon icon_name size pixbuf = liftIO $ do
    icon_name' <- textToCString icon_name
    let pixbuf' = unsafeManagedPtrCastPtr pixbuf
    gtk_icon_theme_add_builtin_icon icon_name' size pixbuf'
    touchManagedPtr pixbuf
    freeMem icon_name'
    return ()

-- method IconTheme::get_default
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Gtk" "IconTheme"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_get_default" gtk_icon_theme_get_default :: 
    IO (Ptr IconTheme)


iconThemeGetDefault ::
    (MonadIO m) =>
    m IconTheme
iconThemeGetDefault  = liftIO $ do
    result <- gtk_icon_theme_get_default
    checkUnexpectedReturnNULL "gtk_icon_theme_get_default" result
    result' <- (newObject IconTheme) result
    return result'

-- method IconTheme::get_for_screen
-- method type : MemberFunction
-- Args : [Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "screen", argType = TInterface "Gdk" "Screen", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gtk" "IconTheme"
-- throws : False
-- Skip return : False

foreign import ccall "gtk_icon_theme_get_for_screen" gtk_icon_theme_get_for_screen :: 
    Ptr Gdk.Screen ->                       -- screen : TInterface "Gdk" "Screen"
    IO (Ptr IconTheme)


iconThemeGetForScreen ::
    (MonadIO m, Gdk.ScreenK a) =>
    a ->                                    -- screen
    m IconTheme
iconThemeGetForScreen screen = liftIO $ do
    let screen' = unsafeManagedPtrCastPtr screen
    result <- gtk_icon_theme_get_for_screen screen'
    checkUnexpectedReturnNULL "gtk_icon_theme_get_for_screen" result
    result' <- (newObject IconTheme) result
    touchManagedPtr screen
    return result'