{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gio.Interfaces.ActionMap
(
ActionMap(..) ,
IsActionMap ,
toActionMap ,
#if defined(ENABLE_OVERLOADING)
ResolveActionMapMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ActionMapAddActionMethodInfo ,
#endif
actionMapAddAction ,
#if defined(ENABLE_OVERLOADING)
ActionMapAddActionEntriesMethodInfo ,
#endif
actionMapAddActionEntries ,
#if defined(ENABLE_OVERLOADING)
ActionMapLookupActionMethodInfo ,
#endif
actionMapLookupAction ,
#if defined(ENABLE_OVERLOADING)
ActionMapRemoveActionMethodInfo ,
#endif
actionMapRemoveAction ,
#if defined(ENABLE_OVERLOADING)
ActionMapRemoveActionEntriesMethodInfo ,
#endif
actionMapRemoveActionEntries ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.GLib.Structs.VariantType as GLib.VariantType
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Callbacks as Gio.Callbacks
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Action as Gio.Action
import {-# SOURCE #-} qualified GI.Gio.Structs.ActionEntry as Gio.ActionEntry
#else
import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gio.Interfaces.Action as Gio.Action
import {-# SOURCE #-} qualified GI.Gio.Structs.ActionEntry as Gio.ActionEntry
#endif
newtype ActionMap = ActionMap (SP.ManagedPtr ActionMap)
deriving (ActionMap -> ActionMap -> Bool
(ActionMap -> ActionMap -> Bool)
-> (ActionMap -> ActionMap -> Bool) -> Eq ActionMap
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: ActionMap -> ActionMap -> Bool
== :: ActionMap -> ActionMap -> Bool
$c/= :: ActionMap -> ActionMap -> Bool
/= :: ActionMap -> ActionMap -> Bool
Eq)
instance SP.ManagedPtrNewtype ActionMap where
toManagedPtr :: ActionMap -> ManagedPtr ActionMap
toManagedPtr (ActionMap ManagedPtr ActionMap
p) = ManagedPtr ActionMap
p
foreign import ccall "g_action_map_get_type"
c_g_action_map_get_type :: IO B.Types.GType
instance B.Types.TypedObject ActionMap where
glibType :: IO GType
glibType = IO GType
c_g_action_map_get_type
instance B.Types.GObject ActionMap
class (SP.GObject o, O.IsDescendantOf ActionMap o) => IsActionMap o
instance (SP.GObject o, O.IsDescendantOf ActionMap o) => IsActionMap o
instance O.HasParentTypes ActionMap
type instance O.ParentTypes ActionMap = '[GObject.Object.Object]
toActionMap :: (MIO.MonadIO m, IsActionMap o) => o -> m ActionMap
toActionMap :: forall (m :: * -> *) o.
(MonadIO m, IsActionMap o) =>
o -> m ActionMap
toActionMap = IO ActionMap -> m ActionMap
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ActionMap -> m ActionMap)
-> (o -> IO ActionMap) -> o -> m ActionMap
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ActionMap -> ActionMap) -> o -> IO ActionMap
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ActionMap -> ActionMap
ActionMap
instance B.GValue.IsGValue (Maybe ActionMap) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_g_action_map_get_type
gvalueSet_ :: Ptr GValue -> Maybe ActionMap -> IO ()
gvalueSet_ Ptr GValue
gv Maybe ActionMap
P.Nothing = Ptr GValue -> Ptr ActionMap -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr ActionMap
forall a. Ptr a
FP.nullPtr :: FP.Ptr ActionMap)
gvalueSet_ Ptr GValue
gv (P.Just ActionMap
obj) = ActionMap -> (Ptr ActionMap -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ActionMap
obj (Ptr GValue -> Ptr ActionMap -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe ActionMap)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr ActionMap)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr ActionMap)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject ActionMap ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ActionMap
type instance O.AttributeList ActionMap = ActionMapAttributeList
type ActionMapAttributeList = ('[ ] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveActionMapMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveActionMapMethod "addAction" o = ActionMapAddActionMethodInfo
ResolveActionMapMethod "addActionEntries" o = ActionMapAddActionEntriesMethodInfo
ResolveActionMapMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveActionMapMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveActionMapMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveActionMapMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveActionMapMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveActionMapMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveActionMapMethod "lookupAction" o = ActionMapLookupActionMethodInfo
ResolveActionMapMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveActionMapMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveActionMapMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveActionMapMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveActionMapMethod "removeAction" o = ActionMapRemoveActionMethodInfo
ResolveActionMapMethod "removeActionEntries" o = ActionMapRemoveActionEntriesMethodInfo
ResolveActionMapMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveActionMapMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveActionMapMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveActionMapMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveActionMapMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveActionMapMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveActionMapMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveActionMapMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveActionMapMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveActionMapMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveActionMapMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveActionMapMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveActionMapMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveActionMapMethod t ActionMap, O.OverloadedMethod info ActionMap p) => OL.IsLabel t (ActionMap -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveActionMapMethod t ActionMap, O.OverloadedMethod info ActionMap p, R.HasField t ActionMap p) => R.HasField t ActionMap p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveActionMapMethod t ActionMap, O.OverloadedMethodInfo info ActionMap) => OL.IsLabel t (O.MethodProxy info ActionMap) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
foreign import ccall "g_action_map_add_action" g_action_map_add_action ::
Ptr ActionMap ->
Ptr Gio.Action.Action ->
IO ()
actionMapAddAction ::
(B.CallStack.HasCallStack, MonadIO m, IsActionMap a, Gio.Action.IsAction b) =>
a
-> b
-> m ()
actionMapAddAction :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsActionMap a, IsAction b) =>
a -> b -> m ()
actionMapAddAction a
actionMap b
action = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
actionMap' <- a -> IO (Ptr ActionMap)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
actionMap
action' <- unsafeManagedPtrCastPtr action
g_action_map_add_action actionMap' action'
touchManagedPtr actionMap
touchManagedPtr action
return ()
#if defined(ENABLE_OVERLOADING)
data ActionMapAddActionMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsActionMap a, Gio.Action.IsAction b) => O.OverloadedMethod ActionMapAddActionMethodInfo a signature where
overloadedMethod = actionMapAddAction
instance O.OverloadedMethodInfo ActionMapAddActionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ActionMap.actionMapAddAction",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ActionMap.html#v:actionMapAddAction"
})
#endif
foreign import ccall "g_action_map_add_action_entries" g_action_map_add_action_entries ::
Ptr ActionMap ->
Ptr Gio.ActionEntry.ActionEntry ->
Int32 ->
Ptr () ->
IO ()
actionMapAddActionEntries ::
(B.CallStack.HasCallStack, MonadIO m, IsActionMap a) =>
a
-> [Gio.ActionEntry.ActionEntry]
-> Ptr ()
-> m ()
actionMapAddActionEntries :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsActionMap a) =>
a -> [ActionEntry] -> Ptr () -> m ()
actionMapAddActionEntries a
actionMap [ActionEntry]
entries Ptr ()
userData = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
let nEntries :: Int32
nEntries = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [ActionEntry] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [ActionEntry]
entries
actionMap' <- a -> IO (Ptr ActionMap)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
actionMap
entries' <- mapM unsafeManagedPtrGetPtr entries
entries'' <- packBlockArray 64 entries'
g_action_map_add_action_entries actionMap' entries'' nEntries userData
touchManagedPtr actionMap
mapM_ touchManagedPtr entries
freeMem entries''
return ()
#if defined(ENABLE_OVERLOADING)
data ActionMapAddActionEntriesMethodInfo
instance (signature ~ ([Gio.ActionEntry.ActionEntry] -> Ptr () -> m ()), MonadIO m, IsActionMap a) => O.OverloadedMethod ActionMapAddActionEntriesMethodInfo a signature where
overloadedMethod = actionMapAddActionEntries
instance O.OverloadedMethodInfo ActionMapAddActionEntriesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ActionMap.actionMapAddActionEntries",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ActionMap.html#v:actionMapAddActionEntries"
})
#endif
foreign import ccall "g_action_map_lookup_action" g_action_map_lookup_action ::
Ptr ActionMap ->
CString ->
IO (Ptr Gio.Action.Action)
actionMapLookupAction ::
(B.CallStack.HasCallStack, MonadIO m, IsActionMap a) =>
a
-> T.Text
-> m (Maybe Gio.Action.Action)
actionMapLookupAction :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsActionMap a) =>
a -> Text -> m (Maybe Action)
actionMapLookupAction a
actionMap Text
actionName = IO (Maybe Action) -> m (Maybe Action)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Action) -> m (Maybe Action))
-> IO (Maybe Action) -> m (Maybe Action)
forall a b. (a -> b) -> a -> b
$ do
actionMap' <- a -> IO (Ptr ActionMap)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
actionMap
actionName' <- textToCString actionName
result <- g_action_map_lookup_action actionMap' actionName'
maybeResult <- convertIfNonNull result $ \Ptr Action
result' -> do
result'' <- ((ManagedPtr Action -> Action) -> Ptr Action -> IO Action
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Action -> Action
Gio.Action.Action) Ptr Action
result'
return result''
touchManagedPtr actionMap
freeMem actionName'
return maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionMapLookupActionMethodInfo
instance (signature ~ (T.Text -> m (Maybe Gio.Action.Action)), MonadIO m, IsActionMap a) => O.OverloadedMethod ActionMapLookupActionMethodInfo a signature where
overloadedMethod = actionMapLookupAction
instance O.OverloadedMethodInfo ActionMapLookupActionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ActionMap.actionMapLookupAction",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ActionMap.html#v:actionMapLookupAction"
})
#endif
foreign import ccall "g_action_map_remove_action" g_action_map_remove_action ::
Ptr ActionMap ->
CString ->
IO ()
actionMapRemoveAction ::
(B.CallStack.HasCallStack, MonadIO m, IsActionMap a) =>
a
-> T.Text
-> m ()
actionMapRemoveAction :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsActionMap a) =>
a -> Text -> m ()
actionMapRemoveAction a
actionMap Text
actionName = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
actionMap' <- a -> IO (Ptr ActionMap)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
actionMap
actionName' <- textToCString actionName
g_action_map_remove_action actionMap' actionName'
touchManagedPtr actionMap
freeMem actionName'
return ()
#if defined(ENABLE_OVERLOADING)
data ActionMapRemoveActionMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsActionMap a) => O.OverloadedMethod ActionMapRemoveActionMethodInfo a signature where
overloadedMethod = actionMapRemoveAction
instance O.OverloadedMethodInfo ActionMapRemoveActionMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ActionMap.actionMapRemoveAction",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ActionMap.html#v:actionMapRemoveAction"
})
#endif
foreign import ccall "g_action_map_remove_action_entries" g_action_map_remove_action_entries ::
Ptr ActionMap ->
Ptr Gio.ActionEntry.ActionEntry ->
Int32 ->
IO ()
actionMapRemoveActionEntries ::
(B.CallStack.HasCallStack, MonadIO m, IsActionMap a) =>
a
-> [Gio.ActionEntry.ActionEntry]
-> m ()
actionMapRemoveActionEntries :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsActionMap a) =>
a -> [ActionEntry] -> m ()
actionMapRemoveActionEntries a
actionMap [ActionEntry]
entries = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
let nEntries :: Int32
nEntries = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [ActionEntry] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [ActionEntry]
entries
actionMap' <- a -> IO (Ptr ActionMap)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
actionMap
entries' <- mapM unsafeManagedPtrGetPtr entries
entries'' <- packBlockArray 64 entries'
g_action_map_remove_action_entries actionMap' entries'' nEntries
touchManagedPtr actionMap
mapM_ touchManagedPtr entries
freeMem entries''
return ()
#if defined(ENABLE_OVERLOADING)
data ActionMapRemoveActionEntriesMethodInfo
instance (signature ~ ([Gio.ActionEntry.ActionEntry] -> m ()), MonadIO m, IsActionMap a) => O.OverloadedMethod ActionMapRemoveActionEntriesMethodInfo a signature where
overloadedMethod = actionMapRemoveActionEntries
instance O.OverloadedMethodInfo ActionMapRemoveActionEntriesMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gio.Interfaces.ActionMap.actionMapRemoveActionEntries",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gio-2.0.35/docs/GI-Gio-Interfaces-ActionMap.html#v:actionMapRemoveActionEntries"
})
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList ActionMap = ActionMapSignalList
type ActionMapSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif