gi-gio-0.2.46.12: GI/Gio/Interfaces/ActionMap.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.Gio.Interfaces.ActionMap
(
-- * Exported types
ActionMap(..) ,
noActionMap ,
ActionMapK ,
toActionMap ,
-- * Methods
-- ** actionMapAddAction
actionMapAddAction ,
-- ** actionMapAddActionEntries
actionMapAddActionEntries ,
-- ** actionMapLookupAction
actionMapLookupAction ,
-- ** actionMapRemoveAction
actionMapRemoveAction ,
) 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.GObject as GObject
-- interface ActionMap
newtype ActionMap = ActionMap (ForeignPtr ActionMap)
noActionMap :: Maybe ActionMap
noActionMap = Nothing
type instance AttributeList ActionMap = ActionMapAttributeList
type ActionMapAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList ActionMap = ActionMapSignalList
type ActionMapSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
foreign import ccall "g_action_map_get_type"
c_g_action_map_get_type :: IO GType
type instance ParentTypes ActionMap = ActionMapParentTypes
type ActionMapParentTypes = '[GObject.Object]
instance GObject ActionMap where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_g_action_map_get_type
class GObject o => ActionMapK o
instance (GObject o, IsDescendantOf ActionMap o) => ActionMapK o
toActionMap :: ActionMapK o => o -> IO ActionMap
toActionMap = unsafeCastTo ActionMap
-- method ActionMap::add_action
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action", argType = TInterface "Gio" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action", argType = TInterface "Gio" "Action", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_action_map_add_action" g_action_map_add_action ::
Ptr ActionMap -> -- _obj : TInterface "Gio" "ActionMap"
Ptr Action -> -- action : TInterface "Gio" "Action"
IO ()
actionMapAddAction ::
(MonadIO m, ActionMapK a, ActionK b) =>
a -> -- _obj
b -> -- action
m ()
actionMapAddAction _obj action = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let action' = unsafeManagedPtrCastPtr action
g_action_map_add_action _obj' action'
touchManagedPtr _obj
touchManagedPtr action
return ()
-- method ActionMap::add_action_entries
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "entries", argType = TCArray False (-1) 2 (TInterface "Gio" "ActionEntry"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "n_entries", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : [Arg {argName = "n_entries", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "entries", argType = TCArray False (-1) 2 (TInterface "Gio" "ActionEntry"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "user_data", argType = TBasicType TVoid, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_action_map_add_action_entries" g_action_map_add_action_entries ::
Ptr ActionMap -> -- _obj : TInterface "Gio" "ActionMap"
Ptr ActionEntry -> -- entries : TCArray False (-1) 2 (TInterface "Gio" "ActionEntry")
Int32 -> -- n_entries : TBasicType TInt32
Ptr () -> -- user_data : TBasicType TVoid
IO ()
actionMapAddActionEntries ::
(MonadIO m, ActionMapK a) =>
a -> -- _obj
[ActionEntry] -> -- entries
Ptr () -> -- user_data
m ()
actionMapAddActionEntries _obj entries user_data = liftIO $ do
let n_entries = fromIntegral $ length entries
let _obj' = unsafeManagedPtrCastPtr _obj
let entries' = map unsafeManagedPtrGetPtr entries
entries'' <- packBlockArray 64 entries'
g_action_map_add_action_entries _obj' entries'' n_entries user_data
touchManagedPtr _obj
mapM_ touchManagedPtr entries
freeMem entries''
return ()
-- method ActionMap::lookup_action
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Gio" "Action"
-- throws : False
-- Skip return : False
foreign import ccall "g_action_map_lookup_action" g_action_map_lookup_action ::
Ptr ActionMap -> -- _obj : TInterface "Gio" "ActionMap"
CString -> -- action_name : TBasicType TUTF8
IO (Ptr Action)
actionMapLookupAction ::
(MonadIO m, ActionMapK a) =>
a -> -- _obj
T.Text -> -- action_name
m Action
actionMapLookupAction _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
result <- g_action_map_lookup_action _obj' action_name'
checkUnexpectedReturnNULL "g_action_map_lookup_action" result
result' <- (newObject Action) result
touchManagedPtr _obj
freeMem action_name'
return result'
-- method ActionMap::remove_action
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Gio" "ActionMap", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "action_name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_action_map_remove_action" g_action_map_remove_action ::
Ptr ActionMap -> -- _obj : TInterface "Gio" "ActionMap"
CString -> -- action_name : TBasicType TUTF8
IO ()
actionMapRemoveAction ::
(MonadIO m, ActionMapK a) =>
a -> -- _obj
T.Text -> -- action_name
m ()
actionMapRemoveAction _obj action_name = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
action_name' <- textToCString action_name
g_action_map_remove_action _obj' action_name'
touchManagedPtr _obj
freeMem action_name'
return ()