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

-- * Exported types
    StateSet(..)                            ,
    StateSetK                               ,
    toStateSet                              ,
    noStateSet                              ,


 -- * Methods
-- ** stateSetAddState
    stateSetAddState                        ,


-- ** stateSetAddStates
    stateSetAddStates                       ,


-- ** stateSetAndSets
    stateSetAndSets                         ,


-- ** stateSetClearStates
    stateSetClearStates                     ,


-- ** stateSetContainsState
    stateSetContainsState                   ,


-- ** stateSetContainsStates
    stateSetContainsStates                  ,


-- ** stateSetIsEmpty
    stateSetIsEmpty                         ,


-- ** stateSetNew
    stateSetNew                             ,


-- ** stateSetOrSets
    stateSetOrSets                          ,


-- ** stateSetRemoveState
    stateSetRemoveState                     ,


-- ** stateSetXorSets
    stateSetXorSets                         ,




    ) 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.Atk.Types
import GI.Atk.Callbacks
import qualified GI.GObject as GObject

newtype StateSet = StateSet (ForeignPtr StateSet)
foreign import ccall "atk_state_set_get_type"
    c_atk_state_set_get_type :: IO GType

type instance ParentTypes StateSet = StateSetParentTypes
type StateSetParentTypes = '[GObject.Object]

instance GObject StateSet where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_atk_state_set_get_type
    

class GObject o => StateSetK o
instance (GObject o, IsDescendantOf StateSet o) => StateSetK o

toStateSet :: StateSetK o => o -> IO StateSet
toStateSet = unsafeCastTo StateSet

noStateSet :: Maybe StateSet
noStateSet = Nothing

type instance AttributeList StateSet = StateSetAttributeList
type StateSetAttributeList = ('[ ] :: [(Symbol, *)])

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

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

foreign import ccall "atk_state_set_new" atk_state_set_new :: 
    IO (Ptr StateSet)


stateSetNew ::
    (MonadIO m) =>
    m StateSet
stateSetNew  = liftIO $ do
    result <- atk_state_set_new
    checkUnexpectedReturnNULL "atk_state_set_new" result
    result' <- (wrapObject StateSet) result
    return result'

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

foreign import ccall "atk_state_set_add_state" atk_state_set_add_state :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    CUInt ->                                -- type : TInterface "Atk" "StateType"
    IO CInt


stateSetAddState ::
    (MonadIO m, StateSetK a) =>
    a ->                                    -- _obj
    StateType ->                            -- type
    m Bool
stateSetAddState _obj type_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = (fromIntegral . fromEnum) type_
    result <- atk_state_set_add_state _obj' type_'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method StateSet::add_states
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "StateSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "types", argType = TCArray False (-1) 2 (TInterface "Atk" "StateType"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_types", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_types", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "StateSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "types", argType = TCArray False (-1) 2 (TInterface "Atk" "StateType"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "atk_state_set_add_states" atk_state_set_add_states :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    Ptr CUInt ->                            -- types : TCArray False (-1) 2 (TInterface "Atk" "StateType")
    Int32 ->                                -- n_types : TBasicType TInt32
    IO ()


stateSetAddStates ::
    (MonadIO m, StateSetK a) =>
    a ->                                    -- _obj
    [StateType] ->                          -- types
    m ()
stateSetAddStates _obj types = liftIO $ do
    let n_types = fromIntegral $ length types
    let _obj' = unsafeManagedPtrCastPtr _obj
    let types' = map (fromIntegral . fromEnum) types
    types'' <- packStorableArray types'
    atk_state_set_add_states _obj' types'' n_types
    touchManagedPtr _obj
    freeMem types''
    return ()

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

foreign import ccall "atk_state_set_and_sets" atk_state_set_and_sets :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    Ptr StateSet ->                         -- compare_set : TInterface "Atk" "StateSet"
    IO (Ptr StateSet)


stateSetAndSets ::
    (MonadIO m, StateSetK a, StateSetK b) =>
    a ->                                    -- _obj
    b ->                                    -- compare_set
    m StateSet
stateSetAndSets _obj compare_set = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let compare_set' = unsafeManagedPtrCastPtr compare_set
    result <- atk_state_set_and_sets _obj' compare_set'
    checkUnexpectedReturnNULL "atk_state_set_and_sets" result
    result' <- (wrapObject StateSet) result
    touchManagedPtr _obj
    touchManagedPtr compare_set
    return result'

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

foreign import ccall "atk_state_set_clear_states" atk_state_set_clear_states :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    IO ()


stateSetClearStates ::
    (MonadIO m, StateSetK a) =>
    a ->                                    -- _obj
    m ()
stateSetClearStates _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    atk_state_set_clear_states _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "atk_state_set_contains_state" atk_state_set_contains_state :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    CUInt ->                                -- type : TInterface "Atk" "StateType"
    IO CInt


stateSetContainsState ::
    (MonadIO m, StateSetK a) =>
    a ->                                    -- _obj
    StateType ->                            -- type
    m Bool
stateSetContainsState _obj type_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = (fromIntegral . fromEnum) type_
    result <- atk_state_set_contains_state _obj' type_'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method StateSet::contains_states
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "StateSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "types", argType = TCArray False (-1) 2 (TInterface "Atk" "StateType"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_types", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_types", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "StateSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "types", argType = TCArray False (-1) 2 (TInterface "Atk" "StateType"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "atk_state_set_contains_states" atk_state_set_contains_states :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    Ptr CUInt ->                            -- types : TCArray False (-1) 2 (TInterface "Atk" "StateType")
    Int32 ->                                -- n_types : TBasicType TInt32
    IO CInt


stateSetContainsStates ::
    (MonadIO m, StateSetK a) =>
    a ->                                    -- _obj
    [StateType] ->                          -- types
    m Bool
stateSetContainsStates _obj types = liftIO $ do
    let n_types = fromIntegral $ length types
    let _obj' = unsafeManagedPtrCastPtr _obj
    let types' = map (fromIntegral . fromEnum) types
    types'' <- packStorableArray types'
    result <- atk_state_set_contains_states _obj' types'' n_types
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem types''
    return result'

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

foreign import ccall "atk_state_set_is_empty" atk_state_set_is_empty :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    IO CInt


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

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

foreign import ccall "atk_state_set_or_sets" atk_state_set_or_sets :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    Ptr StateSet ->                         -- compare_set : TInterface "Atk" "StateSet"
    IO (Ptr StateSet)


stateSetOrSets ::
    (MonadIO m, StateSetK a, StateSetK b) =>
    a ->                                    -- _obj
    b ->                                    -- compare_set
    m StateSet
stateSetOrSets _obj compare_set = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let compare_set' = unsafeManagedPtrCastPtr compare_set
    result <- atk_state_set_or_sets _obj' compare_set'
    checkUnexpectedReturnNULL "atk_state_set_or_sets" result
    result' <- (wrapObject StateSet) result
    touchManagedPtr _obj
    touchManagedPtr compare_set
    return result'

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

foreign import ccall "atk_state_set_remove_state" atk_state_set_remove_state :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    CUInt ->                                -- type : TInterface "Atk" "StateType"
    IO CInt


stateSetRemoveState ::
    (MonadIO m, StateSetK a) =>
    a ->                                    -- _obj
    StateType ->                            -- type
    m Bool
stateSetRemoveState _obj type_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = (fromIntegral . fromEnum) type_
    result <- atk_state_set_remove_state _obj' type_'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "atk_state_set_xor_sets" atk_state_set_xor_sets :: 
    Ptr StateSet ->                         -- _obj : TInterface "Atk" "StateSet"
    Ptr StateSet ->                         -- compare_set : TInterface "Atk" "StateSet"
    IO (Ptr StateSet)


stateSetXorSets ::
    (MonadIO m, StateSetK a, StateSetK b) =>
    a ->                                    -- _obj
    b ->                                    -- compare_set
    m StateSet
stateSetXorSets _obj compare_set = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let compare_set' = unsafeManagedPtrCastPtr compare_set
    result <- atk_state_set_xor_sets _obj' compare_set'
    checkUnexpectedReturnNULL "atk_state_set_xor_sets" result
    result' <- (wrapObject StateSet) result
    touchManagedPtr _obj
    touchManagedPtr compare_set
    return result'