{- |
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.Style
    ( 

-- * Exported types
    Style(..)                               ,
    StyleK                                  ,
    toStyle                                 ,
    noStyle                                 ,


 -- * Methods
-- ** styleApplyDefaultBackground
    styleApplyDefaultBackground             ,


-- ** styleCopy
    styleCopy                               ,


-- ** styleDetach
    styleDetach                             ,


-- ** styleGetStyleProperty
    styleGetStyleProperty                   ,


-- ** styleHasContext
    styleHasContext                         ,


-- ** styleLookupColor
    styleLookupColor                        ,


-- ** styleLookupIconSet
    styleLookupIconSet                      ,


-- ** styleNew
    styleNew                                ,


-- ** styleRenderIcon
    styleRenderIcon                         ,


-- ** styleSetBackground
    styleSetBackground                      ,




 -- * Properties
-- ** Context
    StyleContextPropertyInfo                ,
    constructStyleContext                   ,
    getStyleContext                         ,




 -- * Signals
-- ** Realize
    StyleRealizeCallback                    ,
    StyleRealizeCallbackC                   ,
    StyleRealizeSignalInfo                  ,
    afterStyleRealize                       ,
    mkStyleRealizeCallback                  ,
    noStyleRealizeCallback                  ,
    onStyleRealize                          ,
    styleRealizeCallbackWrapper             ,
    styleRealizeClosure                     ,


-- ** Unrealize
    StyleUnrealizeCallback                  ,
    StyleUnrealizeCallbackC                 ,
    StyleUnrealizeSignalInfo                ,
    afterStyleUnrealize                     ,
    mkStyleUnrealizeCallback                ,
    noStyleUnrealizeCallback                ,
    onStyleUnrealize                        ,
    styleUnrealizeCallbackWrapper           ,
    styleUnrealizeClosure                   ,




    ) 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.Cairo as Cairo

newtype Style = Style (ForeignPtr Style)
foreign import ccall "gtk_style_get_type"
    c_gtk_style_get_type :: IO GType

type instance ParentTypes Style = StyleParentTypes
type StyleParentTypes = '[GObject.Object]

instance GObject Style where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_style_get_type
    

class GObject o => StyleK o
instance (GObject o, IsDescendantOf Style o) => StyleK o

toStyle :: StyleK o => o -> IO Style
toStyle = unsafeCastTo Style

noStyle :: Maybe Style
noStyle = Nothing

-- signal Style::realize
type StyleRealizeCallback =
    IO ()

noStyleRealizeCallback :: Maybe StyleRealizeCallback
noStyleRealizeCallback = Nothing

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

foreign import ccall "wrapper"
    mkStyleRealizeCallback :: StyleRealizeCallbackC -> IO (FunPtr StyleRealizeCallbackC)

styleRealizeClosure :: StyleRealizeCallback -> IO Closure
styleRealizeClosure cb = newCClosure =<< mkStyleRealizeCallback wrapped
    where wrapped = styleRealizeCallbackWrapper cb

styleRealizeCallbackWrapper ::
    StyleRealizeCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
styleRealizeCallbackWrapper _cb _ _ = do
    _cb 

onStyleRealize :: (GObject a, MonadIO m) => a -> StyleRealizeCallback -> m SignalHandlerId
onStyleRealize obj cb = liftIO $ connectStyleRealize obj cb SignalConnectBefore
afterStyleRealize :: (GObject a, MonadIO m) => a -> StyleRealizeCallback -> m SignalHandlerId
afterStyleRealize obj cb = connectStyleRealize obj cb SignalConnectAfter

connectStyleRealize :: (GObject a, MonadIO m) =>
                       a -> StyleRealizeCallback -> SignalConnectMode -> m SignalHandlerId
connectStyleRealize obj cb after = liftIO $ do
    cb' <- mkStyleRealizeCallback (styleRealizeCallbackWrapper cb)
    connectSignalFunPtr obj "realize" cb' after

-- signal Style::unrealize
type StyleUnrealizeCallback =
    IO ()

noStyleUnrealizeCallback :: Maybe StyleUnrealizeCallback
noStyleUnrealizeCallback = Nothing

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

foreign import ccall "wrapper"
    mkStyleUnrealizeCallback :: StyleUnrealizeCallbackC -> IO (FunPtr StyleUnrealizeCallbackC)

styleUnrealizeClosure :: StyleUnrealizeCallback -> IO Closure
styleUnrealizeClosure cb = newCClosure =<< mkStyleUnrealizeCallback wrapped
    where wrapped = styleUnrealizeCallbackWrapper cb

styleUnrealizeCallbackWrapper ::
    StyleUnrealizeCallback ->
    Ptr () ->
    Ptr () ->
    IO ()
styleUnrealizeCallbackWrapper _cb _ _ = do
    _cb 

onStyleUnrealize :: (GObject a, MonadIO m) => a -> StyleUnrealizeCallback -> m SignalHandlerId
onStyleUnrealize obj cb = liftIO $ connectStyleUnrealize obj cb SignalConnectBefore
afterStyleUnrealize :: (GObject a, MonadIO m) => a -> StyleUnrealizeCallback -> m SignalHandlerId
afterStyleUnrealize obj cb = connectStyleUnrealize obj cb SignalConnectAfter

connectStyleUnrealize :: (GObject a, MonadIO m) =>
                         a -> StyleUnrealizeCallback -> SignalConnectMode -> m SignalHandlerId
connectStyleUnrealize obj cb after = liftIO $ do
    cb' <- mkStyleUnrealizeCallback (styleUnrealizeCallbackWrapper cb)
    connectSignalFunPtr obj "unrealize" cb' after

-- VVV Prop "context"
   -- Type: TInterface "Gtk" "StyleContext"
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getStyleContext :: (MonadIO m, StyleK o) => o -> m StyleContext
getStyleContext obj = liftIO $ getObjectPropertyObject obj "context" StyleContext

constructStyleContext :: (StyleContextK a) => a -> IO ([Char], GValue)
constructStyleContext val = constructObjectPropertyObject "context" val

data StyleContextPropertyInfo
instance AttrInfo StyleContextPropertyInfo where
    type AttrAllowedOps StyleContextPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint StyleContextPropertyInfo = StyleContextK
    type AttrBaseTypeConstraint StyleContextPropertyInfo = StyleK
    type AttrGetType StyleContextPropertyInfo = StyleContext
    type AttrLabel StyleContextPropertyInfo = "Style::context"
    attrGet _ = getStyleContext
    attrSet _ = undefined
    attrConstruct _ = constructStyleContext

type instance AttributeList Style = StyleAttributeList
type StyleAttributeList = ('[ '("context", StyleContextPropertyInfo)] :: [(Symbol, *)])

data StyleRealizeSignalInfo
instance SignalInfo StyleRealizeSignalInfo where
    type HaskellCallbackType StyleRealizeSignalInfo = StyleRealizeCallback
    connectSignal _ = connectStyleRealize

data StyleUnrealizeSignalInfo
instance SignalInfo StyleUnrealizeSignalInfo where
    type HaskellCallbackType StyleUnrealizeSignalInfo = StyleUnrealizeCallback
    connectSignal _ = connectStyleUnrealize

type instance SignalList Style = StyleSignalList
type StyleSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("realize", StyleRealizeSignalInfo), '("unrealize", StyleUnrealizeSignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

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

foreign import ccall "gtk_style_new" gtk_style_new :: 
    IO (Ptr Style)

{-# DEPRECATED styleNew ["(Since version 3.0)","Use #GtkStyleContext"]#-}
styleNew ::
    (MonadIO m) =>
    m Style
styleNew  = liftIO $ do
    result <- gtk_style_new
    checkUnexpectedReturnNULL "gtk_style_new" result
    result' <- (wrapObject Style) result
    return result'

-- method Style::apply_default_background
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state_type", argType = TInterface "Gtk" "StateType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "cr", argType = TInterface "cairo" "Context", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state_type", argType = TInterface "Gtk" "StateType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "x", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "y", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "width", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "height", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_style_apply_default_background" gtk_style_apply_default_background :: 
    Ptr Style ->                            -- _obj : TInterface "Gtk" "Style"
    Ptr Cairo.Context ->                    -- cr : TInterface "cairo" "Context"
    Ptr Gdk.Window ->                       -- window : TInterface "Gdk" "Window"
    CUInt ->                                -- state_type : TInterface "Gtk" "StateType"
    Int32 ->                                -- x : TBasicType TInt32
    Int32 ->                                -- y : TBasicType TInt32
    Int32 ->                                -- width : TBasicType TInt32
    Int32 ->                                -- height : TBasicType TInt32
    IO ()

{-# DEPRECATED styleApplyDefaultBackground ["(Since version 3.0)","Use #GtkStyleContext instead"]#-}
styleApplyDefaultBackground ::
    (MonadIO m, StyleK a, Gdk.WindowK b) =>
    a ->                                    -- _obj
    Cairo.Context ->                        -- cr
    b ->                                    -- window
    StateType ->                            -- state_type
    Int32 ->                                -- x
    Int32 ->                                -- y
    Int32 ->                                -- width
    Int32 ->                                -- height
    m ()
styleApplyDefaultBackground _obj cr window state_type x y width height = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let cr' = unsafeManagedPtrGetPtr cr
    let window' = unsafeManagedPtrCastPtr window
    let state_type' = (fromIntegral . fromEnum) state_type
    gtk_style_apply_default_background _obj' cr' window' state_type' x y width height
    touchManagedPtr _obj
    touchManagedPtr cr
    touchManagedPtr window
    return ()

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

foreign import ccall "gtk_style_copy" gtk_style_copy :: 
    Ptr Style ->                            -- _obj : TInterface "Gtk" "Style"
    IO (Ptr Style)

{-# DEPRECATED styleCopy ["(Since version 3.0)","Use #GtkStyleContext instead"]#-}
styleCopy ::
    (MonadIO m, StyleK a) =>
    a ->                                    -- _obj
    m Style
styleCopy _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- gtk_style_copy _obj'
    checkUnexpectedReturnNULL "gtk_style_copy" result
    result' <- (wrapObject Style) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "gtk_style_detach" gtk_style_detach :: 
    Ptr Style ->                            -- _obj : TInterface "Gtk" "Style"
    IO ()

{-# DEPRECATED styleDetach ["(Since version 3.0)","Use #GtkStyleContext instead"]#-}
styleDetach ::
    (MonadIO m, StyleK a) =>
    a ->                                    -- _obj
    m ()
styleDetach _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_style_detach _obj'
    touchManagedPtr _obj
    return ()

-- method Style::get_style_property
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "widget_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "widget_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property_name", 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_style_get_style_property" gtk_style_get_style_property :: 
    Ptr Style ->                            -- _obj : TInterface "Gtk" "Style"
    CGType ->                               -- widget_type : TBasicType TGType
    CString ->                              -- property_name : TBasicType TUTF8
    Ptr GValue ->                           -- value : TInterface "GObject" "Value"
    IO ()


styleGetStyleProperty ::
    (MonadIO m, StyleK a) =>
    a ->                                    -- _obj
    GType ->                                -- widget_type
    T.Text ->                               -- property_name
    m (GValue)
styleGetStyleProperty _obj widget_type property_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let widget_type' = gtypeToCGType widget_type
    property_name' <- textToCString property_name
    value <- callocBoxedBytes 24 :: IO (Ptr GValue)
    gtk_style_get_style_property _obj' widget_type' property_name' value
    value' <- (wrapBoxed GValue) value
    touchManagedPtr _obj
    freeMem property_name'
    return value'

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

foreign import ccall "gtk_style_has_context" gtk_style_has_context :: 
    Ptr Style ->                            -- _obj : TInterface "Gtk" "Style"
    IO CInt


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

-- method Style::lookup_color
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "color_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "color", argType = TInterface "Gdk" "Color", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "color_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_style_lookup_color" gtk_style_lookup_color :: 
    Ptr Style ->                            -- _obj : TInterface "Gtk" "Style"
    CString ->                              -- color_name : TBasicType TUTF8
    Ptr Gdk.Color ->                        -- color : TInterface "Gdk" "Color"
    IO CInt

{-# DEPRECATED styleLookupColor ["(Since version 3.0)","Use gtk_style_context_lookup_color() instead"]#-}
styleLookupColor ::
    (MonadIO m, StyleK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- color_name
    m (Bool,Gdk.Color)
styleLookupColor _obj color_name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    color_name' <- textToCString color_name
    color <- callocBoxedBytes 12 :: IO (Ptr Gdk.Color)
    result <- gtk_style_lookup_color _obj' color_name' color
    let result' = (/= 0) result
    color' <- (wrapBoxed Gdk.Color) color
    touchManagedPtr _obj
    freeMem color_name'
    return (result', color')

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

{-# DEPRECATED styleLookupIconSet ["(Since version 3.0)","Use gtk_style_context_lookup_icon_set() instead"]#-}
styleLookupIconSet ::
    (MonadIO m, StyleK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- stock_id
    m IconSet
styleLookupIconSet _obj stock_id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    stock_id' <- textToCString stock_id
    result <- gtk_style_lookup_icon_set _obj' stock_id'
    checkUnexpectedReturnNULL "gtk_style_lookup_icon_set" result
    result' <- (newBoxed IconSet) result
    touchManagedPtr _obj
    freeMem stock_id'
    return result'

-- method Style::render_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", 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},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" "Style", 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},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_style_render_icon" gtk_style_render_icon :: 
    Ptr Style ->                            -- _obj : TInterface "Gtk" "Style"
    Ptr IconSource ->                       -- source : TInterface "Gtk" "IconSource"
    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 styleRenderIcon ["(Since version 3.0)","Use gtk_render_icon_pixbuf() instead"]#-}
styleRenderIcon ::
    (MonadIO m, StyleK a, WidgetK b) =>
    a ->                                    -- _obj
    IconSource ->                           -- source
    TextDirection ->                        -- direction
    StateType ->                            -- state
    Int32 ->                                -- size
    Maybe (b) ->                            -- widget
    Maybe (T.Text) ->                       -- detail
    m GdkPixbuf.Pixbuf
styleRenderIcon _obj source direction state size widget detail = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let source' = unsafeManagedPtrGetPtr source
    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_style_render_icon _obj' source' direction' state' size maybeWidget maybeDetail
    checkUnexpectedReturnNULL "gtk_style_render_icon" result
    result' <- (wrapObject GdkPixbuf.Pixbuf) result
    touchManagedPtr _obj
    touchManagedPtr source
    whenJust widget touchManagedPtr
    freeMem maybeDetail
    return result'

-- method Style::set_background
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state_type", argType = TInterface "Gtk" "StateType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "Style", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "window", argType = TInterface "Gdk" "Window", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state_type", argType = TInterface "Gtk" "StateType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "gtk_style_set_background" gtk_style_set_background :: 
    Ptr Style ->                            -- _obj : TInterface "Gtk" "Style"
    Ptr Gdk.Window ->                       -- window : TInterface "Gdk" "Window"
    CUInt ->                                -- state_type : TInterface "Gtk" "StateType"
    IO ()

{-# DEPRECATED styleSetBackground ["(Since version 3.0)","Use gtk_style_context_set_background() instead"]#-}
styleSetBackground ::
    (MonadIO m, StyleK a, Gdk.WindowK b) =>
    a ->                                    -- _obj
    b ->                                    -- window
    StateType ->                            -- state_type
    m ()
styleSetBackground _obj window state_type = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let window' = unsafeManagedPtrCastPtr window
    let state_type' = (fromIntegral . fromEnum) state_type
    gtk_style_set_background _obj' window' state_type'
    touchManagedPtr _obj
    touchManagedPtr window
    return ()