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

Contents

- Exported types
- Methods
  - getExtraMenu
  - getShowPeekIcon
  - new
  - setExtraMenu
  - setShowPeekIcon
- Properties
  - activatesDefault
  - extraMenu
  - placeholderText
  - showPeekIcon
- Signals
  - activate

Description

A single-line text entry widget for entering passwords and other secrets.

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

It does not show its contents in clear text, does not allow to copy it to the clipboard, and it shows a warning when Caps Lock is engaged. If the underlying platform allows it, `GtkPasswordEntry` will also place the text in a non-pageable memory area, to avoid it being written out to disk by the operating system.

Optionally, it can offer a way to reveal the contents in clear text.

`GtkPasswordEntry` provides only minimal API and should be used with the `Editable` API.

# CSS Nodes

    entry.password
    ╰── text
        ├── image.caps-lock-indicator
        ┊

`GtkPasswordEntry` has a single CSS node with name entry that carries a .passwordstyle class. The text Css node below it has a child with name image and style class .caps-lock-indicator for the Caps Lock icon, and possibly other children.

# Accessibility

`GtkPasswordEntry` uses the `AccessibleRoleTextBox` role.

Synopsis

- newtype PasswordEntry = PasswordEntry (ManagedPtr PasswordEntry)
- class (GObject o, IsDescendantOf PasswordEntry o) => IsPasswordEntry o
- toPasswordEntry :: (MonadIO m, IsPasswordEntry o) => o -> m PasswordEntry
- passwordEntryGetExtraMenu :: (HasCallStack, MonadIO m, IsPasswordEntry a) => a -> m (Maybe MenuModel)
- passwordEntryGetShowPeekIcon :: (HasCallStack, MonadIO m, IsPasswordEntry a) => a -> m Bool
- passwordEntryNew :: (HasCallStack, MonadIO m) => m PasswordEntry
- passwordEntrySetExtraMenu :: (HasCallStack, MonadIO m, IsPasswordEntry a, IsMenuModel b) => a -> Maybe b -> m ()
- passwordEntrySetShowPeekIcon :: (HasCallStack, MonadIO m, IsPasswordEntry a) => a -> Bool -> m ()
- constructPasswordEntryActivatesDefault :: (IsPasswordEntry o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPasswordEntryActivatesDefault :: (MonadIO m, IsPasswordEntry o) => o -> m Bool
- setPasswordEntryActivatesDefault :: (MonadIO m, IsPasswordEntry o) => o -> Bool -> m ()
- clearPasswordEntryExtraMenu :: (MonadIO m, IsPasswordEntry o) => o -> m ()
- constructPasswordEntryExtraMenu :: (IsPasswordEntry o, MonadIO m, IsMenuModel a) => a -> m (GValueConstruct o)
- getPasswordEntryExtraMenu :: (MonadIO m, IsPasswordEntry o) => o -> m (Maybe MenuModel)
- setPasswordEntryExtraMenu :: (MonadIO m, IsPasswordEntry o, IsMenuModel a) => o -> a -> m ()
- clearPasswordEntryPlaceholderText :: (MonadIO m, IsPasswordEntry o) => o -> m ()
- constructPasswordEntryPlaceholderText :: (IsPasswordEntry o, MonadIO m) => Text -> m (GValueConstruct o)
- getPasswordEntryPlaceholderText :: (MonadIO m, IsPasswordEntry o) => o -> m (Maybe Text)
- setPasswordEntryPlaceholderText :: (MonadIO m, IsPasswordEntry o) => o -> Text -> m ()
- constructPasswordEntryShowPeekIcon :: (IsPasswordEntry o, MonadIO m) => Bool -> m (GValueConstruct o)
- getPasswordEntryShowPeekIcon :: (MonadIO m, IsPasswordEntry o) => o -> m Bool
- setPasswordEntryShowPeekIcon :: (MonadIO m, IsPasswordEntry o) => o -> Bool -> m ()
- type PasswordEntryActivateCallback = IO ()
- afterPasswordEntryActivate :: (IsPasswordEntry a, MonadIO m) => a -> ((?self :: a) => PasswordEntryActivateCallback) -> m SignalHandlerId
- onPasswordEntryActivate :: (IsPasswordEntry a, MonadIO m) => a -> ((?self :: a) => PasswordEntryActivateCallback) -> m SignalHandlerId

# Exported types

newtype PasswordEntry Source #

Memory-managed wrapper type.

Constructors

PasswordEntry (ManagedPtr PasswordEntry) |

#### Instances

Instances details

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

class (GObject o, IsDescendantOf PasswordEntry o) => IsPasswordEntry o Source #

Type class for types which can be safely cast to `PasswordEntry`, for instance with `toPasswordEntry`.

#### Instances

Instances details

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

toPasswordEntry :: (MonadIO m, IsPasswordEntry o) => o -> m PasswordEntry Source #

Cast to `PasswordEntry`, 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, stealData, stealQdata, 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, getEnableUndo, getExtraMenu, 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, getShowPeekIcon, 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, setExtraMenu, setFocusChild, setFocusOnClick, setFocusable, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setMaxWidthChars, setName, setOpacity, setOverflow, setParent, setPosition, setProperty, setReceivesDefault, setSensitive, setShowPeekIcon, setSizeRequest, setStateFlags, setText, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthChars.

## getExtraMenu

passwordEntryGetExtraMenu Source #

Arguments

:: (HasCallStack, MonadIO m, IsPasswordEntry a) |
=> a | `entry`: a `GtkPasswordEntry`
-> m (Maybe MenuModel) | Returns: the menu model

Gets the menu model set with `passwordEntrySetExtraMenu`.

## getShowPeekIcon

passwordEntryGetShowPeekIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsPasswordEntry a) |
=> a | `entry`: a `GtkPasswordEntry`
-> m Bool | Returns: `True` if an icon is shown

Returns whether the entry is showing an icon to reveal the contents.

## new

passwordEntryNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> m PasswordEntry | Returns: a new `GtkPasswordEntry`

Creates a `GtkPasswordEntry`.

## setExtraMenu

passwordEntrySetExtraMenu Source #

Arguments

:: (HasCallStack, MonadIO m, IsPasswordEntry a, IsMenuModel b) |
=> a | `entry`: a `GtkPasswordEntry`
-> Maybe b | `model`: a `GMenuModel`
-> m () |

Sets a menu model to add when constructing the context menu for `entry`.

## setShowPeekIcon

passwordEntrySetShowPeekIcon Source #

Arguments

:: (HasCallStack, MonadIO m, IsPasswordEntry a) |
=> a | `entry`: a `GtkPasswordEntry`
-> Bool | `showPeekIcon`: whether to show the peek icon
-> m () |

Sets whether the entry should have a clickable icon to reveal the contents.

Setting this to `False` also hides the text again.

# Properties

## activatesDefault

Whether to activate the default widget when Enter is pressed.

constructPasswordEntryActivatesDefault :: (IsPasswordEntry o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getPasswordEntryActivatesDefault :: (MonadIO m, IsPasswordEntry o) => o -> m Bool Source #

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

    get passwordEntry #activatesDefault

setPasswordEntryActivatesDefault :: (MonadIO m, IsPasswordEntry o) => o -> Bool -> m () Source #

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

    set passwordEntry [ #activatesDefault := value ]

## extraMenu

A menu model whose contents will be appended to the context menu.

clearPasswordEntryExtraMenu :: (MonadIO m, IsPasswordEntry o) => o -> m () Source #

Set the value of the “`extra-menu`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #extraMenu

constructPasswordEntryExtraMenu :: (IsPasswordEntry o, MonadIO m, IsMenuModel a) => a -> m (GValueConstruct o) Source #

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

getPasswordEntryExtraMenu :: (MonadIO m, IsPasswordEntry o) => o -> m (Maybe MenuModel) Source #

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

    get passwordEntry #extraMenu

setPasswordEntryExtraMenu :: (MonadIO m, IsPasswordEntry o, IsMenuModel a) => o -> a -> m () Source #

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

    set passwordEntry [ #extraMenu := value ]

## placeholderText

The text that will be displayed in the `GtkPasswordEntry` when it is empty and unfocused.

clearPasswordEntryPlaceholderText :: (MonadIO m, IsPasswordEntry o) => o -> m () Source #

Set the value of the “`placeholder-text`” property to `Nothing`. When overloading is enabled, this is equivalent to

    clear #placeholderText

constructPasswordEntryPlaceholderText :: (IsPasswordEntry o, MonadIO m) => Text -> m (GValueConstruct o) Source #

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

getPasswordEntryPlaceholderText :: (MonadIO m, IsPasswordEntry o) => o -> m (Maybe Text) Source #

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

    get passwordEntry #placeholderText

setPasswordEntryPlaceholderText :: (MonadIO m, IsPasswordEntry o) => o -> Text -> m () Source #

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

    set passwordEntry [ #placeholderText := value ]

## showPeekIcon

Whether to show an icon for revealing the content.

constructPasswordEntryShowPeekIcon :: (IsPasswordEntry o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

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

getPasswordEntryShowPeekIcon :: (MonadIO m, IsPasswordEntry o) => o -> m Bool Source #

Get the value of the “`show-peek-icon`” property. When overloading is enabled, this is equivalent to

    get passwordEntry #showPeekIcon

setPasswordEntryShowPeekIcon :: (MonadIO m, IsPasswordEntry o) => o -> Bool -> m () Source #

Set the value of the “`show-peek-icon`” property. When overloading is enabled, this is equivalent to

    set passwordEntry [ #showPeekIcon := value ]

# Signals

## activate

type PasswordEntryActivateCallback = IO () Source #

Emitted when the entry is activated.

The keybindings for this signal are all forms of the Enter key.

afterPasswordEntryActivate :: (IsPasswordEntry a, MonadIO m) => a -> ((?self :: a) => PasswordEntryActivateCallback) -> m SignalHandlerId Source #

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

    after passwordEntry #activate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onPasswordEntryActivate :: (IsPasswordEntry a, MonadIO m) => a -> ((?self :: a) => PasswordEntryActivateCallback) -> m SignalHandlerId Source #

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

    on passwordEntry #activate callback