Text


Object Hierarchy:

Gtk.Text Gtk.Text Gtk.Text Gtk.Widget Gtk.Widget Gtk.Widget->Gtk.Text GLib.InitiallyUnowned GLib.InitiallyUnowned GLib.InitiallyUnowned->Gtk.Widget GLib.Object GLib.Object GLib.Object->GLib.InitiallyUnowned Gtk.Accessible Gtk.Accessible Gtk.Accessible->Gtk.Text Gtk.Accessible->Gtk.Widget Gtk.Buildable Gtk.Buildable Gtk.Buildable->Gtk.Text Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget Gtk.ConstraintTarget Gtk.ConstraintTarget->Gtk.Text Gtk.ConstraintTarget->Gtk.Widget Gtk.Editable Gtk.Editable Gtk.Editable->Gtk.Text

Description:

[ CCode ( type_id = "gtk_text_get_type ()" ) ]
public class Text : Widget, Accessible, Buildable, ConstraintTarget, Editable

The `GtkText` widget is a single-line text entry widget.

`GtkText` is the common implementation of single-line text editing that is shared between `GtkEntry`, `GtkPasswordEntry`, `GtkSpinButton` and other widgets. In all of these, `GtkText` is used as the delegate for the [[email protected]] implementation.

A fairly large set of key bindings are supported by default. If the entered text is longer than the allocation of the widget, the widget will scroll so that the cursor position is visible.

When using an entry for passwords and other sensitive information, it can be put into “password mode” using [ [email protected]_visibility]. In this mode, entered text is displayed using a “invisible” character. By default, GTK picks the best invisible character that is available in the current font, but it can be changed with [[email protected]_invisible_char].

If you are looking to add icons or progress display in an entry, look at `GtkEntry`. There other alternatives for more specialized use cases, such as `GtkSearchEntry`.

If you need multi-line editable text, look at `GtkTextView`.

CSS nodes

``` text[.read-only] ├── placeholder ├── undershoot.left ├── undershoot.right ├── [selection] ├── [ block-cursor] ╰── [window.popup] ```

`GtkText` has a main node with the name text. Depending on the properties of the widget, the .read-only style class may appear.

When the entry has a selection, it adds a subnode with the name selection.

When the entry is in overwrite mode, it adds a subnode with the name block-cursor that determines how the block cursor is drawn.

The CSS node for a context menu is added as a subnode below text as well.

The undershoot nodes are used to draw the underflow indication when content is scrolled out of view. These nodes get the .left and .right style classes added depending on where the indication is drawn.

When touch is used and touch selection handles are shown, they are using CSS nodes with name cursor-handle. They get the .top or .bottom style class depending on where they are shown in relation to the selection. If there is just a single handle for the text cursor, it gets the style class .insertion-cursor.

Accessibility

`GtkText` uses the gtk_accessible_role_none role, which causes it to be skipped for accessibility. This is because `GtkText` is expected to be used as a delegate for a `GtkEditable` implementation that will be represented to accessibility.


Namespace: Gtk
Package: gtk4

Content:

Properties:

Creation methods:

Methods:

Signals:

Inherited Members:

All known members inherited from class Gtk.Widget
All known members inherited from class GLib.Object



2022 vala-language.org