Class Text
- All Implemented Interfaces:
Accessible,AccessibleText,Buildable,ConstraintTarget,Editable,Proxy
GtkText is the common implementation of single-line text editing
that is shared between Entry, PasswordEntry,
SpinButton, and other widgets. In all of these, a GtkText
instance is used as the delegate for the Editable implementation.
A large number of key bindings s 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 setVisibility(boolean).
In this mode, entered text is displayed using an “invisible” character.
By default, GTK picks the best invisible character that is available
in the current font, but it can be changed with
setInvisibleChar(int).
If you want to add icons or progress display in an entry, look at
Entry. There are other alternatives for more specialized
use cases, such as SearchEntry.
If you need multi-line editable text, use TextView.
Shortcuts and Gestures
GtkText supports the following keyboard shortcuts:
Shift+F10orMenuopens the context menu.Ctrl+AorCtrl+/selects all the text.Ctrl+Shift+AorCtrl+\unselects all.Ctrl+Zundoes the last modification.Ctrl+YorCtrl+Shift+Zredoes the last undone modification.Ctrl+Shift+Ttoggles the text direction.Clearclears the content.
Additionally, the following signals have default keybindings:
Gtk.Text::activateGtk.Text::backspaceGtk.Text::copy-clipboardGtk.Text::cut-clipboardGtk.Text::delete-from-cursorGtk.Text::insert-emojiGtk.Text::move-cursorGtk.Text::paste-clipboardGtk.Text::toggle-overwrite
Actions
GtkText defines a set of built-in actions:
clipboard.copycopies the contents to the clipboard.clipboard.cutcopies the contents to the clipboard and deletes it from the widget.clipboard.pasteinserts the contents of the clipboard into the widget.menu.popupopens the context menu.misc.insert-emojiopens the Emoji chooser.misc.toggle-visibilitytoggles theGtkText:visibility property.misc.toggle-directiontoggles the text direction.selection.deletedeletes the current selection.selection.select-allselects all of the widgets content.text.redoredoes the last change to the contents.text.undoundoes the last change to the contents.text.clearremoves all content.
CSS nodes
text[.read-only]
├── placeholder
├── undershoot.left
├── undershoot.right
├── [selection]
├── [cursor-handle[.top]
├── [cursor-handle.bottom]
├── [block-cursor]
├── [cursor-handle[.top/.bottom][.insertion-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 with the name popup.
The undershoot nodes are used to draw the underflow indication when content
is scrolled out of view. These nodes get the .left or .right style class
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.AccessibleRole.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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theActivateCallbackcallback.static interfaceFunctional interface declaration of theBackspaceCallbackcallback.static classText.Builder<B extends Text.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theCopyClipboardCallbackcallback.static interfaceFunctional interface declaration of theCutClipboardCallbackcallback.static interfaceFunctional interface declaration of theDeleteFromCursorCallbackcallback.static interfaceFunctional interface declaration of theInsertAtCursorCallbackcallback.static interfaceFunctional interface declaration of theInsertEmojiCallbackcallback.static interfaceFunctional interface declaration of theMoveCursorCallbackcallback.static interfaceFunctional interface declaration of thePasteClipboardCallbackcallback.static interfaceFunctional interface declaration of thePreeditChangedCallbackcallback.static interfaceFunctional interface declaration of theToggleOverwriteCallbackcallback.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.Widget$Impl, Widget.WidgetClassNested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.Accessible$Impl, Accessible.AccessibleInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.AccessibleText
AccessibleText.AccessibleText$Impl, AccessibleText.AccessibleTextInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Editable
Editable.ChangedCallback, Editable.DeleteTextCallback, Editable.Editable$Impl, Editable.EditableInterface, Editable.InsertTextCallback -
Constructor Summary
ConstructorsConstructorDescriptionText()Creates a new Text.Text(MemorySegment address) Create a Text proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected TextasParent()Returns this instance as if it were its parent type.static Text.Builder<? extends Text.Builder> builder()AText.Builderobject constructs aTextwith the specified properties.voidcomputeCursorExtents(long position, @Nullable Rect strong, @Nullable Rect weak) Determines the positions of the strong and weak cursors for a given character position.voidEmits the "activate" signal.voidEmits the "backspace" signal.voidEmits the "copy-clipboard" signal.voidEmits the "cut-clipboard" signal.voidemitDeleteFromCursor(DeleteType type, int count) Emits the "delete-from-cursor" signal.voidemitInsertAtCursor(String string) Emits the "insert-at-cursor" signal.voidEmits the "insert-emoji" signal.voidemitMoveCursor(MovementStep step, int count, boolean extend) Emits the "move-cursor" signal.voidEmits the "paste-clipboard" signal.voidemitPreeditChanged(String preedit) Emits the "preedit-changed" signal.voidEmits the "toggle-overwrite" signal.booleanReturns whether pressingEnterwill activate the default widget for the window containing the widget.@Nullable AttrListGets the attribute list that was set on the text widget.Get the entry buffer object which holds the text for this widget.booleanReturns whether Emoji completion is enabled.@Nullable MenuModelGets the extra menu model of the text widget.Gets the input hints of the text widget.Gets the input purpose of the text widget.intRetrieves the character displayed when visibility is set to false.intRetrieves the maximum allowed length of the contents.static MemoryLayoutThe memory layout of the native struct.booleanGets whether text is overwritten when typing.@Nullable StringRetrieves the text that will be displayed when the text widget is empty and unfocusedbooleanReturns whether the text widget will grow and shrink with the content.@Nullable TabArraygetTabs()Gets the tab stops for the text widget.shortRetrieves the length of the contents.booleanReturns whether pasted text will be truncated to the first line.static @Nullable TypegetType()Get the GType of the Text classbooleanRetrieves whether the text is visible.booleanCauses the text widget to have the keyboard focus.onActivate(Text.ActivateCallback handler) Emitted when the user hits theEnterkey.onBackspace(Text.BackspaceCallback handler) Emitted when the user asks for it.Emitted to copy the selection to the clipboard.onCutClipboard(Text.CutClipboardCallback handler) Emitted to cut the selection to the clipboard.Emitted when the user initiates a text deletion.Emitted when the user initiates the insertion of a fixed string at the cursor.onInsertEmoji(Text.InsertEmojiCallback handler) Emitted to present the Emoji chooser.onMoveCursor(Text.MoveCursorCallback handler) Emitted when the user initiates a cursor movement.Emitted to paste the contents of the clipboard.Emitted when the preedit text changes.Emitted to toggle the overwrite mode.voidsetActivatesDefault(boolean activates) Sets whether pressingEnterwill activate the default widget.voidsetAttributes(@Nullable AttrList attrs) Apply attributes to the contents of the text widget.voidsetBuffer(EntryBuffer buffer) Set the entry buffer object which holds the text for this widget.voidsetEnableEmojiCompletion(boolean enableEmojiCompletion) Sets whether Emoji completion is enabled.voidsetExtraMenu(@Nullable MenuModel model) Sets a menu model to add to the context menu of the text widget.voidsetInputHints(Set<InputHints> hints) Sets hints that allow input methods to fine-tune their behaviour.voidsetInputHints(InputHints... hints) Sets hints that allow input methods to fine-tune their behaviour.voidsetInputPurpose(InputPurpose purpose) Sets the input purpose of the text widget.voidsetInvisibleChar(int ch) Sets the character to use when in “password mode”.voidsetMaxLength(int length) Sets the maximum allowed length of the contents.voidsetOverwriteMode(boolean overwrite) Sets whether the text is overwritten when typing.voidsetPlaceholderText(@Nullable String text) Sets the text to be displayed when the text widget is empty and unfocused.voidsetPropagateTextWidth(boolean propagateTextWidth) Sets whether the text widget should grow and shrink with the content.voidSets tab stops for the text widget.voidsetTruncateMultiline(boolean truncateMultiline) Sets whether pasted text should be truncated to the first line.voidsetVisibility(boolean visible) Sets whether the contents of the text widget are visible or not.voidUnsets the invisible char.static TextwithBuffer(EntryBuffer buffer) Creates a newGtkTextwith the specified buffer.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, getLimitEvents, 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, setLimitEvents, 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, unsetStateFlagsMethods 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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateStateMethods inherited from interface org.gnome.gtk.AccessibleText
updateCaretPosition, updateContents, updateSelectionBoundMethods inherited from interface org.gnome.gtk.Buildable
getBuildableIdMethods inherited from interface org.gnome.gtk.Editable
delegateGetAccessiblePlatformState, deleteSelection, deleteText, emitChanged, emitDeleteText, emitInsertText, finishDelegate, getAlignment, getChars, getDelegate, getEditable, getEnableUndo, getMaxWidthChars, getPosition, getSelectionBounds, getText, getWidthChars, initDelegate, insertText, onChanged, onDeleteText, onInsertText, selectRegion, setAlignment, setEditable, setEnableUndo, setMaxWidthChars, setPosition, setText, setWidthChars
-
Constructor Details
-
Text
Create a Text proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
Text
public Text()Creates a new Text.
-
-
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 Javasuperkeyword, 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 newGtkTextwith the specified buffer.- Parameters:
buffer- the buffer to use- Returns:
- a new
GtkText
-
computeCursorExtents
Determines the positions of the strong and weak cursors for a given character position.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 are inserted. The weak cursor location is the location where characters of the directionality opposite to the base direction are inserted.
The rectangle positions are in widget coordinates.
- Parameters:
position- the character positionstrong- location to store the strong cursor positionweak- location to store the weak cursor position- Since:
- 4.4
-
getActivatesDefault
public boolean getActivatesDefault()Returns whether pressingEnterwill activate the default widget for the window containing the widget.- Returns:
- true if this Text will activate the default widget
-
getAttributes
Gets the attribute list that was set on the text widget.- Returns:
- the attribute list
-
getBuffer
Get the entry buffer object which holds the text for this widget.- Returns:
- the entry buffer object
-
getEnableEmojiCompletion
public boolean getEnableEmojiCompletion()Returns whether Emoji completion is enabled.- Returns:
- true if Emoji completion is enabled
-
getExtraMenu
Gets the extra menu model of the text widget.- Returns:
- the menu model
-
getInputHints
Gets the input hints of the text widget.- Returns:
- the input hints
-
getInputPurpose
Gets the input purpose of the text widget.- Returns:
- the input purpose
-
getInvisibleChar
public int getInvisibleChar()Retrieves the character displayed when visibility is set to false.Note that GTK does not compute this value unless it needs it, so the value returned by this function is not very useful unless it has been explicitly set with
setInvisibleChar(int).- Returns:
- the current invisible char, or 0, if
textdoes not show invisible text at all
-
getMaxLength
public int getMaxLength()Retrieves the maximum allowed length of the contents.See
setMaxLength(int).This is equivalent to getting
self'sGtkEntryBufferand callingEntryBuffer.getMaxLength()on it.- Returns:
- the maximum allowed number of characters, or 0 if there is no limit
-
getOverwriteMode
public boolean getOverwriteMode()Gets whether text is overwritten when typing.- Returns:
- whether text is overwritten when typing
-
getPlaceholderText
Retrieves the text that will be displayed when the text widget is empty and unfocused- Returns:
- the placeholder text
-
getPropagateTextWidth
public boolean getPropagateTextWidth()Returns whether the text widget will grow and shrink with the content.- Returns:
- true if this Text will propagate the text width
-
getTabs
Gets the tab stops for the text widget.- Returns:
- the tab stops
-
getTextLength
public short getTextLength()Retrieves the length of the contents.This is equivalent to getting
self'sGtkEntryBufferand callingEntryBuffer.getLength()on it.- Returns:
- the length of the contents, in characters
-
getTruncateMultiline
public boolean getTruncateMultiline()Returns whether pasted text will be truncated to the first line.- Returns:
- true if this Text will truncate pasted multi-line text
-
getVisibility
public boolean getVisibility()Retrieves whether the text is visible.- Returns:
- true if the text is visible
-
grabFocusWithoutSelecting
public boolean grabFocusWithoutSelecting()Causes the text widget to have the keyboard focus.It behaves like
Widget.grabFocus(), except that it does not select the contents ofself.You only want to call this on some special entries which the user usually doesn't want to replace all text in, such as search-as-you-type entries.
- Returns:
- true if focus is now inside this Text
-
setActivatesDefault
public void setActivatesDefault(boolean activates) Sets whether pressingEnterwill activate the default widget.This usually means that the dialog containing this Text will be closed, since the default widget is usually one of the dialog buttons.
- Parameters:
activates- true to activate window’s default widget onEnterkeypress
-
setAttributes
Apply attributes to the contents of the text widget.- Parameters:
attrs- a list of style attributes
-
setBuffer
Set the entry buffer object which holds the text for this widget.- Parameters:
buffer- an entry buffer object
-
setEnableEmojiCompletion
public void setEnableEmojiCompletion(boolean enableEmojiCompletion) Sets whether Emoji completion is enabled.If it is, typing ':', followed by a recognized keyword, will pop up a window with suggested Emojis matching the keyword.
- Parameters:
enableEmojiCompletion- true to enable Emoji completion
-
setExtraMenu
Sets a menu model to add to the context menu of the text widget.- Parameters:
model- a menu model
-
setInputHints
Sets hints that allow input methods to fine-tune their behaviour.- Parameters:
hints- input hints
-
setInputHints
Sets hints that allow input methods to fine-tune their behaviour.- Parameters:
hints- input hints
-
setInputPurpose
Sets the input purpose of the text widget.The input purpose can be used by on-screen keyboards and other input methods to adjust their behaviour.
- Parameters:
purpose- the input purpose
-
setInvisibleChar
public void setInvisibleChar(int ch) Sets the character to use when in “password mode”.By default, GTK picks the best invisible char available in the current font. If you set the invisible char to 0, then the user will get no feedback at all; there will be no text on the screen as they type.
- Parameters:
ch- a Unicode character
-
setMaxLength
public void setMaxLength(int length) Sets the maximum allowed length of the contents.If the current contents are longer than the given length, they will be truncated to fit.
This is equivalent to getting
self'sGtkEntryBufferand callingEntryBuffer.setMaxLength(int)on it.- Parameters:
length- the maximum length of the text, or 0 for no maximum. (other than the maximum length of entries.) The value passed in will be clamped to the range 0-65536
-
setOverwriteMode
public void setOverwriteMode(boolean overwrite) Sets whether the text is overwritten when typing.- Parameters:
overwrite- new value
-
setPlaceholderText
Sets the text to be displayed when the text widget is empty and unfocused.This can be used to give a visual hint of the expected contents of the text widget.
- Parameters:
text- a string to be displayed when this Text is empty and unfocused
-
setPropagateTextWidth
public void setPropagateTextWidth(boolean propagateTextWidth) Sets whether the text widget should grow and shrink with the content.- Parameters:
propagateTextWidth- true to propagate the text width
-
setTabs
Sets tab stops for the text widget.- Parameters:
tabs- tab stops
-
setTruncateMultiline
public void setTruncateMultiline(boolean truncateMultiline) Sets whether pasted text should be truncated to the first line.- Parameters:
truncateMultiline- true to truncate multi-line text
-
setVisibility
public void setVisibility(boolean visible) Sets whether the contents of the text widget are visible or not.When visibility is set to false, characters are displayed as the invisible char, and it will also appear that way when the text in the widget is copied to the clipboard.
By default, GTK picks the best invisible character available in the current font, but it can be changed with
setInvisibleChar(int).Note that you probably want to set
Gtk.Text:input-purposetoGtk.InputPurpose.passwordorGtk.InputPurpose.pinto inform input methods about the purpose of this widget, in addition to setting visibility to false.- Parameters:
visible- true if the contents of the text widget are displayed as plain text
-
unsetInvisibleChar
public void unsetInvisibleChar()Unsets the invisible char.After calling this, the default invisible char is used again.
-
onActivate
Emitted when the user hits theEnterkey.The default bindings for this signal are all forms of the
Enterkey.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitActivate
public void emitActivate()Emits the "activate" signal. SeeonActivate(org.gnome.gtk.Text.ActivateCallback). -
onBackspace
Emitted when the user asks for it.This is a keybinding signal.
The default bindings for this signal are
BackspaceandShift+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.Text.BackspaceCallback). -
onCopyClipboard
public SignalConnection<Text.CopyClipboardCallback> onCopyClipboard(Text.CopyClipboardCallback handler) Emitted to copy the selection to the clipboard.This is a keybinding signal.
The default bindings for this signal are
Ctrl+candCtrl+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.Text.CopyClipboardCallback). -
onCutClipboard
public SignalConnection<Text.CutClipboardCallback> onCutClipboard(Text.CutClipboardCallback handler) Emitted to cut the selection to the clipboard.This is a keybinding signal.
The default bindings for this signal are
Ctrl+xandShift+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.Text.CutClipboardCallback). -
onDeleteFromCursor
public SignalConnection<Text.DeleteFromCursorCallback> onDeleteFromCursor(Text.DeleteFromCursorCallback handler) Emitted when the user initiates a text deletion.This is a keybinding signal.
If the
typeisGtk.DeleteType.chars, GTK deletes the selection if there is one, otherwise it deletes the requested number of characters.The default bindings for this signal are
Deletefor deleting a character andCtrl+Deletefor deleting a word.- 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.Text.DeleteFromCursorCallback). -
onInsertAtCursor
public SignalConnection<Text.InsertAtCursorCallback> onInsertAtCursor(Text.InsertAtCursorCallback handler) Emitted when the user initiates the insertion of a fixed string at the cursor.This 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.Text.InsertAtCursorCallback). -
onInsertEmoji
Emitted to present the Emoji chooser.This 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.Text.InsertEmojiCallback). -
onMoveCursor
Emitted when the user initiates a cursor movement.If the cursor is not visible in
self,this signal causes the viewport to be moved instead.This is a keybinding signal.
Applications should not connect to it, but may emit it with
GObjects.signalEmitByName(org.gnome.gobject.GObject, java.lang.String, java.lang.Object...)if they need to control the cursor programmatically.The default bindings for this signal come in two variants, the variant with the
Shiftmodifier 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/paragraphsHomeandEndmove to the ends of the buffer
- 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.Text.MoveCursorCallback). -
onPasteClipboard
public SignalConnection<Text.PasteClipboardCallback> onPasteClipboard(Text.PasteClipboardCallback handler) Emitted to paste the contents of the clipboard.This is a keybinding signal.
The default bindings for this signal are
Ctrl+vandShift+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.Text.PasteClipboardCallback). -
onPreeditChanged
public SignalConnection<Text.PreeditChangedCallback> onPreeditChanged(Text.PreeditChangedCallback handler) Emitted when the preedit text 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.
- 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.Text.PreeditChangedCallback). -
onToggleOverwrite
public SignalConnection<Text.ToggleOverwriteCallback> onToggleOverwrite(Text.ToggleOverwriteCallback handler) Emitted to toggle the overwrite mode.This is a keybinding signal.
The default bindings 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.Text.ToggleOverwriteCallback). -
builder
AText.Builderobject constructs aTextwith the specified properties. Use the variousset...()methods to set properties, and finish construction withText.Builder.build().- Returns:
- the builder object
-