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 |
The AccelLabel
is a widget that shows an accelerator next to a description
of said accelerator, e.g. “Save Document Ctrl+S”.
It is commonly used in menus to show the keyboard short-cuts for commands.
The accelerator key to display is typically not set explicitly (although it
can be, with accelLabelSetAccel
). Instead, the AccelLabel
displays
the accelerators which have been added to a particular widget. This widget is
set by calling gtk_accel_label_set_accel_widget()
.
For example, a menu item may have an accelerator added to emit
the “activate” signal when the “Ctrl+S” key combination is pressed.
A AccelLabel
is created and added to the menu item widget, and
gtk_accel_label_set_accel_widget()
is called with the item as the
second argument. The AccelLabel
will now display “Ctrl+S” after its label.
Note that accel labels are typically set up automatically when menus are created.
A AccelLabel
will only display accelerators which have GTK_ACCEL_VISIBLE
set (see GtkAccelFlags
).
A AccelLabel
can display multiple accelerators and even signal names,
though it is almost always used to display just one accelerator key.
CSS nodes
plain code
accellabel ├── label ╰── accelerator
AccelLabel
has a main CSS node with the name accellabel.
It contains the two child nodes with name label and accelerator.
Synopsis
- newtype AccelLabel = AccelLabel (ManagedPtr AccelLabel)
- class (GObject o, IsDescendantOf AccelLabel o) => IsAccelLabel o
- toAccelLabel :: (MonadIO m, IsAccelLabel o) => o -> m AccelLabel
- accelLabelGetAccel :: (HasCallStack, MonadIO m, IsAccelLabel a) => a -> m (Word32, [ModifierType])
- accelLabelGetAccelWidth :: (HasCallStack, MonadIO m, IsAccelLabel a) => a -> m Word32
- accelLabelGetLabel :: (HasCallStack, MonadIO m, IsAccelLabel a) => a -> m Text
- accelLabelGetUseUnderline :: (HasCallStack, MonadIO m, IsAccelLabel a) => a -> m Bool
- accelLabelNew :: (HasCallStack, MonadIO m) => Text -> m AccelLabel
- accelLabelRefetch :: (HasCallStack, MonadIO m, IsAccelLabel a) => a -> m Bool
- accelLabelSetAccel :: (HasCallStack, MonadIO m, IsAccelLabel a) => a -> Word32 -> [ModifierType] -> m ()
- accelLabelSetLabel :: (HasCallStack, MonadIO m, IsAccelLabel a) => a -> Text -> m ()
- accelLabelSetUseUnderline :: (HasCallStack, MonadIO m, IsAccelLabel a) => a -> Bool -> m ()
- constructAccelLabelLabel :: (IsAccelLabel o, MonadIO m) => Text -> m (GValueConstruct o)
- getAccelLabelLabel :: (MonadIO m, IsAccelLabel o) => o -> m Text
- setAccelLabelLabel :: (MonadIO m, IsAccelLabel o) => o -> Text -> m ()
- constructAccelLabelUseUnderline :: (IsAccelLabel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getAccelLabelUseUnderline :: (MonadIO m, IsAccelLabel o) => o -> m Bool
- setAccelLabelUseUnderline :: (MonadIO m, IsAccelLabel o) => o -> Bool -> m ()
Exported types
newtype AccelLabel Source #
Memory-managed wrapper type.
Instances
Eq AccelLabel Source # | |
Defined in GI.Gtk.Objects.AccelLabel (==) :: AccelLabel -> AccelLabel -> Bool # (/=) :: AccelLabel -> AccelLabel -> Bool # | |
IsGValue AccelLabel Source # | Convert |
Defined in GI.Gtk.Objects.AccelLabel toGValue :: AccelLabel -> IO GValue # fromGValue :: GValue -> IO AccelLabel # | |
ManagedPtrNewtype AccelLabel Source # | |
Defined in GI.Gtk.Objects.AccelLabel | |
TypedObject AccelLabel Source # | |
Defined in GI.Gtk.Objects.AccelLabel | |
GObject AccelLabel Source # | |
Defined in GI.Gtk.Objects.AccelLabel | |
HasParentTypes AccelLabel Source # | |
Defined in GI.Gtk.Objects.AccelLabel | |
type ParentTypes AccelLabel Source # | |
Defined in GI.Gtk.Objects.AccelLabel |
class (GObject o, IsDescendantOf AccelLabel o) => IsAccelLabel o Source #
Type class for types which can be safely cast to AccelLabel
, for instance with toAccelLabel
.
Instances
(GObject o, IsDescendantOf AccelLabel o) => IsAccelLabel o Source # | |
Defined in GI.Gtk.Objects.AccelLabel |
toAccelLabel :: (MonadIO m, IsAccelLabel o) => o -> m AccelLabel Source #
Cast to AccelLabel
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Overloaded methods
getAccel
:: (HasCallStack, MonadIO m, IsAccelLabel a) | |
=> a |
|
-> m (Word32, [ModifierType]) |
Gets the keyval and modifier mask set with
accelLabelSetAccel
.
getAccelWidth
accelLabelGetAccelWidth Source #
:: (HasCallStack, MonadIO m, IsAccelLabel a) | |
=> a |
|
-> m Word32 | Returns: the width needed to display the accelerator key(s). |
Returns the width needed to display the accelerator key(s). This is used by menus to align all of the menu item widgets, and shouldn't be needed by applications.
getLabel
:: (HasCallStack, MonadIO m, IsAccelLabel a) | |
=> a |
|
-> m Text | Returns: |
Returns the current label, set via accelLabelSetLabel
getUseUnderline
accelLabelGetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsAccelLabel a) | |
=> a |
|
-> m Bool | Returns: whether the accel label uses mnemonic underlines |
Returns whether the accel label interprets underscores in it's
label property as mnemonic indicators.
See accelLabelSetUseUnderline
and labelSetUseUnderline
;
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> m AccelLabel | Returns: a new |
Creates a new AccelLabel
.
refetch
:: (HasCallStack, MonadIO m, IsAccelLabel a) | |
=> a |
|
-> m Bool | Returns: always returns |
Recreates the string representing the accelerator keys. This should not be needed since the string is automatically updated whenever accelerators are added or removed from the associated widget.
setAccel
:: (HasCallStack, MonadIO m, IsAccelLabel a) | |
=> a |
|
-> Word32 |
|
-> [ModifierType] |
|
-> m () |
Manually sets a keyval and modifier mask as the accelerator rendered
by accelLabel
.
If a keyval and modifier are explicitly set then these values are used regardless of any associated accel closure or widget.
Providing an acceleratorKey
of 0 removes the manual setting.
setLabel
:: (HasCallStack, MonadIO m, IsAccelLabel a) | |
=> a |
|
-> Text |
|
-> m () |
Sets the label part of the accel label.
setUseUnderline
accelLabelSetUseUnderline Source #
:: (HasCallStack, MonadIO m, IsAccelLabel a) | |
=> a |
|
-> Bool |
|
-> m () |
Controls whether to interpret underscores in the text label of accelLabel
as mnemonic indicators. See also labelSetUseUnderline
Properties
label
No description available in the introspection data.
constructAccelLabelLabel :: (IsAccelLabel o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “label
” property. This is rarely needed directly, but it is used by new
.
getAccelLabelLabel :: (MonadIO m, IsAccelLabel o) => o -> m Text Source #
Get the value of the “label
” property.
When overloading is enabled, this is equivalent to
get
accelLabel #label
setAccelLabelLabel :: (MonadIO m, IsAccelLabel o) => o -> Text -> m () Source #
Set the value of the “label
” property.
When overloading is enabled, this is equivalent to
set
accelLabel [ #label:=
value ]
useUnderline
No description available in the introspection data.
constructAccelLabelUseUnderline :: (IsAccelLabel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-underline
” property. This is rarely needed directly, but it is used by new
.
getAccelLabelUseUnderline :: (MonadIO m, IsAccelLabel o) => o -> m Bool Source #
Get the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
get
accelLabel #useUnderline
setAccelLabelUseUnderline :: (MonadIO m, IsAccelLabel o) => o -> Bool -> m () Source #
Set the value of the “use-underline
” property.
When overloading is enabled, this is equivalent to
set
accelLabel [ #useUnderline:=
value ]