{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- GtkShortcut is the low level object used for managing keyboard
-- shortcuts.
-- 
-- It contains a description of how to trigger the shortcut via a
-- t'GI.Gtk.Objects.ShortcutTrigger.ShortcutTrigger' and a way to activate the shortcut on a widget
-- via t'GI.Gtk.Objects.ShortcutAction.ShortcutAction'.
-- 
-- The actual work is usually done via t'GI.Gtk.Objects.ShortcutController.ShortcutController', which
-- decides if and when to activate a shortcut. Using that controller
-- directly however is rarely necessary as various higher level
-- convenience APIs exist on @/GtkWidgets/@ that make it easier to use
-- shortcuts in GTK.
-- 
-- t'GI.Gtk.Objects.Shortcut.Shortcut' does provide functionality to make it easy for users
-- to work with shortcuts, either by providing informational strings
-- for display purposes or by allowing shortcuts to be configured.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gtk.Objects.Shortcut
    ( 

-- * Exported types
    Shortcut(..)                            ,
    IsShortcut                              ,
    toShortcut                              ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveShortcutMethod                   ,
#endif


-- ** getAction #method:getAction#

#if defined(ENABLE_OVERLOADING)
    ShortcutGetActionMethodInfo             ,
#endif
    shortcutGetAction                       ,


-- ** getArguments #method:getArguments#

#if defined(ENABLE_OVERLOADING)
    ShortcutGetArgumentsMethodInfo          ,
#endif
    shortcutGetArguments                    ,


-- ** getTrigger #method:getTrigger#

#if defined(ENABLE_OVERLOADING)
    ShortcutGetTriggerMethodInfo            ,
#endif
    shortcutGetTrigger                      ,


-- ** new #method:new#

    shortcutNew                             ,


-- ** setAction #method:setAction#

#if defined(ENABLE_OVERLOADING)
    ShortcutSetActionMethodInfo             ,
#endif
    shortcutSetAction                       ,


-- ** setArguments #method:setArguments#

#if defined(ENABLE_OVERLOADING)
    ShortcutSetArgumentsMethodInfo          ,
#endif
    shortcutSetArguments                    ,


-- ** setTrigger #method:setTrigger#

#if defined(ENABLE_OVERLOADING)
    ShortcutSetTriggerMethodInfo            ,
#endif
    shortcutSetTrigger                      ,




 -- * Properties
-- ** action #attr:action#
-- | The action that gets activated by this shortcut.

#if defined(ENABLE_OVERLOADING)
    ShortcutActionPropertyInfo              ,
#endif
    clearShortcutAction                     ,
    constructShortcutAction                 ,
    getShortcutAction                       ,
    setShortcutAction                       ,
#if defined(ENABLE_OVERLOADING)
    shortcutAction                          ,
#endif


-- ** arguments #attr:arguments#
-- | Arguments passed to activation.

#if defined(ENABLE_OVERLOADING)
    ShortcutArgumentsPropertyInfo           ,
#endif
    clearShortcutArguments                  ,
    constructShortcutArguments              ,
    getShortcutArguments                    ,
    setShortcutArguments                    ,
#if defined(ENABLE_OVERLOADING)
    shortcutArguments                       ,
#endif


-- ** trigger #attr:trigger#
-- | The trigger that triggers this shortcut.

#if defined(ENABLE_OVERLOADING)
    ShortcutTriggerPropertyInfo             ,
#endif
    clearShortcutTrigger                    ,
    constructShortcutTrigger                ,
    getShortcutTrigger                      ,
    setShortcutTrigger                      ,
#if defined(ENABLE_OVERLOADING)
    shortcutTrigger                         ,
#endif




    ) 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

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gtk.Objects.ShortcutAction as Gtk.ShortcutAction
import {-# SOURCE #-} qualified GI.Gtk.Objects.ShortcutTrigger as Gtk.ShortcutTrigger

-- | Memory-managed wrapper type.
newtype Shortcut = Shortcut (SP.ManagedPtr Shortcut)
    deriving (Shortcut -> Shortcut -> Bool
(Shortcut -> Shortcut -> Bool)
-> (Shortcut -> Shortcut -> Bool) -> Eq Shortcut
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Shortcut -> Shortcut -> Bool
$c/= :: Shortcut -> Shortcut -> Bool
== :: Shortcut -> Shortcut -> Bool
$c== :: Shortcut -> Shortcut -> Bool
Eq)

instance SP.ManagedPtrNewtype Shortcut where
    toManagedPtr :: Shortcut -> ManagedPtr Shortcut
toManagedPtr (Shortcut ManagedPtr Shortcut
p) = ManagedPtr Shortcut
p

foreign import ccall "gtk_shortcut_get_type"
    c_gtk_shortcut_get_type :: IO B.Types.GType

instance B.Types.TypedObject Shortcut where
    glibType :: IO GType
glibType = IO GType
c_gtk_shortcut_get_type

instance B.Types.GObject Shortcut

-- | Convert 'Shortcut' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue Shortcut where
    toGValue :: Shortcut -> IO GValue
toGValue Shortcut
o = do
        GType
gtype <- IO GType
c_gtk_shortcut_get_type
        Shortcut -> (Ptr Shortcut -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Shortcut
o (GType
-> (GValue -> Ptr Shortcut -> IO ()) -> Ptr Shortcut -> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Shortcut -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO Shortcut
fromGValue GValue
gv = do
        Ptr Shortcut
ptr <- GValue -> IO (Ptr Shortcut)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr Shortcut)
        (ManagedPtr Shortcut -> Shortcut) -> Ptr Shortcut -> IO Shortcut
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr Shortcut -> Shortcut
Shortcut Ptr Shortcut
ptr
        
    

-- | Type class for types which can be safely cast to `Shortcut`, for instance with `toShortcut`.
class (SP.GObject o, O.IsDescendantOf Shortcut o) => IsShortcut o
instance (SP.GObject o, O.IsDescendantOf Shortcut o) => IsShortcut o

instance O.HasParentTypes Shortcut
type instance O.ParentTypes Shortcut = '[GObject.Object.Object]

-- | Cast to `Shortcut`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toShortcut :: (MonadIO m, IsShortcut o) => o -> m Shortcut
toShortcut :: o -> m Shortcut
toShortcut = IO Shortcut -> m Shortcut
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Shortcut -> m Shortcut)
-> (o -> IO Shortcut) -> o -> m Shortcut
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Shortcut -> Shortcut) -> o -> IO Shortcut
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr Shortcut -> Shortcut
Shortcut

#if defined(ENABLE_OVERLOADING)
type family ResolveShortcutMethod (t :: Symbol) (o :: *) :: * where
    ResolveShortcutMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveShortcutMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveShortcutMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveShortcutMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveShortcutMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveShortcutMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveShortcutMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveShortcutMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveShortcutMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveShortcutMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveShortcutMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveShortcutMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveShortcutMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveShortcutMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveShortcutMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveShortcutMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveShortcutMethod "getAction" o = ShortcutGetActionMethodInfo
    ResolveShortcutMethod "getArguments" o = ShortcutGetArgumentsMethodInfo
    ResolveShortcutMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveShortcutMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveShortcutMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveShortcutMethod "getTrigger" o = ShortcutGetTriggerMethodInfo
    ResolveShortcutMethod "setAction" o = ShortcutSetActionMethodInfo
    ResolveShortcutMethod "setArguments" o = ShortcutSetArgumentsMethodInfo
    ResolveShortcutMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveShortcutMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveShortcutMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveShortcutMethod "setTrigger" o = ShortcutSetTriggerMethodInfo
    ResolveShortcutMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveShortcutMethod t Shortcut, O.MethodInfo info Shortcut p) => OL.IsLabel t (Shortcut -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif

-- VVV Prop "action"
   -- Type: TInterface (Name {namespace = "Gtk", name = "ShortcutAction"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@action@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' shortcut #action
-- @
getShortcutAction :: (MonadIO m, IsShortcut o) => o -> m Gtk.ShortcutAction.ShortcutAction
getShortcutAction :: o -> m ShortcutAction
getShortcutAction o
obj = IO ShortcutAction -> m ShortcutAction
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ShortcutAction -> m ShortcutAction)
-> IO ShortcutAction -> m ShortcutAction
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe ShortcutAction) -> IO ShortcutAction
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getShortcutAction" (IO (Maybe ShortcutAction) -> IO ShortcutAction)
-> IO (Maybe ShortcutAction) -> IO ShortcutAction
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr ShortcutAction -> ShortcutAction)
-> IO (Maybe ShortcutAction)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"action" ManagedPtr ShortcutAction -> ShortcutAction
Gtk.ShortcutAction.ShortcutAction

-- | Set the value of the “@action@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' shortcut [ #action 'Data.GI.Base.Attributes.:=' value ]
-- @
setShortcutAction :: (MonadIO m, IsShortcut o, Gtk.ShortcutAction.IsShortcutAction a) => o -> a -> m ()
setShortcutAction :: o -> a -> m ()
setShortcutAction o
obj a
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe a -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"action" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)

-- | Construct a `GValueConstruct` with valid value for the “@action@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructShortcutAction :: (IsShortcut o, MIO.MonadIO m, Gtk.ShortcutAction.IsShortcutAction a) => a -> m (GValueConstruct o)
constructShortcutAction :: a -> m (GValueConstruct o)
constructShortcutAction a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"action" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)

-- | Set the value of the “@action@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #action
-- @
clearShortcutAction :: (MonadIO m, IsShortcut o) => o -> m ()
clearShortcutAction :: o -> m ()
clearShortcutAction o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe ShortcutAction -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"action" (Maybe ShortcutAction
forall a. Maybe a
Nothing :: Maybe Gtk.ShortcutAction.ShortcutAction)

#if defined(ENABLE_OVERLOADING)
data ShortcutActionPropertyInfo
instance AttrInfo ShortcutActionPropertyInfo where
    type AttrAllowedOps ShortcutActionPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ShortcutActionPropertyInfo = IsShortcut
    type AttrSetTypeConstraint ShortcutActionPropertyInfo = Gtk.ShortcutAction.IsShortcutAction
    type AttrTransferTypeConstraint ShortcutActionPropertyInfo = Gtk.ShortcutAction.IsShortcutAction
    type AttrTransferType ShortcutActionPropertyInfo = Gtk.ShortcutAction.ShortcutAction
    type AttrGetType ShortcutActionPropertyInfo = Gtk.ShortcutAction.ShortcutAction
    type AttrLabel ShortcutActionPropertyInfo = "action"
    type AttrOrigin ShortcutActionPropertyInfo = Shortcut
    attrGet = getShortcutAction
    attrSet = setShortcutAction
    attrTransfer _ v = do
        unsafeCastTo Gtk.ShortcutAction.ShortcutAction v
    attrConstruct = constructShortcutAction
    attrClear = clearShortcutAction
#endif

-- VVV Prop "arguments"
   -- Type: TVariant
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just True,Just True)

-- | Get the value of the “@arguments@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' shortcut #arguments
-- @
getShortcutArguments :: (MonadIO m, IsShortcut o) => o -> m (Maybe GVariant)
getShortcutArguments :: o -> m (Maybe GVariant)
getShortcutArguments o
obj = IO (Maybe GVariant) -> m (Maybe GVariant)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe GVariant) -> m (Maybe GVariant))
-> IO (Maybe GVariant) -> m (Maybe GVariant)
forall a b. (a -> b) -> a -> b
$ o -> String -> IO (Maybe GVariant)
forall a. GObject a => a -> String -> IO (Maybe GVariant)
B.Properties.getObjectPropertyVariant o
obj String
"arguments"

-- | Set the value of the “@arguments@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' shortcut [ #arguments 'Data.GI.Base.Attributes.:=' value ]
-- @
setShortcutArguments :: (MonadIO m, IsShortcut o) => o -> GVariant -> m ()
setShortcutArguments :: o -> GVariant -> m ()
setShortcutArguments o
obj GVariant
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe GVariant -> IO ()
forall a. GObject a => a -> String -> Maybe GVariant -> IO ()
B.Properties.setObjectPropertyVariant o
obj String
"arguments" (GVariant -> Maybe GVariant
forall a. a -> Maybe a
Just GVariant
val)

-- | Construct a `GValueConstruct` with valid value for the “@arguments@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructShortcutArguments :: (IsShortcut o, MIO.MonadIO m) => GVariant -> m (GValueConstruct o)
constructShortcutArguments :: GVariant -> m (GValueConstruct o)
constructShortcutArguments GVariant
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe GVariant -> IO (GValueConstruct o)
forall o. String -> Maybe GVariant -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyVariant String
"arguments" (GVariant -> Maybe GVariant
forall a. a -> Maybe a
P.Just GVariant
val)

-- | Set the value of the “@arguments@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #arguments
-- @
clearShortcutArguments :: (MonadIO m, IsShortcut o) => o -> m ()
clearShortcutArguments :: o -> m ()
clearShortcutArguments o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe GVariant -> IO ()
forall a. GObject a => a -> String -> Maybe GVariant -> IO ()
B.Properties.setObjectPropertyVariant o
obj String
"arguments" (Maybe GVariant
forall a. Maybe a
Nothing :: Maybe GVariant)

#if defined(ENABLE_OVERLOADING)
data ShortcutArgumentsPropertyInfo
instance AttrInfo ShortcutArgumentsPropertyInfo where
    type AttrAllowedOps ShortcutArgumentsPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ShortcutArgumentsPropertyInfo = IsShortcut
    type AttrSetTypeConstraint ShortcutArgumentsPropertyInfo = (~) GVariant
    type AttrTransferTypeConstraint ShortcutArgumentsPropertyInfo = (~) GVariant
    type AttrTransferType ShortcutArgumentsPropertyInfo = GVariant
    type AttrGetType ShortcutArgumentsPropertyInfo = (Maybe GVariant)
    type AttrLabel ShortcutArgumentsPropertyInfo = "arguments"
    type AttrOrigin ShortcutArgumentsPropertyInfo = Shortcut
    attrGet = getShortcutArguments
    attrSet = setShortcutArguments
    attrTransfer _ v = do
        return v
    attrConstruct = constructShortcutArguments
    attrClear = clearShortcutArguments
#endif

-- VVV Prop "trigger"
   -- Type: TInterface (Name {namespace = "Gtk", name = "ShortcutTrigger"})
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Just False,Nothing)

-- | Get the value of the “@trigger@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' shortcut #trigger
-- @
getShortcutTrigger :: (MonadIO m, IsShortcut o) => o -> m Gtk.ShortcutTrigger.ShortcutTrigger
getShortcutTrigger :: o -> m ShortcutTrigger
getShortcutTrigger o
obj = IO ShortcutTrigger -> m ShortcutTrigger
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ShortcutTrigger -> m ShortcutTrigger)
-> IO ShortcutTrigger -> m ShortcutTrigger
forall a b. (a -> b) -> a -> b
$ Text -> IO (Maybe ShortcutTrigger) -> IO ShortcutTrigger
forall a. HasCallStack => Text -> IO (Maybe a) -> IO a
checkUnexpectedNothing Text
"getShortcutTrigger" (IO (Maybe ShortcutTrigger) -> IO ShortcutTrigger)
-> IO (Maybe ShortcutTrigger) -> IO ShortcutTrigger
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr ShortcutTrigger -> ShortcutTrigger)
-> IO (Maybe ShortcutTrigger)
forall a b.
(GObject a, GObject b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyObject o
obj String
"trigger" ManagedPtr ShortcutTrigger -> ShortcutTrigger
Gtk.ShortcutTrigger.ShortcutTrigger

-- | Set the value of the “@trigger@” property.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' shortcut [ #trigger 'Data.GI.Base.Attributes.:=' value ]
-- @
setShortcutTrigger :: (MonadIO m, IsShortcut o, Gtk.ShortcutTrigger.IsShortcutTrigger a) => o -> a -> m ()
setShortcutTrigger :: o -> a -> m ()
setShortcutTrigger o
obj a
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe a -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"trigger" (a -> Maybe a
forall a. a -> Maybe a
Just a
val)

-- | Construct a `GValueConstruct` with valid value for the “@trigger@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
constructShortcutTrigger :: (IsShortcut o, MIO.MonadIO m, Gtk.ShortcutTrigger.IsShortcutTrigger a) => a -> m (GValueConstruct o)
constructShortcutTrigger :: a -> m (GValueConstruct o)
constructShortcutTrigger a
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe a -> IO (GValueConstruct o)
forall a o.
GObject a =>
String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyObject String
"trigger" (a -> Maybe a
forall a. a -> Maybe a
P.Just a
val)

-- | Set the value of the “@trigger@” property to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #trigger
-- @
clearShortcutTrigger :: (MonadIO m, IsShortcut o) => o -> m ()
clearShortcutTrigger :: o -> m ()
clearShortcutTrigger o
obj = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe ShortcutTrigger -> IO ()
forall a b.
(GObject a, GObject b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyObject o
obj String
"trigger" (Maybe ShortcutTrigger
forall a. Maybe a
Nothing :: Maybe Gtk.ShortcutTrigger.ShortcutTrigger)

#if defined(ENABLE_OVERLOADING)
data ShortcutTriggerPropertyInfo
instance AttrInfo ShortcutTriggerPropertyInfo where
    type AttrAllowedOps ShortcutTriggerPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrBaseTypeConstraint ShortcutTriggerPropertyInfo = IsShortcut
    type AttrSetTypeConstraint ShortcutTriggerPropertyInfo = Gtk.ShortcutTrigger.IsShortcutTrigger
    type AttrTransferTypeConstraint ShortcutTriggerPropertyInfo = Gtk.ShortcutTrigger.IsShortcutTrigger
    type AttrTransferType ShortcutTriggerPropertyInfo = Gtk.ShortcutTrigger.ShortcutTrigger
    type AttrGetType ShortcutTriggerPropertyInfo = Gtk.ShortcutTrigger.ShortcutTrigger
    type AttrLabel ShortcutTriggerPropertyInfo = "trigger"
    type AttrOrigin ShortcutTriggerPropertyInfo = Shortcut
    attrGet = getShortcutTrigger
    attrSet = setShortcutTrigger
    attrTransfer _ v = do
        unsafeCastTo Gtk.ShortcutTrigger.ShortcutTrigger v
    attrConstruct = constructShortcutTrigger
    attrClear = clearShortcutTrigger
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Shortcut
type instance O.AttributeList Shortcut = ShortcutAttributeList
type ShortcutAttributeList = ('[ '("action", ShortcutActionPropertyInfo), '("arguments", ShortcutArgumentsPropertyInfo), '("trigger", ShortcutTriggerPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
shortcutAction :: AttrLabelProxy "action"
shortcutAction = AttrLabelProxy

shortcutArguments :: AttrLabelProxy "arguments"
shortcutArguments = AttrLabelProxy

shortcutTrigger :: AttrLabelProxy "trigger"
shortcutTrigger = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Shortcut = ShortcutSignalList
type ShortcutSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method Shortcut::new
-- method type : Constructor
-- Args: [ Arg
--           { argCName = "trigger"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "ShortcutTrigger" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The trigger that will trigger the shortcut"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       , Arg
--           { argCName = "action"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "ShortcutAction" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The action that will be activated upon\n   triggering"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gtk" , name = "Shortcut" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_shortcut_new" gtk_shortcut_new :: 
    Ptr Gtk.ShortcutTrigger.ShortcutTrigger -> -- trigger : TInterface (Name {namespace = "Gtk", name = "ShortcutTrigger"})
    Ptr Gtk.ShortcutAction.ShortcutAction -> -- action : TInterface (Name {namespace = "Gtk", name = "ShortcutAction"})
    IO (Ptr Shortcut)

-- | Creates a new t'GI.Gtk.Objects.Shortcut.Shortcut' that is triggered by /@trigger@/ and then activates
-- /@action@/.
shortcutNew ::
    (B.CallStack.HasCallStack, MonadIO m, Gtk.ShortcutTrigger.IsShortcutTrigger a, Gtk.ShortcutAction.IsShortcutAction b) =>
    Maybe (a)
    -- ^ /@trigger@/: The trigger that will trigger the shortcut
    -> Maybe (b)
    -- ^ /@action@/: The action that will be activated upon
    --    triggering
    -> m Shortcut
    -- ^ __Returns:__ a new t'GI.Gtk.Objects.Shortcut.Shortcut'
shortcutNew :: Maybe a -> Maybe b -> m Shortcut
shortcutNew Maybe a
trigger Maybe b
action = IO Shortcut -> m Shortcut
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Shortcut -> m Shortcut) -> IO Shortcut -> m Shortcut
forall a b. (a -> b) -> a -> b
$ do
    Ptr ShortcutTrigger
maybeTrigger <- case Maybe a
trigger of
        Maybe a
Nothing -> Ptr ShortcutTrigger -> IO (Ptr ShortcutTrigger)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ShortcutTrigger
forall a. Ptr a
nullPtr
        Just a
jTrigger -> do
            Ptr ShortcutTrigger
jTrigger' <- a -> IO (Ptr ShortcutTrigger)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject a
jTrigger
            Ptr ShortcutTrigger -> IO (Ptr ShortcutTrigger)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ShortcutTrigger
jTrigger'
    Ptr ShortcutAction
maybeAction <- case Maybe b
action of
        Maybe b
Nothing -> Ptr ShortcutAction -> IO (Ptr ShortcutAction)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ShortcutAction
forall a. Ptr a
nullPtr
        Just b
jAction -> do
            Ptr ShortcutAction
jAction' <- b -> IO (Ptr ShortcutAction)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject b
jAction
            Ptr ShortcutAction -> IO (Ptr ShortcutAction)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ShortcutAction
jAction'
    Ptr Shortcut
result <- Ptr ShortcutTrigger -> Ptr ShortcutAction -> IO (Ptr Shortcut)
gtk_shortcut_new Ptr ShortcutTrigger
maybeTrigger Ptr ShortcutAction
maybeAction
    Text -> Ptr Shortcut -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"shortcutNew" Ptr Shortcut
result
    Shortcut
result' <- ((ManagedPtr Shortcut -> Shortcut) -> Ptr Shortcut -> IO Shortcut
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr Shortcut -> Shortcut
Shortcut) Ptr Shortcut
result
    Maybe a -> (a -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe a
trigger a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
action b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    Shortcut -> IO Shortcut
forall (m :: * -> *) a. Monad m => a -> m a
return Shortcut
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Shortcut::get_action
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Shortcut" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkShortcut" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gtk" , name = "ShortcutAction" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_shortcut_get_action" gtk_shortcut_get_action :: 
    Ptr Shortcut ->                         -- self : TInterface (Name {namespace = "Gtk", name = "Shortcut"})
    IO (Ptr Gtk.ShortcutAction.ShortcutAction)

-- | Gets the action that is activated by this shortcut.
shortcutGetAction ::
    (B.CallStack.HasCallStack, MonadIO m, IsShortcut a) =>
    a
    -- ^ /@self@/: a t'GI.Gtk.Objects.Shortcut.Shortcut'
    -> m Gtk.ShortcutAction.ShortcutAction
    -- ^ __Returns:__ the action
shortcutGetAction :: a -> m ShortcutAction
shortcutGetAction a
self = IO ShortcutAction -> m ShortcutAction
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ShortcutAction -> m ShortcutAction)
-> IO ShortcutAction -> m ShortcutAction
forall a b. (a -> b) -> a -> b
$ do
    Ptr Shortcut
self' <- a -> IO (Ptr Shortcut)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr ShortcutAction
result <- Ptr Shortcut -> IO (Ptr ShortcutAction)
gtk_shortcut_get_action Ptr Shortcut
self'
    Text -> Ptr ShortcutAction -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"shortcutGetAction" Ptr ShortcutAction
result
    ShortcutAction
result' <- ((ManagedPtr ShortcutAction -> ShortcutAction)
-> Ptr ShortcutAction -> IO ShortcutAction
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ShortcutAction -> ShortcutAction
Gtk.ShortcutAction.ShortcutAction) Ptr ShortcutAction
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    ShortcutAction -> IO ShortcutAction
forall (m :: * -> *) a. Monad m => a -> m a
return ShortcutAction
result'

#if defined(ENABLE_OVERLOADING)
data ShortcutGetActionMethodInfo
instance (signature ~ (m Gtk.ShortcutAction.ShortcutAction), MonadIO m, IsShortcut a) => O.MethodInfo ShortcutGetActionMethodInfo a signature where
    overloadedMethod = shortcutGetAction

#endif

-- method Shortcut::get_arguments
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Shortcut" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkShortcut" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just TVariant
-- throws : False
-- Skip return : False

foreign import ccall "gtk_shortcut_get_arguments" gtk_shortcut_get_arguments :: 
    Ptr Shortcut ->                         -- self : TInterface (Name {namespace = "Gtk", name = "Shortcut"})
    IO (Ptr GVariant)

-- | Gets the arguments that are passed when activating the shortcut.
shortcutGetArguments ::
    (B.CallStack.HasCallStack, MonadIO m, IsShortcut a) =>
    a
    -- ^ /@self@/: a t'GI.Gtk.Objects.Shortcut.Shortcut'
    -> m (Maybe GVariant)
    -- ^ __Returns:__ the arguments
shortcutGetArguments :: a -> m (Maybe GVariant)
shortcutGetArguments a
self = IO (Maybe GVariant) -> m (Maybe GVariant)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe GVariant) -> m (Maybe GVariant))
-> IO (Maybe GVariant) -> m (Maybe GVariant)
forall a b. (a -> b) -> a -> b
$ do
    Ptr Shortcut
self' <- a -> IO (Ptr Shortcut)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr GVariant
result <- Ptr Shortcut -> IO (Ptr GVariant)
gtk_shortcut_get_arguments Ptr Shortcut
self'
    Maybe GVariant
maybeResult <- Ptr GVariant
-> (Ptr GVariant -> IO GVariant) -> IO (Maybe GVariant)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
convertIfNonNull Ptr GVariant
result ((Ptr GVariant -> IO GVariant) -> IO (Maybe GVariant))
-> (Ptr GVariant -> IO GVariant) -> IO (Maybe GVariant)
forall a b. (a -> b) -> a -> b
$ \Ptr GVariant
result' -> do
        GVariant
result'' <- Ptr GVariant -> IO GVariant
B.GVariant.newGVariantFromPtr Ptr GVariant
result'
        GVariant -> IO GVariant
forall (m :: * -> *) a. Monad m => a -> m a
return GVariant
result''
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Maybe GVariant -> IO (Maybe GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe GVariant
maybeResult

#if defined(ENABLE_OVERLOADING)
data ShortcutGetArgumentsMethodInfo
instance (signature ~ (m (Maybe GVariant)), MonadIO m, IsShortcut a) => O.MethodInfo ShortcutGetArgumentsMethodInfo a signature where
    overloadedMethod = shortcutGetArguments

#endif

-- method Shortcut::get_trigger
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Shortcut" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkShortcut" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Gtk" , name = "ShortcutTrigger" })
-- throws : False
-- Skip return : False

foreign import ccall "gtk_shortcut_get_trigger" gtk_shortcut_get_trigger :: 
    Ptr Shortcut ->                         -- self : TInterface (Name {namespace = "Gtk", name = "Shortcut"})
    IO (Ptr Gtk.ShortcutTrigger.ShortcutTrigger)

-- | Gets the trigger used to trigger /@self@/.
shortcutGetTrigger ::
    (B.CallStack.HasCallStack, MonadIO m, IsShortcut a) =>
    a
    -- ^ /@self@/: a t'GI.Gtk.Objects.Shortcut.Shortcut'
    -> m Gtk.ShortcutTrigger.ShortcutTrigger
    -- ^ __Returns:__ the trigger used
shortcutGetTrigger :: a -> m ShortcutTrigger
shortcutGetTrigger a
self = IO ShortcutTrigger -> m ShortcutTrigger
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ShortcutTrigger -> m ShortcutTrigger)
-> IO ShortcutTrigger -> m ShortcutTrigger
forall a b. (a -> b) -> a -> b
$ do
    Ptr Shortcut
self' <- a -> IO (Ptr Shortcut)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr ShortcutTrigger
result <- Ptr Shortcut -> IO (Ptr ShortcutTrigger)
gtk_shortcut_get_trigger Ptr Shortcut
self'
    Text -> Ptr ShortcutTrigger -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"shortcutGetTrigger" Ptr ShortcutTrigger
result
    ShortcutTrigger
result' <- ((ManagedPtr ShortcutTrigger -> ShortcutTrigger)
-> Ptr ShortcutTrigger -> IO ShortcutTrigger
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr ShortcutTrigger -> ShortcutTrigger
Gtk.ShortcutTrigger.ShortcutTrigger) Ptr ShortcutTrigger
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    ShortcutTrigger -> IO ShortcutTrigger
forall (m :: * -> *) a. Monad m => a -> m a
return ShortcutTrigger
result'

#if defined(ENABLE_OVERLOADING)
data ShortcutGetTriggerMethodInfo
instance (signature ~ (m Gtk.ShortcutTrigger.ShortcutTrigger), MonadIO m, IsShortcut a) => O.MethodInfo ShortcutGetTriggerMethodInfo a signature where
    overloadedMethod = shortcutGetTrigger

#endif

-- method Shortcut::set_action
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Shortcut" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkShortcut" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "action"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "ShortcutAction" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The new action.\n    If the @action is %NULL, the nothing action will be used."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_shortcut_set_action" gtk_shortcut_set_action :: 
    Ptr Shortcut ->                         -- self : TInterface (Name {namespace = "Gtk", name = "Shortcut"})
    Ptr Gtk.ShortcutAction.ShortcutAction -> -- action : TInterface (Name {namespace = "Gtk", name = "ShortcutAction"})
    IO ()

-- | Sets the new action for /@self@/ to be /@action@/.
shortcutSetAction ::
    (B.CallStack.HasCallStack, MonadIO m, IsShortcut a, Gtk.ShortcutAction.IsShortcutAction b) =>
    a
    -- ^ /@self@/: a t'GI.Gtk.Objects.Shortcut.Shortcut'
    -> Maybe (b)
    -- ^ /@action@/: The new action.
    --     If the /@action@/ is 'P.Nothing', the nothing action will be used.
    -> m ()
shortcutSetAction :: a -> Maybe b -> m ()
shortcutSetAction a
self Maybe b
action = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Shortcut
self' <- a -> IO (Ptr Shortcut)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr ShortcutAction
maybeAction <- case Maybe b
action of
        Maybe b
Nothing -> Ptr ShortcutAction -> IO (Ptr ShortcutAction)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ShortcutAction
forall a. Ptr a
nullPtr
        Just b
jAction -> do
            Ptr ShortcutAction
jAction' <- b -> IO (Ptr ShortcutAction)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject b
jAction
            Ptr ShortcutAction -> IO (Ptr ShortcutAction)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ShortcutAction
jAction'
    Ptr Shortcut -> Ptr ShortcutAction -> IO ()
gtk_shortcut_set_action Ptr Shortcut
self' Ptr ShortcutAction
maybeAction
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
action b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ShortcutSetActionMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsShortcut a, Gtk.ShortcutAction.IsShortcutAction b) => O.MethodInfo ShortcutSetActionMethodInfo a signature where
    overloadedMethod = shortcutSetAction

#endif

-- method Shortcut::set_arguments
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Shortcut" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkShortcut" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "args"
--           , argType = TVariant
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "arguments to pass when activating @self"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_shortcut_set_arguments" gtk_shortcut_set_arguments :: 
    Ptr Shortcut ->                         -- self : TInterface (Name {namespace = "Gtk", name = "Shortcut"})
    Ptr GVariant ->                         -- args : TVariant
    IO ()

-- | Sets the arguments to pass when activating the shortcut.
shortcutSetArguments ::
    (B.CallStack.HasCallStack, MonadIO m, IsShortcut a) =>
    a
    -- ^ /@self@/: a t'GI.Gtk.Objects.Shortcut.Shortcut'
    -> Maybe (GVariant)
    -- ^ /@args@/: arguments to pass when activating /@self@/
    -> m ()
shortcutSetArguments :: a -> Maybe GVariant -> m ()
shortcutSetArguments a
self Maybe GVariant
args = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Shortcut
self' <- a -> IO (Ptr Shortcut)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr GVariant
maybeArgs <- case Maybe GVariant
args of
        Maybe GVariant
Nothing -> Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
forall a. Ptr a
nullPtr
        Just GVariant
jArgs -> do
            Ptr GVariant
jArgs' <- GVariant -> IO (Ptr GVariant)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr GVariant
jArgs
            Ptr GVariant -> IO (Ptr GVariant)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr GVariant
jArgs'
    Ptr Shortcut -> Ptr GVariant -> IO ()
gtk_shortcut_set_arguments Ptr Shortcut
self' Ptr GVariant
maybeArgs
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Maybe GVariant -> (GVariant -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe GVariant
args GVariant -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ShortcutSetArgumentsMethodInfo
instance (signature ~ (Maybe (GVariant) -> m ()), MonadIO m, IsShortcut a) => O.MethodInfo ShortcutSetArgumentsMethodInfo a signature where
    overloadedMethod = shortcutSetArguments

#endif

-- method Shortcut::set_trigger
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "self"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "Shortcut" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #GtkShortcut" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "trigger"
--           , argType =
--               TInterface Name { namespace = "Gtk" , name = "ShortcutTrigger" }
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just
--                       "The new trigger.\n    If the @trigger is %NULL, the never trigger will be used."
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferEverything
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "gtk_shortcut_set_trigger" gtk_shortcut_set_trigger :: 
    Ptr Shortcut ->                         -- self : TInterface (Name {namespace = "Gtk", name = "Shortcut"})
    Ptr Gtk.ShortcutTrigger.ShortcutTrigger -> -- trigger : TInterface (Name {namespace = "Gtk", name = "ShortcutTrigger"})
    IO ()

-- | Sets the new trigger for /@self@/ to be /@trigger@/.
shortcutSetTrigger ::
    (B.CallStack.HasCallStack, MonadIO m, IsShortcut a, Gtk.ShortcutTrigger.IsShortcutTrigger b) =>
    a
    -- ^ /@self@/: a t'GI.Gtk.Objects.Shortcut.Shortcut'
    -> Maybe (b)
    -- ^ /@trigger@/: The new trigger.
    --     If the /@trigger@/ is 'P.Nothing', the never trigger will be used.
    -> m ()
shortcutSetTrigger :: a -> Maybe b -> m ()
shortcutSetTrigger a
self Maybe b
trigger = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    Ptr Shortcut
self' <- a -> IO (Ptr Shortcut)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr ShortcutTrigger
maybeTrigger <- case Maybe b
trigger of
        Maybe b
Nothing -> Ptr ShortcutTrigger -> IO (Ptr ShortcutTrigger)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ShortcutTrigger
forall a. Ptr a
nullPtr
        Just b
jTrigger -> do
            Ptr ShortcutTrigger
jTrigger' <- b -> IO (Ptr ShortcutTrigger)
forall a b. (HasCallStack, GObject a) => a -> IO (Ptr b)
B.ManagedPtr.disownObject b
jTrigger
            Ptr ShortcutTrigger -> IO (Ptr ShortcutTrigger)
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ShortcutTrigger
jTrigger'
    Ptr Shortcut -> Ptr ShortcutTrigger -> IO ()
gtk_shortcut_set_trigger Ptr Shortcut
self' Ptr ShortcutTrigger
maybeTrigger
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    Maybe b -> (b -> IO ()) -> IO ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust Maybe b
trigger b -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr
    () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data ShortcutSetTriggerMethodInfo
instance (signature ~ (Maybe (b) -> m ()), MonadIO m, IsShortcut a, Gtk.ShortcutTrigger.IsShortcutTrigger b) => O.MethodInfo ShortcutSetTriggerMethodInfo a signature where
    overloadedMethod = shortcutSetTrigger

#endif