TextBuffer

Stores text and attributes for display in a gtk.text_view.TextView.

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 gtk.text_buffer.TextBuffer.setEnableUndo.

class TextBuffer : ObjectG {}

Constructors

this
this(gtk.text_tag_table.TextTagTable table)

Creates a new text buffer.

Members

Functions

addMark
void addMark(gtk.text_mark.TextMark mark, gtk.text_iter.TextIter where)

Adds the mark at position where.

addSelectionClipboard
void addSelectionClipboard(gdk.clipboard.Clipboard clipboard)

Adds clipboard to the list of clipboards in which the selection contents of buffer are available.

applyTag
void applyTag(gtk.text_tag.TextTag tag, gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Emits the “apply-tag” signal on buffer.

applyTagByName
void applyTagByName(string name, gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Emits the “apply-tag” signal on buffer.

backspace
bool backspace(gtk.text_iter.TextIter iter, bool interactive, bool defaultEditable)

Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by iter.

beginIrreversibleAction
void beginIrreversibleAction()

Denotes the beginning of an action that may not be undone.

beginUserAction
void beginUserAction()

Called to indicate that the buffer operations between here and a call to gtk.text_buffer.TextBuffer.endUserAction are part of a single user-visible operation.

connectApplyTag
ulong connectApplyTag(T callback, Flag!"After" after)

Connect to ApplyTag signal.

connectBeginUserAction
ulong connectBeginUserAction(T callback, Flag!"After" after)

Connect to BeginUserAction signal.

connectChanged
ulong connectChanged(T callback, Flag!"After" after)

Connect to Changed signal.

connectDeleteRange
ulong connectDeleteRange(T callback, Flag!"After" after)

Connect to DeleteRange signal.

connectEndUserAction
ulong connectEndUserAction(T callback, Flag!"After" after)

Connect to EndUserAction signal.

connectInsertChildAnchor
ulong connectInsertChildAnchor(T callback, Flag!"After" after)

Connect to InsertChildAnchor signal.

connectInsertPaintable
ulong connectInsertPaintable(T callback, Flag!"After" after)

Connect to InsertPaintable signal.

connectInsertText
ulong connectInsertText(T callback, Flag!"After" after)

Connect to InsertText signal.

connectMarkDeleted
ulong connectMarkDeleted(T callback, Flag!"After" after)

Connect to MarkDeleted signal.

connectMarkSet
ulong connectMarkSet(T callback, Flag!"After" after)

Connect to MarkSet signal.

connectModifiedChanged
ulong connectModifiedChanged(T callback, Flag!"After" after)

Connect to ModifiedChanged signal.

connectPasteDone
ulong connectPasteDone(T callback, Flag!"After" after)

Connect to PasteDone signal.

connectRedo
ulong connectRedo(T callback, Flag!"After" after)

Connect to Redo signal.

connectRemoveTag
ulong connectRemoveTag(T callback, Flag!"After" after)

Connect to RemoveTag signal.

connectUndo
ulong connectUndo(T callback, Flag!"After" after)

Connect to Undo signal.

copyClipboard
void copyClipboard(gdk.clipboard.Clipboard clipboard)

Copies the currently-selected text to a clipboard.

createChildAnchor
gtk.text_child_anchor.TextChildAnchor createChildAnchor(gtk.text_iter.TextIter iter)

Creates and inserts a child anchor.

createMark
gtk.text_mark.TextMark createMark(string markName, gtk.text_iter.TextIter where, bool leftGravity)

Creates a mark at position where.

cutClipboard
void cutClipboard(gdk.clipboard.Clipboard clipboard, bool defaultEditable)

Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.

deleteInteractive
bool deleteInteractive(gtk.text_iter.TextIter startIter, gtk.text_iter.TextIter endIter, bool defaultEditable)

Deletes all editable text in the given range.

deleteMark
void deleteMark(gtk.text_mark.TextMark mark)

Deletes mark, so that it’s no longer located anywhere in the buffer.

deleteMarkByName
void deleteMarkByName(string name)

Deletes the mark named name; the mark must exist.

deleteSelection
bool deleteSelection(bool interactive, bool defaultEditable)

Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text.

delete_
void delete_(gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Deletes text between start and end.

endIrreversibleAction
void endIrreversibleAction()

Denotes the end of an action that may not be undone.

endUserAction
void endUserAction()

Ends a user-visible operation.

getBounds
void getBounds(gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Retrieves the first and last iterators in the buffer, i.e. the entire buffer lies within the range [start,end).

getCanRedo
bool getCanRedo()

Gets whether there is a redoable action in the history.

getCanUndo
bool getCanUndo()

Gets whether there is an undoable action in the history.

getCharCount
int getCharCount()

Gets the number of characters in the buffer.

getEnableUndo
bool getEnableUndo()

Gets whether the buffer is saving modifications to the buffer to allow for undo and redo actions.

getEndIter
void getEndIter(gtk.text_iter.TextIter iter)

Initializes iter with the “end iterator,” one past the last valid character in the text buffer.

getHasSelection
bool getHasSelection()

Indicates whether the buffer has some text currently selected.

getInsert
gtk.text_mark.TextMark getInsert()

Returns the mark that represents the cursor (insertion point).

getIterAtChildAnchor
void getIterAtChildAnchor(gtk.text_iter.TextIter iter, gtk.text_child_anchor.TextChildAnchor anchor)

Obtains the location of anchor within buffer.

getIterAtLine
bool getIterAtLine(gtk.text_iter.TextIter iter, int lineNumber)

Initializes iter to the start of the given line.

getIterAtLineIndex
bool getIterAtLineIndex(gtk.text_iter.TextIter iter, int lineNumber, int byteIndex)

Obtains an iterator pointing to byte_index within the given line.

getIterAtLineOffset
bool getIterAtLineOffset(gtk.text_iter.TextIter iter, int lineNumber, int charOffset)

Obtains an iterator pointing to char_offset within the given line.

getIterAtMark
void getIterAtMark(gtk.text_iter.TextIter iter, gtk.text_mark.TextMark mark)

Initializes iter with the current position of mark.

getIterAtOffset
void getIterAtOffset(gtk.text_iter.TextIter iter, int charOffset)

Initializes iter to a position char_offset chars from the start of the entire buffer.

getLineCount
int getLineCount()

Obtains the number of lines in the buffer.

getMark
gtk.text_mark.TextMark getMark(string name)

Returns the mark named name in buffer buffer, or null if no such mark exists in the buffer.

getMaxUndoLevels
uint getMaxUndoLevels()

Gets the maximum number of undo levels to perform.

getModified
bool getModified()

Indicates whether the buffer has been modified since the last call to gtk.text_buffer.TextBuffer.setModified set the modification flag to false.

getSelectionBound
gtk.text_mark.TextMark getSelectionBound()

Returns the mark that represents the selection bound.

getSelectionBounds
bool getSelectionBounds(gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Returns true if some text is selected; places the bounds of the selection in start and end.

getSelectionContent
gdk.content_provider.ContentProvider getSelectionContent()

Get a content provider for this buffer.

getSlice
string getSlice(gtk.text_iter.TextIter start, gtk.text_iter.TextIter end, bool includeHiddenChars)

Returns the text in the range [start,end).

getStartIter
void getStartIter(gtk.text_iter.TextIter iter)

Initialized iter with the first position in the text buffer.

getTagTable
gtk.text_tag_table.TextTagTable getTagTable()

Get the gtk.text_tag_table.TextTagTable associated with this buffer.

getText
string getText(gtk.text_iter.TextIter start, gtk.text_iter.TextIter end, bool includeHiddenChars)

Returns the text in the range [start,end).

insert
void insert(gtk.text_iter.TextIter iter, string text)

Inserts len bytes of text at position iter.

insertAtCursor
void insertAtCursor(string text)

Inserts text in buffer.

insertChildAnchor
void insertChildAnchor(gtk.text_iter.TextIter iter, gtk.text_child_anchor.TextChildAnchor anchor)

Inserts a child widget anchor into the text buffer at iter.

insertInteractive
bool insertInteractive(gtk.text_iter.TextIter iter, string text, bool defaultEditable)

Inserts text in buffer.

insertInteractiveAtCursor
bool insertInteractiveAtCursor(string text, bool defaultEditable)

Inserts text in buffer.

insertMarkup
void insertMarkup(gtk.text_iter.TextIter iter, string markup)

Inserts the text in markup at position iter.

insertPaintable
void insertPaintable(gtk.text_iter.TextIter iter, gdk.paintable.Paintable paintable)

Inserts an image into the text buffer at iter.

insertRange
void insertRange(gtk.text_iter.TextIter iter, gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Copies text, tags, and paintables between start and end and inserts the copy at iter.

insertRangeInteractive
bool insertRangeInteractive(gtk.text_iter.TextIter iter, gtk.text_iter.TextIter start, gtk.text_iter.TextIter end, bool defaultEditable)

Copies text, tags, and paintables between start and end and inserts the copy at iter.

moveMark
void moveMark(gtk.text_mark.TextMark mark, gtk.text_iter.TextIter where)

Moves mark to the new location where.

moveMarkByName
void moveMarkByName(string name, gtk.text_iter.TextIter where)

Moves the mark named name (which must exist) to location where.

pasteClipboard
void pasteClipboard(gdk.clipboard.Clipboard clipboard, gtk.text_iter.TextIter overrideLocation, bool defaultEditable)

Pastes the contents of a clipboard.

placeCursor
void placeCursor(gtk.text_iter.TextIter where)

This function moves the “insert” and “selection_bound” marks simultaneously.

redo
void redo()

Redoes the next redoable action on the buffer, if there is one.

removeAllTags
void removeAllTags(gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Removes all tags in the range between start and end.

removeSelectionClipboard
void removeSelectionClipboard(gdk.clipboard.Clipboard clipboard)

Removes a gdk.clipboard.Clipboard added with gtk.text_buffer.TextBuffer.addSelectionClipboard

removeTag
void removeTag(gtk.text_tag.TextTag tag, gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Emits the “remove-tag” signal.

removeTagByName
void removeTagByName(string name, gtk.text_iter.TextIter start, gtk.text_iter.TextIter end)

Emits the “remove-tag” signal.

selectRange
void selectRange(gtk.text_iter.TextIter ins, gtk.text_iter.TextIter bound)

This function moves the “insert” and “selection_bound” marks simultaneously.

setEnableUndo
void setEnableUndo(bool enableUndo)

Sets whether or not to enable undoable actions in the text buffer.

setMaxUndoLevels
void setMaxUndoLevels(uint maxUndoLevels)

Sets the maximum number of undo levels to perform.

setModified
void setModified(bool setting)

Used to keep track of whether the buffer has been modified since the last time it was saved.

setText
void setText(string text)

Deletes current contents of buffer, and inserts text 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, call gtk.text_buffer.TextBuffer.delete_ and gtk.text_buffer.TextBuffer.insert directly instead.

undo
void undo()

Undoes the last undoable action on the buffer, if there is one.

Inherited Members

From ObjectG

setGObject
void setGObject(void* cObj, Flag!"Take" take)

Set the GObject of a D ObjectG wrapper.

cPtr
void* cPtr(Flag!"Dup" dup)

Get a pointer to the underlying C object.

ref_
void* ref_(void* gObj)

Calls g_object_ref() on a GObject.

unref
unref(void* gObj)

Calls g_object_unref() on a GObject.

getType
GType getType()

Get the GType of an object.

gType
GType gType [@property getter]

GObject GType property.

self
ObjectG self()

Convenience method to return this cast to a type. For use in D with statements.

getDObject
T getDObject(void* cptr, Flag!"Take" take)

Template to get the D object from a C GObject and cast it to the given D object type.

connectSignalClosure
ulong connectSignalClosure(string signalDetail, DClosure closure, Flag!"After" after)

Connect a D closure to an object signal.

setProperty
void setProperty(string propertyName, T val)

Template for setting a GObject property.

getProperty
T getProperty(string propertyName)

Template for getting a GObject property.

compatControl
size_t compatControl(size_t what, void* data)
bindProperty
gobject.binding.Binding bindProperty(string sourceProperty, gobject.object.ObjectG target, string targetProperty, gobject.types.BindingFlags flags)

Creates a binding between source_property on source and target_property on target.

bindPropertyFull
gobject.binding.Binding bindPropertyFull(string sourceProperty, gobject.object.ObjectG target, string targetProperty, gobject.types.BindingFlags flags, gobject.closure.Closure transformTo, gobject.closure.Closure transformFrom)

Creates a binding between source_property on source and target_property on target, allowing you to set the transformation functions to be used by the binding.

forceFloating
void forceFloating()

This function is intended for #GObject implementations to re-enforce a floating[floating-ref] object reference. Doing this is seldom required: all #GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling gobject.object.ObjectG.refSink.

freezeNotify
void freezeNotify()

Increases the freeze count on object. If the freeze count is non-zero, the emission of "notify" signals on object is stopped. The signals are queued until the freeze count is decreased to zero. Duplicate notifications are squashed so that at most one #GObject::notify signal is emitted for each property modified while the object is frozen.

getData
void* getData(string key)

Gets a named field from the objects table of associations (see gobject.object.ObjectG.setData).

getProperty
void getProperty(string propertyName, gobject.value.Value value)

Gets a property of an object.

getQdata
void* getQdata(glib.types.Quark quark)

This function gets back user data pointers stored via gobject.object.ObjectG.setQdata.

getv
void getv(string[] names, gobject.value.Value[] values)

Gets n_properties properties for an object. Obtained properties will be set to values. All properties must be valid. Warnings will be emitted and undefined behaviour may result if invalid properties are passed in.

isFloating
bool isFloating()

Checks whether object has a floating[floating-ref] reference.

notify
void notify(string propertyName)

Emits a "notify" signal for the property property_name on object.

notifyByPspec
void notifyByPspec(gobject.param_spec.ParamSpec pspec)

Emits a "notify" signal for the property specified by pspec on object.

refSink
gobject.object.ObjectG refSink()

Increase the reference count of object, and possibly remove the floating[floating-ref] reference, if object has a floating reference.

runDispose
void runDispose()

Releases all references to other objects. This can be used to break reference cycles.

setData
void setData(string key, void* data)

Each object carries around a table of associations from strings to pointers. This function lets you set an association.

setProperty
void setProperty(string propertyName, gobject.value.Value value)

Sets a property on an object.

stealData
void* stealData(string key)

Remove a specified datum from the object's data associations, without invoking the association's destroy handler.

stealQdata
void* stealQdata(glib.types.Quark quark)

This function gets back user data pointers stored via gobject.object.ObjectG.setQdata and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

thawNotify
void thawNotify()

Reverts the effect of a previous call to gobject.object.ObjectG.freezeNotify. The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted.

watchClosure
void watchClosure(gobject.closure.Closure closure)

This function essentially limits the life time of the closure to the life time of the object. That is, when the object is finalized, the closure is invalidated by calling gobject.closure.Closure.invalidate on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, gobject.object.ObjectG.ref_ and gobject.object.ObjectG.unref are added as marshal guards to the closure, to ensure that an extra reference count is held on object during invocation of the closure. Usually, this function will be called on closures that use this object as closure data.

connectNotify
ulong connectNotify(string detail, T callback, Flag!"After" after)

Connect to Notify signal.