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

-- * Exported types
    StyleProperties(..)                     ,
    StylePropertiesK                        ,
    toStyleProperties                       ,
    noStyleProperties                       ,


 -- * Methods
-- ** stylePropertiesClear
    stylePropertiesClear                    ,


-- ** stylePropertiesGetProperty
    stylePropertiesGetProperty              ,


-- ** stylePropertiesLookupColor
    stylePropertiesLookupColor              ,


-- ** stylePropertiesMapColor
    stylePropertiesMapColor                 ,


-- ** stylePropertiesMerge
    stylePropertiesMerge                    ,


-- ** stylePropertiesNew
    stylePropertiesNew                      ,


-- ** stylePropertiesSetProperty
    stylePropertiesSetProperty              ,


-- ** stylePropertiesUnsetProperty
    stylePropertiesUnsetProperty            ,




    ) 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

newtype StyleProperties = StyleProperties (ForeignPtr StyleProperties)
foreign import ccall "gtk_style_properties_get_type"
    c_gtk_style_properties_get_type :: IO GType

type instance ParentTypes StyleProperties = StylePropertiesParentTypes
type StylePropertiesParentTypes = '[GObject.Object, StyleProvider]

instance GObject StyleProperties where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_gtk_style_properties_get_type
    

class GObject o => StylePropertiesK o
instance (GObject o, IsDescendantOf StyleProperties o) => StylePropertiesK o

toStyleProperties :: StylePropertiesK o => o -> IO StyleProperties
toStyleProperties = unsafeCastTo StyleProperties

noStyleProperties :: Maybe StyleProperties
noStyleProperties = Nothing

type instance AttributeList StyleProperties = StylePropertiesAttributeList
type StylePropertiesAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList StyleProperties = StylePropertiesSignalList
type StylePropertiesSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

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

foreign import ccall "gtk_style_properties_new" gtk_style_properties_new :: 
    IO (Ptr StyleProperties)

{-# DEPRECATED stylePropertiesNew ["(Since version 3.16)","#GtkStyleProperties are deprecated."]#-}
stylePropertiesNew ::
    (MonadIO m) =>
    m StyleProperties
stylePropertiesNew  = liftIO $ do
    result <- gtk_style_properties_new
    checkUnexpectedReturnNULL "gtk_style_properties_new" result
    result' <- (wrapObject StyleProperties) result
    return result'

-- method StyleProperties::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", 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_properties_clear" gtk_style_properties_clear :: 
    Ptr StyleProperties ->                  -- _obj : TInterface "Gtk" "StyleProperties"
    IO ()

{-# DEPRECATED stylePropertiesClear ["(Since version 3.16)","#GtkStyleProperties are deprecated."]#-}
stylePropertiesClear ::
    (MonadIO m, StylePropertiesK a) =>
    a ->                                    -- _obj
    m ()
stylePropertiesClear _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    gtk_style_properties_clear _obj'
    touchManagedPtr _obj
    return ()

-- method StyleProperties::get_property
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TInterface "Gtk" "StateFlags", 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 = TransferEverything}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TInterface "Gtk" "StateFlags", 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_properties_get_property" gtk_style_properties_get_property :: 
    Ptr StyleProperties ->                  -- _obj : TInterface "Gtk" "StyleProperties"
    CString ->                              -- property : TBasicType TUTF8
    CUInt ->                                -- state : TInterface "Gtk" "StateFlags"
    Ptr GValue ->                           -- value : TInterface "GObject" "Value"
    IO CInt

{-# DEPRECATED stylePropertiesGetProperty ["(Since version 3.16)","#GtkStyleProperties are deprecated."]#-}
stylePropertiesGetProperty ::
    (MonadIO m, StylePropertiesK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- property
    [StateFlags] ->                         -- state
    m (Bool,GValue)
stylePropertiesGetProperty _obj property state = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    property' <- textToCString property
    let state' = gflagsToWord state
    value <- callocBoxedBytes 24 :: IO (Ptr GValue)
    result <- gtk_style_properties_get_property _obj' property' state' value
    let result' = (/= 0) result
    value' <- (wrapBoxed GValue) value
    touchManagedPtr _obj
    freeMem property'
    return (result', value')

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

foreign import ccall "gtk_style_properties_lookup_color" gtk_style_properties_lookup_color :: 
    Ptr StyleProperties ->                  -- _obj : TInterface "Gtk" "StyleProperties"
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr SymbolicColor)

{-# DEPRECATED stylePropertiesLookupColor ["(Since version 3.8)","#GtkSymbolicColor is deprecated."]#-}
stylePropertiesLookupColor ::
    (MonadIO m, StylePropertiesK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- name
    m SymbolicColor
stylePropertiesLookupColor _obj name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    name' <- textToCString name
    result <- gtk_style_properties_lookup_color _obj' name'
    checkUnexpectedReturnNULL "gtk_style_properties_lookup_color" result
    result' <- (newBoxed SymbolicColor) result
    touchManagedPtr _obj
    freeMem name'
    return result'

-- method StyleProperties::map_color
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "color", argType = TInterface "Gtk" "SymbolicColor", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "color", argType = TInterface "Gtk" "SymbolicColor", 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_properties_map_color" gtk_style_properties_map_color :: 
    Ptr StyleProperties ->                  -- _obj : TInterface "Gtk" "StyleProperties"
    CString ->                              -- name : TBasicType TUTF8
    Ptr SymbolicColor ->                    -- color : TInterface "Gtk" "SymbolicColor"
    IO ()

{-# DEPRECATED stylePropertiesMapColor ["(Since version 3.8)","#GtkSymbolicColor is deprecated."]#-}
stylePropertiesMapColor ::
    (MonadIO m, StylePropertiesK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- name
    SymbolicColor ->                        -- color
    m ()
stylePropertiesMapColor _obj name color = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    name' <- textToCString name
    let color' = unsafeManagedPtrGetPtr color
    gtk_style_properties_map_color _obj' name' color'
    touchManagedPtr _obj
    touchManagedPtr color
    freeMem name'
    return ()

-- method StyleProperties::merge
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "props_to_merge", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "replace", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "props_to_merge", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "replace", argType = TBasicType TBoolean, 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_properties_merge" gtk_style_properties_merge :: 
    Ptr StyleProperties ->                  -- _obj : TInterface "Gtk" "StyleProperties"
    Ptr StyleProperties ->                  -- props_to_merge : TInterface "Gtk" "StyleProperties"
    CInt ->                                 -- replace : TBasicType TBoolean
    IO ()

{-# DEPRECATED stylePropertiesMerge ["(Since version 3.16)","#GtkStyleProperties are deprecated."]#-}
stylePropertiesMerge ::
    (MonadIO m, StylePropertiesK a, StylePropertiesK b) =>
    a ->                                    -- _obj
    b ->                                    -- props_to_merge
    Bool ->                                 -- replace
    m ()
stylePropertiesMerge _obj props_to_merge replace = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let props_to_merge' = unsafeManagedPtrCastPtr props_to_merge
    let replace' = (fromIntegral . fromEnum) replace
    gtk_style_properties_merge _obj' props_to_merge' replace'
    touchManagedPtr _obj
    touchManagedPtr props_to_merge
    return ()

-- method StyleProperties::set_property
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TInterface "Gtk" "StateFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TInterface "Gtk" "StateFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TInterface "GObject" "Value", 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_properties_set_property" gtk_style_properties_set_property :: 
    Ptr StyleProperties ->                  -- _obj : TInterface "Gtk" "StyleProperties"
    CString ->                              -- property : TBasicType TUTF8
    CUInt ->                                -- state : TInterface "Gtk" "StateFlags"
    Ptr GValue ->                           -- value : TInterface "GObject" "Value"
    IO ()

{-# DEPRECATED stylePropertiesSetProperty ["(Since version 3.16)","#GtkStyleProperties are deprecated."]#-}
stylePropertiesSetProperty ::
    (MonadIO m, StylePropertiesK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- property
    [StateFlags] ->                         -- state
    GValue ->                               -- value
    m ()
stylePropertiesSetProperty _obj property state value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    property' <- textToCString property
    let state' = gflagsToWord state
    let value' = unsafeManagedPtrGetPtr value
    gtk_style_properties_set_property _obj' property' state' value'
    touchManagedPtr _obj
    touchManagedPtr value
    freeMem property'
    return ()

-- method StyleProperties::unset_property
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TInterface "Gtk" "StateFlags", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gtk" "StyleProperties", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "property", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "state", argType = TInterface "Gtk" "StateFlags", 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_properties_unset_property" gtk_style_properties_unset_property :: 
    Ptr StyleProperties ->                  -- _obj : TInterface "Gtk" "StyleProperties"
    CString ->                              -- property : TBasicType TUTF8
    CUInt ->                                -- state : TInterface "Gtk" "StateFlags"
    IO ()

{-# DEPRECATED stylePropertiesUnsetProperty ["(Since version 3.16)","#GtkStyleProperties are deprecated."]#-}
stylePropertiesUnsetProperty ::
    (MonadIO m, StylePropertiesK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- property
    [StateFlags] ->                         -- state
    m ()
stylePropertiesUnsetProperty _obj property state = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    property' <- textToCString property
    let state' = gflagsToWord state
    gtk_style_properties_unset_property _obj' property' state'
    touchManagedPtr _obj
    freeMem property'
    return ()