Class TextBuffer
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
Buffer
GtkTextView
.
You may wish to begin by reading the text widget conceptual overview, which gives an overview of all the objects and data types related to the text widget and how they work together.
GtkTextBuffer can support undoing changes to the buffer
content, see setEnableUndo(boolean)
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theApplyTagCallback
callback.static interface
Functional interface declaration of theBeginUserActionCallback
callback.static class
TextBuffer.Builder<B extends TextBuffer.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theChangedCallback
callback.static interface
Functional interface declaration of theDeleteRangeCallback
callback.static interface
Functional interface declaration of theEndUserActionCallback
callback.static interface
Functional interface declaration of theInsertChildAnchorCallback
callback.static interface
Functional interface declaration of theInsertPaintableCallback
callback.static interface
Functional interface declaration of theInsertTextCallback
callback.static interface
Functional interface declaration of theMarkDeletedCallback
callback.static interface
Functional interface declaration of theMarkSetCallback
callback.static interface
Functional interface declaration of theModifiedChangedCallback
callback.static interface
Functional interface declaration of thePasteDoneCallback
callback.static interface
Functional interface declaration of theRedoCallback
callback.static interface
Functional interface declaration of theRemoveTagCallback
callback.static class
The class structure forGtkTextBuffer
.static interface
Functional interface declaration of theUndoCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCallsTextBuffer(org.gnome.gtk.TextTagTable)
with table =null
TextBuffer
(MemorySegment address) Create a TextBuffer proxy instance for the provided memory address.TextBuffer
(@Nullable TextTagTable table) Creates a new text buffer. -
Method Summary
Modifier and TypeMethodDescriptionint
addCommitNotify
(Set<TextBufferNotifyFlags> flags, TextBufferCommitNotify commitNotify) Adds aGtk.TextBufferCommitNotify
to be called when a change is to be made to theGtk.TextBuffer
.int
addCommitNotify
(TextBufferNotifyFlags flags, TextBufferCommitNotify commitNotify) Adds aGtk.TextBufferCommitNotify
to be called when a change is to be made to theGtk.TextBuffer
.void
Adds the mark at positionwhere
.void
addSelectionClipboard
(Clipboard clipboard) Addsclipboard
to the list of clipboards in which the selection contents of this TextBuffer are available.void
Emits the “apply-tag” signal on this TextBuffer.void
applyTagByName
(String name, TextIter start, TextIter end) Emits the “apply-tag” signal on this TextBuffer.protected TextBuffer
asParent()
Returns this instance as if it were its parent type.boolean
Performs the appropriate action as if the user hit the delete key with the cursor at the position specified byiter
.void
Denotes the beginning of an action that may not be undone.void
Called to indicate that the buffer operations between here and a call to gtk_text_buffer_end_user_action() are part of a single user-visible operation.static TextBuffer.Builder
<? extends TextBuffer.Builder> builder()
ATextBuffer.Builder
object constructs aTextBuffer
with the specified properties.protected void
changed()
The class handler for theGtkTextBuffer::changed
signal.void
copyClipboard
(Clipboard clipboard) Copies the currently-selected text to a clipboard.createChildAnchor
(TextIter iter) Creates and inserts a child anchor.createMark
(@Nullable String markName, TextIter where, boolean leftGravity) Creates a mark at positionwhere
.Creates a tag and adds it to the tag table for this TextBuffer.void
cutClipboard
(Clipboard clipboard, boolean defaultEditable) Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.void
Deletes text betweenstart
andend
.boolean
deleteInteractive
(TextIter startIter, TextIter endIter, boolean defaultEditable) Deletes all editable text in the given range.void
deleteMark
(TextMark mark) Deletesmark
, so that it’s no longer located anywhere in the buffer.void
deleteMarkByName
(String name) Deletes the mark namedname
; the mark must exist.protected void
deleteRange
(TextIter start, TextIter end) The class handler for theGtkTextBuffer::delete-range
signal.boolean
deleteSelection
(boolean interactive, boolean defaultEditable) Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text.void
emitApplyTag
(TextTag tag, TextIter start, TextIter end) Emits the "apply-tag" signal.void
Emits the "begin-user-action" signal.void
Emits the "changed" signal.void
emitDeleteRange
(TextIter start, TextIter end) Emits the "delete-range" signal.void
Emits the "end-user-action" signal.void
emitInsertChildAnchor
(TextIter location, TextChildAnchor anchor) Emits the "insert-child-anchor" signal.void
emitInsertPaintable
(TextIter location, Paintable paintable) Emits the "insert-paintable" signal.void
emitInsertText
(TextIter location, String text, int len) Emits the "insert-text" signal.void
emitMarkDeleted
(TextMark mark) Emits the "mark-deleted" signal.void
emitMarkSet
(TextIter location, TextMark mark) Emits the "mark-set" signal.void
Emits the "modified-changed" signal.void
emitPasteDone
(Clipboard clipboard) Emits the "paste-done" signal.void
emitRedo()
Emits the "redo" signal.void
emitRemoveTag
(TextTag tag, TextIter start, TextIter end) Emits the "remove-tag" signal.void
emitUndo()
Emits the "undo" signal.void
Denotes the end of an action that may not be undone.void
Ends a user-visible operation.void
Retrieves the first and last iterators in the buffer, i.e.boolean
Gets whether there is a redoable action in the history.boolean
Gets whether there is an undoable action in the history.int
Gets the number of characters in the buffer.boolean
Gets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.void
getEndIter
(TextIter iter) Initializesiter
with the “end iterator,” one past the last valid character in the text buffer.boolean
Indicates whether the buffer has some text currently selected.Returns the mark that represents the cursor (insertion point).void
getIterAtChildAnchor
(TextIter iter, TextChildAnchor anchor) Obtains the location ofanchor
within this TextBuffer.boolean
getIterAtLine
(TextIter iter, int lineNumber) Initializesiter
to the start of the given line.boolean
getIterAtLineIndex
(TextIter iter, int lineNumber, int byteIndex) Obtains an iterator pointing tobyteIndex
within the given line.boolean
getIterAtLineOffset
(TextIter iter, int lineNumber, int charOffset) Obtains an iterator pointing tocharOffset
within the given line.void
getIterAtMark
(TextIter iter, TextMark mark) Initializesiter
with the current position ofmark
.void
getIterAtOffset
(TextIter iter, int charOffset) Initializesiter
to a positioncharOffset
chars from the start of the entire buffer.int
Obtains the number of lines in the buffer.Returns the mark namedname
in buffer this TextBuffer, ornull
if no such mark exists in the buffer.int
Gets the maximum number of undo levels to perform.static MemoryLayout
The memory layout of the native struct.boolean
Indicates whether the buffer has been modified since the last call tosetModified(boolean)
set the modification flag tofalse
.Returns the mark that represents the selection bound.boolean
getSelectionBounds
(TextIter start, TextIter end) Returnstrue
if some text is selected; places the bounds of the selection instart
andend
.Get a content provider for this buffer.Returns the text in the rangeend). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if @include_hidden_chars is %FALSE. The returned string includes a 0xFFFC character whenever the buffer contains embedded images, so byte and character indexes into the returned string do correspond to byte and character indexes into the buffer. Contrast with [method@Gtk.TextBuffer.get_text
.void
getStartIter
(TextIter iter) Initializediter
with the first position in the text buffer.Get theGtkTextTagTable
associated with this buffer.Returns the text in the rangeend). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if @include_hidden_chars is %FALSE. Does not include characters representing embedded images, so byte and character indexes into the returned string do not correspond to byte and character indexes into the buffer. Contrast with [method@Gtk.TextBuffer.get_slice
.static Type
getType()
Get the GType of the TextBuffer classvoid
Insertslen
bytes oftext
at positioniter
.void
insertAtCursor
(String text, int len) Insertstext
in this TextBuffer.void
insertChildAnchor
(TextIter iter, TextChildAnchor anchor) Inserts a child widget anchor into the text buffer atiter
.boolean
insertInteractive
(TextIter iter, String text, int len, boolean defaultEditable) Insertstext
in this TextBuffer.boolean
insertInteractiveAtCursor
(String text, int len, boolean defaultEditable) Insertstext
in this TextBuffer.void
insertMarkup
(TextIter iter, String markup, int len) Inserts the text inmarkup
at positioniter
.void
insertPaintable
(TextIter iter, Paintable paintable) Inserts an image into the text buffer atiter
.void
insertRange
(TextIter iter, TextIter start, TextIter end) Copies text, tags, and paintables betweenstart
andend
and inserts the copy atiter
.boolean
insertRangeInteractive
(TextIter iter, TextIter start, TextIter end, boolean defaultEditable) Copies text, tags, and paintables betweenstart
andend
and inserts the copy atiter
.protected void
insertText
(TextIter pos, String newText, int newTextLength) The class handler for theGtkTextBuffer::insert-text
signal.void
insertWithTags
(TextIter iter, String text, int len, TextTag firstTag, Object... varargs) Insertstext
into this TextBuffer atiter
, applying the list of tags to the newly-inserted text.void
insertWithTagsByName
(TextIter iter, String text, int len, String firstTagName, Object... varargs) Insertstext
into this TextBuffer atiter
, applying the list of tags to the newly-inserted text.protected void
markDeleted
(TextMark mark) The class handler for theGtkTextBuffer::mark-deleted
signal.protected void
The class handler for theGtkTextBuffer::mark-set
signal.protected void
The class handler for theGtkTextBuffer::modified-changed
signal.void
Movesmark
to the new locationwhere
.void
moveMarkByName
(String name, TextIter where) Moves the mark namedname
(which must exist) to locationwhere
.onApplyTag
(TextBuffer.ApplyTagCallback handler) Emitted to apply a tag to a range of text in aGtkTextBuffer
.Emitted at the beginning of a single user-visible operation on aGtkTextBuffer
.onChanged
(TextBuffer.ChangedCallback handler) Emitted when the content of aGtkTextBuffer
has changed.Emitted to delete a range from aGtkTextBuffer
.Emitted at the end of a single user-visible operation on theGtkTextBuffer
.Emitted to insert aGtkTextChildAnchor
in aGtkTextBuffer
.Emitted to insert aGdkPaintable
in aGtkTextBuffer
.Emitted to insert text in aGtkTextBuffer
.Emitted as notification after aGtkTextMark
is deleted.onMarkSet
(TextBuffer.MarkSetCallback handler) Emitted as notification after aGtkTextMark
is set.Emitted when the modified bit of aGtkTextBuffer
flips.onPasteDone
(TextBuffer.PasteDoneCallback handler) Emitted after paste operation has been completed.onRedo
(TextBuffer.RedoCallback handler) Emitted when a request has been made to redo the previously undone operation.onRemoveTag
(TextBuffer.RemoveTagCallback handler) Emitted to remove all occurrences oftag
from a range of text in aGtkTextBuffer
.onUndo
(TextBuffer.UndoCallback handler) Emitted when a request has been made to undo the previous operation or set of operations that have been grouped together.void
pasteClipboard
(Clipboard clipboard, @Nullable TextIter overrideLocation, boolean defaultEditable) Pastes the contents of a clipboard.protected void
The class handler for theGtkTextBuffer::paste-done
signal.void
placeCursor
(TextIter where) This function moves the “insert” and “selection_bound” marks simultaneously.void
redo()
Redoes the next redoable action on the buffer, if there is one.void
removeAllTags
(TextIter start, TextIter end) Removes all tags in the range betweenstart
andend
.void
removeCommitNotify
(int commitNotifyHandler) Removes theGtkTextBufferCommitNotify
handler previously registered withaddCommitNotify(java.util.Set<org.gnome.gtk.TextBufferNotifyFlags>, org.gnome.gtk.TextBufferCommitNotify)
.void
removeSelectionClipboard
(Clipboard clipboard) Removes aGdkClipboard
added withaddSelectionClipboard(org.gnome.gdk.Clipboard)
void
Emits the “remove-tag” signal.void
removeTagByName
(String name, TextIter start, TextIter end) Emits the “remove-tag” signal.void
selectRange
(TextIter ins, TextIter bound) This function moves the “insert” and “selection_bound” marks simultaneously.void
setEnableUndo
(boolean enableUndo) Sets whether or not to enable undoable actions in the text buffer.void
setMaxUndoLevels
(int maxUndoLevels) Sets the maximum number of undo levels to perform.void
setModified
(boolean setting) Used to keep track of whether the buffer has been modified since the last time it was saved.void
Deletes current contents of this TextBuffer, and insertstext
instead.void
undo()
Undoes the last undoable action on the buffer, if there is one.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
-
Constructor Details
-
TextBuffer
Create a TextBuffer proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
TextBuffer
Creates a new text buffer.- Parameters:
table
- a tag table, ornull
to create a new one
-
TextBuffer
public TextBuffer()CallsTextBuffer(org.gnome.gtk.TextTagTable)
with table =null
-
-
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. -
addCommitNotify
Adds aGtk.TextBufferCommitNotify
to be called when a change is to be made to theGtk.TextBuffer
.Functions are explicitly forbidden from making changes to the
Gtk.TextBuffer
from this callback. It is intended for tracking changes to the buffer only.It may be advantageous to use
Gtk.TextBufferCommitNotify
over connecting to theGtk.TextBuffer::insert-text
orGtk.TextBuffer::delete-range
signals to avoid ordering issues with other signal handlers which may further modify theGtk.TextBuffer
.- Parameters:
flags
- which notifications should be dispatched tocallback
commitNotify
- aGtk.TextBufferCommitNotify
to call for commit notifications- Returns:
- a handler id which may be used to remove the commit notify
callback using
removeCommitNotify(int)
.
-
addCommitNotify
Adds aGtk.TextBufferCommitNotify
to be called when a change is to be made to theGtk.TextBuffer
.Functions are explicitly forbidden from making changes to the
Gtk.TextBuffer
from this callback. It is intended for tracking changes to the buffer only.It may be advantageous to use
Gtk.TextBufferCommitNotify
over connecting to theGtk.TextBuffer::insert-text
orGtk.TextBuffer::delete-range
signals to avoid ordering issues with other signal handlers which may further modify theGtk.TextBuffer
.- Parameters:
flags
- which notifications should be dispatched tocallback
commitNotify
- aGtk.TextBufferCommitNotify
to call for commit notifications- Returns:
- a handler id which may be used to remove the commit notify
callback using
removeCommitNotify(int)
.
-
addMark
Adds the mark at positionwhere
.The mark must not be added to another buffer, and if its name is not
null
then there must not be another mark in the buffer with the same name.Emits the
Gtk.TextBuffer::mark-set
signal as notification of the mark's initial placement.- Parameters:
mark
- the mark to addwhere
- location to place mark
-
addSelectionClipboard
Addsclipboard
to the list of clipboards in which the selection contents of this TextBuffer are available.In most cases,
clipboard
will be theGdkClipboard
returned byWidget.getPrimaryClipboard()
for a view of this TextBuffer.- Parameters:
clipboard
- aGdkClipboard
-
applyTag
Emits the “apply-tag” signal on this TextBuffer.The default handler for the signal applies
tag
to the given range.start
andend
do not have to be in order.- Parameters:
tag
- aGtkTextTag
start
- one bound of range to be taggedend
- other bound of range to be tagged
-
applyTagByName
Emits the “apply-tag” signal on this TextBuffer.Calls
TextTagTable.lookup(java.lang.String)
on the buffer’s tag table to get aGtkTextTag
, then callsapplyTag(org.gnome.gtk.TextTag, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
.- Parameters:
name
- name of a namedGtkTextTag
start
- one bound of range to be taggedend
- other bound of range to be tagged
-
backspace
Performs the appropriate action as if the user hit the delete key with the cursor at the position specified byiter
.In the normal case a single character will be deleted, but when combining accents are involved, more than one character can be deleted, and when precomposed character and accent combinations are involved, less than one character will be deleted.
Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, the
iter
will be re-initialized to point to the location where text was deleted.- Parameters:
iter
- a position in this TextBufferinteractive
- whether the deletion is caused by user interactiondefaultEditable
- whether the buffer is editable by default- Returns:
true
if the buffer was modified
-
beginIrreversibleAction
public void beginIrreversibleAction()Denotes the beginning of an action that may not be undone.This will cause any previous operations in the undo/redo queue to be cleared.
This should be paired with a call to
endIrreversibleAction()
after the irreversible action has completed.You may nest calls to gtk_text_buffer_begin_irreversible_action() and gtk_text_buffer_end_irreversible_action() pairs.
-
beginUserAction
public void beginUserAction()Called to indicate that the buffer operations between here and a call to gtk_text_buffer_end_user_action() are part of a single user-visible operation.The operations between gtk_text_buffer_begin_user_action() and gtk_text_buffer_end_user_action() can then be grouped when creating an undo stack.
GtkTextBuffer
maintains a count of calls to gtk_text_buffer_begin_user_action() that have not been closed with a call to gtk_text_buffer_end_user_action(), and emits the “begin-user-action” and “end-user-action” signals only for the outermost pair of calls. This allows you to build user actions from other user actions.The “interactive” buffer mutation functions, such as
insertInteractive(org.gnome.gtk.TextIter, java.lang.String, int, boolean)
, automatically call begin/end user action around the buffer operations they perform, so there's no need to add extra calls if you user action consists solely of a single call to one of those functions. -
copyClipboard
Copies the currently-selected text to a clipboard.- Parameters:
clipboard
- theGdkClipboard
object to copy to
-
createChildAnchor
Creates and inserts a child anchor.This is a convenience function which simply creates a child anchor with
TextChildAnchor()
and inserts it into the buffer withinsertChildAnchor(org.gnome.gtk.TextIter, org.gnome.gtk.TextChildAnchor)
.The new anchor is owned by the buffer; no reference count is returned to the caller of this function.
- Parameters:
iter
- location in the buffer- Returns:
- the created child anchor
-
createMark
public TextMark createMark(@Nullable @Nullable String markName, TextIter where, boolean leftGravity) Creates a mark at positionwhere
.If
markName
isnull
, the mark is anonymous; otherwise, the mark can be retrieved by name usinggetMark(java.lang.String)
. If a mark has left gravity, and text is inserted at the mark’s current location, the mark will be moved to the left of the newly-inserted text. If the mark has right gravity (leftGravity
=false
), the mark will end up on the right of newly-inserted text. The standard left-to-right cursor is a mark with right gravity (when you type, the cursor stays on the right side of the text you’re typing).The caller of this function does not own a reference to the returned
GtkTextMark
, so you can ignore the return value if you like. Marks are owned by the buffer and go away when the buffer does.Emits the
Gtk.TextBuffer::mark-set
signal as notification of the mark's initial placement.- Parameters:
markName
- name for markwhere
- location to place markleftGravity
- whether the mark has left gravity- Returns:
- the new
GtkTextMark
object
-
createTag
public TextTag createTag(@Nullable @Nullable String tagName, @Nullable @Nullable String firstPropertyName, Object... varargs) Creates a tag and adds it to the tag table for this TextBuffer.Equivalent to calling
TextTag()
and then adding the tag to the buffer’s tag table. The returned tag is owned by the buffer’s tag table, so the ref count will be equal to one.If
tagName
isnull
, the tag is anonymous.If
tagName
is non-null
, a tag calledtagName
must not already exist in the tag table for this buffer.The
firstPropertyName
argument and subsequent arguments are a list of properties to set on the tag, as with g_object_set().- Parameters:
tagName
- name of the new tagfirstPropertyName
- name of first property to setvarargs
-null
-terminated list of property names and values- Returns:
- a new tag
-
cutClipboard
Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.- Parameters:
clipboard
- theGdkClipboard
object to cut todefaultEditable
- default editability of the buffer
-
delete
Deletes text betweenstart
andend
.The order of
start
andend
is not actually relevant; gtk_text_buffer_delete() will reorder them.This function actually emits the “delete-range” signal, and the default handler of that signal deletes the text. Because the buffer is modified, all outstanding iterators become invalid after calling this function; however, the
start
andend
will be re-initialized to point to the location where text was deleted.- Parameters:
start
- a position in this TextBufferend
- another position in this TextBuffer
-
deleteInteractive
Deletes all editable text in the given range.Calls
delete(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
for each editable sub-range of [start
,end
).start
andend
are revalidated to point to the location of the last deleted range, or left untouched if no text was deleted.- Parameters:
startIter
- start of range to deleteendIter
- end of rangedefaultEditable
- whether the buffer is editable by default- Returns:
- whether some text was actually deleted
-
deleteMark
Deletesmark
, so that it’s no longer located anywhere in the buffer.Removes the reference the buffer holds to the mark, so if you haven’t called g_object_ref() on the mark, it will be freed. Even if the mark isn’t freed, most operations on
mark
become invalid, until it gets added to a buffer again withaddMark(org.gnome.gtk.TextMark, org.gnome.gtk.TextIter)
. UseTextMark.getDeleted()
to find out if a mark has been removed from its buffer.The
Gtk.TextBuffer::mark-deleted
signal will be emitted as notification after the mark is deleted.- Parameters:
mark
- aGtkTextMark
in this TextBuffer
-
deleteMarkByName
Deletes the mark namedname
; the mark must exist.See
deleteMark(org.gnome.gtk.TextMark)
for details.- Parameters:
name
- name of a mark in this TextBuffer
-
deleteSelection
public boolean deleteSelection(boolean interactive, boolean defaultEditable) Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text.If
interactive
istrue
, the editability of the selection will be considered (users can’t delete uneditable text).- Parameters:
interactive
- whether the deletion is caused by user interactiondefaultEditable
- whether the buffer is editable by default- Returns:
- whether there was a non-empty selection to delete
-
endIrreversibleAction
public void endIrreversibleAction()Denotes the end of an action that may not be undone.This will cause any previous operations in the undo/redo queue to be cleared.
This should be called after completing modifications to the text buffer after
beginIrreversibleAction()
was called.You may nest calls to gtk_text_buffer_begin_irreversible_action() and gtk_text_buffer_end_irreversible_action() pairs.
-
endUserAction
public void endUserAction()Ends a user-visible operation.Should be paired with a call to
beginUserAction()
. See that function for a full explanation. -
getBounds
-
getCanRedo
public boolean getCanRedo()Gets whether there is a redoable action in the history.- Returns:
true
if there is a redoable action
-
getCanUndo
public boolean getCanUndo()Gets whether there is an undoable action in the history.- Returns:
true
if there is an undoable action
-
getCharCount
public int getCharCount()Gets the number of characters in the buffer.Note that characters and bytes are not the same, you can’t e.g. expect the contents of the buffer in string form to be this many bytes long.
The character count is cached, so this function is very fast.
- Returns:
- number of characters in the buffer
-
getEnableUndo
public boolean getEnableUndo()Gets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.See
beginIrreversibleAction()
andendIrreversibleAction()
to create changes to the buffer that cannot be undone.- Returns:
true
if undoing and redoing changes to the buffer is allowed.
-
getEndIter
Initializesiter
with the “end iterator,” one past the last valid character in the text buffer.If dereferenced with
TextIter.getChar()
, the end iterator has a character value of 0. The entire buffer lies in the range from the first position in the buffer (callgetStartIter(org.gnome.gtk.TextIter)
to get character position 0) to the end iterator.- Parameters:
iter
- iterator to initialize
-
getHasSelection
public boolean getHasSelection()Indicates whether the buffer has some text currently selected.- Returns:
true
if the there is text selected
-
getInsert
Returns the mark that represents the cursor (insertion point).Equivalent to calling
getMark(java.lang.String)
to get the mark named “insert”, but very slightly more efficient, and involves less typing.- Returns:
- insertion point mark
-
getIterAtChildAnchor
Obtains the location ofanchor
within this TextBuffer.- Parameters:
iter
- an iterator to be initializedanchor
- a child anchor that appears in this TextBuffer
-
getIterAtLine
Initializesiter
to the start of the given line.If
lineNumber
is greater than or equal to the number of lines in the this TextBuffer, the end iterator is returned.- Parameters:
iter
- iterator to initializelineNumber
- line number counting from 0- Returns:
- whether the exact position has been found
-
getIterAtLineIndex
Obtains an iterator pointing tobyteIndex
within the given line.byteIndex
must be the start of a UTF-8 character. Note bytes, not characters; UTF-8 may encode one character as multiple bytes.If
lineNumber
is greater than or equal to the number of lines in the this TextBuffer, the end iterator is returned. And ifbyteIndex
is off the end of the line, the iterator at the end of the line is returned.- Parameters:
iter
- iterator to initializelineNumber
- line number counting from 0byteIndex
- byte index from start of line- Returns:
- whether the exact position has been found
-
getIterAtLineOffset
Obtains an iterator pointing tocharOffset
within the given line.Note characters, not bytes; UTF-8 may encode one character as multiple bytes.
If
lineNumber
is greater than or equal to the number of lines in the this TextBuffer, the end iterator is returned. And ifcharOffset
is off the end of the line, the iterator at the end of the line is returned.- Parameters:
iter
- iterator to initializelineNumber
- line number counting from 0charOffset
- char offset from start of line- Returns:
- whether the exact position has been found
-
getIterAtMark
-
getIterAtOffset
Initializesiter
to a positioncharOffset
chars from the start of the entire buffer.If
charOffset
is -1 or greater than the number of characters in the buffer,iter
is initialized to the end iterator, the iterator one past the last valid character in the buffer.- Parameters:
iter
- iterator to initializecharOffset
- char offset from start of buffer, counting from 0, or -1
-
getLineCount
public int getLineCount()Obtains the number of lines in the buffer.This value is cached, so the function is very fast.
- Returns:
- number of lines in the buffer
-
getMark
-
getMaxUndoLevels
public int getMaxUndoLevels()Gets the maximum number of undo levels to perform.If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.
- Returns:
- The max number of undo levels allowed (0 indicates unlimited).
-
getModified
public boolean getModified()Indicates whether the buffer has been modified since the last call tosetModified(boolean)
set the modification flag tofalse
.Used for example to enable a “save” function in a text editor.
- Returns:
true
if the buffer has been modified
-
getSelectionBound
Returns the mark that represents the selection bound.Equivalent to calling
getMark(java.lang.String)
to get the mark named “selection_bound”, but very slightly more efficient, and involves less typing.The currently-selected text in this TextBuffer is the region between the “selection_bound” and “insert” marks. If “selection_bound” and “insert” are in the same place, then there is no current selection.
getSelectionBounds(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
is another convenient function for handling the selection, if you just want to know whether there’s a selection and what its bounds are.- Returns:
- selection bound mark
-
getSelectionBounds
Returnstrue
if some text is selected; places the bounds of the selection instart
andend
.If the selection has length 0, then
start
andend
are filled in with the same value.start
andend
will be in ascending order. Ifstart
andend
arenull
, then they are not filled in, but the return value still indicates whether text is selected.- Parameters:
start
- iterator to initialize with selection startend
- iterator to initialize with selection end- Returns:
- whether the selection has nonzero length
-
getSelectionContent
Get a content provider for this buffer.It can be used to make the content of this TextBuffer available in a
GdkClipboard
, seeClipboard.setContent(org.gnome.gdk.ContentProvider)
.- Returns:
- a new
GdkContentProvider
.
-
getSlice
Returns the text in the rangeend). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if @include_hidden_chars is %FALSE. The returned string includes a 0xFFFC character whenever the buffer contains embedded images, so byte and character indexes into the returned string do correspond to byte and character indexes into the buffer. Contrast with [method@Gtk.TextBuffer.get_text
. Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a paintable or widget is in the buffer.- Parameters:
start
- start of a rangeend
- end of a rangeincludeHiddenChars
- whether to include invisible text- Returns:
- an allocated UTF-8 string
-
getStartIter
Initializediter
with the first position in the text buffer.This is the same as using
getIterAtOffset(org.gnome.gtk.TextIter, int)
to get the iter at character offset 0.- Parameters:
iter
- iterator to initialize
-
getTagTable
Get theGtkTextTagTable
associated with this buffer.- Returns:
- the buffer’s tag table
-
getText
Returns the text in the rangeend). Excludes undisplayed text (text marked with tags that set the invisibility attribute) if @include_hidden_chars is %FALSE. Does not include characters representing embedded images, so byte and character indexes into the returned string do not correspond to byte and character indexes into the buffer. Contrast with [method@Gtk.TextBuffer.get_slice
.- Parameters:
start
- start of a rangeend
- end of a rangeincludeHiddenChars
- whether to include invisible text- Returns:
- an allocated UTF-8 string
-
insert
Insertslen
bytes oftext
at positioniter
.If
len
is -1,text
must be nul-terminated and will be inserted in its entirety. Emits the “insert-text” signal; insertion actually occurs in the default handler for the signal.iter
is invalidated when insertion occurs (because the buffer contents change), but the default signal handler revalidates it to point to the end of the inserted text.- Parameters:
iter
- a position in the buffertext
- text in UTF-8 formatlen
- length of text in bytes, or -1
-
insertAtCursor
Insertstext
in this TextBuffer.Simply calls
insert(org.gnome.gtk.TextIter, java.lang.String, int)
, using the current cursor position as the insertion point.- Parameters:
text
- text in UTF-8 formatlen
- length of text, in bytes
-
insertChildAnchor
Inserts a child widget anchor into the text buffer atiter
.The anchor will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode “object replacement character” 0xFFFC. Note that the “slice” variants for obtaining portions of the buffer as a string include this character for child anchors, but the “text” variants do not. E.g. see
getSlice(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, boolean)
andgetText(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, boolean)
.Consider
createChildAnchor(org.gnome.gtk.TextIter)
as a more convenient alternative to this function. The buffer will add a reference to the anchor, so you can unref it after insertion.- Parameters:
iter
- location to insert the anchoranchor
- aGtkTextChildAnchor
-
insertInteractive
Insertstext
in this TextBuffer.Like
insert(org.gnome.gtk.TextIter, java.lang.String, int)
, but the insertion will not occur ifiter
is at a non-editable location in the buffer. Usually you want to prevent insertions at ineditable locations if the insertion results from a user action (is interactive).defaultEditable
indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result ofTextView.getEditable()
is appropriate here.- Parameters:
iter
- a position in this TextBuffertext
- some UTF-8 textlen
- length of text in bytes, or -1defaultEditable
- default editability of buffer- Returns:
- whether text was actually inserted
-
insertInteractiveAtCursor
Insertstext
in this TextBuffer.Calls
insertInteractive(org.gnome.gtk.TextIter, java.lang.String, int, boolean)
at the cursor position.defaultEditable
indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result ofTextView.getEditable()
is appropriate here.- Parameters:
text
- text in UTF-8 formatlen
- length of text in bytes, or -1defaultEditable
- default editability of buffer- Returns:
- whether text was actually inserted
-
insertMarkup
Inserts the text inmarkup
at positioniter
.markup
will be inserted in its entirety and must be nul-terminated and valid UTF-8. Emits theGtk.TextBuffer::insert-text
signal, possibly multiple times; insertion actually occurs in the default handler for the signal.iter
will point to the end of the inserted text on return.- Parameters:
iter
- location to insert the markupmarkup
- a nul-terminated UTF-8 string containing Pango markuplen
- length ofmarkup
in bytes, or -1
-
insertPaintable
Inserts an image into the text buffer atiter
.The image will be counted as one character in character counts, and when obtaining the buffer contents as a string, will be represented by the Unicode “object replacement character” 0xFFFC. Note that the “slice” variants for obtaining portions of the buffer as a string include this character for paintable, but the “text” variants do not. e.g. see
getSlice(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, boolean)
andgetText(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, boolean)
.- Parameters:
iter
- location to insert the paintablepaintable
- aGdkPaintable
-
insertRange
Copies text, tags, and paintables betweenstart
andend
and inserts the copy atiter
.The order of
start
andend
doesn’t matter.Used instead of simply getting/inserting text because it preserves images and tags. If
start
andend
are in a different buffer from this TextBuffer, the two buffers must share the same tag table.Implemented via emissions of the ::insert-text and ::apply-tag signals, so expect those.
- Parameters:
iter
- a position in this TextBufferstart
- a position in aGtkTextBuffer
end
- another position in the same buffer asstart
-
insertRangeInteractive
public boolean insertRangeInteractive(TextIter iter, TextIter start, TextIter end, boolean defaultEditable) Copies text, tags, and paintables betweenstart
andend
and inserts the copy atiter
.Same as
insertRange(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
, but does nothing if the insertion point isn’t editable. ThedefaultEditable
parameter indicates whether the text is editable atiter
if no tags enclosingiter
affect editability. Typically the result ofTextView.getEditable()
is appropriate here.- Parameters:
iter
- a position in this TextBufferstart
- a position in aGtkTextBuffer
end
- another position in the same buffer asstart
defaultEditable
- default editability of the buffer- Returns:
- whether an insertion was possible at
iter
-
insertWithTags
public void insertWithTags(TextIter iter, String text, int len, TextTag firstTag, Object... varargs) Insertstext
into this TextBuffer atiter
, applying the list of tags to the newly-inserted text.The last tag specified must be
null
to terminate the list. Equivalent to callinginsert(org.gnome.gtk.TextIter, java.lang.String, int)
, thenapplyTag(org.gnome.gtk.TextTag, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
on the inserted text; this is just a convenience function.- Parameters:
iter
- an iterator in this TextBuffertext
- UTF-8 textlen
- length oftext
, or -1firstTag
- first tag to apply totext
varargs
-null
-terminated list of tags to apply
-
insertWithTagsByName
public void insertWithTagsByName(TextIter iter, String text, int len, String firstTagName, Object... varargs) Insertstext
into this TextBuffer atiter
, applying the list of tags to the newly-inserted text.Same as
insertWithTags(org.gnome.gtk.TextIter, java.lang.String, int, org.gnome.gtk.TextTag, java.lang.Object...)
, but allows you to pass in tag names instead of tag objects.- Parameters:
iter
- position in this TextBuffertext
- UTF-8 textlen
- length oftext
, or -1firstTagName
- name of a tag to apply totext
varargs
- more tag names
-
moveMark
-
moveMarkByName
Moves the mark namedname
(which must exist) to locationwhere
.See
moveMark(org.gnome.gtk.TextMark, org.gnome.gtk.TextIter)
for details.- Parameters:
name
- name of a markwhere
- new location for mark
-
pasteClipboard
public void pasteClipboard(Clipboard clipboard, @Nullable @Nullable TextIter overrideLocation, boolean defaultEditable) Pastes the contents of a clipboard.If
overrideLocation
isnull
, the pasted text will be inserted at the cursor position, or the buffer selection will be replaced if the selection is non-empty.Note: pasting is asynchronous, that is, we’ll ask for the paste data and return, and at some point later after the main loop runs, the paste data will be inserted.
- Parameters:
clipboard
- theGdkClipboard
to paste fromoverrideLocation
- location to insert pasted textdefaultEditable
- whether the buffer is editable by default
-
placeCursor
This function moves the “insert” and “selection_bound” marks simultaneously.If you move them to the same place in two steps with
moveMark(org.gnome.gtk.TextMark, org.gnome.gtk.TextIter)
, you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.- Parameters:
where
- where to put the cursor
-
redo
public void redo()Redoes the next redoable action on the buffer, if there is one. -
removeAllTags
Removes all tags in the range betweenstart
andend
.Be careful with this function; it could remove tags added in code unrelated to the code you’re currently writing. That is, using this function is probably a bad idea if you have two or more unrelated code sections that add tags.
- Parameters:
start
- one bound of range to be untaggedend
- other bound of range to be untagged
-
removeCommitNotify
public void removeCommitNotify(int commitNotifyHandler) Removes theGtkTextBufferCommitNotify
handler previously registered withaddCommitNotify(java.util.Set<org.gnome.gtk.TextBufferNotifyFlags>, org.gnome.gtk.TextBufferCommitNotify)
.This may result in the
user_data_destroy
being called that was passed when registering the commit notify functions.- Parameters:
commitNotifyHandler
- the notify handler identifier returned fromaddCommitNotify(java.util.Set<org.gnome.gtk.TextBufferNotifyFlags>, org.gnome.gtk.TextBufferCommitNotify)
.
-
removeSelectionClipboard
Removes aGdkClipboard
added withaddSelectionClipboard(org.gnome.gdk.Clipboard)
- Parameters:
clipboard
- aGdkClipboard
added to this TextBuffer byaddSelectionClipboard(org.gnome.gdk.Clipboard)
-
removeTag
Emits the “remove-tag” signal.The default handler for the signal removes all occurrences of
tag
from the given range.start
andend
don’t have to be in order.- Parameters:
tag
- aGtkTextTag
start
- one bound of range to be untaggedend
- other bound of range to be untagged
-
removeTagByName
Emits the “remove-tag” signal.Calls
TextTagTable.lookup(java.lang.String)
on the buffer’s tag table to get aGtkTextTag
, then callsremoveTag(org.gnome.gtk.TextTag, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
.- Parameters:
name
- name of aGtkTextTag
start
- one bound of range to be untaggedend
- other bound of range to be untagged
-
selectRange
This function moves the “insert” and “selection_bound” marks simultaneously.If you move them in two steps with
moveMark(org.gnome.gtk.TextMark, org.gnome.gtk.TextIter)
, you will temporarily select a region in between their old and new locations, which can be pretty inefficient since the temporarily-selected region will force stuff to be recalculated. This function moves them as a unit, which can be optimized.- Parameters:
ins
- where to put the “insert” markbound
- where to put the “selection_bound” mark
-
setEnableUndo
public void setEnableUndo(boolean enableUndo) Sets whether or not to enable undoable actions in the text buffer.Undoable actions in this context are changes to the text content of the buffer. Changes to tags and marks are not tracked.
If enabled, the user will be able to undo the last number of actions up to
getMaxUndoLevels()
.See
beginIrreversibleAction()
andendIrreversibleAction()
to create changes to the buffer that cannot be undone.- Parameters:
enableUndo
-true
to enable undo
-
setMaxUndoLevels
public void setMaxUndoLevels(int maxUndoLevels) Sets the maximum number of undo levels to perform.If 0, unlimited undo actions may be performed. Note that this may have a memory usage impact as it requires storing an additional copy of the inserted or removed text within the text buffer.
- Parameters:
maxUndoLevels
- the maximum number of undo actions to perform
-
setModified
public void setModified(boolean setting) Used to keep track of whether the buffer has been modified since the last time it was saved.Whenever the buffer is saved to disk, call
gtk_text_buffer_set_modified (@buffer, FALSE)
. When the buffer is modified, it will automatically toggle on the modified bit again. When the modified bit flips, the buffer emits theGtk.TextBuffer::modified-changed
signal.- Parameters:
setting
- modification flag setting
-
setText
Deletes current contents of this TextBuffer, and insertstext
instead. This is automatically marked as an irreversible action in the undo stack. If you wish to mark this action as part of a larger undo operation, calldelete(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
andinsert(org.gnome.gtk.TextIter, java.lang.String, int)
directly instead.If
len
is -1,text
must be nul-terminated.text
must be valid UTF-8.- Parameters:
text
- UTF-8 text to insertlen
- length oftext
in bytes
-
undo
public void undo()Undoes the last undoable action on the buffer, if there is one. -
changed
protected void changed()The class handler for theGtkTextBuffer::changed
signal. -
deleteRange
-
insertText
-
markDeleted
The class handler for theGtkTextBuffer::mark-deleted
signal. -
markSet
-
modifiedChanged
protected void modifiedChanged()The class handler for theGtkTextBuffer::modified-changed
signal. -
pasteDone
The class handler for theGtkTextBuffer::paste-done
signal. -
onApplyTag
public SignalConnection<TextBuffer.ApplyTagCallback> onApplyTag(TextBuffer.ApplyTagCallback handler) Emitted to apply a tag to a range of text in aGtkTextBuffer
.Applying actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the
start
andend
iters (or has to revalidate them).See also:
applyTag(org.gnome.gtk.TextTag, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
,insertWithTags(org.gnome.gtk.TextIter, java.lang.String, int, org.gnome.gtk.TextTag, java.lang.Object...)
,insertRange(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitApplyTag
Emits the "apply-tag" signal. SeeonApplyTag(org.gnome.gtk.TextBuffer.ApplyTagCallback)
. -
onBeginUserAction
public SignalConnection<TextBuffer.BeginUserActionCallback> onBeginUserAction(TextBuffer.BeginUserActionCallback handler) Emitted at the beginning of a single user-visible operation on aGtkTextBuffer
.See also:
beginUserAction()
,insertInteractive(org.gnome.gtk.TextIter, java.lang.String, int, boolean)
,insertRangeInteractive(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, boolean)
,deleteInteractive(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, boolean)
,backspace(org.gnome.gtk.TextIter, boolean, boolean)
,deleteSelection(boolean, boolean)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitBeginUserAction
public void emitBeginUserAction()Emits the "begin-user-action" signal. SeeonBeginUserAction(org.gnome.gtk.TextBuffer.BeginUserActionCallback)
. -
onChanged
Emitted when the content of aGtkTextBuffer
has changed.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitChanged
public void emitChanged()Emits the "changed" signal. SeeonChanged(org.gnome.gtk.TextBuffer.ChangedCallback)
. -
onDeleteRange
public SignalConnection<TextBuffer.DeleteRangeCallback> onDeleteRange(TextBuffer.DeleteRangeCallback handler) Emitted to delete a range from aGtkTextBuffer
.Note that if your handler runs before the default handler it must not invalidate the
start
andend
iters (or has to revalidate them). The default signal handler revalidates thestart
andend
iters to both point to the location where text was deleted. Handlers which run after the default handler (see g_signal_connect_after()) do not have access to the deleted text.See also:
delete(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitDeleteRange
Emits the "delete-range" signal. SeeonDeleteRange(org.gnome.gtk.TextBuffer.DeleteRangeCallback)
. -
onEndUserAction
public SignalConnection<TextBuffer.EndUserActionCallback> onEndUserAction(TextBuffer.EndUserActionCallback handler) Emitted at the end of a single user-visible operation on theGtkTextBuffer
.See also:
endUserAction()
,insertInteractive(org.gnome.gtk.TextIter, java.lang.String, int, boolean)
,insertRangeInteractive(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, boolean)
,deleteInteractive(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, boolean)
,backspace(org.gnome.gtk.TextIter, boolean, boolean)
,deleteSelection(boolean, boolean)
,backspace(org.gnome.gtk.TextIter, boolean, boolean)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitEndUserAction
public void emitEndUserAction()Emits the "end-user-action" signal. SeeonEndUserAction(org.gnome.gtk.TextBuffer.EndUserActionCallback)
. -
onInsertChildAnchor
public SignalConnection<TextBuffer.InsertChildAnchorCallback> onInsertChildAnchor(TextBuffer.InsertChildAnchorCallback handler) Emitted to insert aGtkTextChildAnchor
in aGtkTextBuffer
.Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the
location
iter (or has to revalidate it). The default signal handler revalidates it to be placed after the insertedanchor
.See also:
insertChildAnchor(org.gnome.gtk.TextIter, org.gnome.gtk.TextChildAnchor)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitInsertChildAnchor
Emits the "insert-child-anchor" signal. SeeonInsertChildAnchor(org.gnome.gtk.TextBuffer.InsertChildAnchorCallback)
. -
onInsertPaintable
public SignalConnection<TextBuffer.InsertPaintableCallback> onInsertPaintable(TextBuffer.InsertPaintableCallback handler) Emitted to insert aGdkPaintable
in aGtkTextBuffer
.Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the
location
iter (or has to revalidate it). The default signal handler revalidates it to be placed after the insertedpaintable
.See also:
insertPaintable(org.gnome.gtk.TextIter, org.gnome.gdk.Paintable)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitInsertPaintable
Emits the "insert-paintable" signal. SeeonInsertPaintable(org.gnome.gtk.TextBuffer.InsertPaintableCallback)
. -
onInsertText
public SignalConnection<TextBuffer.InsertTextCallback> onInsertText(TextBuffer.InsertTextCallback handler) Emitted to insert text in aGtkTextBuffer
.Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the
location
iter (or has to revalidate it). The default signal handler revalidates it to point to the end of the inserted text.See also:
insert(org.gnome.gtk.TextIter, java.lang.String, int)
,insertRange(org.gnome.gtk.TextIter, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitInsertText
Emits the "insert-text" signal. SeeonInsertText(org.gnome.gtk.TextBuffer.InsertTextCallback)
. -
onMarkDeleted
public SignalConnection<TextBuffer.MarkDeletedCallback> onMarkDeleted(TextBuffer.MarkDeletedCallback handler) Emitted as notification after aGtkTextMark
is deleted.See also:
deleteMark(org.gnome.gtk.TextMark)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitMarkDeleted
Emits the "mark-deleted" signal. SeeonMarkDeleted(org.gnome.gtk.TextBuffer.MarkDeletedCallback)
. -
onMarkSet
Emitted as notification after aGtkTextMark
is set.See also:
createMark(java.lang.String, org.gnome.gtk.TextIter, boolean)
,moveMark(org.gnome.gtk.TextMark, org.gnome.gtk.TextIter)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitMarkSet
Emits the "mark-set" signal. SeeonMarkSet(org.gnome.gtk.TextBuffer.MarkSetCallback)
. -
onModifiedChanged
public SignalConnection<TextBuffer.ModifiedChangedCallback> onModifiedChanged(TextBuffer.ModifiedChangedCallback handler) Emitted when the modified bit of aGtkTextBuffer
flips.See also:
setModified(boolean)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitModifiedChanged
public void emitModifiedChanged()Emits the "modified-changed" signal. SeeonModifiedChanged(org.gnome.gtk.TextBuffer.ModifiedChangedCallback)
. -
onPasteDone
public SignalConnection<TextBuffer.PasteDoneCallback> onPasteDone(TextBuffer.PasteDoneCallback handler) Emitted after paste operation has been completed.This is useful to properly scroll the view to the end of the pasted text. See
pasteClipboard(org.gnome.gdk.Clipboard, org.gnome.gtk.TextIter, boolean)
for more details.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitPasteDone
Emits the "paste-done" signal. SeeonPasteDone(org.gnome.gtk.TextBuffer.PasteDoneCallback)
. -
onRedo
Emitted when a request has been made to redo the previously undone operation.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitRedo
public void emitRedo()Emits the "redo" signal. SeeonRedo(org.gnome.gtk.TextBuffer.RedoCallback)
. -
onRemoveTag
public SignalConnection<TextBuffer.RemoveTagCallback> onRemoveTag(TextBuffer.RemoveTagCallback handler) Emitted to remove all occurrences oftag
from a range of text in aGtkTextBuffer
.Removal actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the
start
andend
iters (or has to revalidate them).See also:
removeTag(org.gnome.gtk.TextTag, org.gnome.gtk.TextIter, org.gnome.gtk.TextIter)
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitRemoveTag
Emits the "remove-tag" signal. SeeonRemoveTag(org.gnome.gtk.TextBuffer.RemoveTagCallback)
. -
onUndo
Emitted when a request has been made to undo the previous operation or set of operations that have been grouped together.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitUndo
public void emitUndo()Emits the "undo" signal. SeeonUndo(org.gnome.gtk.TextBuffer.UndoCallback)
. -
builder
ATextBuffer.Builder
object constructs aTextBuffer
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withTextBuffer.Builder.build()
.
-