gi-gtk-4.0.2: Gtk bindings
CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.AccelLabel

Description

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

Exported types

newtype AccelLabel Source #

Memory-managed wrapper type.

Instances

Instances details
Eq AccelLabel Source # 
Instance details

Defined in GI.Gtk.Objects.AccelLabel

IsGValue AccelLabel Source #

Convert AccelLabel to and from GValue with toGValue and fromGValue.

Instance details

Defined in GI.Gtk.Objects.AccelLabel

ManagedPtrNewtype AccelLabel Source # 
Instance details

Defined in GI.Gtk.Objects.AccelLabel

TypedObject AccelLabel Source # 
Instance details

Defined in GI.Gtk.Objects.AccelLabel

Methods

glibType :: IO GType #

GObject AccelLabel Source # 
Instance details

Defined in GI.Gtk.Objects.AccelLabel

HasParentTypes AccelLabel Source # 
Instance details

Defined in GI.Gtk.Objects.AccelLabel

type ParentTypes AccelLabel Source # 
Instance details

Defined in GI.Gtk.Objects.AccelLabel

type ParentTypes AccelLabel = '[Widget, Object, ImplementorIface, Buildable, ConstraintTarget]

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

Instances details
(GObject o, IsDescendantOf AccelLabel o) => IsAccelLabel o Source # 
Instance details

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

accelLabelGetAccel Source #

Arguments

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

accelLabel: a AccelLabel

-> m (Word32, [ModifierType]) 

Gets the keyval and modifier mask set with accelLabelSetAccel.

getAccelWidth

accelLabelGetAccelWidth Source #

Arguments

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

accelLabel: a AccelLabel.

-> 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

accelLabelGetLabel Source #

Arguments

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

accelLabel: a AccelLabel

-> m Text

Returns: accelLabel's label

Returns the current label, set via accelLabelSetLabel

getUseUnderline

accelLabelGetUseUnderline Source #

Arguments

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

accelLabel: a AccelLabel

-> 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

accelLabelNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

string: the label string. Must be non-Nothing.

-> m AccelLabel

Returns: a new AccelLabel.

Creates a new AccelLabel.

refetch

accelLabelRefetch Source #

Arguments

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

accelLabel: a AccelLabel.

-> m Bool

Returns: always returns False.

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

accelLabelSetAccel Source #

Arguments

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

accelLabel: a AccelLabel

-> Word32

acceleratorKey: a keyval, or 0

-> [ModifierType]

acceleratorMods: the modifier mask for the accel

-> 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

accelLabelSetLabel Source #

Arguments

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

accelLabel: a AccelLabel

-> Text

text: The new label text

-> m () 

Sets the label part of the accel label.

setUseUnderline

accelLabelSetUseUnderline Source #

Arguments

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

accelLabel: a AccelLabel

-> Bool

setting: Whether to use underlines in the label or not

-> 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 ]