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 [ifaceGtk.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 [enumGtk.AccessibleRole.text_box] role.
<group>Numeric/Text Data Entry</group> <gtkada_demo>create_password_entry.adb</gtkada_demo>
function "+"
(Widget : access Gtk_Password_Entry_Record'Class)
return Gtk.Accessible.Gtk_Accessible
function "+"
(Widget : access Gtk_Password_Entry_Record'Class)
return Gtk.Buildable.Gtk_Buildable
function "+"
(Widget : access Gtk_Password_Entry_Record'Class)
return Gtk.Constraint_Target.Gtk_Constraint_Target
function "+"
(Widget : access Gtk_Password_Entry_Record'Class)
return Gtk.Editable.Gtk_Editable
function "-"
(Interf : Gtk.Accessible.Gtk_Accessible)
return Gtk_Password_Entry
function "-"
(Interf : Gtk.Buildable.Gtk_Buildable)
return Gtk_Password_Entry
function "-"
(Interf : Gtk.Constraint_Target.Gtk_Constraint_Target)
return Gtk_Password_Entry
function "-"
(Interf : Gtk.Editable.Gtk_Editable)
return Gtk_Password_Entry
Activates_Default_Property : constant Glib.Properties.Property_Boolean;
Whether to activate the default widget when Enter is pressed.
procedure Announce
(Self : not null access Gtk_Password_Entry_Record;
Message : UTF8_String;
Priority : Gtk.Accessible.Gtk_Accessible_Announcement_Priority)
type Cb_GObject_Void is not null access procedure
(Self : access Glib.Object.GObject_Record'Class);
type Cb_Gtk_Password_Entry_Void is not null access procedure
(Self : access Gtk_Password_Entry_Record'Class);
function Delegate_Get_Accessible_Platform_State
(Self : not null access Gtk_Password_Entry_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State) return Boolean
procedure Delete_Selection
(Self : not null access Gtk_Password_Entry_Record)
procedure Delete_Text
(Self : not null access Gtk_Password_Entry_Record;
Start_Pos : Glib.Gint;
End_Pos : Glib.Gint := -1)
Extra_Menu_Property : constant Glib.Properties.Property_Boxed;
Type: Gio.Menu_Model A menu model whose contents will be appended to the context menu.
procedure Finish_Delegate
(Self : not null access Gtk_Password_Entry_Record)
function Get_Accessible_Id
(Self : not null access Gtk_Password_Entry_Record) return UTF8_String
function Get_Accessible_Parent
(Self : not null access Gtk_Password_Entry_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Accessible_Role
(Self : not null access Gtk_Password_Entry_Record)
return Gtk.Accessible.Gtk_Accessible_Role
function Get_Alignment
(Self : not null access Gtk_Password_Entry_Record)
return Interfaces.C.C_float
function Get_At_Context
(Self : not null access Gtk_Password_Entry_Record)
return Gtk.Atcontext.Gtk_Atcontext
function Get_Bounds
(Self : not null access Gtk_Password_Entry_Record;
X : out Glib.Gint;
Y : out Glib.Gint;
Width : out Glib.Gint;
Height : out Glib.Gint) return Boolean
function Get_Chars
(Self : not null access Gtk_Password_Entry_Record;
Start_Pos : Glib.Gint;
End_Pos : Glib.Gint := -1) return UTF8_String
function Get_Delegate
(Self : not null access Gtk_Password_Entry_Record)
return Gtk.Editable.Gtk_Editable
function Get_Editable
(Self : not null access Gtk_Password_Entry_Record) return Boolean
function Get_Enable_Undo
(Self : not null access Gtk_Password_Entry_Record) return Boolean
function Get_Extra_Menu
(Self : not null access Gtk_Password_Entry_Record)
return Glib.Menu_Model.Gmenu_Model
Gets the menu model set with Gtk.Password_Entry.Set_Extra_Menu.
the menu model. Has transfer-ownership='none'.
function Get_First_Accessible_Child
(Self : not null access Gtk_Password_Entry_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Max_Width_Chars
(Self : not null access Gtk_Password_Entry_Record) return Glib.Gint
function Get_Next_Accessible_Sibling
(Self : not null access Gtk_Password_Entry_Record)
return Gtk.Accessible.Gtk_Accessible
function Get_Platform_State
(Self : not null access Gtk_Password_Entry_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State) return Boolean
function Get_Position
(Self : not null access Gtk_Password_Entry_Record) return Glib.Gint
procedure Get_Selection_Bounds
(Self : not null access Gtk_Password_Entry_Record;
Start_Pos : out Glib.Gint;
End_Pos : out Glib.Gint;
Has_Selection : out Boolean)
function Get_Show_Peek_Icon
(Self : not null access Gtk_Password_Entry_Record) return Boolean
Returns whether the entry is showing an icon to reveal the contents.
True if an icon is shown
function Get_Text
(Self : not null access Gtk_Password_Entry_Record) return UTF8_String
function Get_Type return Glib.GType
function Get_Width_Chars
(Self : not null access Gtk_Password_Entry_Record) return Glib.Gint
procedure Gtk_New (Self : out Gtk_Password_Entry)
Creates a GtkPasswordEntry. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
type Gtk_Password_Entry is access all Gtk_Password_Entry_Record'Class;
function Gtk_Password_Entry_New return Gtk_Password_Entry
Creates a GtkPasswordEntry.
type Gtk_Password_Entry_Record is new Gtk_Widget_Record with null record;
package Implements_Gtk_Accessible is new Glib.Types.Implements
(Gtk.Accessible.Gtk_Accessible, Gtk_Password_Entry_Record, Gtk_Password_Entry);
package Implements_Gtk_Buildable is new Glib.Types.Implements
(Gtk.Buildable.Gtk_Buildable, Gtk_Password_Entry_Record, Gtk_Password_Entry);
package Implements_Gtk_Constraint_Target is new Glib.Types.Implements
(Gtk.Constraint_Target.Gtk_Constraint_Target, Gtk_Password_Entry_Record, Gtk_Password_Entry);
package Implements_Gtk_Editable is new Glib.Types.Implements
(Gtk.Editable.Gtk_Editable, Gtk_Password_Entry_Record, Gtk_Password_Entry);
procedure Init_Delegate
(Self : not null access Gtk_Password_Entry_Record)
procedure Initialize
(Self : not null access Gtk_Password_Entry_Record'Class)
Creates a GtkPasswordEntry. Initialize does nothing if the object was already created with another call to Initialize* or G_New.
procedure Insert_Text
(Self : not null access Gtk_Password_Entry_Record;
Text : UTF8_String;
Length : Glib.Gint;
Position : in out Glib.Gint)
procedure On_Activate
(Self : not null access Gtk_Password_Entry_Record;
Call : Cb_GObject_Void;
Slot : not null access Glib.Object.GObject_Record'Class;
After : Boolean := False)
Emitted when the entry is activated.
The keybindings for this signal are all forms of the Enter key.
procedure On_Activate
(Self : not null access Gtk_Password_Entry_Record;
Call : Cb_Gtk_Password_Entry_Void;
After : Boolean := False)
Emitted when the entry is activated.
The keybindings for this signal are all forms of the Enter key.
Placeholder_Text_Property : constant Glib.Properties.Property_String;
The text that will be displayed in the GtkPasswordEntry when it is empty and unfocused.
procedure Reset_Property
(Self : not null access Gtk_Password_Entry_Record;
Property : Gtk.Accessible.Gtk_Accessible_Property)
procedure Reset_Relation
(Self : not null access Gtk_Password_Entry_Record;
Relation : Gtk.Accessible.Gtk_Accessible_Relation)
procedure Reset_State
(Self : not null access Gtk_Password_Entry_Record;
State : Gtk.Accessible.Gtk_Accessible_State)
procedure Select_Region
(Self : not null access Gtk_Password_Entry_Record;
Start_Pos : Glib.Gint;
End_Pos : Glib.Gint := -1)
procedure Set_Accessible_Parent
(Self : not null access Gtk_Password_Entry_Record;
Parent : Gtk.Accessible.Gtk_Accessible;
Next_Sibling : Gtk.Accessible.Gtk_Accessible)
procedure Set_Alignment
(Self : not null access Gtk_Password_Entry_Record;
Xalign : Interfaces.C.C_float)
procedure Set_Editable
(Self : not null access Gtk_Password_Entry_Record;
Is_Editable : Boolean)
procedure Set_Enable_Undo
(Self : not null access Gtk_Password_Entry_Record;
Enable_Undo : Boolean)
procedure Set_Extra_Menu
(Self : not null access Gtk_Password_Entry_Record;
Model : access Glib.Menu_Model.Gmenu_Model_Record'Class)
Sets a menu model to add when constructing the context menu for Entry.
a GMenuModel
procedure Set_Max_Width_Chars
(Self : not null access Gtk_Password_Entry_Record;
N_Chars : Glib.Gint)
procedure Set_Position
(Self : not null access Gtk_Password_Entry_Record;
Position : Glib.Gint)
procedure Set_Show_Peek_Icon
(Self : not null access Gtk_Password_Entry_Record;
Show_Peek_Icon : Boolean)
Sets whether the entry should have a clickable icon to reveal the contents. Setting this to False also hides the text again.
whether to show the peek icon
procedure Set_Text
(Self : not null access Gtk_Password_Entry_Record;
Text : UTF8_String)
procedure Set_Width_Chars
(Self : not null access Gtk_Password_Entry_Record;
N_Chars : Glib.Gint)
Show_Peek_Icon_Property : constant Glib.Properties.Property_Boolean;
Whether to show an icon for revealing the content.
Signal_Activate : constant Glib.Signal_Name := "activate";
Emitted when the entry is activated.
The keybindings for this signal are all forms of the Enter key.
procedure Update_Next_Accessible_Sibling
(Self : not null access Gtk_Password_Entry_Record;
New_Sibling : Gtk.Accessible.Gtk_Accessible)
procedure Update_Platform_State
(Self : not null access Gtk_Password_Entry_Record;
State : Gtk.Accessible.Gtk_Accessible_Platform_State)