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

-- * Exported types
    PropertyAction(..)                      ,
    PropertyActionK                         ,
    toPropertyAction                        ,
    noPropertyAction                        ,


 -- * Methods
-- ** propertyActionNew
    propertyActionNew                       ,




 -- * Properties
-- ** Enabled
    PropertyActionEnabledPropertyInfo       ,
    getPropertyActionEnabled                ,


-- ** Name
    PropertyActionNamePropertyInfo          ,
    constructPropertyActionName             ,
    getPropertyActionName                   ,


-- ** Object
    PropertyActionObjectPropertyInfo        ,
    constructPropertyActionObject           ,


-- ** ParameterType
    PropertyActionParameterTypePropertyInfo ,
    getPropertyActionParameterType          ,


-- ** PropertyName
    PropertyActionPropertyNamePropertyInfo  ,
    constructPropertyActionPropertyName     ,


-- ** State
    PropertyActionStatePropertyInfo         ,
    getPropertyActionState                  ,


-- ** StateType
    PropertyActionStateTypePropertyInfo     ,
    getPropertyActionStateType              ,




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

newtype PropertyAction = PropertyAction (ForeignPtr PropertyAction)
foreign import ccall "g_property_action_get_type"
    c_g_property_action_get_type :: IO GType

type instance ParentTypes PropertyAction = PropertyActionParentTypes
type PropertyActionParentTypes = '[GObject.Object, Action]

instance GObject PropertyAction where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_g_property_action_get_type
    

class GObject o => PropertyActionK o
instance (GObject o, IsDescendantOf PropertyAction o) => PropertyActionK o

toPropertyAction :: PropertyActionK o => o -> IO PropertyAction
toPropertyAction = unsafeCastTo PropertyAction

noPropertyAction :: Maybe PropertyAction
noPropertyAction = Nothing

--- XXX Duplicated object with different types:
  --- Name {namespace = "Gio", name = "PropertyAction"} -> Property {propName = "name", propType = TBasicType TUTF8, propFlags = [PropertyReadable,PropertyWritable,PropertyConstructOnly], propTransfer = TransferNothing, propDeprecated = Nothing}
  --- Name {namespace = "Gio", name = "Action"} -> Property {propName = "name", propType = TBasicType TUTF8, propFlags = [PropertyReadable], propTransfer = TransferNothing, propDeprecated = Nothing}
-- VVV Prop "enabled"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable]

getPropertyActionEnabled :: (MonadIO m, PropertyActionK o) => o -> m Bool
getPropertyActionEnabled obj = liftIO $ getObjectPropertyBool obj "enabled"

data PropertyActionEnabledPropertyInfo
instance AttrInfo PropertyActionEnabledPropertyInfo where
    type AttrAllowedOps PropertyActionEnabledPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint PropertyActionEnabledPropertyInfo = (~) ()
    type AttrBaseTypeConstraint PropertyActionEnabledPropertyInfo = PropertyActionK
    type AttrGetType PropertyActionEnabledPropertyInfo = Bool
    type AttrLabel PropertyActionEnabledPropertyInfo = "PropertyAction::enabled"
    attrGet _ = getPropertyActionEnabled
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]

getPropertyActionName :: (MonadIO m, PropertyActionK o) => o -> m T.Text
getPropertyActionName obj = liftIO $ getObjectPropertyString obj "name"

constructPropertyActionName :: T.Text -> IO ([Char], GValue)
constructPropertyActionName val = constructObjectPropertyString "name" val

data PropertyActionNamePropertyInfo
instance AttrInfo PropertyActionNamePropertyInfo where
    type AttrAllowedOps PropertyActionNamePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint PropertyActionNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint PropertyActionNamePropertyInfo = PropertyActionK
    type AttrGetType PropertyActionNamePropertyInfo = T.Text
    type AttrLabel PropertyActionNamePropertyInfo = "PropertyAction::name"
    attrGet _ = getPropertyActionName
    attrSet _ = undefined
    attrConstruct _ = constructPropertyActionName

-- VVV Prop "object"
   -- Type: TInterface "GObject" "Object"
   -- Flags: [PropertyWritable,PropertyConstructOnly]

constructPropertyActionObject :: (GObject.ObjectK a) => a -> IO ([Char], GValue)
constructPropertyActionObject val = constructObjectPropertyObject "object" val

data PropertyActionObjectPropertyInfo
instance AttrInfo PropertyActionObjectPropertyInfo where
    type AttrAllowedOps PropertyActionObjectPropertyInfo = '[ 'AttrConstruct]
    type AttrSetTypeConstraint PropertyActionObjectPropertyInfo = GObject.ObjectK
    type AttrBaseTypeConstraint PropertyActionObjectPropertyInfo = PropertyActionK
    type AttrGetType PropertyActionObjectPropertyInfo = ()
    type AttrLabel PropertyActionObjectPropertyInfo = "PropertyAction::object"
    attrGet _ = undefined
    attrSet _ = undefined
    attrConstruct _ = constructPropertyActionObject

-- VVV Prop "parameter-type"
   -- Type: TInterface "GLib" "VariantType"
   -- Flags: [PropertyReadable]

getPropertyActionParameterType :: (MonadIO m, PropertyActionK o) => o -> m GLib.VariantType
getPropertyActionParameterType obj = liftIO $ getObjectPropertyBoxed obj "parameter-type" GLib.VariantType

data PropertyActionParameterTypePropertyInfo
instance AttrInfo PropertyActionParameterTypePropertyInfo where
    type AttrAllowedOps PropertyActionParameterTypePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint PropertyActionParameterTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint PropertyActionParameterTypePropertyInfo = PropertyActionK
    type AttrGetType PropertyActionParameterTypePropertyInfo = GLib.VariantType
    type AttrLabel PropertyActionParameterTypePropertyInfo = "PropertyAction::parameter-type"
    attrGet _ = getPropertyActionParameterType
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "property-name"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyWritable,PropertyConstructOnly]

constructPropertyActionPropertyName :: T.Text -> IO ([Char], GValue)
constructPropertyActionPropertyName val = constructObjectPropertyString "property-name" val

data PropertyActionPropertyNamePropertyInfo
instance AttrInfo PropertyActionPropertyNamePropertyInfo where
    type AttrAllowedOps PropertyActionPropertyNamePropertyInfo = '[ 'AttrConstruct]
    type AttrSetTypeConstraint PropertyActionPropertyNamePropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint PropertyActionPropertyNamePropertyInfo = PropertyActionK
    type AttrGetType PropertyActionPropertyNamePropertyInfo = ()
    type AttrLabel PropertyActionPropertyNamePropertyInfo = "PropertyAction::property-name"
    attrGet _ = undefined
    attrSet _ = undefined
    attrConstruct _ = constructPropertyActionPropertyName

-- VVV Prop "state"
   -- Type: TVariant
   -- Flags: [PropertyReadable]

getPropertyActionState :: (MonadIO m, PropertyActionK o) => o -> m GVariant
getPropertyActionState obj = liftIO $ getObjectPropertyVariant obj "state"

data PropertyActionStatePropertyInfo
instance AttrInfo PropertyActionStatePropertyInfo where
    type AttrAllowedOps PropertyActionStatePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint PropertyActionStatePropertyInfo = (~) ()
    type AttrBaseTypeConstraint PropertyActionStatePropertyInfo = PropertyActionK
    type AttrGetType PropertyActionStatePropertyInfo = GVariant
    type AttrLabel PropertyActionStatePropertyInfo = "PropertyAction::state"
    attrGet _ = getPropertyActionState
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "state-type"
   -- Type: TInterface "GLib" "VariantType"
   -- Flags: [PropertyReadable]

getPropertyActionStateType :: (MonadIO m, PropertyActionK o) => o -> m GLib.VariantType
getPropertyActionStateType obj = liftIO $ getObjectPropertyBoxed obj "state-type" GLib.VariantType

data PropertyActionStateTypePropertyInfo
instance AttrInfo PropertyActionStateTypePropertyInfo where
    type AttrAllowedOps PropertyActionStateTypePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint PropertyActionStateTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint PropertyActionStateTypePropertyInfo = PropertyActionK
    type AttrGetType PropertyActionStateTypePropertyInfo = GLib.VariantType
    type AttrLabel PropertyActionStateTypePropertyInfo = "PropertyAction::state-type"
    attrGet _ = getPropertyActionStateType
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList PropertyAction = PropertyActionAttributeList
type PropertyActionAttributeList = ('[ '("enabled", PropertyActionEnabledPropertyInfo), '("object", PropertyActionObjectPropertyInfo), '("parameter-type", PropertyActionParameterTypePropertyInfo), '("property-name", PropertyActionPropertyNamePropertyInfo), '("state", PropertyActionStatePropertyInfo), '("state-type", PropertyActionStateTypePropertyInfo)] :: [(Symbol, *)])

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

-- method PropertyAction::new
-- method type : Constructor
-- Args : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object", argType = TInterface "GObject" "Object", 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}]
-- Lengths : []
-- hInArgs : [Arg {argName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "object", argType = TInterface "GObject" "Object", 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 : TInterface "Gio" "PropertyAction"
-- throws : False
-- Skip return : False

foreign import ccall "g_property_action_new" g_property_action_new :: 
    CString ->                              -- name : TBasicType TUTF8
    Ptr GObject.Object ->                   -- object : TInterface "GObject" "Object"
    CString ->                              -- property_name : TBasicType TUTF8
    IO (Ptr PropertyAction)


propertyActionNew ::
    (MonadIO m, GObject.ObjectK a) =>
    T.Text ->                               -- name
    a ->                                    -- object
    T.Text ->                               -- property_name
    m PropertyAction
propertyActionNew name object property_name = liftIO $ do
    name' <- textToCString name
    let object' = unsafeManagedPtrCastPtr object
    property_name' <- textToCString property_name
    result <- g_property_action_new name' object' property_name'
    checkUnexpectedReturnNULL "g_property_action_new" result
    result' <- (wrapObject PropertyAction) result
    touchManagedPtr object
    freeMem name'
    freeMem property_name'
    return result'