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

Contents

- Exported types
- Methods
  - getEditing
  - new
  - startEditing
  - stopEditing
- Properties
  - editing

Description

Allows users to edit the displayed text by switching to an “edit mode”.

<picture> <source srcset="editable-label-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkEditableLabel" src="editable-label.png"> </picture>

`GtkEditableLabel` does not have API of its own, but it implements the `Editable` interface.

The default bindings for activating the edit mode is to click or press the Enter key. The default bindings for leaving the edit mode are the Enter key (to save the results) or the Escape key (to cancel the editing).

# Shortcuts and Gestures

`GtkEditableLabel` supports the following keyboard shortcuts:

- <kbd>Enter</kbd> starts editing.
- <kbd>Escape</kbd> stops editing.

# Actions

`GtkEditableLabel` defines a set of built-in actions:

- `editing.starts` switches the widget into editing mode.
- `editing.stop` switches the widget out of editing mode.

# CSS nodes

    editablelabel[.editing]
    ╰── stack
        ├── label
        ╰── text

`GtkEditableLabel` has a main node with the name editablelabel. When the entry is in editing mode, it gets the .editing style class.

For all the subnodes added to the text node in various situations, see `Text`.

Synopsis

- newtype EditableLabel = EditableLabel (ManagedPtr EditableLabel)
- class (GObject o, IsDescendantOf EditableLabel o) => IsEditableLabel o
- toEditableLabel :: (MonadIO m, IsEditableLabel o) => o -> m EditableLabel
- editableLabelGetEditing :: (HasCallStack, MonadIO m, IsEditableLabel a) => a -> m Bool
- editableLabelNew :: (HasCallStack, MonadIO m) => Text -> m EditableLabel
- editableLabelStartEditing :: (HasCallStack, MonadIO m, IsEditableLabel a) => a -> m ()
- editableLabelStopEditing :: (HasCallStack, MonadIO m, IsEditableLabel a) => a -> Bool -> m ()
- constructEditableLabelEditing :: (IsEditableLabel o, MonadIO m) => Bool -> m (GValueConstruct o)
- getEditableLabelEditing :: (MonadIO m, IsEditableLabel o) => o -> m Bool
- setEditableLabelEditing :: (MonadIO m, IsEditableLabel o) => o -> Bool -> m ()

# Exported types

newtype EditableLabel Source #

Memory-managed wrapper type.

Constructors

EditableLabel (ManagedPtr EditableLabel) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf EditableLabel o) => IsEditableLabel o Source #

Type class for types which can be safely cast to `EditableLabel`, for instance with `toEditableLabel`.

#### Instances

Instances details

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

toEditableLabel :: (MonadIO m, IsEditableLabel o) => o -> m EditableLabel Source #

Cast to `EditableLabel`, 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

actionSetEnabled, activate, activateAction, activateDefault, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, announce, bindProperty, bindPropertyFull, childFocus, computeBounds, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, delegateGetAccessiblePlatformState, deleteSelection, deleteText, disposeTemplate, dragCheckThreshold, errorBell, finishDelegate, forceFloating, freezeNotify, getv, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initDelegate, initTemplate, insertActionGroup, insertAfter, insertBefore, insertText, isAncestor, isDrawable, isFloating, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, notify, notifyByPspec, observeChildren, observeControllers, pick, queueAllocate, queueDraw, queueResize, realize, ref, refSink, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, resetProperty, resetRelation, resetState, runDispose, selectRegion, shouldLayout, show, sizeAllocate, snapshotChild, startEditing, stealData, stealQdata, stopEditing, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unsetStateFlags, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateState, watchClosure.

#### Getters

getAccessibleId, getAccessibleParent, getAccessibleRole, getAlignment, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getAtContext, getBaseline, getBounds, getBuildableId, getCanFocus, getCanTarget, getChars, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getData, getDelegate, getDirection, getDisplay, getEditable, getEditing, getEnableUndo, getFirstAccessibleChild, getFirstChild, getFocusChild, getFocusOnClick, getFocusable, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getMaxWidthChars, getName, getNative, getNextAccessibleSibling, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPlatformState, getPosition, getPreferredSize, getPrevSibling, getPrimaryClipboard, getProperty, getQdata, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSelectionBounds, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getText, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, getWidthChars.

#### Setters

setAccessibleParent, setAlignment, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setData, setDataFull, setDirection, setEditable, setEnableUndo, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMaxWidthChars, setName, setOpacity, setOverflow, setParent, setPosition, setProperty, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setText, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthChars.

## getEditing

editableLabelGetEditing Source #

Arguments

:: (HasCallStack, MonadIO m, IsEditableLabel a) |
=> a | `self`: a `GtkEditableLabel`
-> m Bool | Returns: `True` if `self` is currently in editing mode

Returns whether the label is currently in “editing mode”.

## new

editableLabelNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> Text | `str`: the text for the label
-> m EditableLabel | Returns: the new `GtkEditableLabel`

Creates a new `GtkEditableLabel` widget.

## startEditing

editableLabelStartEditing Source #

Arguments

:: (HasCallStack, MonadIO m, IsEditableLabel a) |
=> a | `self`: a `GtkEditableLabel`
-> m () |

Switches the label into “editing mode”.

## stopEditing

editableLabelStopEditing Source #

Arguments

:: (HasCallStack, MonadIO m, IsEditableLabel a) |
=> a | `self`: a `GtkEditableLabel`
-> Bool | `commit`: whether to set the edited text on the label
-> m () |

Switches the label out of “editing mode”.

If `commit` is `True`, the resulting text is kept as the Editable:text property value, otherwise the resulting text is discarded and the label will keep its previous Editable:text property value.

# Properties

## editing

This property is `True` while the widget is in edit mode.

constructEditableLabelEditing :: (IsEditableLabel o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`editing`” property. This is rarely needed directly, but it is used by `new`.

getEditableLabelEditing :: (MonadIO m, IsEditableLabel o) => o -> m Bool Source #

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

    get editableLabel #editing

setEditableLabelEditing :: (MonadIO m, IsEditableLabel o) => o -> Bool -> m () Source #

Set the value of the “`editing`” property. When overloading is enabled, this is equivalent to

    set editableLabel [ #editing := value ]