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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theApplyTagCallbackcallback.static interfaceFunctional interface declaration of theBeginUserActionCallbackcallback.static classTextBuffer.Builder<B extends TextBuffer.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theChangedCallbackcallback.static interfaceFunctional interface declaration of theDeleteRangeCallbackcallback.static interfaceFunctional interface declaration of theEndUserActionCallbackcallback.static interfaceFunctional interface declaration of theInsertChildAnchorCallbackcallback.static interfaceFunctional interface declaration of theInsertPaintableCallbackcallback.static interfaceFunctional interface declaration of theInsertTextCallbackcallback.static interfaceFunctional interface declaration of theMarkDeletedCallbackcallback.static interfaceFunctional interface declaration of theMarkSetCallbackcallback.static interfaceFunctional interface declaration of theModifiedChangedCallbackcallback.static interfaceFunctional interface declaration of thePasteDoneCallbackcallback.static interfaceFunctional interface declaration of theRedoCallbackcallback.static interfaceFunctional interface declaration of theRemoveTagCallbackcallback.static classThe class structure forGtkTextBuffer.static interfaceFunctional interface declaration of theUndoCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new TextBuffer.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 TypeMethodDescriptionintaddCommitNotify(Set<TextBufferNotifyFlags> flags, @Nullable TextBufferCommitNotify commitNotify) Adds aGtk.TextBufferCommitNotifyto be called when a change is to be made to theGtk.TextBuffer.intaddCommitNotify(TextBufferNotifyFlags flags, @Nullable TextBufferCommitNotify commitNotify) Adds aGtk.TextBufferCommitNotifyto be called when a change is to be made to theGtk.TextBuffer.voidAdds the mark at positionwhere.voidaddSelectionClipboard(Clipboard clipboard) Addsclipboardto the list of clipboards in which the selection contents of this TextBuffer are available.voidEmits the “apply-tag” signal onbuffer.voidapplyTagByName(String name, TextIter start, TextIter end) Emits the “apply-tag” signal onbuffer.protected TextBufferasParent()Returns this instance as if it were its parent type.booleanPerforms the appropriate action as if the user hit the delete key with the cursor at the position specified byiter.voidDenotes the beginning of an action that may not be undone.voidCalled 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.Builderobject constructs aTextBufferwith the specified properties.protected voidchanged()The class handler for theGtkTextBuffer::changedsignal.voidcopyClipboard(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 forbuffer.voidcutClipboard(Clipboard clipboard, boolean defaultEditable) Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.voidDeletes text betweenstartandend.booleandeleteInteractive(TextIter startIter, TextIter endIter, boolean defaultEditable) Deletes all editable text in the given range.voiddeleteMark(TextMark mark) Deletesmark,so that it’s no longer located anywhere in the buffer.voiddeleteMarkByName(String name) Deletes the mark namedname;the mark must exist.protected voiddeleteRange(TextIter start, TextIter end) The class handler for theGtkTextBuffer::delete-rangesignal.booleandeleteSelection(boolean interactive, boolean defaultEditable) Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text.voidemitApplyTag(@Nullable TextTag tag, @Nullable TextIter start, @Nullable TextIter end) Emits the "apply-tag" signal.voidEmits the "begin-user-action" signal.voidEmits the "changed" signal.voidemitDeleteRange(@Nullable TextIter start, @Nullable TextIter end) Emits the "delete-range" signal.voidEmits the "end-user-action" signal.voidemitInsertChildAnchor(@Nullable TextIter location, @Nullable TextChildAnchor anchor) Emits the "insert-child-anchor" signal.voidemitInsertPaintable(@Nullable TextIter location, @Nullable Paintable paintable) Emits the "insert-paintable" signal.voidemitInsertText(@Nullable TextIter location, String text, int len) Emits the "insert-text" signal.voidemitMarkDeleted(@Nullable TextMark mark) Emits the "mark-deleted" signal.voidemitMarkSet(@Nullable TextIter location, @Nullable TextMark mark) Emits the "mark-set" signal.voidEmits the "modified-changed" signal.voidemitPasteDone(@Nullable Clipboard clipboard) Emits the "paste-done" signal.voidemitRedo()Emits the "redo" signal.voidemitRemoveTag(@Nullable TextTag tag, @Nullable TextIter start, @Nullable TextIter end) Emits the "remove-tag" signal.voidemitUndo()Emits the "undo" signal.voidDenotes the end of an action that may not be undone.voidEnds a user-visible operation.voidRetrieves the first and last iterators in the buffer, i.e.booleanGets whether there is a redoable action in the history.booleanGets whether there is an undoable action in the history.intGets the number of characters in the buffer.booleanGets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.voidgetEndIter(TextIter iter) Initializesiterwith the “end iterator,” one past the last valid character in the text buffer.booleanIndicates whether the buffer has some text currently selected.Returns the mark that represents the cursor (insertion point).voidgetIterAtChildAnchor(TextIter iter, TextChildAnchor anchor) Obtains the location ofanchorwithinbuffer.booleangetIterAtLine(TextIter iter, int lineNumber) Initializesiterto the start of the given line.booleangetIterAtLineIndex(TextIter iter, int lineNumber, int byteIndex) Obtains an iterator pointing tobyteIndexwithin the given line.booleangetIterAtLineOffset(TextIter iter, int lineNumber, int charOffset) Obtains an iterator pointing tocharOffsetwithin the given line.voidgetIterAtMark(TextIter iter, TextMark mark) Initializesiterwith the current position ofmark.voidgetIterAtOffset(TextIter iter, int charOffset) Initializesiterto a positioncharOffsetchars from the start of the entire buffer.intObtains the number of lines in the buffer.@Nullable TextMarkReturns the mark namednamein bufferbuffer,ornullif no such mark exists in the buffer.intGets the maximum number of undo levels to perform.static MemoryLayoutThe memory layout of the native struct.booleanIndicates 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.booleangetSelectionBounds(TextIter start, TextIter end) Returnstrueif some text is selected; places the bounds of the selection instartandend.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.voidgetStartIter(TextIter iter) Initializediterwith the first position in the text buffer.Get theGtkTextTagTableassociated 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 @Nullable TypegetType()Get the GType of the TextBuffer classvoidInsertslenbytes oftextat positioniter.voidinsertAtCursor(String text, int len) Insertstextinbuffer.voidinsertChildAnchor(TextIter iter, TextChildAnchor anchor) Inserts a child widget anchor into the text buffer atiter.booleaninsertInteractive(TextIter iter, String text, int len, boolean defaultEditable) Insertstextinbuffer.booleaninsertInteractiveAtCursor(String text, int len, boolean defaultEditable) Insertstextinbuffer.voidinsertMarkup(TextIter iter, String markup, int len) Inserts the text inmarkupat positioniter.voidinsertPaintable(TextIter iter, Paintable paintable) Inserts an image into the text buffer atiter.voidinsertRange(TextIter iter, TextIter start, TextIter end) Copies text, tags, and paintables betweenstartandendand inserts the copy atiter.booleaninsertRangeInteractive(TextIter iter, TextIter start, TextIter end, boolean defaultEditable) Copies text, tags, and paintables betweenstartandendand inserts the copy atiter.protected voidinsertText(TextIter pos, String newText, int newTextLength) The class handler for theGtkTextBuffer::insert-textsignal.voidinsertWithTags(TextIter iter, String text, int len, TextTag firstTag, Object... varargs) Insertstextinto this TextBuffer atiter,applying the list of tags to the newly-inserted text.voidinsertWithTagsByName(TextIter iter, String text, int len, String firstTagName, Object... varargs) Insertstextinto this TextBuffer atiter,applying the list of tags to the newly-inserted text.protected voidmarkDeleted(TextMark mark) The class handler for theGtkTextBuffer::mark-deletedsignal.protected voidThe class handler for theGtkTextBuffer::mark-setsignal.protected voidThe class handler for theGtkTextBuffer::modified-changedsignal.voidMovesmarkto the new locationwhere.voidmoveMarkByName(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 aGtkTextBufferhas changed.Emitted to delete a range from aGtkTextBuffer.Emitted at the end of a single user-visible operation on theGtkTextBuffer.Emitted to insert aGtkTextChildAnchorin aGtkTextBuffer.Emitted to insert aGdkPaintablein aGtkTextBuffer.Emitted to insert text in aGtkTextBuffer.Emitted as notification after aGtkTextMarkis deleted.onMarkSet(TextBuffer.MarkSetCallback handler) Emitted as notification after aGtkTextMarkis set.Emitted when the modified bit of aGtkTextBufferflips.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 oftagfrom 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.voidpasteClipboard(Clipboard clipboard, @Nullable TextIter overrideLocation, boolean defaultEditable) Pastes the contents of a clipboard.protected voidThe class handler for theGtkTextBuffer::paste-donesignal.voidplaceCursor(TextIter where) This function moves the “insert” and “selection_bound” marks simultaneously.voidredo()Redoes the next redoable action on the buffer, if there is one.voidremoveAllTags(TextIter start, TextIter end) Removes all tags in the range betweenstartandend.voidremoveCommitNotify(int commitNotifyHandler) Removes theGtkTextBufferCommitNotifyhandler previously registered withaddCommitNotify(java.util.Set<org.gnome.gtk.TextBufferNotifyFlags>, org.gnome.gtk.TextBufferCommitNotify).voidremoveSelectionClipboard(Clipboard clipboard) Removes aGdkClipboardadded withaddSelectionClipboard(org.gnome.gdk.Clipboard)voidEmits the “remove-tag” signal.voidremoveTagByName(String name, TextIter start, TextIter end) Emits the “remove-tag” signal.voidselectRange(TextIter ins, TextIter bound) This function moves the “insert” and “selection_bound” marks simultaneously.voidsetEnableUndo(boolean enableUndo) Sets whether or not to enable undoable actions in the text buffer.voidsetMaxUndoLevels(int maxUndoLevels) Sets the maximum number of undo levels to perform.voidsetModified(boolean setting) Used to keep track of whether the buffer has been modified since the last time it was saved.voidDeletes current contents ofbuffer,and insertstextinstead.voidundo()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, 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, 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, ornullto create a new one
-
TextBuffer
public TextBuffer()Creates a new TextBuffer.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the 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. -
addCommitNotify
public int addCommitNotify(Set<TextBufferNotifyFlags> flags, @Nullable TextBufferCommitNotify commitNotify) Adds aGtk.TextBufferCommitNotifyto be called when a change is to be made to theGtk.TextBuffer.Functions are explicitly forbidden from making changes to the
Gtk.TextBufferfrom this callback. It is intended for tracking changes to the buffer only.It may be advantageous to use
Gtk.TextBufferCommitNotifyover connecting to theGtk.TextBuffer::insert-textorGtk.TextBuffer::delete-rangesignals to avoid ordering issues with other signal handlers which may further modify theGtk.TextBuffer.- Parameters:
flags- which notifications should be dispatched tocallbackcommitNotify- aGtk.TextBufferCommitNotifyto call for commit notifications- Returns:
- a handler id which may be used to remove the commit notify
callback using
removeCommitNotify(int). - Since:
- 4.16
-
addCommitNotify
public int addCommitNotify(TextBufferNotifyFlags flags, @Nullable TextBufferCommitNotify commitNotify) Adds aGtk.TextBufferCommitNotifyto be called when a change is to be made to theGtk.TextBuffer.Functions are explicitly forbidden from making changes to the
Gtk.TextBufferfrom this callback. It is intended for tracking changes to the buffer only.It may be advantageous to use
Gtk.TextBufferCommitNotifyover connecting to theGtk.TextBuffer::insert-textorGtk.TextBuffer::delete-rangesignals to avoid ordering issues with other signal handlers which may further modify theGtk.TextBuffer.- Parameters:
flags- which notifications should be dispatched tocallbackcommitNotify- aGtk.TextBufferCommitNotifyto call for commit notifications- Returns:
- a handler id which may be used to remove the commit notify
callback using
removeCommitNotify(int). - Since:
- 4.16
-
addMark
Adds the mark at positionwhere.The mark must not be added to another buffer, and if its name is not
nullthen there must not be another mark in the buffer with the same name.Emits the
Gtk.TextBuffer::mark-setsignal as notification of the mark's initial placement.- Parameters:
mark- the mark to addwhere- location to place mark
-
addSelectionClipboard
Addsclipboardto the list of clipboards in which the selection contents of this TextBuffer are available.In most cases,
clipboardwill be theGdkClipboardreturned byWidget.getPrimaryClipboard()for a view ofbuffer.- Parameters:
clipboard- aGdkClipboard
-
applyTag
Emits the “apply-tag” signal onbuffer.The default handler for the signal applies
tagto the given range.startandenddo not have to be in order.- Parameters:
tag- aGtkTextTagstart- one bound of range to be taggedend- other bound of range to be tagged
-
applyTagByName
Emits the “apply-tag” signal onbuffer.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 namedGtkTextTagstart- 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
iterwill 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:
trueif 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.
GtkTextBuffermaintains 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- theGdkClipboardobject 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
Creates a mark at positionwhere.If
markNameisnull, 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-setsignal 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
GtkTextMarkobject
-
createTag
public TextTag createTag(@Nullable String tagName, @Nullable String firstPropertyName, Object... varargs) Creates a tag and adds it to the tag table forbuffer.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
tagNameisnull, the tag is anonymous.If
tagNameis non-null, a tag calledtagNamemust not already exist in the tag table for this buffer.The
firstPropertyNameargument 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- theGdkClipboardobject to cut todefaultEditable- default editability of the buffer
-
delete
Deletes text betweenstartandend.The order of
startandendis 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
startandendwill 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 [end).startandendare 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
markbecome 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-deletedsignal will be emitted as notification after the mark is deleted.- Parameters:
mark- aGtkTextMarkin 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
interactiveistrue, 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:
trueif there is a redoable action
-
getCanUndo
public boolean getCanUndo()Gets whether there is an undoable action in the history.- Returns:
trueif 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:
trueif undoing and redoing changes to the buffer is allowed.
-
getEndIter
Initializesiterwith 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:
trueif 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 ofanchorwithinbuffer.- Parameters:
iter- an iterator to be initializedanchor- a child anchor that appears in this TextBuffer
-
getIterAtLine
Initializesiterto the start of the given line.If
lineNumberis greater than or equal to the number of lines in thebuffer,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 tobyteIndexwithin the given line.byteIndexmust be the start of a UTF-8 character. Note bytes, not characters; UTF-8 may encode one character as multiple bytes.If
lineNumberis greater than or equal to the number of lines in thebuffer,the end iterator is returned. And ifbyteIndexis 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 tocharOffsetwithin the given line.Note characters, not bytes; UTF-8 may encode one character as multiple bytes.
If
lineNumberis greater than or equal to the number of lines in thebuffer,the end iterator is returned. And ifcharOffsetis 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
Initializesiterto a positioncharOffsetchars from the start of the entire buffer.If
charOffsetis -1 or greater than the number of characters in the buffer,iteris 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:
trueif 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
Returnstrueif some text is selected; places the bounds of the selection instartandend.If the selection has length 0, then
startandendare filled in with the same value.startandendwill be in ascending order. Ifstartandendarenull, 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
Initializediterwith 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 theGtkTextTagTableassociated 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
Insertslenbytes oftextat positioniter.If
lenis -1,textmust 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.iteris 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
Insertstextinbuffer.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
Insertstextinbuffer.Like
insert(org.gnome.gtk.TextIter, java.lang.String, int), but the insertion will not occur ifiteris 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).defaultEditableindicates 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
Insertstextinbuffer.Calls
insertInteractive(org.gnome.gtk.TextIter, java.lang.String, int, boolean)at the cursor position.defaultEditableindicates 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 inmarkupat positioniter.markupwill be inserted in its entirety and must be nul-terminated and valid UTF-8. Emits theGtk.TextBuffer::insert-textsignal, possibly multiple times; insertion actually occurs in the default handler for the signal.iterwill 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 ofmarkupin 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 betweenstartandendand inserts the copy atiter.The order of
startandenddoesn’t matter.Used instead of simply getting/inserting text because it preserves images and tags. If
startandendare in a different buffer frombuffer,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 aGtkTextBufferend- another position in the same buffer asstart
-
insertRangeInteractive
public boolean insertRangeInteractive(TextIter iter, TextIter start, TextIter end, boolean defaultEditable) Copies text, tags, and paintables betweenstartandendand 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. ThedefaultEditableparameter indicates whether the text is editable atiterif no tags enclosingiteraffect editability. Typically the result ofTextView.getEditable()is appropriate here.- Parameters:
iter- a position in this TextBufferstart- a position in aGtkTextBufferend- another position in the same buffer asstartdefaultEditable- 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) Insertstextinto this TextBuffer atiter,applying the list of tags to the newly-inserted text.The last tag specified must be
nullto 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 totextvarargs-null-terminated list of tags to apply
-
insertWithTagsByName
public void insertWithTagsByName(TextIter iter, String text, int len, String firstTagName, Object... varargs) Insertstextinto 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 totextvarargs- 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 TextIter overrideLocation, boolean defaultEditable) Pastes the contents of a clipboard.If
overrideLocationisnull, 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- theGdkClipboardto 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 betweenstartandend.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 theGtkTextBufferCommitNotifyhandler previously registered withaddCommitNotify(java.util.Set<org.gnome.gtk.TextBufferNotifyFlags>, org.gnome.gtk.TextBufferCommitNotify).This may result in the
user_data_destroybeing 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).- Since:
- 4.16
-
removeSelectionClipboard
Removes aGdkClipboardadded withaddSelectionClipboard(org.gnome.gdk.Clipboard)- Parameters:
clipboard- aGdkClipboardadded to this TextBuffer byaddSelectionClipboard(org.gnome.gdk.Clipboard)
-
removeTag
Emits the “remove-tag” signal.The default handler for the signal removes all occurrences of
tagfrom the given range.startandenddon’t have to be in order.- Parameters:
tag- aGtkTextTagstart- 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 aGtkTextTagstart- 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-trueto 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-changedsignal.- Parameters:
setting- modification flag setting
-
setText
Deletes current contents ofbuffer,and insertstextinstead. 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
lenis -1,textmust be nul-terminated.textmust be valid UTF-8.- Parameters:
text- UTF-8 text to insertlen- length oftextin 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::changedsignal. -
deleteRange
-
insertText
-
markDeleted
The class handler for theGtkTextBuffer::mark-deletedsignal. -
markSet
-
modifiedChanged
protected void modifiedChanged()The class handler for theGtkTextBuffer::modified-changedsignal. -
pasteDone
The class handler for theGtkTextBuffer::paste-donesignal. -
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
startandenditers (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 aGtkTextBufferhas 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
startandenditers (or has to revalidate them). The default signal handler revalidates thestartandenditers 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 aGtkTextChildAnchorin aGtkTextBuffer.Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the
locationiter (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 aGdkPaintablein aGtkTextBuffer.Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the
locationiter (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
locationiter (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 aGtkTextMarkis 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 aGtkTextMarkis 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 aGtkTextBufferflips.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 oftagfrom 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
startandenditers (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.Builderobject constructs aTextBufferwith the specified properties. Use the variousset...()methods to set properties, and finish construction withTextBuffer.Builder.build().- Returns:
- the builder object
-