{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Atk.Interfaces.Action
(
Action(..) ,
IsAction ,
#if defined(ENABLE_OVERLOADING)
ResolveActionMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ActionDoActionMethodInfo ,
#endif
actionDoAction ,
#if defined(ENABLE_OVERLOADING)
ActionGetDescriptionMethodInfo ,
#endif
actionGetDescription ,
#if defined(ENABLE_OVERLOADING)
ActionGetKeybindingMethodInfo ,
#endif
actionGetKeybinding ,
#if defined(ENABLE_OVERLOADING)
ActionGetLocalizedNameMethodInfo ,
#endif
actionGetLocalizedName ,
#if defined(ENABLE_OVERLOADING)
ActionGetNActionsMethodInfo ,
#endif
actionGetNActions ,
#if defined(ENABLE_OVERLOADING)
ActionGetNameMethodInfo ,
#endif
actionGetName ,
#if defined(ENABLE_OVERLOADING)
ActionSetDescriptionMethodInfo ,
#endif
actionSetDescription ,
) 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 Data.Bits as DB
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
#else
#endif
newtype Action = Action (SP.ManagedPtr Action)
deriving (Action -> Action -> Bool
(Action -> Action -> Bool)
-> (Action -> Action -> Bool) -> Eq Action
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Action -> Action -> Bool
== :: Action -> Action -> Bool
$c/= :: Action -> Action -> Bool
/= :: Action -> Action -> Bool
Eq)
instance SP.ManagedPtrNewtype Action where
toManagedPtr :: Action -> ManagedPtr Action
toManagedPtr (Action ManagedPtr Action
p) = ManagedPtr Action
p
class (ManagedPtrNewtype o, O.IsDescendantOf Action o) => IsAction o
instance (ManagedPtrNewtype o, O.IsDescendantOf Action o) => IsAction o
instance BoxedPtr Action where
boxedPtrCopy :: Action -> IO Action
boxedPtrCopy = Action -> IO Action
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: Action -> IO ()
boxedPtrFree = \Action
_x -> () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
type family ResolveActionMethod (t :: Symbol) (o :: DK.Type) :: DK.Type 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 = O.MethodResolutionFailed l o
instance (info ~ ResolveActionMethod t Action, O.OverloadedMethod info Action p) => OL.IsLabel t (Action -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel :: Action -> p
fromLabel = forall {k} (i :: k) o s. OverloadedMethod i o s => o -> s
forall i o s. OverloadedMethod i o s => o -> s
O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveActionMethod t Action, O.OverloadedMethod info Action p, R.HasField t Action p) => R.HasField t Action p where
getField :: Action -> p
getField = forall {k} (i :: k) o s. OverloadedMethod i o s => o -> s
forall i o s. OverloadedMethod i o s => o -> s
O.overloadedMethod @info
#endif
instance (info ~ ResolveActionMethod t Action, O.OverloadedMethodInfo info Action) => OL.IsLabel t (O.MethodProxy info Action) where
#if MIN_VERSION_base(4,10,0)
fromLabel :: MethodProxy info Action
fromLabel = MethodProxy info Action
forall info obj. MethodProxy info obj
O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
foreign import ccall "atk_action_do_action" atk_action_do_action ::
Ptr Action ->
Int32 ->
IO CInt
actionDoAction ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> Int32
-> m Bool
actionDoAction :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m Bool
actionDoAction a
action Int32
i = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
result <- atk_action_do_action action' i
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr action
return result'
#if defined(ENABLE_OVERLOADING)
data ActionDoActionMethodInfo
instance (signature ~ (Int32 -> m Bool), MonadIO m, IsAction a) => O.OverloadedMethod ActionDoActionMethodInfo a signature where
overloadedMethod :: a -> signature
overloadedMethod = a -> signature
a -> Int32 -> m Bool
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m Bool
actionDoAction
instance O.OverloadedMethodInfo ActionDoActionMethodInfo a where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.Atk.Interfaces.Action.actionDoAction",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-atk-2.0.29/docs/GI-Atk-Interfaces-Action.html#v:actionDoAction"
})
#endif
foreign import ccall "atk_action_get_description" atk_action_get_description ::
Ptr Action ->
Int32 ->
IO CString
actionGetDescription ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> Int32
-> m (Maybe T.Text)
actionGetDescription :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m (Maybe Text)
actionGetDescription a
action Int32
i = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
result <- atk_action_get_description action' i
maybeResult <- convertIfNonNull result $ \CString
result' -> do
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
return result''
touchManagedPtr action
return maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionGetDescriptionMethodInfo
instance (signature ~ (Int32 -> m (Maybe T.Text)), MonadIO m, IsAction a) => O.OverloadedMethod ActionGetDescriptionMethodInfo a signature where
overloadedMethod :: a -> signature
overloadedMethod = a -> signature
a -> Int32 -> m (Maybe Text)
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m (Maybe Text)
actionGetDescription
instance O.OverloadedMethodInfo ActionGetDescriptionMethodInfo a where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.Atk.Interfaces.Action.actionGetDescription",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-atk-2.0.29/docs/GI-Atk-Interfaces-Action.html#v:actionGetDescription"
})
#endif
foreign import ccall "atk_action_get_keybinding" atk_action_get_keybinding ::
Ptr Action ->
Int32 ->
IO CString
actionGetKeybinding ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> Int32
-> m (Maybe T.Text)
actionGetKeybinding :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m (Maybe Text)
actionGetKeybinding a
action Int32
i = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
result <- atk_action_get_keybinding action' i
maybeResult <- convertIfNonNull result $ \CString
result' -> do
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
return result''
touchManagedPtr action
return maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionGetKeybindingMethodInfo
instance (signature ~ (Int32 -> m (Maybe T.Text)), MonadIO m, IsAction a) => O.OverloadedMethod ActionGetKeybindingMethodInfo a signature where
overloadedMethod :: a -> signature
overloadedMethod = a -> signature
a -> Int32 -> m (Maybe Text)
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m (Maybe Text)
actionGetKeybinding
instance O.OverloadedMethodInfo ActionGetKeybindingMethodInfo a where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.Atk.Interfaces.Action.actionGetKeybinding",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-atk-2.0.29/docs/GI-Atk-Interfaces-Action.html#v:actionGetKeybinding"
})
#endif
foreign import ccall "atk_action_get_localized_name" atk_action_get_localized_name ::
Ptr Action ->
Int32 ->
IO CString
actionGetLocalizedName ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> Int32
-> m (Maybe T.Text)
actionGetLocalizedName :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m (Maybe Text)
actionGetLocalizedName a
action Int32
i = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
result <- atk_action_get_localized_name action' i
maybeResult <- convertIfNonNull result $ \CString
result' -> do
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
return result''
touchManagedPtr action
return maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionGetLocalizedNameMethodInfo
instance (signature ~ (Int32 -> m (Maybe T.Text)), MonadIO m, IsAction a) => O.OverloadedMethod ActionGetLocalizedNameMethodInfo a signature where
overloadedMethod :: a -> signature
overloadedMethod = a -> signature
a -> Int32 -> m (Maybe Text)
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m (Maybe Text)
actionGetLocalizedName
instance O.OverloadedMethodInfo ActionGetLocalizedNameMethodInfo a where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.Atk.Interfaces.Action.actionGetLocalizedName",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-atk-2.0.29/docs/GI-Atk-Interfaces-Action.html#v:actionGetLocalizedName"
})
#endif
foreign import ccall "atk_action_get_n_actions" atk_action_get_n_actions ::
Ptr Action ->
IO Int32
actionGetNActions ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> m Int32
actionGetNActions :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> m Int32
actionGetNActions a
action = IO Int32 -> m Int32
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ do
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
result <- atk_action_get_n_actions action'
touchManagedPtr action
return result
#if defined(ENABLE_OVERLOADING)
data ActionGetNActionsMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsAction a) => O.OverloadedMethod ActionGetNActionsMethodInfo a signature where
overloadedMethod :: a -> signature
overloadedMethod = a -> signature
a -> m Int32
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> m Int32
actionGetNActions
instance O.OverloadedMethodInfo ActionGetNActionsMethodInfo a where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.Atk.Interfaces.Action.actionGetNActions",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-atk-2.0.29/docs/GI-Atk-Interfaces-Action.html#v:actionGetNActions"
})
#endif
foreign import ccall "atk_action_get_name" atk_action_get_name ::
Ptr Action ->
Int32 ->
IO CString
actionGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> Int32
-> m (Maybe T.Text)
actionGetName :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m (Maybe Text)
actionGetName a
action Int32
i = IO (Maybe Text) -> m (Maybe Text)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Text) -> m (Maybe Text))
-> IO (Maybe Text) -> m (Maybe Text)
forall a b. (a -> b) -> a -> b
$ do
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
result <- atk_action_get_name action' i
maybeResult <- convertIfNonNull result $ \CString
result' -> do
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
return result''
touchManagedPtr action
return maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionGetNameMethodInfo
instance (signature ~ (Int32 -> m (Maybe T.Text)), MonadIO m, IsAction a) => O.OverloadedMethod ActionGetNameMethodInfo a signature where
overloadedMethod :: a -> signature
overloadedMethod = a -> signature
a -> Int32 -> m (Maybe Text)
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> m (Maybe Text)
actionGetName
instance O.OverloadedMethodInfo ActionGetNameMethodInfo a where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.Atk.Interfaces.Action.actionGetName",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-atk-2.0.29/docs/GI-Atk-Interfaces-Action.html#v:actionGetName"
})
#endif
foreign import ccall "atk_action_set_description" atk_action_set_description ::
Ptr Action ->
Int32 ->
CString ->
IO CInt
actionSetDescription ::
(B.CallStack.HasCallStack, MonadIO m, IsAction a) =>
a
-> Int32
-> T.Text
-> m Bool
actionSetDescription :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> Text -> m Bool
actionSetDescription a
action Int32
i Text
desc = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
desc' <- textToCString desc
result <- atk_action_set_description action' i desc'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr action
freeMem desc'
return result'
#if defined(ENABLE_OVERLOADING)
data ActionSetDescriptionMethodInfo
instance (signature ~ (Int32 -> T.Text -> m Bool), MonadIO m, IsAction a) => O.OverloadedMethod ActionSetDescriptionMethodInfo a signature where
overloadedMethod :: a -> signature
overloadedMethod = a -> signature
a -> Int32 -> Text -> m Bool
forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsAction a) =>
a -> Int32 -> Text -> m Bool
actionSetDescription
instance O.OverloadedMethodInfo ActionSetDescriptionMethodInfo a where
overloadedMethodInfo :: Maybe ResolvedSymbolInfo
overloadedMethodInfo = ResolvedSymbolInfo -> Maybe ResolvedSymbolInfo
forall a. a -> Maybe a
P.Just (O.ResolvedSymbolInfo {
resolvedSymbolName :: Text
O.resolvedSymbolName = Text
"GI.Atk.Interfaces.Action.actionSetDescription",
resolvedSymbolURL :: Text
O.resolvedSymbolURL = Text
"https://hackage.haskell.org/package/gi-atk-2.0.29/docs/GI-Atk-Interfaces-Action.html#v:actionSetDescription"
})
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Action = ActionSignalList
type ActionSignalList = ('[ ] :: [(Symbol, DK.Type)])
#endif