Package: gtk

Class gtk-text-view

Superclasses

gtk-container, gtk-widget, gtk-buildable, gtk-scrollable, g-object, common-lisp:standard-object, common-lisp:t

Documented Subclasses

None

Direct Slots

accepts-tab
The accepts-tab property of type :boolean (Read / Write)
Whether the Tab key will result in a tab character being entered.
Default value: true
bottom-margin
The bottom-margin property of type :int (Read / Write)
The bottom margin for text in the text view. Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme. Do not confuse this property with the margin-bottom property. Since 3.18
Allowed values: >= 0
Default value: 0
buffer
The buffer property of type gtk-text-buffer (Read / Write)
The text buffer which is displayed.
cursor-visible
The cursor-visible property of type :boolean (Read / Write)
Whether the insertion cursor is shown.
Default value: true
editable
The editable property of type :boolean (Read / Write)
Whether the text can be modified by the user.
Default value: true
im-module
The im-module property of type :string (Read / Write)
Which IM (input method) module should be used for this entry. See the gtk-im-context documentation. Setting this to a non-nil value overrides the system-wide IM module setting. See the gtk-im-module setting.
Default value: nil
indent
The indent property of type :int (Read / Write)
Amount to indent the paragraph, in pixels.
Default value: 0
input-hints
The input-hints property of type gtk-input-hints (Read / Write)
Additional hints, beyond the "input-purpose" signal, that allow input methods to fine-tune their behaviour.
input-purpose
The input-purpose property of type gtk-input-purpose (Read / Write)
The purpose of this text field. This property can be used by on-screen keyboards and other input methods to adjust their behaviour.
Default value: :free-form
justification
The justification property of type gtk-justification (Read / Write)
Left, right, or center justification.
Default value: :left
left-margin
The left-margin property of type :int (Read / Write)
Width of the left margin in pixels.
Allowed values: >= 0
Default value: 0
monospace
The monospace property of type :boolean (Read / Write)
Whether to use a monospace font.
Default value: false
overwrite
The overwrite property of type :boolean (Read / Write)
Whether entered text overwrites existing contents.
Default value: false
pixels-above-lines
The pixels-above-lines property of type :int (Read / Write)
Pixels of blank space above paragraphs.
Allowed values: >= 0
Default value: 0
pixels-below-lines
The pixels-below-lines property of type :int (Read / Write)
Pixels of blank space below paragraphs.
Allowed values: >= 0
Default value: 0
pixels-inside-wrap
The pixels-inside-wrap property of type :int (Read / Write)
Pixels of blank space between wrapped lines in a paragraph.
Allowed values: >= 0
Default value: 0
populate-all
The populate-all property of type :boolean (Read / Write)
If true, the "populate-popup" signal is also emitted for touch popups.
Default value: false
right-margin
The right-margin property of type :int (Read / Write)
Width of the right margin in pixels.
Allowed values: >= 0
Default value: 0
tabs
The tabs property of type pango-tab-array (Read / Write)
Custom tabs for this text.
top-margin
The top-margin property of type :int (Read / Write)
The top margin for text in the text view. Note that this property is confusingly named. In CSS terms, the value set here is padding, and it is applied in addition to the padding from the theme. Do not confuse this property with the margin-top property. Since 3.18
Allowed values: >= 0
Default value: 0
wrap-mode
The wrap-mode property of type gtk-wrap-mode (Read / Write)
Whether to wrap lines never, at word boundaries, or at character boundaries.
Default value: :none

Details

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 nodes

 textview.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

error-underline-color
The error-underline-color style property of type gdk-color (Read)
Color with which to draw error-indication underlines.

Signal Details

The "backspace" signal
 lambda (view)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
The "copy-clipboard" signal
 lambda (view)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
The "cut-clipboard" signal
 lambda (view)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
The "delete-from-cursor" signal
 lambda (view granularity count)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
granularity
The granularity of the deletion, as a value of the gtk-delete-type enumeration.
count
An integer with the number of type units to delete.
The "extend-selection" signal
 lambda (view granularity location start end)    :run-last      
The signal is emitted when the selection needs to be extended at the location iterator.
view
The gtk-text-view widget which received the signal.
granularity
The granularity as a value of the gtk-text-extend-selection enumeration.
location
The gtk-text-iter iterator where to extend the selection.
start
The gtk-text-iter iterator where the selection should start.
end
The gtk-text-iter iterator where the selection should end.
Returns
True to stop other handlers from being invoked for the event, false to propagate the event further.
The "insert-at-cursor" signal
 lambda (view text)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
text
The string with the text to insert.
The "insert-emoji" signal
 lambda (view)    :action      
This 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
view
The gtk-text-view widget which received the signal.
The "move-cursor" signal
 lambda (view step count extend)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
step
The granularity of the move, as a value of the gtk-movement-step enumeration.
count
An integer with the number of step units to move.
extend
True if the move should extend the selection.
The "move-viewport" signal
 lambda (view step count)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
step
The granularity of the move, as a value of the gtk-movement-step enumeration.
count
An integer with the number of step units to move.
The "paste-clipboard" signal
 lambda (view)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
The "populate-popup" signal
 lambda (view popup)    :run-last      
The 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.
view
The gtk-text-view widget on which the signal is emitted.
popup
The gtk-widget object that is being populated.
The "preedit-changed" signal
 lambda (view preedit)    :action      
If 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.
view
The gtk-text-view object which received the signal.
preedit
A string with the current preedit text.
The "select-all" signal
 lambda (view select)    :action      
The 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.
view
The gtk-text-viw widget which received the signal.
select
True to select, false to unselect.
The "set-anchor" signal
 lambda (view)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
The "toggle-cursor-visible" signal
 lambda (view)    :action      
This signal is a keybinding signal which gets emitted to toggle the visibility of the cursor. The default binding for this signal is F7.
view
The gtk-text-view widget which received the signal.
The "toggle-overwrite" signal
 lambda (view)    :action      
The 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.
view
The gtk-text-view widget which received the signal.
 

Slot Access Functions

Inherited Slot Access Functions

See also

*2021-10-16