Class TextView
- All Implemented Interfaces:
Proxy
,Accessible
,AccessibleText
,Buildable
,ConstraintTarget
,Scrollable
- Direct Known Subclasses:
View
TextBuffer
.
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
orMenu
opens the context menu.Ctrl
+Z
undoes the last modification.Ctrl
+Y
orCtrl
+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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theBackspaceCallback
callback.static class
TextView.Builder<B extends TextView.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theCopyClipboardCallback
callback.static interface
Functional interface declaration of theCutClipboardCallback
callback.static interface
Functional interface declaration of theDeleteFromCursorCallback
callback.static interface
Functional interface declaration of theExtendSelectionCallback
callback.static interface
Functional interface declaration of theInsertAtCursorCallback
callback.static interface
Functional interface declaration of theInsertEmojiCallback
callback.static interface
Functional interface declaration of theMoveCursorCallback
callback.static interface
Functional interface declaration of theMoveViewportCallback
callback.static interface
Functional interface declaration of thePasteClipboardCallback
callback.static interface
Functional interface declaration of thePreeditChangedCallback
callback.static interface
Functional interface declaration of theSelectAllCallback
callback.static interface
Functional interface declaration of theSetAnchorCallback
callback.static class
static interface
Functional interface declaration of theToggleCursorVisibleCallback
callback.static interface
Functional interface declaration of theToggleOverwriteCallback
callback.Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.WidgetClass, Widget.WidgetImpl
Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.AccessibleImpl, Accessible.AccessibleInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.AccessibleText
AccessibleText.AccessibleTextImpl, AccessibleText.AccessibleTextInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.BuildableIface, Buildable.BuildableImpl
Nested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTargetImpl, ConstraintTarget.ConstraintTargetInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Scrollable
Scrollable.ScrollableImpl, Scrollable.ScrollableInterface
-
Constructor Summary
ConstructorDescriptionTextView()
Creates a newGtkTextView
.TextView
(MemorySegment address) Create a TextView proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChildAtAnchor
(Widget child, TextChildAnchor anchor) Adds a child widget in the text buffer, at the givenanchor
.void
addOverlay
(Widget child, int xpos, int ypos) Addschild
at a fixed coordinate in theGtkTextView
's text window.protected TextView
asParent()
Returns this instance as if it were its parent type.protected void
The class handler for theGtkTextView::backspace
keybinding signal.boolean
backwardDisplayLine
(TextIter iter) Moves the giveniter
backward by one display (wrapped) line.boolean
Moves the giveniter
backward to the next display line start.void
bufferToWindowCoords
(TextWindowType win, int bufferX, int bufferY, @Nullable Out<Integer> windowX, @Nullable Out<Integer> windowY) Converts buffer coordinates to window coordinates.static TextView.Builder
<? extends TextView.Builder> builder()
ATextView.Builder
object constructs aTextView
with the specified properties.protected void
The class handler for theGtkTextView::copy-clipboard
keybinding signal.protected TextBuffer
The create_buffer vfunc is called to create aGtkTextBuffer
for the text view.protected void
The class handler for theGtkTextView::cut-clipboard
keybinding signalprotected void
deleteFromCursor
(DeleteType type, int count) The class handler for theGtkTextView::delete-from-cursor
keybinding signal.void
Emits the "backspace" signal.void
Emits the "copy-clipboard" signal.void
Emits the "cut-clipboard" signal.void
emitDeleteFromCursor
(DeleteType type, int count) Emits the "delete-from-cursor" signal.boolean
emitExtendSelection
(TextExtendSelection granularity, TextIter location, TextIter start, TextIter end) Emits the "extend-selection" signal.void
emitInsertAtCursor
(String string) Emits the "insert-at-cursor" signal.void
Emits the "insert-emoji" signal.void
emitMoveCursor
(MovementStep step, int count, boolean extendSelection) Emits the "move-cursor" signal.void
emitMoveViewport
(ScrollStep step, int count) Emits the "move-viewport" signal.void
Emits the "paste-clipboard" signal.void
emitPreeditChanged
(String preedit) Emits the "preedit-changed" signal.void
emitSelectAll
(boolean select) Emits the "select-all" signal.void
Emits the "set-anchor" signal.void
Emits the "toggle-cursor-visible" signal.void
Emits the "toggle-overwrite" signal.protected boolean
extendSelection
(TextExtendSelection granularity, TextIter location, TextIter start, TextIter end) The class handler for theGtkTextView::extend-selection
signal.boolean
forwardDisplayLine
(TextIter iter) Moves the giveniter
forward by one display (wrapped) line.boolean
Moves the giveniter
forward to the next display line end.boolean
Returns whether pressing theTab
key inserts a tab characters.int
Gets the bottom margin for text in the this TextView.Returns theGtkTextBuffer
being displayed by this text view.void
getCursorLocations
(@Nullable TextIter iter, @Nullable Rectangle strong, @Nullable Rectangle weak) Determine the positions of the strong and weak cursors if the insertion point is atiter
.boolean
Find out whether the cursor should be displayed.boolean
Returns the default editability of theGtkTextView
.Gets the menu model that gets added to the context menu ornull
if none has been set.getGutter
(TextWindowType win) Gets aGtkWidget
that has previously been set as gutter.int
Gets the default indentation of paragraphs in this TextView.Gets theinput-hints
of theGtkTextView
.Gets theinput-purpose
of theGtkTextView
.boolean
getIterAtLocation
(TextIter iter, int x, int y) Retrieves the iterator at buffer coordinatesx
andy
.boolean
getIterAtPosition
(TextIter iter, @Nullable Out<Integer> trailing, int x, int y) Retrieves the iterator pointing to the character at buffer coordinatesx
andy
.void
getIterLocation
(TextIter iter, Rectangle location) Gets a rectangle which roughly contains the character atiter
.Gets the default justification of paragraphs in this TextView.int
Gets the default left margin size of paragraphs in the this TextView.void
getLineAtY
(TextIter targetIter, int y, Out<Integer> lineTop) Gets theGtkTextIter
at the start of the line containing the coordinatey
.void
Gets the y coordinate of the top of the line containingiter
, and the height of the line.Gets thePangoContext
that is used for rendering LTR directed text layouts.static MemoryLayout
The memory layout of the native struct.boolean
Gets whether theGtkTextView
uses monospace styling.boolean
Returns whether theGtkTextView
is in overwrite mode or not.int
Gets the default number of pixels to put above paragraphs.int
Gets the default number of pixels to put below paragraphs.int
Gets the default number of pixels to put between wrapped lines inside a paragraph.int
Gets the default right margin for text in this TextView.Gets thePangoContext
that is used for rendering RTL directed text layouts.getTabs()
Gets the default tabs for this TextView.int
Gets the top margin for text in the this TextView.static Type
getType()
Get the GType of the TextView classvoid
getVisibleRect
(Rectangle visibleRect) FillsvisibleRect
with the currently-visible region of the buffer, in buffer coordinates.Gets the line wrapping for the view.boolean
imContextFilterKeypress
(Event event) Allow theGtkTextView
input method to internally handle key press and release events.protected void
insertAtCursor
(String str) The class handler for theGtkTextView::insert-at-cursor
keybinding signal.protected void
The class handler for theGtkTextView::insert-emoji
signal.protected void
moveCursor
(MovementStep step, int count, boolean extendSelection) The class handler for theGtkTextView::move-cursor
keybinding signal.boolean
moveMarkOnscreen
(TextMark mark) Moves a mark within the buffer so that it's located within the currently-visible text area.void
moveOverlay
(Widget child, int xpos, int ypos) Updates the position of a child.boolean
moveVisually
(TextIter iter, int count) Move the iterator a given number of characters visually, treating it as the strong cursor position.onBackspace
(TextView.BackspaceCallback handler) Gets emitted when the user asks for it.Gets emitted to copy the selection to the clipboard.Gets emitted to cut the selection to the clipboard.Gets emitted when the user initiates a text deletion.Emitted when the selection needs to be extended atlocation
.Gets emitted when the user initiates the insertion of a fixed string at the cursor.Gets emitted to present the Emoji chooser for thetextView
.onMoveCursor
(TextView.MoveCursorCallback handler) Gets emitted when the user initiates a cursor movement.Gets emitted to move the viewport.Gets emitted to paste the contents of the clipboard into the text view.Emitted when preedit text of the active IM changes.onSelectAll
(TextView.SelectAllCallback handler) Gets emitted to select or unselect the complete contents of the text view.onSetAnchor
(TextView.SetAnchorCallback handler) Gets emitted when the user initiates settings the "anchor" mark.Gets emitted to toggle thecursor-visible
property.Gets emitted to toggle the overwrite mode of the text view.protected void
The class handler for theGtkTextView::paste-clipboard
keybinding signal.boolean
Moves the cursor to the currently visible region of the buffer.void
Removes a child widget from this TextView.void
Ensures that the cursor is shown.void
Reset the input method context of the text view if needed.void
scrollMarkOnscreen
(TextMark mark) Scrolls this TextView the minimum distance such thatmark
is contained within the visible area of the widget.boolean
scrollToIter
(TextIter iter, double withinMargin, boolean useAlign, double xalign, double yalign) Scrolls this TextView so thatiter
is on the screen in the position indicated byxalign
andyalign
.void
scrollToMark
(TextMark mark, double withinMargin, boolean useAlign, double xalign, double yalign) Scrolls this TextView so thatmark
is on the screen in the position indicated byxalign
andyalign
.void
setAcceptsTab
(boolean acceptsTab) Sets the behavior of the text widget when theTab
key is pressed.protected void
The class handler for theGtkTextView::set-anchor
keybinding signal.void
setBottomMargin
(int bottomMargin) Sets the bottom margin for text in this TextView.void
setBuffer
(@Nullable TextBuffer buffer) Setsbuffer
as the buffer being displayed by this TextView.void
setCursorVisible
(boolean setting) Toggles whether the insertion point should be displayed.void
setEditable
(boolean setting) Sets the default editability of theGtkTextView
.void
setExtraMenu
(@Nullable MenuModel model) Sets a menu model to add when constructing the context menu for this TextView.void
setGutter
(TextWindowType win, @Nullable Widget widget) Placeswidget
into the gutter specified bywin
.void
setIndent
(int indent) Sets the default indentation for paragraphs in this TextView.void
setInputHints
(Set<InputHints> hints) Sets theinput-hints
of theGtkTextView
.void
setInputHints
(InputHints... hints) Sets theinput-hints
of theGtkTextView
.void
setInputPurpose
(InputPurpose purpose) Sets theinput-purpose
of theGtkTextView
.void
setJustification
(Justification justification) Sets the default justification of text in this TextView.void
setLeftMargin
(int leftMargin) Sets the default left margin for text in this TextView.void
setMonospace
(boolean monospace) Sets whether theGtkTextView
should display text in monospace styling.void
setOverwrite
(boolean overwrite) Changes theGtkTextView
overwrite mode.void
setPixelsAboveLines
(int pixelsAboveLines) Sets the default number of blank pixels above paragraphs in this TextView.void
setPixelsBelowLines
(int pixelsBelowLines) Sets the default number of pixels of blank space to put below paragraphs in this TextView.void
setPixelsInsideWrap
(int pixelsInsideWrap) Sets the default number of pixels of blank space to leave between display/wrapped lines within a paragraph.void
setRightMargin
(int rightMargin) Sets the default right margin for text in the text view.void
Sets the default tab stops for paragraphs in this TextView.void
setTopMargin
(int topMargin) Sets the top margin for text in this TextView.void
setWrapMode
(WrapMode wrapMode) Sets the line wrapping for the view.protected void
snapshotLayer
(TextViewLayer layer, Snapshot snapshot) The snapshot_layer vfunc is called before and after the text view is drawing its own text.boolean
startsDisplayLine
(TextIter iter) Determines whetheriter
is at the start of a display line.protected void
The class handler for theGtkTextView::toggle-overwrite
keybinding signal.void
windowToBufferCoords
(TextWindowType win, int windowX, int windowY, @Nullable Out<Integer> bufferX, @Nullable Out<Integer> bufferY) Converts coordinates on the window identified bywin
to buffer coordinates.static TextView
withBuffer
(TextBuffer buffer) Creates a newGtkTextView
widget displaying the bufferbuffer
.Methods inherited from class org.gnome.gtk.Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlags
Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updateProperty, updateRelation, updateState
Methods inherited from interface org.gnome.gtk.AccessibleText
updateCaretPosition, updateContents, updateSelectionBound
Methods inherited from interface org.gnome.gtk.Buildable
getBuildableId
Methods inherited from interface org.gnome.gtk.Scrollable
getBorder, getHadjustment, getHscrollPolicy, getVadjustment, getVscrollPolicy, setHadjustment, setHscrollPolicy, setVadjustment, setVscrollPolicy
-
Constructor Details
-
TextView
Create a TextView proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
TextView
public TextView()Creates a newGtkTextView
.If you don’t call
setBuffer(org.gnome.gtk.TextBuffer)
before using the text view, an empty default buffer will be created for you. Get the buffer withgetBuffer()
. If you want to specify your own buffer, considerwithBuffer(org.gnome.gtk.TextBuffer)
.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
withBuffer
Creates a newGtkTextView
widget displaying the bufferbuffer
.One buffer can be shared among many widgets.
buffer
may benull
to create a default buffer, in which case this function is equivalent toTextView()
. The text view adds its own reference count to the buffer; it does not take over an existing reference.- Parameters:
buffer
- aGtkTextBuffer
- Returns:
- a new
GtkTextView
.
-
addChildAtAnchor
Adds a child widget in the text buffer, at the givenanchor
.- Parameters:
child
- aGtkWidget
anchor
- aGtkTextChildAnchor
in theGtkTextBuffer
for this TextView
-
addOverlay
Addschild
at a fixed coordinate in theGtkTextView
's text window.The
xpos
andypos
must be in buffer coordinates (seegetIterLocation(org.gnome.gtk.TextIter, org.gnome.gdk.Rectangle)
to convert to buffer coordinates).child
will scroll with the text view.If instead you want a widget that will not move with the
GtkTextView
contents seeGtkOverlay
.- Parameters:
child
- aGtkWidget
xpos
- X position of child in window coordinatesypos
- Y position of child in window coordinates
-
backwardDisplayLine
Moves the giveniter
backward by one display (wrapped) line.A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view’s width; paragraphs are the same in all views, since they depend on the contents of the
GtkTextBuffer
.- Parameters:
iter
- aGtkTextIter
- Returns:
true
ifiter
was moved and is not on the end iterator
-
backwardDisplayLineStart
Moves the giveniter
backward to the next display line start.A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view’s width; paragraphs are the same in all views, since they depend on the contents of the
GtkTextBuffer
.- Parameters:
iter
- aGtkTextIter
- Returns:
true
ifiter
was moved and is not on the end iterator
-
bufferToWindowCoords
public void bufferToWindowCoords(TextWindowType win, int bufferX, int bufferY, @Nullable @Nullable Out<Integer> windowX, @Nullable @Nullable Out<Integer> windowY) Converts buffer coordinates to window coordinates.- Parameters:
win
- aGtkTextWindowType
bufferX
- buffer x coordinatebufferY
- buffer y coordinatewindowX
- window x coordinate return locationwindowY
- window y coordinate return location
-
forwardDisplayLine
Moves the giveniter
forward by one display (wrapped) line.A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view’s width; paragraphs are the same in all views, since they depend on the contents of the
GtkTextBuffer
.- Parameters:
iter
- aGtkTextIter
- Returns:
true
ifiter
was moved and is not on the end iterator
-
forwardDisplayLineEnd
Moves the giveniter
forward to the next display line end.A display line is different from a paragraph. Paragraphs are separated by newlines or other paragraph separator characters. Display lines are created by line-wrapping a paragraph. If wrapping is turned off, display lines and paragraphs will be the same. Display lines are divided differently for each view, since they depend on the view’s width; paragraphs are the same in all views, since they depend on the contents of the
GtkTextBuffer
.- Parameters:
iter
- aGtkTextIter
- Returns:
true
ifiter
was moved and is not on the end iterator
-
getAcceptsTab
public boolean getAcceptsTab()Returns whether pressing theTab
key inserts a tab characters.- Returns:
true
if pressing the Tab key inserts a tab character,false
if pressing the Tab key moves the keyboard focus.
-
getBottomMargin
public int getBottomMargin()Gets the bottom margin for text in the this TextView.- Returns:
- bottom margin in pixels
-
getBuffer
Returns theGtkTextBuffer
being displayed by this text view.The reference count on the buffer is not incremented; the caller of this function won’t own a new reference.
- Returns:
- a
GtkTextBuffer
-
getCursorLocations
public void getCursorLocations(@Nullable @Nullable TextIter iter, @Nullable @Nullable Rectangle strong, @Nullable @Nullable Rectangle weak) Determine the positions of the strong and weak cursors if the insertion point is atiter
.The position of each cursor is stored as a zero-width rectangle. The strong cursor location is the location where characters of the directionality equal to the base direction of the paragraph are inserted. The weak cursor location is the location where characters of the directionality opposite to the base direction of the paragraph are inserted.
If
iter
isnull
, the actual cursor position is used.Note that if
iter
happens to be the actual cursor position, and there is currently an IM preedit sequence being entered, the returned locations will be adjusted to account for the preedit cursor’s offset within the preedit sequence.The rectangle position is in buffer coordinates; use
bufferToWindowCoords(org.gnome.gtk.TextWindowType, int, int, io.github.jwharm.javagi.base.Out<java.lang.Integer>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
to convert these coordinates to coordinates for one of the windows in the text view.- Parameters:
iter
- aGtkTextIter
strong
- location to store the strong cursor positionweak
- location to store the weak cursor position
-
getCursorVisible
public boolean getCursorVisible()Find out whether the cursor should be displayed.- Returns:
- whether the insertion mark is visible
-
getEditable
public boolean getEditable()Returns the default editability of theGtkTextView
.Tags in the buffer may override this setting for some ranges of text.
- Returns:
- whether text is editable by default
-
getExtraMenu
Gets the menu model that gets added to the context menu ornull
if none has been set.- Returns:
- the menu model
-
getGutter
Gets aGtkWidget
that has previously been set as gutter.See
setGutter(org.gnome.gtk.TextWindowType, org.gnome.gtk.Widget)
.win
must be one ofTextWindowType.LEFT
,TextWindowType.RIGHT
,TextWindowType.TOP
, orTextWindowType.BOTTOM
.- Parameters:
win
- aGtkTextWindowType
- Returns:
- a
GtkWidget
-
getIndent
public int getIndent()Gets the default indentation of paragraphs in this TextView.Tags in the view’s buffer may override the default. The indentation may be negative.
- Returns:
- number of pixels of indentation
-
getInputHints
Gets theinput-hints
of theGtkTextView
.- Returns:
- the input hints
-
getInputPurpose
Gets theinput-purpose
of theGtkTextView
.- Returns:
- the input purpose
-
getIterAtLocation
Retrieves the iterator at buffer coordinatesx
andy
.Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with
windowToBufferCoords(org.gnome.gtk.TextWindowType, int, int, io.github.jwharm.javagi.base.Out<java.lang.Integer>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
.- Parameters:
iter
- aGtkTextIter
x
- x position, in buffer coordinatesy
- y position, in buffer coordinates- Returns:
true
if the position is over text
-
getIterAtPosition
public boolean getIterAtPosition(TextIter iter, @Nullable @Nullable Out<Integer> trailing, int x, int y) Retrieves the iterator pointing to the character at buffer coordinatesx
andy
.Buffer coordinates are coordinates for the entire buffer, not just the currently-displayed portion. If you have coordinates from an event, you have to convert those to buffer coordinates with
windowToBufferCoords(org.gnome.gtk.TextWindowType, int, int, io.github.jwharm.javagi.base.Out<java.lang.Integer>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
.Note that this is different from
getIterAtLocation(org.gnome.gtk.TextIter, int, int)
, which returns cursor locations, i.e. positions between characters.- Parameters:
iter
- aGtkTextIter
trailing
- if non-null
, location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme.x
- x position, in buffer coordinatesy
- y position, in buffer coordinates- Returns:
true
if the position is over text
-
getIterLocation
Gets a rectangle which roughly contains the character atiter
.The rectangle position is in buffer coordinates; use
bufferToWindowCoords(org.gnome.gtk.TextWindowType, int, int, io.github.jwharm.javagi.base.Out<java.lang.Integer>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
to convert these coordinates to coordinates for one of the windows in the text view.- Parameters:
iter
- aGtkTextIter
location
- bounds of the character atiter
-
getJustification
Gets the default justification of paragraphs in this TextView.Tags in the buffer may override the default.
- Returns:
- default justification
-
getLeftMargin
public int getLeftMargin()Gets the default left margin size of paragraphs in the this TextView.Tags in the buffer may override the default.
- Returns:
- left margin in pixels
-
getLineAtY
Gets theGtkTextIter
at the start of the line containing the coordinatey
.y
is in buffer coordinates, convert from window coordinates withwindowToBufferCoords(org.gnome.gtk.TextWindowType, int, int, io.github.jwharm.javagi.base.Out<java.lang.Integer>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
. If non-null
,lineTop
will be filled with the coordinate of the top edge of the line.- Parameters:
targetIter
- aGtkTextIter
y
- a y coordinatelineTop
- return location for top coordinate of the line
-
getLineYrange
Gets the y coordinate of the top of the line containingiter
, and the height of the line.The coordinate is a buffer coordinate; convert to window coordinates with
bufferToWindowCoords(org.gnome.gtk.TextWindowType, int, int, io.github.jwharm.javagi.base.Out<java.lang.Integer>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
.- Parameters:
iter
- aGtkTextIter
y
- return location for a y coordinateheight
- return location for a height
-
getLtrContext
Gets thePangoContext
that is used for rendering LTR directed text layouts.The context may be replaced when CSS changes occur.
- Returns:
- a
PangoContext
-
getMonospace
public boolean getMonospace()Gets whether theGtkTextView
uses monospace styling.- Returns:
true
if monospace fonts are desired
-
getOverwrite
public boolean getOverwrite()Returns whether theGtkTextView
is in overwrite mode or not.- Returns:
- whether this TextView is in overwrite mode or not.
-
getPixelsAboveLines
public int getPixelsAboveLines()Gets the default number of pixels to put above paragraphs.Adding this function with
getPixelsBelowLines()
is equal to the line space between each paragraph.- Returns:
- default number of pixels above paragraphs
-
getPixelsBelowLines
public int getPixelsBelowLines()Gets the default number of pixels to put below paragraphs.The line space is the sum of the value returned by this function and the value returned by
getPixelsAboveLines()
.- Returns:
- default number of blank pixels below paragraphs
-
getPixelsInsideWrap
public int getPixelsInsideWrap()Gets the default number of pixels to put between wrapped lines inside a paragraph.- Returns:
- default number of pixels of blank space between wrapped lines
-
getRightMargin
public int getRightMargin()Gets the default right margin for text in this TextView.Tags in the buffer may override the default.
- Returns:
- right margin in pixels
-
getRtlContext
Gets thePangoContext
that is used for rendering RTL directed text layouts.The context may be replaced when CSS changes occur.
- Returns:
- a
PangoContext
-
getTabs
Gets the default tabs for this TextView.Tags in the buffer may override the defaults. The returned array will be
null
if “standard” (8-space) tabs are used. Free the return value withTabArray.free()
.- Returns:
- copy of default tab array,
or
null
if standard tabs are used; must be freed withTabArray.free()
.
-
getTopMargin
public int getTopMargin()Gets the top margin for text in the this TextView.- Returns:
- top margin in pixels
-
getVisibleRect
FillsvisibleRect
with the currently-visible region of the buffer, in buffer coordinates.Convert to window coordinates with
bufferToWindowCoords(org.gnome.gtk.TextWindowType, int, int, io.github.jwharm.javagi.base.Out<java.lang.Integer>, io.github.jwharm.javagi.base.Out<java.lang.Integer>)
.- Parameters:
visibleRect
- rectangle to fill
-
getWrapMode
-
imContextFilterKeypress
Allow theGtkTextView
input method to internally handle key press and release events.If this function returns
true
, then no further processing should be done for this key event. SeeIMContext.filterKeypress(org.gnome.gdk.Event)
.Note that you are expected to call this function from your handler when overriding key event handling. This is needed in the case when you need to insert your own key handling between the input method and the default key event handling of the
GtkTextView
.static gboolean gtk_foo_bar_key_press_event (GtkWidget *widget, GdkEvent *event) { guint keyval; gdk_event_get_keyval ((GdkEvent*)event, &keyval); if (keyval == GDK_KEY_Return || keyval == GDK_KEY_KP_Enter) { if (gtk_text_view_im_context_filter_keypress (GTK_TEXT_VIEW (widget), event)) return TRUE; } // Do some stuff return GTK_WIDGET_CLASS (gtk_foo_bar_parent_class)->key_press_event (widget, event); }
- Parameters:
event
- the key event- Returns:
true
if the input method handled the key event.
-
moveMarkOnscreen
Moves a mark within the buffer so that it's located within the currently-visible text area.- Parameters:
mark
- aGtkTextMark
- Returns:
true
if the mark moved (wasn’t already onscreen)
-
moveOverlay
Updates the position of a child.- Parameters:
child
- a widget already added withaddOverlay(org.gnome.gtk.Widget, int, int)
xpos
- new X position in buffer coordinatesypos
- new Y position in buffer coordinates
-
moveVisually
Move the iterator a given number of characters visually, treating it as the strong cursor position.If
count
is positive, then the new strong cursor position will becount
positions to the right of the old cursor position. Ifcount
is negative then the new strong cursor position will becount
positions to the left of the old cursor position.In the presence of bi-directional text, the correspondence between logical and visual order will depend on the direction of the current run, and there may be jumps when the cursor is moved off of the end of a run.
- Parameters:
iter
- aGtkTextIter
count
- number of characters to move (negative moves left, positive moves right)- Returns:
true
ifiter
moved and is not on the end iterator
-
placeCursorOnscreen
public boolean placeCursorOnscreen()Moves the cursor to the currently visible region of the buffer.- Returns:
true
if the cursor had to be moved.
-
remove
Removes a child widget from this TextView.- Parameters:
child
- the child to remove
-
resetCursorBlink
public void resetCursorBlink()Ensures that the cursor is shown.This also resets the time that it will stay blinking (or visible, in case blinking is disabled).
This function should be called in response to user input (e.g. from derived classes that override the textview's event handlers).
-
resetImContext
public void resetImContext()Reset the input method context of the text view if needed.This can be necessary in the case where modifying the buffer would confuse on-going input method behavior.
-
scrollMarkOnscreen
Scrolls this TextView the minimum distance such thatmark
is contained within the visible area of the widget.- Parameters:
mark
- a mark in the buffer for this TextView
-
scrollToIter
public boolean scrollToIter(TextIter iter, double withinMargin, boolean useAlign, double xalign, double yalign) Scrolls this TextView so thatiter
is on the screen in the position indicated byxalign
andyalign
.An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If
useAlign
isfalse
, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of sizewithinMargin
.Note that this function uses the currently-computed height of the lines in the text buffer. Line heights are computed in an idle handler; so this function may not have the desired effect if it’s called before the height computations. To avoid oddness, consider using
scrollToMark(org.gnome.gtk.TextMark, double, boolean, double, double)
which saves a point to be scrolled to after line validation.- Parameters:
iter
- aGtkTextIter
withinMargin
- margin as a [0.0,0.5) fraction of screen sizeuseAlign
- whether to use alignment arguments (iffalse
, just get the mark onscreen)xalign
- horizontal alignment of mark within visible areayalign
- vertical alignment of mark within visible area- Returns:
true
if scrolling occurred
-
scrollToMark
public void scrollToMark(TextMark mark, double withinMargin, boolean useAlign, double xalign, double yalign) Scrolls this TextView so thatmark
is on the screen in the position indicated byxalign
andyalign
.An alignment of 0.0 indicates left or top, 1.0 indicates right or bottom, 0.5 means center. If
useAlign
isfalse
, the text scrolls the minimal distance to get the mark onscreen, possibly not scrolling at all. The effective screen for purposes of this function is reduced by a margin of sizewithinMargin
.- Parameters:
mark
- aGtkTextMark
withinMargin
- margin as a [0.0,0.5) fraction of screen sizeuseAlign
- whether to use alignment arguments (iffalse
, just get the mark onscreen)xalign
- horizontal alignment of mark within visible areayalign
- vertical alignment of mark within visible area
-
setAcceptsTab
public void setAcceptsTab(boolean acceptsTab) Sets the behavior of the text widget when theTab
key is pressed.If
acceptsTab
istrue
, a tab character is inserted. IfacceptsTab
isfalse
the keyboard focus is moved to the next widget in the focus chain.Focus can always be moved using
Ctrl
+Tab
.- Parameters:
acceptsTab
-true
if pressing the Tab key should insert a tab character,false
, if pressing the Tab key should move the keyboard focus.
-
setBottomMargin
public void setBottomMargin(int bottomMargin) Sets the bottom margin for text in this TextView.Note that this function is confusingly named. In CSS terms, the value set here is padding.
- Parameters:
bottomMargin
- bottom margin in pixels
-
setBuffer
Setsbuffer
as the buffer being displayed by this TextView.The previous buffer displayed by the text view is unreferenced, and a reference is added to
buffer
. If you owned a reference tobuffer
before passing it to this function, you must remove that reference yourself;GtkTextView
will not “adopt” it.- Parameters:
buffer
- aGtkTextBuffer
-
setCursorVisible
public void setCursorVisible(boolean setting) Toggles whether the insertion point should be displayed.A buffer with no editable text probably shouldn’t have a visible cursor, so you may want to turn the cursor off.
Note that this property may be overridden by the
Gtk.Settings:gtk-keynav-use-caret
setting.- Parameters:
setting
- whether to show the insertion cursor
-
setEditable
public void setEditable(boolean setting) Sets the default editability of theGtkTextView
.You can override this default setting with tags in the buffer, using the “editable” attribute of tags.
- Parameters:
setting
- whether it’s editable
-
setExtraMenu
Sets a menu model to add when constructing the context menu for this TextView.You can pass
null
to remove a previously set extra menu.- Parameters:
model
- aGMenuModel
-
setGutter
Placeswidget
into the gutter specified bywin
.win
must be one ofTextWindowType.LEFT
,TextWindowType.RIGHT
,TextWindowType.TOP
, orTextWindowType.BOTTOM
.- Parameters:
win
- aGtkTextWindowType
widget
- aGtkWidget
-
setIndent
public void setIndent(int indent) Sets the default indentation for paragraphs in this TextView.Tags in the buffer may override the default.
- Parameters:
indent
- indentation in pixels
-
setInputHints
Sets theinput-hints
of theGtkTextView
.The
input-hints
allow input methods to fine-tune their behaviour.- Parameters:
hints
- the hints
-
setInputHints
Sets theinput-hints
of theGtkTextView
.The
input-hints
allow input methods to fine-tune their behaviour.- Parameters:
hints
- the hints
-
setInputPurpose
Sets theinput-purpose
of theGtkTextView
.The
input-purpose
can be used by on-screen keyboards and other input methods to adjust their behaviour.- Parameters:
purpose
- the purpose
-
setJustification
Sets the default justification of text in this TextView.Tags in the view’s buffer may override the default.
- Parameters:
justification
- justification
-
setLeftMargin
public void setLeftMargin(int leftMargin) Sets the default left margin for text in this TextView.Tags in the buffer may override the default.
Note that this function is confusingly named. In CSS terms, the value set here is padding.
- Parameters:
leftMargin
- left margin in pixels
-
setMonospace
public void setMonospace(boolean monospace) Sets whether theGtkTextView
should display text in monospace styling.- Parameters:
monospace
-true
to request monospace styling
-
setOverwrite
public void setOverwrite(boolean overwrite) Changes theGtkTextView
overwrite mode.- Parameters:
overwrite
-true
to turn on overwrite mode,false
to turn it off
-
setPixelsAboveLines
public void setPixelsAboveLines(int pixelsAboveLines) Sets the default number of blank pixels above paragraphs in this TextView.Tags in the buffer for this TextView may override the defaults.
- Parameters:
pixelsAboveLines
- pixels above paragraphs
-
setPixelsBelowLines
public void setPixelsBelowLines(int pixelsBelowLines) Sets the default number of pixels of blank space to put below paragraphs in this TextView.May be overridden by tags applied to this TextView’s buffer.
- Parameters:
pixelsBelowLines
- pixels below paragraphs
-
setPixelsInsideWrap
public void setPixelsInsideWrap(int pixelsInsideWrap) Sets the default number of pixels of blank space to leave between display/wrapped lines within a paragraph.May be overridden by tags in this TextView’s buffer.
- Parameters:
pixelsInsideWrap
- default number of pixels between wrapped lines
-
setRightMargin
public void setRightMargin(int rightMargin) Sets the default right margin for text in the text view.Tags in the buffer may override the default.
Note that this function is confusingly named. In CSS terms, the value set here is padding.
- Parameters:
rightMargin
- right margin in pixels
-
setTabs
Sets the default tab stops for paragraphs in this TextView.Tags in the buffer may override the default.
- Parameters:
tabs
- tabs as aPangoTabArray
-
setTopMargin
public void setTopMargin(int topMargin) Sets the top margin for text in this TextView.Note that this function is confusingly named. In CSS terms, the value set here is padding.
- Parameters:
topMargin
- top margin in pixels
-
setWrapMode
Sets the line wrapping for the view.- Parameters:
wrapMode
- aGtkWrapMode
-
startsDisplayLine
Determines whetheriter
is at the start of a display line.See
forwardDisplayLine(org.gnome.gtk.TextIter)
for an explanation of display lines vs. paragraphs.- Parameters:
iter
- aGtkTextIter
- Returns:
true
ifiter
begins a wrapped line
-
windowToBufferCoords
public void windowToBufferCoords(TextWindowType win, int windowX, int windowY, @Nullable @Nullable Out<Integer> bufferX, @Nullable @Nullable Out<Integer> bufferY) Converts coordinates on the window identified bywin
to buffer coordinates.- Parameters:
win
- aGtkTextWindowType
windowX
- window x coordinatewindowY
- window y coordinatebufferX
- buffer x coordinate return locationbufferY
- buffer y coordinate return location
-
backspace
protected void backspace()The class handler for theGtkTextView::backspace
keybinding signal. -
copyClipboard
protected void copyClipboard()The class handler for theGtkTextView::copy-clipboard
keybinding signal. -
createBuffer
The create_buffer vfunc is called to create aGtkTextBuffer
for the text view. The default implementation is to just call gtk_text_buffer_new(). -
cutClipboard
protected void cutClipboard()The class handler for theGtkTextView::cut-clipboard
keybinding signal -
deleteFromCursor
The class handler for theGtkTextView::delete-from-cursor
keybinding signal. -
extendSelection
protected boolean extendSelection(TextExtendSelection granularity, TextIter location, TextIter start, TextIter end) The class handler for theGtkTextView::extend-selection
signal. -
insertAtCursor
The class handler for theGtkTextView::insert-at-cursor
keybinding signal. -
insertEmoji
protected void insertEmoji()The class handler for theGtkTextView::insert-emoji
signal. -
moveCursor
The class handler for theGtkTextView::move-cursor
keybinding signal. -
pasteClipboard
protected void pasteClipboard()The class handler for theGtkTextView::paste-clipboard
keybinding signal. -
setAnchor
protected void setAnchor()The class handler for theGtkTextView::set-anchor
keybinding signal. -
snapshotLayer
The snapshot_layer vfunc is called before and after the text view is drawing its own text. Applications can override this vfunc in a subclass to draw customized content underneath or above the text. In theTextViewLayer.BELOW_TEXT
andTextViewLayer.ABOVE_TEXT
layers the drawing is done in the buffer coordinate space. -
toggleOverwrite
protected void toggleOverwrite()The class handler for theGtkTextView::toggle-overwrite
keybinding signal. -
onBackspace
Gets emitted when the user asks for it.The ::backspace signal is a keybinding signal.
The default bindings for this signal are
Backspace
andShift
+Backspace
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitBackspace
public void emitBackspace()Emits the "backspace" signal. SeeonBackspace(org.gnome.gtk.TextView.BackspaceCallback)
. -
onCopyClipboard
public SignalConnection<TextView.CopyClipboardCallback> onCopyClipboard(TextView.CopyClipboardCallback handler) Gets emitted to copy the selection to the clipboard.The ::copy-clipboard signal is a keybinding signal.
The default bindings for this signal are
Ctrl
+c
andCtrl
+Insert
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitCopyClipboard
public void emitCopyClipboard()Emits the "copy-clipboard" signal. SeeonCopyClipboard(org.gnome.gtk.TextView.CopyClipboardCallback)
. -
onCutClipboard
public SignalConnection<TextView.CutClipboardCallback> onCutClipboard(TextView.CutClipboardCallback handler) Gets emitted to cut the selection to the clipboard.The ::cut-clipboard signal is a keybinding signal.
The default bindings for this signal are
Ctrl
+x
andShift
+Delete
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitCutClipboard
public void emitCutClipboard()Emits the "cut-clipboard" signal. SeeonCutClipboard(org.gnome.gtk.TextView.CutClipboardCallback)
. -
onDeleteFromCursor
public SignalConnection<TextView.DeleteFromCursorCallback> onDeleteFromCursor(TextView.DeleteFromCursorCallback handler) Gets emitted when the user initiates a text deletion.The ::delete-from-cursor signal is a keybinding signal.
If the
type
isDeleteType.CHARS
, GTK deletes the selection if there is one, otherwise it deletes the requested number of characters.The default bindings for this signal are
Delete
for deleting a character,Ctrl
+Delete
for deleting a word andCtrl
+Backspace
for deleting a word backwards.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitDeleteFromCursor
Emits the "delete-from-cursor" signal. SeeonDeleteFromCursor(org.gnome.gtk.TextView.DeleteFromCursorCallback)
. -
onExtendSelection
public SignalConnection<TextView.ExtendSelectionCallback> onExtendSelection(TextView.ExtendSelectionCallback handler) Emitted when the selection needs to be extended atlocation
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitExtendSelection
public boolean emitExtendSelection(TextExtendSelection granularity, TextIter location, TextIter start, TextIter end) Emits the "extend-selection" signal. SeeonExtendSelection(org.gnome.gtk.TextView.ExtendSelectionCallback)
. -
onInsertAtCursor
public SignalConnection<TextView.InsertAtCursorCallback> onInsertAtCursor(TextView.InsertAtCursorCallback handler) Gets emitted when the user initiates the insertion of a fixed string at the cursor.The ::insert-at-cursor signal is a keybinding signal.
This signal has no default bindings.
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitInsertAtCursor
Emits the "insert-at-cursor" signal. SeeonInsertAtCursor(org.gnome.gtk.TextView.InsertAtCursorCallback)
. -
onInsertEmoji
public SignalConnection<TextView.InsertEmojiCallback> onInsertEmoji(TextView.InsertEmojiCallback handler) Gets emitted to present the Emoji chooser for thetextView
.The ::insert-emoji signal is a keybinding signal.
The default bindings for this signal are
Ctrl
+.
andCtrl
+;
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitInsertEmoji
public void emitInsertEmoji()Emits the "insert-emoji" signal. SeeonInsertEmoji(org.gnome.gtk.TextView.InsertEmojiCallback)
. -
onMoveCursor
public SignalConnection<TextView.MoveCursorCallback> onMoveCursor(TextView.MoveCursorCallback handler) Gets emitted when the user initiates a cursor movement.The ::move-cursor signal is a keybinding signal. If the cursor is not visible in
textView
, this signal causes the viewport to be moved instead.Applications should not connect to it, but may emit it with g_signal_emit_by_name() 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 it does not. There are too many key combinations to list them all here.←
,→
,↑
,↓
move by individual characters/linesCtrl
+←
, etc. move by words/paragraphsHome
andEnd
move to the ends of the bufferPgUp
andPgDn
move vertically by pagesCtrl
+PgUp
andCtrl
+PgDn
move horizontally by pages
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitMoveCursor
Emits the "move-cursor" signal. SeeonMoveCursor(org.gnome.gtk.TextView.MoveCursorCallback)
. -
onMoveViewport
public SignalConnection<TextView.MoveViewportCallback> onMoveViewport(TextView.MoveViewportCallback handler) Gets emitted to move the viewport.The ::move-viewport 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.
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitMoveViewport
Emits the "move-viewport" signal. SeeonMoveViewport(org.gnome.gtk.TextView.MoveViewportCallback)
. -
onPasteClipboard
public SignalConnection<TextView.PasteClipboardCallback> onPasteClipboard(TextView.PasteClipboardCallback handler) Gets emitted to paste the contents of the clipboard into the text view.The ::paste-clipboard signal is a keybinding signal.
The default bindings for this signal are
Ctrl
+v
andShift
+Insert
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitPasteClipboard
public void emitPasteClipboard()Emits the "paste-clipboard" signal. SeeonPasteClipboard(org.gnome.gtk.TextView.PasteClipboardCallback)
. -
onPreeditChanged
public SignalConnection<TextView.PreeditChangedCallback> onPreeditChanged(TextView.PreeditChangedCallback handler) Emitted when preedit text of the active IM changes.If an input method is used, the typed text will not immediately be committed to the buffer. So if you are interested in the text, connect to this signal.
This signal is only emitted if the text at the given position is actually editable.
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitPreeditChanged
Emits the "preedit-changed" signal. SeeonPreeditChanged(org.gnome.gtk.TextView.PreeditChangedCallback)
. -
onSelectAll
Gets emitted to select or unselect the complete contents of the text view.The ::select-all signal is a keybinding signal.
The default bindings for this signal are
Ctrl
+a
andCtrl
+/
for selecting andShift
+Ctrl
+a
andCtrl
+\\
for unselecting.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitSelectAll
public void emitSelectAll(boolean select) Emits the "select-all" signal. SeeonSelectAll(org.gnome.gtk.TextView.SelectAllCallback)
. -
onSetAnchor
Gets emitted when the user initiates settings the "anchor" mark.The ::set-anchor 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.
This signal has no default bindings.
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitSetAnchor
public void emitSetAnchor()Emits the "set-anchor" signal. SeeonSetAnchor(org.gnome.gtk.TextView.SetAnchorCallback)
. -
onToggleCursorVisible
public SignalConnection<TextView.ToggleCursorVisibleCallback> onToggleCursorVisible(TextView.ToggleCursorVisibleCallback handler) Gets emitted to toggle thecursor-visible
property.The ::toggle-cursor-visible signal is a keybinding signal.
The default binding for this signal is
F7
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitToggleCursorVisible
public void emitToggleCursorVisible()Emits the "toggle-cursor-visible" signal. SeeonToggleCursorVisible(org.gnome.gtk.TextView.ToggleCursorVisibleCallback)
. -
onToggleOverwrite
public SignalConnection<TextView.ToggleOverwriteCallback> onToggleOverwrite(TextView.ToggleOverwriteCallback handler) Gets emitted to toggle the overwrite mode of the text view.The ::toggle-overwrite signal is a keybinding signal.
The default binding for this signal is
Insert
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitToggleOverwrite
public void emitToggleOverwrite()Emits the "toggle-overwrite" signal. SeeonToggleOverwrite(org.gnome.gtk.TextView.ToggleOverwriteCallback)
. -
builder
ATextView.Builder
object constructs aTextView
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withTextView.Builder.build()
.
-