Class Text
- All Implemented Interfaces:
Proxy
,Accessible
,AccessibleText
,Buildable
,ConstraintTarget
,Editable
GtkText
widget is a single-line text entry widget.
GtkText
is the common implementation of single-line text editing
that is shared between Entry
, PasswordEntry
,
SpinButton
, and other widgets. In all of these, GtkText
is
used as the delegate for the Editable
implementation.
A fairly large set of key bindings are 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 a “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 are looking to add icons or progress display in an entry, look
at Entry
. There other alternatives for more specialized use
cases, such as SearchEntry
.
If you need multi-line editable text, look at TextView
.
Shortcuts and Gestures
GtkText
supports the following keyboard shortcuts:
Shift
+F10
orMenu
opens the context menu.Ctrl
+A
orCtrl
+/
selects all the text.Ctrl
+Shift
+A
orCtrl
+\
unselects all.Ctrl
+Z
undoes the last modification.Ctrl
+Y
orCtrl
+Shift
+Z
redoes the last undone modification.
Additionally, the following signals have default keybindings:
Gtk.Text::activate
Gtk.Text::backspace
Gtk.Text::copy-clipboard
Gtk.Text::cut-clipboard
Gtk.Text::delete-from-cursor
Gtk.Text::insert-emoji
Gtk.Text::move-cursor
Gtk.Text::paste-clipboard
Gtk.Text::toggle-overwrite
Actions
GtkText
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.misc.toggle-visibility
toggles theGtkText
:visibility property.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
text[.read-only]
├── placeholder
├── undershoot.left
├── undershoot.right
├── [selection]
├── [block-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 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
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theActivateCallback
callback.static interface
Functional interface declaration of theBackspaceCallback
callback.static class
Text.Builder<B extends Text.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 theInsertAtCursorCallback
callback.static interface
Functional interface declaration of theInsertEmojiCallback
callback.static interface
Functional interface declaration of theMoveCursorCallback
callback.static interface
Functional interface declaration of thePasteClipboardCallback
callback.static interface
Functional interface declaration of thePreeditChangedCallback
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.Editable
Editable.ChangedCallback, Editable.DeleteTextCallback, Editable.EditableImpl, Editable.EditableInterface, Editable.InsertTextCallback
-
Constructor Summary
ConstructorDescriptionText()
Creates a newGtkText
.Text
(MemorySegment address) Create a Text proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected Text
asParent()
Returns this instance as if it were its parent type.static Text.Builder
<? extends Text.Builder> builder()
AText.Builder
object constructs aText
with the specified properties.void
computeCursorExtents
(long position, @Nullable Rect strong, @Nullable Rect weak) Determine the positions of the strong and weak cursors if the insertion point in the layout is atposition
.void
Emits the "activate" 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.void
emitInsertAtCursor
(String string) Emits the "insert-at-cursor" signal.void
Emits the "insert-emoji" signal.void
emitMoveCursor
(MovementStep step, int count, boolean extend) Emits the "move-cursor" signal.void
Emits the "paste-clipboard" signal.void
emitPreeditChanged
(String preedit) Emits the "preedit-changed" signal.void
Emits the "toggle-overwrite" signal.boolean
Returns whether pressing Enter will activate the default widget for the window containing this Text.Gets the attribute list that was set on theGtkText
.Get theGtkEntryBuffer
object which holds the text for this widget.boolean
Returns whether Emoji completion is enabled for thisGtkText
widget.Gets the menu model for extra items in the context menu.Gets the input hints of theGtkText
.Gets the input purpose of theGtkText
.int
Retrieves the character displayed when visibility is set to false.int
Retrieves the maximum allowed length of the text in this Text.static MemoryLayout
The memory layout of the native struct.boolean
Gets whether text is overwritten when typing in theGtkText
.Retrieves the text that will be displayed when this Text is empty and unfocusedboolean
Returns whether theGtkText
will grow and shrink with the content.getTabs()
Gets the tabstops that were set on theGtkText
.short
Retrieves the current length of the text in this Text.boolean
Returns whether theGtkText
will truncate multi-line text that is pasted into the widgetstatic Type
getType()
Get the GType of the Text classboolean
Retrieves whether the text in this Text is visible.boolean
Causes this Text to have keyboard focus.onActivate
(Text.ActivateCallback handler) Emitted when the user hits theEnter
key.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 for the widget.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 of theGtkText
.void
setActivatesDefault
(boolean activates) Ifactivates
istrue
, pressing Enter will activate the default widget for the window containing this Text.void
setAttributes
(@Nullable AttrList attrs) Sets attributes that are applied to the text.void
setBuffer
(EntryBuffer buffer) Set theGtkEntryBuffer
object which holds the text for this widget.void
setEnableEmojiCompletion
(boolean enableEmojiCompletion) Sets whether Emoji completion is enabled.void
setExtraMenu
(@Nullable MenuModel model) Sets a menu model to add when constructing the context menu for this Text.void
setInputHints
(Set<InputHints> hints) Sets input hints that allow input methods to fine-tune their behaviour.void
setInputHints
(InputHints... hints) Sets input hints that allow input methods to fine-tune their behaviour.void
setInputPurpose
(InputPurpose purpose) Sets the input purpose of theGtkText
.void
setInvisibleChar
(int ch) Sets the character to use when in “password mode”.void
setMaxLength
(int length) Sets the maximum allowed length of the contents of the widget.void
setOverwriteMode
(boolean overwrite) Sets whether the text is overwritten when typing in theGtkText
.void
setPlaceholderText
(@Nullable String text) Sets text to be displayed in this Text when it is empty.void
setPropagateTextWidth
(boolean propagateTextWidth) Sets whether theGtkText
should grow and shrink with the content.void
Sets tabstops that are applied to the text.void
setTruncateMultiline
(boolean truncateMultiline) Sets whether theGtkText
should truncate multi-line text that is pasted into the widget.void
setVisibility
(boolean visible) Sets whether the contents of theGtkText
are visible or not.void
Unsets the invisible char.static Text
withBuffer
(EntryBuffer buffer) Creates a newGtkText
with the specified text 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, 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.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 newGtkText
.
-
-
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 newGtkText
with the specified text buffer.- Parameters:
buffer
- The buffer to use for the newGtkText
.- Returns:
- a new
GtkText
-
computeCursorExtents
public void computeCursorExtents(long position, @Nullable @Nullable Rect strong, @Nullable @Nullable Rect weak) Determine the positions of the strong and weak cursors if the insertion point in the layout is atposition
.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
-
getActivatesDefault
public boolean getActivatesDefault()Returns whether pressing Enter will activate the default widget for the window containing this Text.- Returns:
true
if theGtkText
will activate the default widget
-
getAttributes
Gets the attribute list that was set on theGtkText
.- Returns:
- the attribute list
-
getBuffer
Get theGtkEntryBuffer
object which holds the text for this widget.- Returns:
- A
GtkEntryBuffer
object.
-
getEnableEmojiCompletion
public boolean getEnableEmojiCompletion()Returns whether Emoji completion is enabled for thisGtkText
widget.- Returns:
true
if Emoji completion is enabled
-
getExtraMenu
Gets the menu model for extra items in the context menu.- Returns:
- the menu model
-
getInputHints
Gets the input hints of theGtkText
.- Returns:
- the input hints
-
getInputPurpose
Gets the input purpose of theGtkText
.- 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
text
does not show invisible text at all.
-
getMaxLength
public int getMaxLength()Retrieves the maximum allowed length of the text in this Text.See
setMaxLength(int)
.This is equivalent to getting this Text's
GtkEntryBuffer
and callingEntryBuffer.getMaxLength()
on it.- Returns:
- the maximum allowed number of characters
in
GtkText
, or 0 if there is no maximum.
-
getOverwriteMode
public boolean getOverwriteMode()Gets whether text is overwritten when typing in theGtkText
.- Returns:
- whether the text is overwritten when typing
-
getPlaceholderText
Retrieves the text that will be displayed when this Text is empty and unfocusedIf no placeholder text has been set,
null
will be returned.- Returns:
- the placeholder text
-
getPropagateTextWidth
public boolean getPropagateTextWidth()Returns whether theGtkText
will grow and shrink with the content.- Returns:
true
if this Text will propagate the text width
-
getTabs
Gets the tabstops that were set on theGtkText
.- Returns:
- the tabstops
-
getTextLength
public short getTextLength()Retrieves the current length of the text in this Text.This is equivalent to getting this Text's
GtkEntryBuffer
and callingEntryBuffer.getLength()
on it.- Returns:
- the current number of characters
in
GtkText
, or 0 if there are none.
-
getTruncateMultiline
public boolean getTruncateMultiline()Returns whether theGtkText
will truncate multi-line text that is pasted into the widget- Returns:
true
if this Text will truncate multi-line text
-
getVisibility
public boolean getVisibility()Retrieves whether the text in this Text is visible.- Returns:
true
if the text is currently visible
-
grabFocusWithoutSelecting
public boolean grabFocusWithoutSelecting()Causes this Text to have keyboard focus.It behaves like
Widget.grabFocus()
, except that it doesn't select the contents of this Text. 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) Ifactivates
istrue
, pressing Enter will activate the default widget for the window containing this Text.This usually means that the dialog containing the
GtkText
will be closed, since the default widget is usually one of the dialog buttons.- Parameters:
activates
-true
to activate window’s default widget on Enter keypress
-
setAttributes
Sets attributes that are applied to the text.- Parameters:
attrs
- aPangoAttrList
-
setBuffer
Set theGtkEntryBuffer
object which holds the text for this widget.- Parameters:
buffer
- aGtkEntryBuffer
-
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 when constructing the context menu for this Text.- Parameters:
model
- aGMenuModel
-
setInputHints
Sets input hints that allow input methods to fine-tune their behaviour.- Parameters:
hints
- the hints
-
setInputHints
Sets input hints that allow input methods to fine-tune their behaviour.- Parameters:
hints
- the hints
-
setInputPurpose
Sets the input purpose of theGtkText
.This can be used by on-screen keyboards and other input methods to adjust their behaviour.
- Parameters:
purpose
- the 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 of the widget.If the current contents are longer than the given length, then they will be truncated to fit.
This is equivalent to getting this Text's
GtkEntryBuffer
and callingEntryBuffer.setMaxLength(int)
on it.- Parameters:
length
- the maximum length of theGtkText
, 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 in theGtkText
.- Parameters:
overwrite
- new value
-
setPlaceholderText
Sets text to be displayed in this Text when it is empty.This can be used to give a visual hint of the expected contents of the
GtkText
.- Parameters:
text
- a string to be displayed when this Text is empty and unfocused
-
setPropagateTextWidth
public void setPropagateTextWidth(boolean propagateTextWidth) Sets whether theGtkText
should grow and shrink with the content.- Parameters:
propagateTextWidth
-true
to propagate the text width
-
setTabs
Sets tabstops that are applied to the text.- Parameters:
tabs
- aPangoTabArray
-
setTruncateMultiline
public void setTruncateMultiline(boolean truncateMultiline) Sets whether theGtkText
should truncate multi-line text that is pasted into the widget.- Parameters:
truncateMultiline
-true
to truncate multi-line text
-
setVisibility
public void setVisibility(boolean visible) Sets whether the contents of theGtkText
are visible or not.When visibility is set to
false
, characters are displayed as the invisible char, and 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-purpose
toInputPurpose.PASSWORD
orInputPurpose.PIN
to inform input methods about the purpose of this self, in addition to setting visibility tofalse
.- Parameters:
visible
-true
if the contents of theGtkText
are displayed as plaintext
-
unsetInvisibleChar
public void unsetInvisibleChar()Unsets the invisible char.After calling this, the default invisible char is used again.
-
onActivate
Emitted when the user hits theEnter
key.The default bindings for this signal are all forms of the
Enter
key.- 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
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.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
+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.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
+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.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
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 andCtrl
+Delete
for 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 for the widget.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 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 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
+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.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 of theGtkText
.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.Builder
object constructs aText
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withText.Builder.build()
.
-