Class PasswordEntry
- All Implemented Interfaces:
Accessible, Buildable, ConstraintTarget, Editable, Proxy
A single-line text entry widget for entering passwords and other secrets.
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 Gtk.AccessibleRole.text_box role.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theActivateCallbackcallback.static classPasswordEntry.Builder<B extends PasswordEntry.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classNested classes/interfaces inherited from class Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.Widget$Impl, Widget.WidgetClassNested classes/interfaces inherited from class InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface Accessible
Accessible.Accessible$Impl, Accessible.AccessibleInterfaceNested classes/interfaces inherited from interface Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterfaceNested classes/interfaces inherited from interface Editable
Editable.ChangedCallback, Editable.DeleteTextCallback, Editable.Editable$Impl, Editable.EditableInterface, Editable.InsertTextCallback -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new PasswordEntry.PasswordEntry(MemorySegment address) Create a PasswordEntry instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected PasswordEntryasParent()Return this instance as if it were its parent type.static PasswordEntry.Builder<? extends PasswordEntry.Builder> builder()APasswordEntry.Builderobject constructs aPasswordEntrywith the specified properties.voidEmits the "activate" signal.@Nullable MenuModelGets the menu model set with gtk_password_entry_set_extra_menu().static MemoryLayoutThe memory layout of the native struct.booleanReturns whether the entry is showing an icon to reveal the contents.static @Nullable TypegetType()Get the GType of the PasswordEntry class.onActivate(PasswordEntry.ActivateCallback handler) Emitted when the entry is activated.voidsetExtraMenu(@Nullable MenuModel model) Sets a menu model to add when constructing the context menu forentry.voidsetShowPeekIcon(boolean showPeekIcon) Sets whether the entry should have a clickable icon to reveal the contents.Methods inherited from class Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlagsMethods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCodeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Accessible
announce, getAccessibleId, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateStateMethods inherited from interface Buildable
getBuildableIdMethods inherited from interface Editable
delegateGetAccessiblePlatformState, deleteSelection, deleteText, emitChanged, emitDeleteText, emitInsertText, finishDelegate, getAlignment, getChars, getDelegate, getEditable, getEnableUndo, getMaxWidthChars, getPosition, getSelectionBounds, getText, getWidthChars, initDelegate, insertText, onChanged, onDeleteText, onInsertText, selectRegion, setAlignment, setEditable, setEnableUndo, setMaxWidthChars, setPosition, setText, setWidthChars
-
Constructor Details
-
PasswordEntry
Create a PasswordEntry instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
PasswordEntry
public PasswordEntry()Create a new PasswordEntry.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code. -
getExtraMenu
Gets the menu model set with gtk_password_entry_set_extra_menu().- Returns:
- the menu model
-
getShowPeekIcon
public boolean getShowPeekIcon()Returns whether the entry is showing an icon to reveal the contents.- Returns:
trueif an icon is shown
-
setExtraMenu
Sets a menu model to add when constructing the context menu forentry.- Parameters:
model- aGMenuModel
-
setShowPeekIcon
public void setShowPeekIcon(boolean showPeekIcon) Sets whether the entry should have a clickable icon to reveal the contents.
Setting this to
falsealso hides the text again.- Parameters:
showPeekIcon- whether to show the peek icon
-
onActivate
public SignalConnection<PasswordEntry.ActivateCallback> onActivate(PasswordEntry.ActivateCallback handler) Emitted when the entry is activated.
The keybindings for this signal are all forms of the Enter key.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitActivate
public void emitActivate()Emits the "activate" signal. SeeonActivate(PasswordEntry.ActivateCallback). -
builder
APasswordEntry.Builderobject constructs aPasswordEntrywith the specified properties. Use the variousset...()methods to set properties, and finish construction withPasswordEntry.Builder.build().- Returns:
- the builder object
-