gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.Shortcut

Contents

- Exported types
- Methods
  - getAction
  - getArguments
  - getTrigger
  - new
  - setAction
  - setArguments
  - setTrigger
- Properties
  - action
  - arguments
  - trigger

Description

Describes a keyboard shortcut.

It contains a description of how to trigger the shortcut via a `ShortcutTrigger` and a way to activate the shortcut on a widget via a `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 `GtkWidget`s that make it easier to use shortcuts in GTK.

`GtkShortcut` 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 (Maybe ShortcutAction)
- shortcutGetArguments :: (HasCallStack, MonadIO m, IsShortcut a) => a -> m (Maybe GVariant)
- shortcutGetTrigger :: (HasCallStack, MonadIO m, IsShortcut a) => a -> m (Maybe 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 (Maybe 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 (Maybe ShortcutTrigger)
- setShortcutTrigger :: (MonadIO m, IsShortcut o, IsShortcutTrigger a) => o -> a -> m ()

# Exported types

newtype Shortcut Source #

Memory-managed wrapper type.

Constructors

Shortcut (ManagedPtr Shortcut) |

#### Instances

Instances details

Eq Shortcut Source # |
Instance details Defined in GI.Gtk.Objects.Shortcut Methods (==) :: Shortcut -> Shortcut -> Bool Source # (/=) :: Shortcut -> Shortcut -> Bool Source #
GObject Shortcut Source # |
Instance details Defined in GI.Gtk.Objects.Shortcut
ManagedPtrNewtype Shortcut Source # |
Instance details Defined in GI.Gtk.Objects.Shortcut Methods toManagedPtr :: Shortcut -> ManagedPtr Shortcut Source #
TypedObject Shortcut Source # |
Instance details Defined in GI.Gtk.Objects.Shortcut Methods glibType :: IO GType Source #
HasParentTypes Shortcut Source # |
Instance details Defined in GI.Gtk.Objects.Shortcut
IsGValue (Maybe Shortcut) Source # | Convert `Shortcut` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.Shortcut Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe Shortcut -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe Shortcut) Source #
type ParentTypes Shortcut Source # |
Instance details Defined in GI.Gtk.Objects.Shortcut type ParentTypes Shortcut = '[Object]

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

Instances details

(GObject o, IsDescendantOf Shortcut o) => IsShortcut o Source # |
Instance details Defined in GI.Gtk.Objects.Shortcut

toShortcut :: (MonadIO m, IsShortcut o) => o -> m Shortcut Source #

Cast to `Shortcut`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getAction, getArguments, getData, getProperty, getQdata, getTrigger.

#### Setters

setAction, setArguments, setData, setDataFull, setProperty, setTrigger.

## getAction

shortcutGetAction Source #

Arguments

:: (HasCallStack, MonadIO m, IsShortcut a) |
=> a | `self`: a `GtkShortcut`
-> m (Maybe ShortcutAction) | Returns: the action

Gets the action that is activated by this shortcut.

## getArguments

shortcutGetArguments Source #

Arguments

:: (HasCallStack, MonadIO m, IsShortcut a) |
=> a | `self`: a `GtkShortcut`
-> m (Maybe GVariant) | Returns: the arguments

Gets the arguments that are passed when activating the shortcut.

## getTrigger

shortcutGetTrigger Source #

Arguments

:: (HasCallStack, MonadIO m, IsShortcut a) |
=> a | `self`: a `GtkShortcut`
-> m (Maybe ShortcutTrigger) | Returns: the trigger used

Gets the trigger used to trigger `self`.

## new

shortcutNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsShortcutTrigger a, 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 `GtkShortcut`

Creates a new `GtkShortcut` that is triggered by `trigger` and then activates `action`.

## setAction

shortcutSetAction Source #

Arguments

:: (HasCallStack, MonadIO m, IsShortcut a, IsShortcutAction b) |
=> a | `self`: a `GtkShortcut`
-> Maybe b | `action`: The new action. If the `action` is `Nothing`, the nothing action will be used.
-> m () |

Sets the new action for `self` to be `action`.

## setArguments

shortcutSetArguments Source #

Arguments

:: (HasCallStack, MonadIO m, IsShortcut a) |
=> a | `self`: a `GtkShortcut`
-> Maybe GVariant | `args`: arguments to pass when activating `self`
-> m () |

Sets the arguments to pass when activating the shortcut.

## setTrigger

shortcutSetTrigger Source #

Arguments

:: (HasCallStack, MonadIO m, IsShortcut a, IsShortcutTrigger b) |
=> a | `self`: a `GtkShortcut`
-> Maybe b | `trigger`: The new trigger. If the `trigger` is `Nothing`, the never trigger will be used.
-> 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 (Maybe 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 (Maybe 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 ]