packages feed

gi-atk-0.2.18.13: GI/Atk/Interfaces/Action.hs


{- |
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.Interfaces.Action
    ( 

-- * Exported types
    Action(..)                              ,
    noAction                                ,
    ActionK                                 ,


 -- * Methods
-- ** actionDoAction
    ActionDoActionMethodInfo                ,
    actionDoAction                          ,


-- ** actionGetDescription
    ActionGetDescriptionMethodInfo          ,
    actionGetDescription                    ,


-- ** actionGetKeybinding
    ActionGetKeybindingMethodInfo           ,
    actionGetKeybinding                     ,


-- ** actionGetLocalizedName
    ActionGetLocalizedNameMethodInfo        ,
    actionGetLocalizedName                  ,


-- ** actionGetNActions
    ActionGetNActionsMethodInfo             ,
    actionGetNActions                       ,


-- ** actionGetName
    ActionGetNameMethodInfo                 ,
    actionGetName                           ,


-- ** actionSetDescription
    ActionSetDescriptionMethodInfo          ,
    actionSetDescription                    ,




    ) 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

-- interface Action 

newtype Action = Action (ForeignPtr Action)
noAction :: Maybe Action
noAction = Nothing

type family ResolveActionMethod (t :: Symbol) (o :: *) :: * where
    ResolveActionMethod "doAction" o = ActionDoActionMethodInfo
    ResolveActionMethod "getDescription" o = ActionGetDescriptionMethodInfo
    ResolveActionMethod "getKeybinding" o = ActionGetKeybindingMethodInfo
    ResolveActionMethod "getLocalizedName" o = ActionGetLocalizedNameMethodInfo
    ResolveActionMethod "getNActions" o = ActionGetNActionsMethodInfo
    ResolveActionMethod "getName" o = ActionGetNameMethodInfo
    ResolveActionMethod "setDescription" o = ActionSetDescriptionMethodInfo
    ResolveActionMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveActionMethod t Action, MethodInfo info Action p) => IsLabelProxy t (Action -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveActionMethod t Action, MethodInfo info Action p) => IsLabel t (Action -> p) where
    fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif

type instance AttributeList Action = ActionAttributeList
type ActionAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList Action = ActionSignalList
type ActionSignalList = ('[ ] :: [(Symbol, *)])

class ForeignPtrNewtype a => ActionK a
instance (ForeignPtrNewtype o, IsDescendantOf Action o) => ActionK o
type instance ParentTypes Action = ActionParentTypes
type ActionParentTypes = '[]

-- method Action::do_action
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "atk_action_do_action" atk_action_do_action :: 
    Ptr Action ->                           -- _obj : TInterface "Atk" "Action"
    Int32 ->                                -- i : TBasicType TInt32
    IO CInt


actionDoAction ::
    (MonadIO m, ActionK a) =>
    a                                       -- _obj
    -> Int32                                -- i
    -> m Bool                               -- result
actionDoAction _obj i = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_action_do_action _obj' i
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

data ActionDoActionMethodInfo
instance (signature ~ (Int32 -> m Bool), MonadIO m, ActionK a) => MethodInfo ActionDoActionMethodInfo a signature where
    overloadedMethod _ = actionDoAction

-- method Action::get_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "atk_action_get_description" atk_action_get_description :: 
    Ptr Action ->                           -- _obj : TInterface "Atk" "Action"
    Int32 ->                                -- i : TBasicType TInt32
    IO CString


actionGetDescription ::
    (MonadIO m, ActionK a) =>
    a                                       -- _obj
    -> Int32                                -- i
    -> m T.Text                             -- result
actionGetDescription _obj i = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_action_get_description _obj' i
    checkUnexpectedReturnNULL "atk_action_get_description" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

data ActionGetDescriptionMethodInfo
instance (signature ~ (Int32 -> m T.Text), MonadIO m, ActionK a) => MethodInfo ActionGetDescriptionMethodInfo a signature where
    overloadedMethod _ = actionGetDescription

-- method Action::get_keybinding
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "atk_action_get_keybinding" atk_action_get_keybinding :: 
    Ptr Action ->                           -- _obj : TInterface "Atk" "Action"
    Int32 ->                                -- i : TBasicType TInt32
    IO CString


actionGetKeybinding ::
    (MonadIO m, ActionK a) =>
    a                                       -- _obj
    -> Int32                                -- i
    -> m T.Text                             -- result
actionGetKeybinding _obj i = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_action_get_keybinding _obj' i
    checkUnexpectedReturnNULL "atk_action_get_keybinding" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

data ActionGetKeybindingMethodInfo
instance (signature ~ (Int32 -> m T.Text), MonadIO m, ActionK a) => MethodInfo ActionGetKeybindingMethodInfo a signature where
    overloadedMethod _ = actionGetKeybinding

-- method Action::get_localized_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "atk_action_get_localized_name" atk_action_get_localized_name :: 
    Ptr Action ->                           -- _obj : TInterface "Atk" "Action"
    Int32 ->                                -- i : TBasicType TInt32
    IO CString


actionGetLocalizedName ::
    (MonadIO m, ActionK a) =>
    a                                       -- _obj
    -> Int32                                -- i
    -> m T.Text                             -- result
actionGetLocalizedName _obj i = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_action_get_localized_name _obj' i
    checkUnexpectedReturnNULL "atk_action_get_localized_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

data ActionGetLocalizedNameMethodInfo
instance (signature ~ (Int32 -> m T.Text), MonadIO m, ActionK a) => MethodInfo ActionGetLocalizedNameMethodInfo a signature where
    overloadedMethod _ = actionGetLocalizedName

-- method Action::get_n_actions
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "atk_action_get_n_actions" atk_action_get_n_actions :: 
    Ptr Action ->                           -- _obj : TInterface "Atk" "Action"
    IO Int32


actionGetNActions ::
    (MonadIO m, ActionK a) =>
    a                                       -- _obj
    -> m Int32                              -- result
actionGetNActions _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_action_get_n_actions _obj'
    touchManagedPtr _obj
    return result

data ActionGetNActionsMethodInfo
instance (signature ~ (m Int32), MonadIO m, ActionK a) => MethodInfo ActionGetNActionsMethodInfo a signature where
    overloadedMethod _ = actionGetNActions

-- method Action::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TUTF8
-- throws : False
-- Skip return : False

foreign import ccall "atk_action_get_name" atk_action_get_name :: 
    Ptr Action ->                           -- _obj : TInterface "Atk" "Action"
    Int32 ->                                -- i : TBasicType TInt32
    IO CString


actionGetName ::
    (MonadIO m, ActionK a) =>
    a                                       -- _obj
    -> Int32                                -- i
    -> m T.Text                             -- result
actionGetName _obj i = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_action_get_name _obj' i
    checkUnexpectedReturnNULL "atk_action_get_name" result
    result' <- cstringToText result
    touchManagedPtr _obj
    return result'

data ActionGetNameMethodInfo
instance (signature ~ (Int32 -> m T.Text), MonadIO m, ActionK a) => MethodInfo ActionGetNameMethodInfo a signature where
    overloadedMethod _ = actionGetName

-- method Action::set_description
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "desc", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "atk_action_set_description" atk_action_set_description :: 
    Ptr Action ->                           -- _obj : TInterface "Atk" "Action"
    Int32 ->                                -- i : TBasicType TInt32
    CString ->                              -- desc : TBasicType TUTF8
    IO CInt


actionSetDescription ::
    (MonadIO m, ActionK a) =>
    a                                       -- _obj
    -> Int32                                -- i
    -> T.Text                               -- desc
    -> m Bool                               -- result
actionSetDescription _obj i desc = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    desc' <- textToCString desc
    result <- atk_action_set_description _obj' i desc'
    let result' = (/= 0) result
    touchManagedPtr _obj
    freeMem desc'
    return result'

data ActionSetDescriptionMethodInfo
instance (signature ~ (Int32 -> T.Text -> m Bool), MonadIO m, ActionK a) => MethodInfo ActionSetDescriptionMethodInfo a signature where
    overloadedMethod _ = actionSetDescription