packages feed

gi-atk-0.2.16.12: 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
    actionDoAction                          ,


-- ** actionGetDescription
    actionGetDescription                    ,


-- ** actionGetKeybinding
    actionGetKeybinding                     ,


-- ** actionGetLocalizedName
    actionGetLocalizedName                  ,


-- ** actionGetNActions
    actionGetNActions                       ,


-- ** actionGetName
    actionGetName                           ,


-- ** actionSetDescription
    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 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 {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
actionDoAction _obj i = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_action_do_action _obj' i
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method Action::get_description
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
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'

-- method Action::get_keybinding
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
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'

-- method Action::get_localized_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
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'

-- method Action::get_n_actions
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
actionGetNActions _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_action_get_n_actions _obj'
    touchManagedPtr _obj
    return result

-- method Action::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- 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
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'

-- method Action::set_description
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "desc", 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 "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
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'