{-# 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
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.Text as T
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
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
/= :: Action -> Action -> Bool
$c/= :: Action -> Action -> Bool
== :: Action -> Action -> Bool
$c== :: 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 (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: Action -> IO ()
boxedPtrFree = \Action
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
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 = O.MethodResolutionFailed l o
instance (info ~ ResolveActionMethod t Action, O.MethodInfo info Action p) => OL.IsLabel t (Action -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#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 :: a -> Int32 -> m Bool
actionDoAction a
action Int32
i = IO Bool -> m Bool
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
Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
CInt
result <- Ptr Action -> Int32 -> IO CInt
atk_action_do_action Ptr Action
action' Int32
i
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data ActionDoActionMethodInfo
instance (signature ~ (Int32 -> m Bool), MonadIO m, IsAction a) => O.MethodInfo ActionDoActionMethodInfo a signature where
overloadedMethod = 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 :: a -> Int32 -> m (Maybe Text)
actionGetDescription a
action Int32
i = IO (Maybe Text) -> m (Maybe Text)
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
Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
CString
result <- Ptr Action -> Int32 -> IO CString
atk_action_get_description Ptr Action
action' Int32
i
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionGetDescriptionMethodInfo
instance (signature ~ (Int32 -> m (Maybe T.Text)), MonadIO m, IsAction a) => O.MethodInfo ActionGetDescriptionMethodInfo a signature where
overloadedMethod = 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 :: a -> Int32 -> m (Maybe Text)
actionGetKeybinding a
action Int32
i = IO (Maybe Text) -> m (Maybe Text)
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
Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
CString
result <- Ptr Action -> Int32 -> IO CString
atk_action_get_keybinding Ptr Action
action' Int32
i
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionGetKeybindingMethodInfo
instance (signature ~ (Int32 -> m (Maybe T.Text)), MonadIO m, IsAction a) => O.MethodInfo ActionGetKeybindingMethodInfo a signature where
overloadedMethod = 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 :: a -> Int32 -> m (Maybe Text)
actionGetLocalizedName a
action Int32
i = IO (Maybe Text) -> m (Maybe Text)
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
Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
CString
result <- Ptr Action -> Int32 -> IO CString
atk_action_get_localized_name Ptr Action
action' Int32
i
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionGetLocalizedNameMethodInfo
instance (signature ~ (Int32 -> m (Maybe T.Text)), MonadIO m, IsAction a) => O.MethodInfo ActionGetLocalizedNameMethodInfo a signature where
overloadedMethod = 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 :: a -> m Int32
actionGetNActions a
action = IO Int32 -> m Int32
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
Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
Int32
result <- Ptr Action -> IO Int32
atk_action_get_n_actions Ptr Action
action'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
result
#if defined(ENABLE_OVERLOADING)
data ActionGetNActionsMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsAction a) => O.MethodInfo ActionGetNActionsMethodInfo a signature where
overloadedMethod = 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 :: a -> Int32 -> m (Maybe Text)
actionGetName a
action Int32
i = IO (Maybe Text) -> m (Maybe Text)
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
Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
CString
result <- Ptr Action -> Int32 -> IO CString
atk_action_get_name Ptr Action
action' Int32
i
Maybe Text
maybeResult <- CString -> (CString -> IO Text) -> IO (Maybe Text)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull CString
result ((CString -> IO Text) -> IO (Maybe Text))
-> (CString -> IO Text) -> IO (Maybe Text)
forall a b. (a -> b) -> a -> b
$ \CString
result' -> do
Text
result'' <- HasCallStack => CString -> IO Text
CString -> IO Text
cstringToText CString
result'
Text -> IO Text
forall (m :: * -> *) a. Monad m => a -> m a
return Text
result''
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
Maybe Text -> IO (Maybe Text)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Text
maybeResult
#if defined(ENABLE_OVERLOADING)
data ActionGetNameMethodInfo
instance (signature ~ (Int32 -> m (Maybe T.Text)), MonadIO m, IsAction a) => O.MethodInfo ActionGetNameMethodInfo a signature where
overloadedMethod = 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 :: a -> Int32 -> Text -> m Bool
actionSetDescription a
action Int32
i Text
desc = IO Bool -> m Bool
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
Ptr Action
action' <- a -> IO (Ptr Action)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
action
CString
desc' <- Text -> IO CString
textToCString Text
desc
CInt
result <- Ptr Action -> Int32 -> CString -> IO CInt
atk_action_set_description Ptr Action
action' Int32
i CString
desc'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
action
CString -> IO ()
forall a. Ptr a -> IO ()
freeMem CString
desc'
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data ActionSetDescriptionMethodInfo
instance (signature ~ (Int32 -> T.Text -> m Bool), MonadIO m, IsAction a) => O.MethodInfo ActionSetDescriptionMethodInfo a signature where
overloadedMethod = actionSetDescription
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Action = ActionSignalList
type ActionSignalList = ('[ ] :: [(Symbol, *)])
#endif