Package: gtk
Class gtk-text-view
Superclassesgtk-container, gtk-widget, gtk-buildable, gtk-scrollable, g-object, common-lisp:standard-object, common-lisp:t Documented Subclasses
None
Direct SlotsDetails
GTK has a powerful framework for multiline text editing. ![]() The primary objects involved in the process are the gtk-text-buffer object, which represents the text being edited, and the gtk-text-view widget, a widget which can display a gtk-text-buffer object. Each text buffer can be displayed by any number of views. CSS nodestextview.view ├── border.top ├── border.left ├── text │ ╰── [selection] ├── border.right ├── border.bottom ╰── [window.popup]The gtk-text-view implementation has a main CSS node with name textview and .view style class, 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 .left, .right, .top or .bottom style classes. 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. Style Property Details
Signal DetailsThe "backspace" signallambda (view) :actionThe signal is a keybinding signal which gets emitted when the user asks for it. The default bindings for this signal are the Backspace and Shift-Backspace keys.
The "copy-clipboard" signallambda (view) :actionThe signal is a keybinding signal which gets emitted to copy the selection to the clipboard. The default bindings for this signal are the Ctrl-c and Ctrl-Insert keys.
The "cut-clipboard" signallambda (view) :actionThe signal is a keybinding signal which gets emitted to cut the selection to the clipboard. The default bindings for this signal are the Ctrl-x and Shift-Delete keys.
The "delete-from-cursor" signallambda (view granularity count) :actionThe signal is a keybinding signal which gets emitted when the user initiates a text deletion. If the granularity is :chars, GTK deletes the selection if there is one, otherwise it deletes the requested number of characters. The default bindings for this signal are the Delete key for deleting a character, the Ctrl-Delete key for deleting a word and the Ctrl-Backspace key for deleting a word backwords.
The "extend-selection" signallambda (view granularity location start end) :run-lastThe signal is emitted when the selection needs to be extended at the location iterator.
The "insert-at-cursor" signallambda (view text) :actionThe signal is a keybinding signal which gets emitted when the user initiates the insertion of text at the cursor. The signal has no default bindings.
The "insert-emoji" signallambda (view) :actionThis signal is a keybinding signal which gets emitted to present the Emoji chooser for the text view. The default bindings for this signal are Ctrl-. and Ctrl-;. Since 3.22
The "move-cursor" signallambda (view step count extend) :actionThe signal is a keybinding signal which gets emitted when the user initiates a cursor movement. If the cursor is not visible in the text view, this signal causes the viewport to be moved instead. Applications should not connect to it, but may emit it with the g-signal-emit function if they need to control the cursor programmatically. The default bindings for this signal come in two variants, the variant with the Shift modifier extends the selection, the variant without the Shift modifer does not. There are too many key combinations to list them all here. Arrow keys move by individual characters/lines. The Ctrl-arrow key combinations move by words/paragraphs. The Home/End keys move to the ends of the text buffer. The PageUp/PageDown keys move vertically by pages. The Ctrl-PageUp/PageDown keys move horizontally by pages.
The "move-viewport" signallambda (view step count) :actionThe signal is a keybinding signal which can be bound to key combinations to allow the user to move the viewport, i.e. change what part of the text view is visible in a containing scrolled window. There are no default bindings for this signal.
The "paste-clipboard" signallambda (view) :actionThe signal is a keybinding signal which gets emitted to paste the contents of the clipboard into the text view. The default bindings for this signal are the Ctrl-v and Shift-Insert keys.
The "populate-popup" signallambda (view popup) :run-lastThe signal gets emitted before showing the context menu of the text view. If you need to add items to the context menu, connect to this signal and append your items to the popup, which will be a gtk-menu widget in this case. If the populate-all property is true, this signal will also be emitted to populate touch popups. In this case, popup will be a different container, e.g. a gtk-toolbar widget. The signal handler should not make assumptions about the type of the widget, but check whether popup is a gtk-menu widget or gtk-toolbar widget or another kind of container.
The "preedit-changed" signallambda (view preedit) :actionIf an input method is used, the typed text will not immediately be committed to the text buffer. So if you are interested in the text, connect to this signal. The signal is only emitted if the text at the given position is actually editable.
The "select-all" signallambda (view select) :actionThe signal is a keybinding signal which gets emitted to select or unselect the complete contents of the text view. The default bindings for the signal are the Ctrl-a and Ctrl-/ keys for selecting and the Shift-Ctrl-a and Ctrl- keys for unselecting.
The "set-anchor" signallambda (view) :actionThe signal is a keybinding signal which gets emitted when the user initiates setting the "anchor" mark. The "anchor" mark gets placed at the same position as the "insert" mark. The signal has no default bindings.
The "toggle-cursor-visible" signallambda (view) :actionThis signal is a keybinding signal which gets emitted to toggle the visibility of the cursor. The default binding for this signal is F7.
The "toggle-overwrite" signallambda (view) :actionThe signal is a keybinding signal which gets emitted to toggle the overwrite mode of the text view. The default bindings for this signal is the Insert key.
| Slot Access FunctionsInherited Slot Access FunctionsSee also |
*2021-10-16