Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GtkShortcut is the low level object used for managing keyboard shortcuts.
It contains a description of how to trigger the shortcut via a
ShortcutTrigger
and a way to activate the shortcut on a widget
via ShortcutAction
.
The actual work is usually done via 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.
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.
Synopsis
- newtype Shortcut = Shortcut (ManagedPtr Shortcut)
- class (GObject o, IsDescendantOf Shortcut o) => IsShortcut o
- toShortcut :: (MonadIO m, IsShortcut o) => o -> m Shortcut
- shortcutGetAction :: (HasCallStack, MonadIO m, IsShortcut a) => a -> m ShortcutAction
- shortcutGetArguments :: (HasCallStack, MonadIO m, IsShortcut a) => a -> m (Maybe GVariant)
- shortcutGetTrigger :: (HasCallStack, MonadIO m, IsShortcut a) => a -> m ShortcutTrigger
- shortcutNew :: (HasCallStack, MonadIO m, IsShortcutTrigger a, IsShortcutAction b) => Maybe a -> Maybe b -> m Shortcut
- shortcutSetAction :: (HasCallStack, MonadIO m, IsShortcut a, IsShortcutAction b) => a -> Maybe b -> m ()
- shortcutSetArguments :: (HasCallStack, MonadIO m, IsShortcut a) => a -> Maybe GVariant -> m ()
- shortcutSetTrigger :: (HasCallStack, MonadIO m, IsShortcut a, IsShortcutTrigger b) => a -> Maybe b -> m ()
- clearShortcutAction :: (MonadIO m, IsShortcut o) => o -> m ()
- constructShortcutAction :: (IsShortcut o, MonadIO m, IsShortcutAction a) => a -> m (GValueConstruct o)
- getShortcutAction :: (MonadIO m, IsShortcut o) => o -> m ShortcutAction
- setShortcutAction :: (MonadIO m, IsShortcut o, IsShortcutAction a) => o -> a -> m ()
- clearShortcutArguments :: (MonadIO m, IsShortcut o) => o -> m ()
- constructShortcutArguments :: (IsShortcut o, MonadIO m) => GVariant -> m (GValueConstruct o)
- getShortcutArguments :: (MonadIO m, IsShortcut o) => o -> m (Maybe GVariant)
- setShortcutArguments :: (MonadIO m, IsShortcut o) => o -> GVariant -> m ()
- clearShortcutTrigger :: (MonadIO m, IsShortcut o) => o -> m ()
- constructShortcutTrigger :: (IsShortcut o, MonadIO m, IsShortcutTrigger a) => a -> m (GValueConstruct o)
- getShortcutTrigger :: (MonadIO m, IsShortcut o) => o -> m ShortcutTrigger
- setShortcutTrigger :: (MonadIO m, IsShortcut o, IsShortcutTrigger a) => o -> a -> m ()
Exported types
Memory-managed wrapper type.
Instances
Eq Shortcut Source # | |
IsGValue Shortcut Source # | Convert |
ManagedPtrNewtype Shortcut Source # | |
Defined in GI.Gtk.Objects.Shortcut toManagedPtr :: Shortcut -> ManagedPtr Shortcut # | |
TypedObject Shortcut Source # | |
Defined in GI.Gtk.Objects.Shortcut | |
GObject Shortcut Source # | |
Defined in GI.Gtk.Objects.Shortcut | |
HasParentTypes Shortcut Source # | |
Defined in GI.Gtk.Objects.Shortcut | |
type ParentTypes Shortcut Source # | |
Defined in GI.Gtk.Objects.Shortcut |
class (GObject o, IsDescendantOf Shortcut o) => IsShortcut o Source #
Type class for types which can be safely cast to Shortcut
, for instance with toShortcut
.
Instances
(GObject o, IsDescendantOf Shortcut o) => IsShortcut o Source # | |
Defined in GI.Gtk.Objects.Shortcut |
toShortcut :: (MonadIO m, IsShortcut o) => o -> m Shortcut Source #
Methods
Overloaded methods
getAction
:: (HasCallStack, MonadIO m, IsShortcut a) | |
=> a |
|
-> m ShortcutAction | Returns: the action |
Gets the action that is activated by this shortcut.
getArguments
:: (HasCallStack, MonadIO m, IsShortcut a) | |
=> a |
|
-> m (Maybe GVariant) | Returns: the arguments |
Gets the arguments that are passed when activating the shortcut.
getTrigger
:: (HasCallStack, MonadIO m, IsShortcut a) | |
=> a |
|
-> m ShortcutTrigger | Returns: the trigger used |
Gets the trigger used to trigger self
.
new
:: (HasCallStack, MonadIO m, IsShortcutTrigger a, IsShortcutAction b) | |
=> Maybe a |
|
-> Maybe b |
|
-> m Shortcut | Returns: a new |
Creates a new Shortcut
that is triggered by trigger
and then activates
action
.
setAction
:: (HasCallStack, MonadIO m, IsShortcut a, IsShortcutAction b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the new action for self
to be action
.
setArguments
:: (HasCallStack, MonadIO m, IsShortcut a) | |
=> a |
|
-> Maybe GVariant |
|
-> m () |
Sets the arguments to pass when activating the shortcut.
setTrigger
:: (HasCallStack, MonadIO m, IsShortcut a, IsShortcutTrigger b) | |
=> a |
|
-> Maybe b |
|
-> m () |
Sets the new trigger for self
to be trigger
.
Properties
action
The action that gets activated by this shortcut.
clearShortcutAction :: (MonadIO m, IsShortcut o) => o -> m () Source #
Set the value of the “action
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#action
constructShortcutAction :: (IsShortcut o, MonadIO m, IsShortcutAction a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “action
” property. This is rarely needed directly, but it is used by new
.
getShortcutAction :: (MonadIO m, IsShortcut o) => o -> m ShortcutAction Source #
Get the value of the “action
” property.
When overloading is enabled, this is equivalent to
get
shortcut #action
setShortcutAction :: (MonadIO m, IsShortcut o, IsShortcutAction a) => o -> a -> m () Source #
Set the value of the “action
” property.
When overloading is enabled, this is equivalent to
set
shortcut [ #action:=
value ]
arguments
Arguments passed to activation.
clearShortcutArguments :: (MonadIO m, IsShortcut o) => o -> m () Source #
Set the value of the “arguments
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#arguments
constructShortcutArguments :: (IsShortcut o, MonadIO m) => GVariant -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “arguments
” property. This is rarely needed directly, but it is used by new
.
getShortcutArguments :: (MonadIO m, IsShortcut o) => o -> m (Maybe GVariant) Source #
Get the value of the “arguments
” property.
When overloading is enabled, this is equivalent to
get
shortcut #arguments
setShortcutArguments :: (MonadIO m, IsShortcut o) => o -> GVariant -> m () Source #
Set the value of the “arguments
” property.
When overloading is enabled, this is equivalent to
set
shortcut [ #arguments:=
value ]
trigger
The trigger that triggers this shortcut.
clearShortcutTrigger :: (MonadIO m, IsShortcut o) => o -> m () Source #
Set the value of the “trigger
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#trigger
constructShortcutTrigger :: (IsShortcut o, MonadIO m, IsShortcutTrigger a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “trigger
” property. This is rarely needed directly, but it is used by new
.
getShortcutTrigger :: (MonadIO m, IsShortcut o) => o -> m ShortcutTrigger Source #
Get the value of the “trigger
” property.
When overloading is enabled, this is equivalent to
get
shortcut #trigger
setShortcutTrigger :: (MonadIO m, IsShortcut o, IsShortcutTrigger a) => o -> a -> m () Source #
Set the value of the “trigger
” property.
When overloading is enabled, this is equivalent to
set
shortcut [ #trigger:=
value ]