Package org.gnome.gtk

Class TextView

java.lang.Object
All Implemented Interfaces:
Proxy, Accessible, AccessibleText, Buildable, ConstraintTarget, Scrollable
Direct Known Subclasses:
View

@Generated("io.github.jwharm.JavaGI") public class TextView extends Widget implements Accessible, AccessibleText, Buildable, ConstraintTarget, Scrollable
A widget that displays the contents of a TextBuffer.

An example GtkTextView

You may wish to begin by reading the conceptual overview, which gives an overview of all the objects and data types related to the text widget and how they work together.

Shortcuts and Gestures
GtkTextView supports the following keyboard shortcuts:

  • Shift+F10 or Menu opens the context menu.
  • Ctrl+Z undoes the last modification.
  • Ctrl+Y or Ctrl+Shift+Z redoes the last undone modification.

Additionally, the following signals have default keybindings:

  • Gtk.TextView::backspace
  • Gtk.TextView::copy-clipboard
  • Gtk.TextView::cut-clipboard
  • Gtk.TextView::delete-from-cursor
  • Gtk.TextView::insert-emoji
  • Gtk.TextView::move-cursor
  • Gtk.TextView::paste-clipboard
  • Gtk.TextView::select-all
  • Gtk.TextView::toggle-cursor-visible
  • Gtk.TextView::toggle-overwrite

Actions
GtkTextView defines a set of built-in actions:

  • clipboard.copy copies the contents to the clipboard.
  • clipboard.cut copies the contents to the clipboard and deletes it from the widget.
  • clipboard.paste inserts the contents of the clipboard into the widget.
  • menu.popup opens the context menu.
  • misc.insert-emoji opens the Emoji chooser.
  • selection.delete deletes the current selection.
  • selection.select-all selects all of the widgets content.
  • text.redo redoes the last change to the contents.
  • text.undo undoes the last change to the contents.

CSS nodes


 textview.view
 ├── border.top
 ├── border.left
 ├── text
 │   ╰── [selection]
 ├── border.right
 ├── border.bottom
 ╰── [window.popup]
 

GtkTextView has a main css node with name textview and style class .view, and subnodes for each of the border windows, and the main text area, with names border and text, respectively. The border nodes each get one of the style classes .left, .right, .top or .bottom.

A node representing the selection will appear below the text node.

If a context menu is opened, the window node will appear as a subnode of the main node.

Accessibility
GtkTextView uses the AccessibleRole.TEXT_BOX role.