Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
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
- newtype AccelGroup = AccelGroup (ManagedPtr AccelGroup)
- class GObject o => IsAccelGroup o
- toAccelGroup :: (MonadIO m, IsAccelGroup o) => o -> m AccelGroup
- noAccelGroup :: Maybe AccelGroup
- accelGroupActivate :: (HasCallStack, MonadIO m, IsAccelGroup a, IsObject b) => a -> Word32 -> b -> Word32 -> [ModifierType] -> m Bool
- accelGroupConnect :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> Word32 -> [ModifierType] -> [AccelFlags] -> Closure -> m ()
- accelGroupConnectByPath :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> Text -> Closure -> m ()
- accelGroupDisconnect :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> Maybe Closure -> m Bool
- accelGroupDisconnectKey :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> Word32 -> [ModifierType] -> m Bool
- accelGroupFind :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> AccelGroupFindFunc -> m AccelKey
- accelGroupFromAccelClosure :: (HasCallStack, MonadIO m) => Closure -> m (Maybe AccelGroup)
- accelGroupGetIsLocked :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> m Bool
- accelGroupGetModifierMask :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> m [ModifierType]
- accelGroupLock :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> m ()
- accelGroupNew :: (HasCallStack, MonadIO m) => m AccelGroup
- accelGroupQuery :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> Word32 -> [ModifierType] -> m (Maybe [AccelGroupEntry])
- accelGroupUnlock :: (HasCallStack, MonadIO m, IsAccelGroup a) => a -> m ()
- getAccelGroupIsLocked :: (MonadIO m, IsAccelGroup o) => o -> m Bool
- getAccelGroupModifierMask :: (MonadIO m, IsAccelGroup o) => o -> m [ModifierType]
- type AccelGroupAccelActivateCallback = Object -> Word32 -> [ModifierType] -> IO Bool
- type C_AccelGroupAccelActivateCallback = Ptr () -> Ptr Object -> Word32 -> CUInt -> Ptr () -> IO CInt
- afterAccelGroupAccelActivate :: (IsAccelGroup a, MonadIO m) => a -> AccelGroupAccelActivateCallback -> m SignalHandlerId
- genClosure_AccelGroupAccelActivate :: AccelGroupAccelActivateCallback -> IO Closure
- mk_AccelGroupAccelActivateCallback :: C_AccelGroupAccelActivateCallback -> IO (FunPtr C_AccelGroupAccelActivateCallback)
- noAccelGroupAccelActivateCallback :: Maybe AccelGroupAccelActivateCallback
- onAccelGroupAccelActivate :: (IsAccelGroup a, MonadIO m) => a -> AccelGroupAccelActivateCallback -> m SignalHandlerId
- wrap_AccelGroupAccelActivateCallback :: AccelGroupAccelActivateCallback -> C_AccelGroupAccelActivateCallback
- type AccelGroupAccelChangedCallback = Word32 -> [ModifierType] -> Closure -> IO ()
- type C_AccelGroupAccelChangedCallback = Ptr () -> Word32 -> CUInt -> Ptr Closure -> Ptr () -> IO ()
- afterAccelGroupAccelChanged :: (IsAccelGroup a, MonadIO m) => a -> AccelGroupAccelChangedCallback -> m SignalHandlerId
- genClosure_AccelGroupAccelChanged :: AccelGroupAccelChangedCallback -> IO Closure
- mk_AccelGroupAccelChangedCallback :: C_AccelGroupAccelChangedCallback -> IO (FunPtr C_AccelGroupAccelChangedCallback)
- noAccelGroupAccelChangedCallback :: Maybe AccelGroupAccelChangedCallback
- onAccelGroupAccelChanged :: (IsAccelGroup a, MonadIO m) => a -> AccelGroupAccelChangedCallback -> m SignalHandlerId
- wrap_AccelGroupAccelChangedCallback :: AccelGroupAccelChangedCallback -> C_AccelGroupAccelChangedCallback
Exported types
newtype AccelGroup Source #
Memory-managed wrapper type.
Instances
GObject AccelGroup Source # | |
Defined in GI.Gtk.Objects.AccelGroup gobjectType :: AccelGroup -> IO GType # | |
IsObject AccelGroup Source # | |
Defined in GI.Gtk.Objects.AccelGroup | |
IsAccelGroup AccelGroup Source # | |
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
.
Instances
(GObject a, (UnknownAncestorError AccelGroup a :: Constraint)) => IsAccelGroup a Source # | |
Defined in GI.Gtk.Objects.AccelGroup | |
IsAccelGroup AccelGroup Source # | |
Defined in GI.Gtk.Objects.AccelGroup |
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
.
noAccelGroup :: Maybe AccelGroup Source #
A convenience alias for Nothing
:: Maybe
AccelGroup
.
Methods
activate
:: (HasCallStack, MonadIO m, IsAccelGroup a, IsObject b) | |
=> a |
|
-> Word32 |
|
-> b |
|
-> Word32 |
|
-> [ModifierType] |
|
-> m Bool | Returns: |
Finds the first accelerator in accelGroup
that matches
accelKey
and accelMods
, and activates it.
connect
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> Word32 |
|
-> [ModifierType] |
|
-> [AccelFlags] |
|
-> Closure |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> Text |
|
-> Closure |
|
-> 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
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> Maybe Closure |
|
-> m Bool | Returns: |
Removes an accelerator previously installed through
accelGroupConnect
.
Since 2.20 closure
can be Nothing
.
disconnectKey
accelGroupDisconnectKey Source #
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> Word32 |
|
-> [ModifierType] |
|
-> m Bool | Returns: |
Removes an accelerator previously installed through
accelGroupConnect
.
find
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> AccelGroupFindFunc |
|
-> m AccelKey | Returns: the key of the first entry passing
|
fromAccelClosure
accelGroupFromAccelClosure Source #
:: (HasCallStack, MonadIO m) | |
=> Closure |
|
-> m (Maybe AccelGroup) | Returns: the |
Finds the AccelGroup
to which closure
is connected;
see accelGroupConnect
.
getIsLocked
accelGroupGetIsLocked Source #
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> m Bool | Returns: |
Locks are added and removed using accelGroupLock
and
accelGroupUnlock
.
Since: 2.14
getModifierMask
accelGroupGetModifierMask Source #
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> 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
:: (HasCallStack, MonadIO m) | |
=> m AccelGroup | Returns: a new |
Creates a new AccelGroup
.
query
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> Word32 |
|
-> [ModifierType] |
|
-> m (Maybe [AccelGroupEntry]) | Returns: an array of
|
Queries an accelerator group for all entries matching accelKey
and accelMods
.
unlock
:: (HasCallStack, MonadIO m, IsAccelGroup a) | |
=> a |
|
-> 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 #
= Object |
|
-> Word32 |
|
-> [ModifierType] |
|
-> IO Bool | Returns: |
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
genClosure_AccelGroupAccelActivate :: AccelGroupAccelActivateCallback -> IO Closure Source #
Wrap the callback into a Closure
.
mk_AccelGroupAccelActivateCallback :: C_AccelGroupAccelActivateCallback -> IO (FunPtr C_AccelGroupAccelActivateCallback) Source #
Generate a function pointer callable from C code, from a C_AccelGroupAccelActivateCallback
.
noAccelGroupAccelActivateCallback :: Maybe AccelGroupAccelActivateCallback Source #
A convenience synonym for
.Nothing
:: Maybe
AccelGroupAccelActivateCallback
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
wrap_AccelGroupAccelActivateCallback :: AccelGroupAccelActivateCallback -> C_AccelGroupAccelActivateCallback Source #
Wrap a AccelGroupAccelActivateCallback
into a C_AccelGroupAccelActivateCallback
.
accelChanged
type AccelGroupAccelChangedCallback Source #
= Word32 |
|
-> [ModifierType] |
|
-> Closure |
|
-> 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
genClosure_AccelGroupAccelChanged :: AccelGroupAccelChangedCallback -> IO Closure Source #
Wrap the callback into a Closure
.
mk_AccelGroupAccelChangedCallback :: C_AccelGroupAccelChangedCallback -> IO (FunPtr C_AccelGroupAccelChangedCallback) Source #
Generate a function pointer callable from C code, from a C_AccelGroupAccelChangedCallback
.
noAccelGroupAccelChangedCallback :: Maybe AccelGroupAccelChangedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
AccelGroupAccelChangedCallback
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