gi-gtk-3.0.24: Gtk bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.AccelGroup

Contents

Description

A AccelGroup represents a group of keyboard accelerators, typically attached to a toplevel Window (with windowAddAccelGroup). Usually you won’t need to create a AccelGroup directly; instead, when using UIManager, GTK+ automatically sets up the accelerators for your menus in the ui manager’s AccelGroup.

Note that “accelerators” are different from “mnemonics”. Accelerators are shortcuts for activating a menu item; they appear alongside the menu item they’re a shortcut for. For example “Ctrl+Q” might appear alongside the “Quit” menu item. Mnemonics are shortcuts for GUI elements such as text entries or buttons; they appear as underlined characters. See labelNewWithMnemonic. Menu items can have both accelerators and mnemonics, of course.

Synopsis

Exported types

newtype AccelGroup Source #

Memory-managed wrapper type.

Instances
GObject AccelGroup Source # 
Instance details

Defined in GI.Gtk.Objects.AccelGroup

IsObject AccelGroup Source # 
Instance details

Defined in GI.Gtk.Objects.AccelGroup

IsAccelGroup AccelGroup Source # 
Instance details

Defined in GI.Gtk.Objects.AccelGroup

class GObject o => IsAccelGroup o Source #

Type class for types which can be safely cast to AccelGroup, for instance with toAccelGroup.

toAccelGroup :: (MonadIO m, IsAccelGroup o) => o -> m AccelGroup Source #

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

Methods

activate

accelGroupActivate Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a, IsObject b) 
=> a

accelGroup: a AccelGroup

-> Word32

accelQuark: the quark for the accelerator name

-> b

acceleratable: the Object, usually a Window, on which to activate the accelerator

-> Word32

accelKey: accelerator keyval from a key event

-> [ModifierType]

accelMods: keyboard state mask from a key event

-> m Bool

Returns: True if an accelerator was activated and handled this keypress

Finds the first accelerator in accelGroup that matches accelKey and accelMods, and activates it.

connect

accelGroupConnect Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: the accelerator group to install an accelerator in

-> Word32

accelKey: key value of the accelerator

-> [ModifierType]

accelMods: modifier combination of the accelerator

-> [AccelFlags]

accelFlags: a flag mask to configure this accelerator

-> Closure

closure: closure to be executed upon accelerator activation

-> m () 

Installs an accelerator in this group. When accelGroup is being activated in response to a call to accelGroupsActivate, closure will be invoked if the accelKey and accelMods from accelGroupsActivate match those of this connection.

The signature used for the closure is that of AccelGroupActivate.

Note that, due to implementation details, a single closure can only be connected to one accelerator group.

connectByPath

accelGroupConnectByPath Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: the accelerator group to install an accelerator in

-> Text

accelPath: path used for determining key and modifiers

-> Closure

closure: closure to be executed upon accelerator activation

-> m () 

Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers (see accelMapAddEntry). When accelGroup is being activated in response to a call to accelGroupsActivate, closure will be invoked if the accelKey and accelMods from accelGroupsActivate match the key and modifiers for the path.

The signature used for the closure is that of AccelGroupActivate.

Note that accelPath string will be stored in a GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with internStaticString.

disconnect

accelGroupDisconnect Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: the accelerator group to remove an accelerator from

-> Maybe Closure

closure: the closure to remove from this accelerator group, or Nothing to remove all closures

-> m Bool

Returns: True if the closure was found and got disconnected

Removes an accelerator previously installed through accelGroupConnect.

Since 2.20 closure can be Nothing.

disconnectKey

accelGroupDisconnectKey Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: the accelerator group to install an accelerator in

-> Word32

accelKey: key value of the accelerator

-> [ModifierType]

accelMods: modifier combination of the accelerator

-> m Bool

Returns: True if there was an accelerator which could be removed, False otherwise

Removes an accelerator previously installed through accelGroupConnect.

find

accelGroupFind Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: a AccelGroup

-> AccelGroupFindFunc

findFunc: a function to filter the entries of accelGroup with

-> m AccelKey

Returns: the key of the first entry passing findFunc. The key is owned by GTK+ and must not be freed.

Finds the first entry in an accelerator group for which findFunc returns True and returns its AccelKey.

fromAccelClosure

accelGroupFromAccelClosure Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Closure

closure: a Closure

-> m (Maybe AccelGroup)

Returns: the AccelGroup to which closure is connected, or Nothing

Finds the AccelGroup to which closure is connected; see accelGroupConnect.

getIsLocked

accelGroupGetIsLocked Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: a AccelGroup

-> m Bool

Returns: True if there are 1 or more locks on the accelGroup, False otherwise.

Locks are added and removed using accelGroupLock and accelGroupUnlock.

Since: 2.14

getModifierMask

accelGroupGetModifierMask Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: a AccelGroup

-> m [ModifierType]

Returns: the modifier mask for this accel group.

Gets a ModifierType representing the mask for this accelGroup. For example, GDK_CONTROL_MASK, GDK_SHIFT_MASK, etc.

Since: 2.14

lock

accelGroupLock Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: a AccelGroup

-> m () 

Locks the given accelerator group.

Locking an acelerator group prevents the accelerators contained within it to be changed during runtime. Refer to accelMapChangeEntry about runtime accelerator changes.

If called more than once, accelGroup remains locked until accelGroupUnlock has been called an equivalent number of times.

new

accelGroupNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m AccelGroup

Returns: a new AccelGroup object

Creates a new AccelGroup.

query

accelGroupQuery Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: the accelerator group to query

-> Word32

accelKey: key value of the accelerator

-> [ModifierType]

accelMods: modifier combination of the accelerator

-> m (Maybe [AccelGroupEntry])

Returns: an array of nEntries AccelGroupEntry elements, or Nothing. The array is owned by GTK+ and must not be freed.

Queries an accelerator group for all entries matching accelKey and accelMods.

unlock

accelGroupUnlock Source #

Arguments

:: (HasCallStack, MonadIO m, IsAccelGroup a) 
=> a

accelGroup: a AccelGroup

-> m () 

Undoes the last call to accelGroupLock on this accelGroup.

Properties

isLocked

No description available in the introspection data.

getAccelGroupIsLocked :: (MonadIO m, IsAccelGroup o) => o -> m Bool Source #

Get the value of the “is-locked” property. When overloading is enabled, this is equivalent to

get accelGroup #isLocked

modifierMask

No description available in the introspection data.

getAccelGroupModifierMask :: (MonadIO m, IsAccelGroup o) => o -> m [ModifierType] Source #

Get the value of the “modifier-mask” property. When overloading is enabled, this is equivalent to

get accelGroup #modifierMask

Signals

accelActivate

type AccelGroupAccelActivateCallback Source #

Arguments

 = Object

acceleratable: the object on which the accelerator was activated

-> Word32

keyval: the accelerator keyval

-> [ModifierType]

modifier: the modifier combination of the accelerator

-> IO Bool

Returns: True if the accelerator was activated

The accel-activate signal is an implementation detail of AccelGroup and not meant to be used by applications.

type C_AccelGroupAccelActivateCallback = Ptr () -> Ptr Object -> Word32 -> CUInt -> Ptr () -> IO CInt Source #

Type for the callback on the (unwrapped) C side.

afterAccelGroupAccelActivate :: (IsAccelGroup a, MonadIO m) => a -> AccelGroupAccelActivateCallback -> m SignalHandlerId Source #

Connect a signal handler for the “accel-activate” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after accelGroup #accelActivate callback

onAccelGroupAccelActivate :: (IsAccelGroup a, MonadIO m) => a -> AccelGroupAccelActivateCallback -> m SignalHandlerId Source #

Connect a signal handler for the “accel-activate” signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on accelGroup #accelActivate callback

accelChanged

type AccelGroupAccelChangedCallback Source #

Arguments

 = Word32

keyval: the accelerator keyval

-> [ModifierType]

modifier: the modifier combination of the accelerator

-> Closure

accelClosure: the Closure of the accelerator

-> IO () 

The accel-changed signal is emitted when an entry is added to or removed from the accel group.

Widgets like AccelLabel which display an associated accelerator should connect to this signal, and rebuild their visual representation if the accelClosure is theirs.

type C_AccelGroupAccelChangedCallback = Ptr () -> Word32 -> CUInt -> Ptr Closure -> Ptr () -> IO () Source #

Type for the callback on the (unwrapped) C side.

afterAccelGroupAccelChanged :: (IsAccelGroup a, MonadIO m) => a -> AccelGroupAccelChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the “accel-changed” signal, to be run after the default handler. When overloading is enabled, this is equivalent to

after accelGroup #accelChanged callback

onAccelGroupAccelChanged :: (IsAccelGroup a, MonadIO m) => a -> AccelGroupAccelChangedCallback -> m SignalHandlerId Source #

Connect a signal handler for the “accel-changed” signal, to be run before the default handler. When overloading is enabled, this is equivalent to

on accelGroup #accelChanged callback