TextBuffer

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.

class TextBuffer : ObjectG {}

Constructors

this
this(GtkTextBuffer* gtkTextBuffer)

Sets our main struct and passes it to the parent class

this
this(TextTagTable table)

Creates a new text buffer.

Members

Functions

addMark
void addMark(TextMark mark, TextIter where)

Adds the mark at position where. 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 "mark-set" signal as notification of the mark's initial placement. Since 2.12

addOnApplyTag
void addOnApplyTag(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags)

The ::apply-tag signal is emitted to apply a tag to a range of text in a GtkTextBuffer. Applying actually occurs in the default handler. Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them). gtk_text_buffer_apply_tag(), gtk_text_buffer_insert_with_tags(), gtk_text_buffer_insert_range().

addOnBeginUserAction
void addOnBeginUserAction(void delegate(TextBuffer) dlg, ConnectFlags connectFlags)

The ::begin-user-action signal is emitted at the beginning of a single user-visible operation on a GtkTextBuffer. gtk_text_buffer_begin_user_action(), gtk_text_buffer_insert_interactive(), gtk_text_buffer_insert_range_interactive(), gtk_text_buffer_delete_interactive(), gtk_text_buffer_backspace(), gtk_text_buffer_delete_selection().

addOnChanged
void addOnChanged(void delegate(TextBuffer) dlg, ConnectFlags connectFlags)

The ::changed signal is emitted when the content of a GtkTextBuffer has changed.

addOnDeleteRange
void addOnDeleteRange(void delegate(TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags)

The ::delete-range signal is emitted to delete a range from a GtkTextBuffer. Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them). The default signal handler revalidates the start and end 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: gtk_text_buffer_delete().

addOnEndUserAction
void addOnEndUserAction(void delegate(TextBuffer) dlg, ConnectFlags connectFlags)

The ::end-user-action signal is emitted at the end of a single user-visible operation on the GtkTextBuffer. gtk_text_buffer_end_user_action(), gtk_text_buffer_insert_interactive(), gtk_text_buffer_insert_range_interactive(), gtk_text_buffer_delete_interactive(), gtk_text_buffer_backspace(), gtk_text_buffer_delete_selection(), gtk_text_buffer_backspace().

addOnInsertChildAnchor
void addOnInsertChildAnchor(void delegate(TextIter, TextChildAnchor, TextBuffer) dlg, ConnectFlags connectFlags)

The ::insert-child-anchor signal is emitted to insert a GtkTextChildAnchor in a GtkTextBuffer. 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 inserted anchor. See also: gtk_text_buffer_insert_child_anchor().

addOnInsertPixbuf
void addOnInsertPixbuf(void delegate(TextIter, Pixbuf, TextBuffer) dlg, ConnectFlags connectFlags)

The ::insert-pixbuf signal is emitted to insert a GdkPixbuf in a GtkTextBuffer. 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 inserted pixbuf. See also: gtk_text_buffer_insert_pixbuf().

addOnInsertText
void addOnInsertText(void delegate(TextIter, string, gint, TextBuffer) dlg, ConnectFlags connectFlags)

The ::insert-text signal is emitted to insert text in a GtkTextBuffer. 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. gtk_text_buffer_insert(), gtk_text_buffer_insert_range().

addOnMarkDeleted
void addOnMarkDeleted(void delegate(TextMark, TextBuffer) dlg, ConnectFlags connectFlags)

The ::mark-deleted signal is emitted as notification after a GtkTextMark is deleted.

addOnMarkSet
void addOnMarkSet(void delegate(TextIter, TextMark, TextBuffer) dlg, ConnectFlags connectFlags)

The ::mark-set signal is emitted as notification after a GtkTextMark is set. gtk_text_buffer_create_mark(), gtk_text_buffer_move_mark().

addOnModifiedChanged
void addOnModifiedChanged(void delegate(TextBuffer) dlg, ConnectFlags connectFlags)

The ::modified-changed signal is emitted when the modified bit of a GtkTextBuffer flips.

addOnPasteDone
void addOnPasteDone(void delegate(Clipboard, TextBuffer) dlg, ConnectFlags connectFlags)

The paste-done signal is emitted after paste operation has been completed. This is useful to properly scroll the view to the end of the pasted text. See gtk_text_buffer_paste_clipboard() for more details. Since 2.16

addOnRemoveTag
void addOnRemoveTag(void delegate(TextTag, TextIter, TextIter, TextBuffer) dlg, ConnectFlags connectFlags)

The ::remove-tag signal is emitted to remove all occurrences of tag from a range of text in a GtkTextBuffer. Removal actually occurs in the default handler. Note that if your handler runs before the default handler it must not invalidate the start and end iters (or has to revalidate them). gtk_text_buffer_remove_tag(). See Also GtkTextView, GtkTextIter, GtkTextMark

addSelectionClipboard
void addSelectionClipboard(Clipboard clipboard)

Adds clipboard to the list of clipboards in which the selection contents of buffer are available. In most cases, clipboard will be the GtkClipboard of type GDK_SELECTION_PRIMARY for a view of buffer.

applyTag
void applyTag(TextTag tag, TextIter start, TextIter end)

Emits the "apply-tag" signal on buffer. The default handler for the signal applies tag to the given range. start and end do not have to be in order.

applyTagByName
void applyTagByName(string name, TextIter start, TextIter end)

Calls gtk_text_tag_table_lookup() on the buffer's tag table to get a GtkTextTag, then calls gtk_text_buffer_apply_tag().

backspace
int backspace(TextIter iter, int interactive, int defaultEditable)

Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by iter. 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. Since 2.6

beginUserAction
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 gtk_text_buffer_insert_interactive(), 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
void copyClipboard(Clipboard clipboard)

Copies the currently-selected text to a clipboard.

createChildAnchor
TextChildAnchor createChildAnchor(TextIter iter)

This is a convenience function which simply creates a child anchor with gtk_text_child_anchor_new() and inserts it into the buffer with gtk_text_buffer_insert_child_anchor(). The new anchor is owned by the buffer; no reference count is returned to the caller of gtk_text_buffer_create_child_anchor().

createMark
TextMark createMark(string markName, TextIter where, int leftGravity)

Creates a mark at position where. If mark_name is NULL, the mark is anonymous; otherwise, the mark can be retrieved by name using gtk_text_buffer_get_mark(). 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 (left_gravity = 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 "mark-set" signal as notification of the mark's initial placement.

createTag
TextTag createTag(string tagName, ...)

Creates a tag and adds it to the tag table for buffer. Equivalent to adding a new tag to the buffer's tag table.

cutClipboard
void cutClipboard(Clipboard clipboard, int defaultEditable)

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

delet
void delet(TextIter start, TextIter end)

Deletes text between start and end. The order of start and end 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 and end will be re-initialized to point to the location where text was deleted.

deleteInteractive
int deleteInteractive(TextIter startIter, TextIter endIter, int defaultEditable)

Deletes all editable text in the given range. Calls gtk_text_buffer_delete() for each editable sub-range of [start,end). start and end are revalidated to point to the location of the last deleted range, or left untouched if no text was deleted.

deleteMark
void deleteMark(TextMark mark)

Deletes mark, 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 with gtk_text_buffer_add_mark(). Use gtk_text_mark_get_deleted() to find out if a mark has been removed from its buffer. The "mark-deleted" signal will be emitted as notification after the mark is deleted.

deleteMarkByName
void deleteMarkByName(string name)

Deletes the mark named name; the mark must exist. See gtk_text_buffer_delete_mark() for details.

deleteSelection
int deleteSelection(int interactive, int defaultEditable)

Deletes the range between the "insert" and "selection_bound" marks, that is, the currently-selected text. If interactive is TRUE, the editability of the selection will be considered (users can't delete uneditable text).

deserialize
int deserialize(TextBuffer contentBuffer, GdkAtom format, TextIter iter, ubyte[] data)

This function deserializes rich text in format format and inserts it at iter. formats to be used must be registered using gtk_text_buffer_register_deserialize_format() or gtk_text_buffer_register_deserialize_tagset() beforehand. Since 2.10

deserializeGetCanCreateTags
int deserializeGetCanCreateTags(GdkAtom format)

This functions returns the value set with gtk_text_buffer_deserialize_set_can_create_tags() Since 2.10

deserializeSetCanCreateTags
void deserializeSetCanCreateTags(GdkAtom format, int canCreateTags)

Use this function to allow a rich text deserialization function to create new tags in the receiving buffer. Note that using this function is almost always a bad idea, because the rich text functions you register should know how to map the rich text format they handler to your text buffers set of tags. The ability of creating new (arbitrary!) tags in the receiving buffer is meant for special rich text formats like the internal one that is registered using gtk_text_buffer_register_deserialize_tagset(), because that format is essentially a dump of the internal structure of the source buffer, including its tag names. You should allow creation of tags only if you know what you are doing, e.g. if you defined a tagset name for your application suite's text buffers and you know that it's fine to receive new tags from these buffers, because you know that your application can handle the newly created tags. Since 2.10

endUserAction
void endUserAction()

Should be paired with a call to gtk_text_buffer_begin_user_action(). See that function for a full explanation.

getBounds
void getBounds(TextIter start, TextIter end)

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

getCharCount
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.

getCopyTargetList
TargetList getCopyTargetList()

This function returns the list of targets this text buffer can provide for copying and as DND source. The targets in the list are added with info values from the GtkTextBufferTargetInfo enum, using gtk_target_list_add_rich_text_targets() and gtk_target_list_add_text_targets(). Since 2.10

getDeserializeFormats
GdkAtom[] getDeserializeFormats()

This function returns the rich text deserialize formats registered with buffer using gtk_text_buffer_register_deserialize_format() or gtk_text_buffer_register_deserialize_tagset() Since 2.10

getEndIter
void getEndIter(TextIter iter)

Initializes iter with the "end iterator," one past the last valid character in the text buffer. If dereferenced with gtk_text_iter_get_char(), the end iterator has a character value of 0. The entire buffer lies in the range from the first position in the buffer (call gtk_text_buffer_get_start_iter() to get character position 0) to the end iterator.

getHasSelection
int getHasSelection()

Indicates whether the buffer has some text currently selected. Since 2.10

getInsert
TextMark getInsert()

Returns the mark that represents the cursor (insertion point). Equivalent to calling gtk_text_buffer_get_mark() to get the mark named "insert", but very slightly more efficient, and involves less typing.

getIterAtChildAnchor
void getIterAtChildAnchor(TextIter iter, TextChildAnchor anchor)

Obtains the location of anchor within buffer.

getIterAtLine
void getIterAtLine(TextIter iter, int lineNumber)

Initializes iter to the start of the given line. If line_number is greater than the number of lines in the buffer, the end iterator is returned.

getIterAtLineIndex
void getIterAtLineIndex(TextIter iter, int lineNumber, int byteIndex)

Obtains an iterator pointing to byte_index within the given line. byte_index must be the start of a UTF-8 character, and must not be beyond the end of the line. Note bytes, not characters; UTF-8 may encode one character as multiple bytes.

getIterAtLineOffset
void getIterAtLineOffset(TextIter iter, int lineNumber, int charOffset)

Obtains an iterator pointing to char_offset within the given line. The char_offset must exist, offsets off the end of the line are not allowed. Note characters, not bytes; UTF-8 may encode one character as multiple bytes.

getIterAtMark
void getIterAtMark(TextIter iter, TextMark mark)

Initializes iter with the current position of mark.

getIterAtOffset
void getIterAtOffset(TextIter iter, int charOffset)

Initializes iter to a position char_offset chars from the start of the entire buffer. If char_offset 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.

getLineCount
int getLineCount()

Obtains the number of lines in the buffer. This value is cached, so the function is very fast.

getMark
TextMark getMark(string name)

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

getModified
int getModified()

Indicates whether the buffer has been modified since the last call to gtk_text_buffer_set_modified() set the modification flag to FALSE. Used for example to enable a "save" function in a text editor.

getPasteTargetList
TargetList getPasteTargetList()

This function returns the list of targets this text buffer supports for pasting and as DND destination. The targets in the list are added with info values from the GtkTextBufferTargetInfo enum, using gtk_target_list_add_rich_text_targets() and gtk_target_list_add_text_targets(). Since 2.10

getSelectionBound
TextMark getSelectionBound()

Returns the mark that represents the selection bound. Equivalent to calling gtk_text_buffer_get_mark() to get the mark named "selection_bound", but very slightly more efficient, and involves less typing. The currently-selected text in buffer 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. gtk_text_buffer_get_selection_bounds() is another convenient function for handling the selection, if you just want to know whether there's a selection and what its bounds are.

getSelectionBounds
int getSelectionBounds(TextIter start, TextIter end)

Returns TRUE if some text is selected; places the bounds of the selection in start and end (if the selection has length 0, then start and end are filled in with the same value). start and end will be in ascending order. If start and end are NULL, then they are not filled in, but the return value still indicates whether text is selected.

getSerializeFormats
GdkAtom[] getSerializeFormats()

This function returns the rich text serialize formats registered with buffer using gtk_text_buffer_register_serialize_format() or gtk_text_buffer_register_serialize_tagset() Since 2.10

getSlice
string getSlice(TextIter start, TextIter end, int includeHiddenChars)

Returns the text in the range [start,end). 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 gtk_text_buffer_get_text(). Note that 0xFFFC can occur in normal text as well, so it is not a reliable indicator that a pixbuf or widget is in the buffer.

getStartIter
void getStartIter(TextIter iter)

Initialized iter with the first position in the text buffer. This is the same as using gtk_text_buffer_get_iter_at_offset() to get the iter at character offset 0.

getStruct
void* getStruct()

the main Gtk struct as a void*

getTagTable
TextTagTable getTagTable()

Get the GtkTextTagTable associated with this buffer.

getText
string getText()

Obtain the entire text

getText
string getText(TextIter start, TextIter end, int includeHiddenChars)

Returns the text in the range [start,end). 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 gtk_text_buffer_get_slice().

getTextBufferStruct
GtkTextBuffer* getTextBufferStruct()

Get the main Gtk struct

insert
void insert(TextIter iter, string text)

Inserts len bytes of text at position iter. 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.

insertAtCursor
void insertAtCursor(string text)

Simply calls gtk_text_buffer_insert(), using the current cursor position as the insertion point.

insertChildAnchor
void insertChildAnchor(TextIter iter, TextChildAnchor anchor)

Inserts a child widget anchor into the text buffer at iter. 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 gtk_text_buffer_get_slice() and gtk_text_buffer_get_text(). Consider gtk_text_buffer_create_child_anchor() as a more convenient alternative to this function. The buffer will add a reference to the anchor, so you can unref it after insertion.

insertInteractive
int insertInteractive(TextIter iter, string text, int defaultEditable)

Like gtk_text_buffer_insert(), but the insertion will not occur if iter 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). default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of gtk_text_view_get_editable() is appropriate here.

insertInteractiveAtCursor
int insertInteractiveAtCursor(string text, int defaultEditable)

Calls gtk_text_buffer_insert_interactive() at the cursor position. default_editable indicates the editability of text that doesn't have a tag affecting editability applied to it. Typically the result of gtk_text_view_get_editable() is appropriate here.

insertPixbuf
void insertPixbuf(TextIter iter, Pixbuf pixbuf)

Inserts an image into the text buffer at iter. 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 pixbufs, but the "text" variants do not. e.g. see gtk_text_buffer_get_slice() and gtk_text_buffer_get_text().

insertRange
void insertRange(TextIter iter, TextIter start, TextIter end)

Copies text, tags, and pixbufs between start and end (the order of start and end doesn't matter) and inserts the copy at iter. Used instead of simply getting/inserting text because it preserves images and tags. If start and end are in a different buffer from buffer, the two buffers must share the same tag table. Implemented via emissions of the insert_text and apply_tag signals, so expect those.

insertRangeInteractive
int insertRangeInteractive(TextIter iter, TextIter start, TextIter end, int defaultEditable)

Same as gtk_text_buffer_insert_range(), but does nothing if the insertion point isn't editable. The default_editable parameter indicates whether the text is editable at iter if no tags enclosing iter affect editability. Typically the result of gtk_text_view_get_editable() is appropriate here.

insertWithTags
void insertWithTags(TextIter iter, string text, TextTag[] tags)

Inserts text into buffer at iter, applying the list of tags to the newly-inserted text. The last tag specified must be NULL to terminate the list. Equivalent to calling gtk_text_buffer_insert(), then gtk_text_buffer_apply_tag() on the inserted text; gtk_text_buffer_insert_with_tags() is just a convenience function.

insertWithTagsByName
void insertWithTagsByName(TextIter iter, string text, string[] tags)

Same as gtk_text_buffer_insert_with_tags(), but allows you to pass in tag names instead of tag objects.

moveMark
void moveMark(TextMark mark, TextIter where)

Moves mark to the new location where. Emits the "mark-set" signal as notification of the move.

moveMarkByName
void moveMarkByName(string name, TextIter where)

Moves the mark named name (which must exist) to location where. See gtk_text_buffer_move_mark() for details.

pasteClipboard
void pasteClipboard(Clipboard clipboard, TextIter overrideLocation, int defaultEditable)

Pastes the contents of a clipboard. If override_location is NULL, 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.

placeCursor
void placeCursor(TextIter where)

This function moves the "insert" and "selection_bound" marks simultaneously. If you move them to the same place in two steps with gtk_text_buffer_move_mark(), 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.

registerDeserializeFormat
GdkAtom registerDeserializeFormat(string mimeType, GtkTextBufferDeserializeFunc funct, void* userData, GDestroyNotify userDataDestroy)

This function registers a rich text deserialization function along with its mime_type with the passed buffer. Since 2.10

registerDeserializeTagset
GdkAtom registerDeserializeTagset(string tagsetName)

This function registers GTK+'s internal rich text serialization format with the passed buffer. See gtk_text_buffer_register_serialize_tagset() for details. Since 2.10

registerSerializeFormat
GdkAtom registerSerializeFormat(string mimeType, GtkTextBufferSerializeFunc funct, void* userData, GDestroyNotify userDataDestroy)

This function registers a rich text serialization function along with its mime_type with the passed buffer. Since 2.10

registerSerializeTagset
GdkAtom registerSerializeTagset(string tagsetName)

This function registers GTK+'s internal rich text serialization format with the passed buffer. The internal format does not comply to any standard rich text format and only works between GtkTextBuffer instances. It is capable of serializing all of a text buffer's tags and embedded pixbufs. This function is just a wrapper around gtk_text_buffer_register_serialize_format(). The mime type used for registering is "application/x-gtk-text-buffer-rich-text", or "application/x-gtk-text-buffer-rich-text;format=tagset_name" if a tagset_name was passed. The tagset_name can be used to restrict the transfer of rich text to buffers with compatible sets of tags, in order to avoid unknown tags from being pasted. It is probably the common case to pass an identifier != NULL here, since the NULL tagset requires the receiving buffer to deal with with pasting of arbitrary tags. Since 2.10

removeAllTags
void removeAllTags(TextIter start, TextIter end)

Removes all tags in the range between start and end. 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.

removeSelectionClipboard
void removeSelectionClipboard(Clipboard clipboard)

Removes a GtkClipboard added with gtk_text_buffer_add_selection_clipboard().

removeTag
void removeTag(TextTag tag, TextIter start, TextIter end)

Emits the "remove-tag" signal. The default handler for the signal removes all occurrences of tag from the given range. start and end don't have to be in order.

removeTagByName
void removeTagByName(string name, TextIter start, TextIter end)

Calls gtk_text_tag_table_lookup() on the buffer's tag table to get a GtkTextTag, then calls gtk_text_buffer_remove_tag().

selectRange
void selectRange(TextIter ins, TextIter bound)

This function moves the "insert" and "selection_bound" marks simultaneously. If you move them in two steps with gtk_text_buffer_move_mark(), 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. Since 2.4

serialize
ubyte[] serialize(TextBuffer contentBuffer, GdkAtom format, TextIter start, TextIter end)

This function serializes the portion of text between start and end in the rich text format represented by format. formats to be used must be registered using gtk_text_buffer_register_serialize_format() or gtk_text_buffer_register_serialize_tagset() beforehand. Since 2.10

setModified
void setModified(int 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 toggled on the modified bit again. When the modified bit flips, the buffer emits the "modified-changed" signal.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
setText
void setText(string text)

Deletes current contents of buffer, and inserts text instead. If len is -1, text must be nul-terminated. text must be valid UTF-8.

unregisterDeserializeFormat
void unregisterDeserializeFormat(GdkAtom format)

This function unregisters a rich text format that was previously registered using gtk_text_buffer_register_deserialize_format() or gtk_text_buffer_register_deserialize_tagset(). Since 2.10

unregisterSerializeFormat
void unregisterSerializeFormat(GdkAtom format)

This function unregisters a rich text format that was previously registered using gtk_text_buffer_register_serialize_format() or gtk_text_buffer_register_serialize_tagset() Since 2.10

Static functions

callBackApplyTag
void callBackApplyTag(GtkTextBuffer* textbufferStruct, GtkTextTag* tag, GtkTextIter* start, GtkTextIter* end, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackBeginUserAction
void callBackBeginUserAction(GtkTextBuffer* textbufferStruct, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackChanged
void callBackChanged(GtkTextBuffer* textbufferStruct, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackDeleteRange
void callBackDeleteRange(GtkTextBuffer* textbufferStruct, GtkTextIter* start, GtkTextIter* end, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackEndUserAction
void callBackEndUserAction(GtkTextBuffer* textbufferStruct, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackInsertChildAnchor
void callBackInsertChildAnchor(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GtkTextChildAnchor* anchor, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackInsertPixbuf
void callBackInsertPixbuf(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GdkPixbuf* pixbuf, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackInsertText
void callBackInsertText(GtkTextBuffer* textbufferStruct, GtkTextIter* location, gchar* text, gint len, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackMarkDeleted
void callBackMarkDeleted(GtkTextBuffer* textbufferStruct, GtkTextMark* mark, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackMarkSet
void callBackMarkSet(GtkTextBuffer* textbufferStruct, GtkTextIter* location, GtkTextMark* mark, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackModifiedChanged
void callBackModifiedChanged(GtkTextBuffer* textbufferStruct, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackPasteDone
void callBackPasteDone(GtkTextBuffer* textbufferStruct, GtkClipboard* clipboard, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.
callBackRemoveTag
void callBackRemoveTag(GtkTextBuffer* textbufferStruct, GtkTextTag* tag, GtkTextIter* start, GtkTextIter* end, TextBuffer _textBuffer)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

connectedSignals
int[string] connectedSignals;
gtkTextBuffer
GtkTextBuffer* gtkTextBuffer;

the main Gtk struct

onApplyTagListeners
void delegate(TextTag, TextIter, TextIter, TextBuffer)[] onApplyTagListeners;
Undocumented in source.
onBeginUserActionListeners
void delegate(TextBuffer)[] onBeginUserActionListeners;
Undocumented in source.
onChangedListeners
void delegate(TextBuffer)[] onChangedListeners;
Undocumented in source.
onDeleteRangeListeners
void delegate(TextIter, TextIter, TextBuffer)[] onDeleteRangeListeners;
Undocumented in source.
onEndUserActionListeners
void delegate(TextBuffer)[] onEndUserActionListeners;
Undocumented in source.
onInsertChildAnchorListeners
void delegate(TextIter, TextChildAnchor, TextBuffer)[] onInsertChildAnchorListeners;
Undocumented in source.
onInsertPixbufListeners
void delegate(TextIter, Pixbuf, TextBuffer)[] onInsertPixbufListeners;
Undocumented in source.
onInsertTextListeners
void delegate(TextIter, string, gint, TextBuffer)[] onInsertTextListeners;
Undocumented in source.
onMarkDeletedListeners
void delegate(TextMark, TextBuffer)[] onMarkDeletedListeners;
Undocumented in source.
onMarkSetListeners
void delegate(TextIter, TextMark, TextBuffer)[] onMarkSetListeners;
Undocumented in source.
onModifiedChangedListeners
void delegate(TextBuffer)[] onModifiedChangedListeners;
Undocumented in source.
onPasteDoneListeners
void delegate(Clipboard, TextBuffer)[] onPasteDoneListeners;
Undocumented in source.
onRemoveTagListeners
void delegate(TextTag, TextIter, TextIter, TextBuffer)[] onRemoveTagListeners;
Undocumented in source.

Inherited Members

From ObjectG

gObject
GObject* gObject;

the main Gtk struct

getObjectGStruct
GObject* getObjectGStruct()

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

isGcRoot
bool isGcRoot;
Undocumented in source.
destroyNotify
void destroyNotify(ObjectG obj)
Undocumented in source. Be warned that the author may not have intended to support it.
toggleNotify
void toggleNotify(ObjectG obj, GObject* object, int isLastRef)
Undocumented in source. Be warned that the author may not have intended to support it.
~this
~this()
Undocumented in source.
getDObject
RT getDObject(U obj)

Gets a D Object from the objects table of associations.

setStruct
void setStruct(GObject* obj)
Undocumented in source. Be warned that the author may not have intended to support it.
setProperty
void setProperty(string propertyName, int value)
setProperty
void setProperty(string propertyName, string value)
setProperty
void setProperty(string propertyName, long value)
setProperty
void setProperty(string propertyName, ulong value)
unref
void unref()
Undocumented in source. Be warned that the author may not have intended to support it.
doref
ObjectG doref()
Undocumented in source. Be warned that the author may not have intended to support it.
connectedSignals
int[string] connectedSignals;
Undocumented in source.
onNotifyListeners
void delegate(ParamSpec, ObjectG)[] onNotifyListeners;
Undocumented in source.
addOnNotify
void addOnNotify(void delegate(ParamSpec, ObjectG) dlg, string property, ConnectFlags connectFlags)

The notify signal is emitted on an object when one of its properties has been changed. Note that getting this signal doesn't guarantee that the value of the property has actually changed, it may also be emitted when the setter for the property is called to reinstate the previous value.

callBackNotify
void callBackNotify(GObject* gobjectStruct, GParamSpec* pspec, ObjectG _objectG)
Undocumented in source. Be warned that the author may not have intended to support it.
classInstallProperty
void classInstallProperty(GObjectClass* oclass, uint propertyId, ParamSpec pspec)

Installs a new property. This is usually done in the class initializer. Note that it is possible to redefine a property in a derived class, by installing a property with the same name. This can be useful at times, e.g. to change the range of allowed values or the default value.

classInstallProperties
void classInstallProperties(GObjectClass* oclass, ParamSpec[] pspecs)

Installs new properties from an array of GParamSpecs. This is usually done in the class initializer. The property id of each property is the index of each GParamSpec in the pspecs array. The property id of 0 is treated specially by GObject and it should not be used to store a GParamSpec. This function should be used if you plan to use a static array of GParamSpecs and g_object_notify_by_pspec(). For instance, this Since 2.26

classFindProperty
ParamSpec classFindProperty(GObjectClass* oclass, string propertyName)

Looks up the GParamSpec for a property of a class.

classListProperties
ParamSpec[] classListProperties(GObjectClass* oclass)

Get an array of GParamSpec* for all properties of a class.

classOverrideProperty
void classOverrideProperty(GObjectClass* oclass, uint propertyId, string name)

Registers property_id as referring to a property with the name name in a parent class or in an interface implemented by oclass. This allows this class to override a property implementation in a parent class or to provide the implementation of a property from an interface. Note Internally, overriding is implemented by creating a property of type GParamSpecOverride; generally operations that query the properties of the object class, such as g_object_class_find_property() or g_object_class_list_properties() will return the overridden property. However, in one case, the construct_properties argument of the constructor virtual function, the GParamSpecOverride is passed instead, so that the param_id field of the GParamSpec will be correct. For virtually all uses, this makes no difference. If you need to get the overridden property, you can call g_param_spec_get_redirect_target(). Since 2.4

interfaceInstallProperty
void interfaceInstallProperty(void* iface, ParamSpec pspec)

Add a property to an interface; this is only useful for interfaces that are added to GObject-derived types. Adding a property to an interface forces all objects classes with that interface to have a compatible property. The compatible property could be a newly created GParamSpec, but normally g_object_class_override_property() will be used so that the object class only needs to provide an implementation and inherits the property description, default value, bounds, and so forth from the interface property. This function is meant to be called from the interface's default vtable initialization function (the class_init member of GTypeInfo.) It must not be called after after class_init has been called for any object types implementing this interface. Since 2.4

interfaceFindProperty
ParamSpec interfaceFindProperty(void* iface, string propertyName)

Find the GParamSpec with the given name for an interface. Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek(). Since 2.4

interfaceListProperties
ParamSpec[] interfaceListProperties(void* iface)

Lists the properties of an interface.Generally, the interface vtable passed in as g_iface will be the default vtable from g_type_default_interface_ref(), or, if you know the interface has already been loaded, g_type_default_interface_peek(). Since 2.4

doref
void* doref(void* object)

Increases the reference count of object.

unref
void unref(void* object)

Decreases the reference count of object. When its reference count drops to 0, the object is finalized (i.e. its memory is freed).

refSink
void* refSink(void* object)

Increase the reference count of object, and possibly remove the floating reference, if object has a floating reference. In other words, if the object is floating, then this call "assumes ownership" of the floating reference, converting it to a normal reference by clearing the floating flag while leaving the reference count unchanged. If the object is not floating, then this call adds a new normal reference increasing the reference count by one. Since 2.10

clearObject
void clearObject(ObjectG objectPtr)

Clears a reference to a GObject. object_ptr must not be NULL. If the reference is NULL then this function does nothing. Otherwise, the reference count of the object is decreased and the pointer is set to NULL. This function is threadsafe and modifies the pointer atomically, using memory barriers where needed. A macro is also included that allows this function to be used without pointer casts. Since 2.28

isFloating
int isFloating(void* object)

Checks whether object has a floating reference. Since 2.10

forceFloating
void forceFloating()

This function is intended for GObject implementations to re-enforce a floating object reference. Doing this is seldom required: all GInitiallyUnowneds are created with a floating reference which usually just needs to be sunken by calling g_object_ref_sink(). Since 2.10

weakRef
void weakRef(GWeakNotify notify, void* data)

Adds a weak reference callback to an object. Weak references are used for notification when an object is finalized. They are called "weak references" because they allow you to safely hold a pointer to an object without calling g_object_ref() (g_object_ref() adds a strong reference, that is, forces the object to stay alive). Note that the weak references created by this method are not thread-safe: they cannot safely be used in one thread if the object's last g_object_unref() might happen in another thread. Use GWeakRef if thread-safety is required.

weakUnref
void weakUnref(GWeakNotify notify, void* data)

Removes a weak reference callback to an object.

addWeakPointer
void addWeakPointer(void** weakPointerLocation)

Adds a weak reference from weak_pointer to object to indicate that the pointer located at weak_pointer_location is only valid during the lifetime of object. When the object is finalized, weak_pointer will be set to NULL. Note that as with g_object_weak_ref(), the weak references created by this method are not thread-safe: they cannot safely be used in one thread if the object's last g_object_unref() might happen in another thread. Use GWeakRef if thread-safety is required.

removeWeakPointer
void removeWeakPointer(void** weakPointerLocation)

Removes a weak reference from object that was previously added using g_object_add_weak_pointer(). The weak_pointer_location has to match the one used with g_object_add_weak_pointer().

addToggleRef
void addToggleRef(GToggleNotify notify, void* data)

Increases the reference count of the object by one and sets a callback to be called when all other references to the object are dropped, or when this is already the last reference to the object and another reference is established. This functionality is intended for binding object to a proxy object managed by another memory manager. This is done with two paired references: the strong reference added by g_object_add_toggle_ref() and a reverse reference to the proxy object which is either a strong reference or weak reference. The setup is that when there are no other references to object, only a weak reference is held in the reverse direction from object to the proxy object, but when there are other references held to object, a strong reference is held. The notify callback is called when the reference from object to the proxy object should be toggled from strong to weak (is_last_ref true) or weak to strong (is_last_ref false). Since a (normal) reference must be held to the object before calling g_object_add_toggle_ref(), the initial state of the reverse link is always strong. Multiple toggle references may be added to the same gobject, however if there are multiple toggle references to an object, none of them will ever be notified until all but one are removed. For this reason, you should only ever use a toggle reference if there is important state in the proxy object. Since 2.8

removeToggleRef
void removeToggleRef(GToggleNotify notify, void* data)

Removes a reference added with g_object_add_toggle_ref(). The reference count of the object is decreased by one. Since 2.8

notify
void notify(string propertyName)

Emits a "notify" signal for the property property_name on object. When possible, eg. when signaling a property change from within the class that registered the property, you should use g_object_notify_by_pspec() instead.

notifyByPspec
void notifyByPspec(ParamSpec pspec)

Emits a "notify" signal for the property specified by pspec on object. This function omits the property name lookup, hence it is faster than g_object_notify(). One way to avoid using g_object_notify() from within the class that registered the properties, and using g_object_notify_by_pspec() instead, is to store the GParamSpec used with Since 2.26

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 "notify" signal is emitted for each property modified while the object is frozen. This is necessary for accessors that modify multiple properties to prevent premature notification while the object is still being modified.

thawNotify
void thawNotify()

Reverts the effect of a previous call to g_object_freeze_notify(). The freeze count is decreased on object and when it reaches zero, queued "notify" signals are emitted. Duplicate notifications for each property are squashed so that at most one "notify" signal is emitted for each property. It is an error to call this function when the freeze count is zero.

getData
void* getData(string key)

Gets a named field from the objects table of associations (see g_object_set_data()).

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. If the object already had an association with that name, the old association will be destroyed.

setDataFull
void setDataFull(string key, void* data, GDestroyNotify destroy)

Like g_object_set_data() except it adds notification for when the association is destroyed, either by setting it to a different value or when the object is destroyed. Note that the destroy callback is not called if data is NULL.

stealData
void* stealData(string key)

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

dupData
void* dupData(string key, GDuplicateFunc dupFunc, void* userData)

This is a variant of g_object_get_data() which returns a 'duplicate' of the value. dup_func defines the meaning of 'duplicate' in this context, it could e.g. take a reference on a ref-counted object. If the key is not set on the object then dup_func will be called with a NULL argument. Note that dup_func is called while user data of object is locked. This function can be useful to avoid races when multiple threads are using object data on the same key on the same object. Since 2.34

replaceData
int replaceData(string key, void* oldval, void* newval, GDestroyNotify destroy, GDestroyNotify* oldDestroy)

Compares the user data for the key key on object with oldval, and if they are the same, replaces oldval with newval. This is like a typical atomic compare-and-exchange operation, for user data on an object. If the previous value was replaced then ownership of the old value (oldval) is passed to the caller, including the registered destroy notify for it (passed out in old_destroy). Its up to the caller to free this as he wishes, which may or may not include using old_destroy as sometimes replacement should not destroy the object in the normal way. Return: TRUE if the existing value for key was replaced by newval, FALSE otherwise. Since 2.34

getQdata
void* getQdata(GQuark quark)

This function gets back user data pointers stored via g_object_set_qdata().

setQdata
void setQdata(GQuark quark, void* data)

This sets an opaque, named pointer on an object. The name is specified through a GQuark (retrived e.g. via g_quark_from_static_string()), and the pointer can be gotten back from the object with g_object_get_qdata() until the object is finalized. Setting a previously set user data pointer, overrides (frees) the old pointer set, using NULL as pointer essentially removes the data stored.

setQdataFull
void setQdataFull(GQuark quark, void* data, GDestroyNotify destroy)

This function works like g_object_set_qdata(), but in addition, a void (*destroy) (gpointer) function may be specified which is called with data as argument when the object is finalized, or the data is being overwritten by a call to g_object_set_qdata() with the same quark.

stealQdata
void* stealQdata(GQuark quark)

This function gets back user data pointers stored via g_object_set_qdata() and removes the data from object without invoking its destroy() function (if any was set). Usually, calling this function is only required to update

dupQdata
void* dupQdata(GQuark quark, GDuplicateFunc dupFunc, void* userData)

This is a variant of g_object_get_qdata() which returns a 'duplicate' of the value. dup_func defines the meaning of 'duplicate' in this context, it could e.g. take a reference on a ref-counted object. If the quark is not set on the object then dup_func will be called with a NULL argument. Note that dup_func is called while user data of object is locked. This function can be useful to avoid races when multiple threads are using object data on the same key on the same object. Since 2.34

replaceQdata
int replaceQdata(GQuark quark, void* oldval, void* newval, GDestroyNotify destroy, GDestroyNotify* oldDestroy)

Compares the user data for the key quark on object with oldval, and if they are the same, replaces oldval with newval. This is like a typical atomic compare-and-exchange operation, for user data on an object. If the previous value was replaced then ownership of the old value (oldval) is passed to the caller, including the registered destroy notify for it (passed out in old_destroy). Its up to the caller to free this as he wishes, which may or may not include using old_destroy as sometimes replacement should not destroy the object in the normal way. Return: TRUE if the existing value for quark was replaced by newval, FALSE otherwise. Since 2.34

setProperty
void setProperty(string propertyName, Value value)

Sets a property on an object.

getProperty
void getProperty(string propertyName, Value value)

Gets a property of an object. value must have been initialized to the expected type of the property (or a type to which the expected type can be transformed) using g_value_init(). In general, a copy is made of the property contents and the caller is responsible for freeing the memory by calling g_value_unset(). Note that g_object_get_property() is really intended for language bindings, g_object_get() is much more convenient for C programming.

setValist
void setValist(string firstPropertyName, void* varArgs)

Sets properties on an object.

getValist
void getValist(string firstPropertyName, void* varArgs)

Gets properties of an object. In general, a copy is made of the property contents and the caller is responsible for freeing the memory in the appropriate manner for the type, for instance by calling g_free() or g_object_unref(). See g_object_get().

watchClosure
void watchClosure(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 g_closure_invalidate() on it, in order to prevent invocations of the closure with a finalized (nonexisting) object. Also, g_object_ref() and g_object_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.

runDispose
void runDispose()

Releases all references to other objects. This can be used to break reference cycles. This functions should only be called from object system implementations.

Meta