Class

GtkTextBuffer

Description [src]

class Gtk.TextBuffer : GObject.Object
{
  priv: GtkTextBufferPrivate*
}

Stores text and attributes for display in a 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 gtk_text_buffer_set_enable_undo().

Hierarchy

hierarchy this GtkTextBuffer ancestor_0 GObject ancestor_0--this

Ancestors

Constructors

gtk_text_buffer_new

Creates a new text buffer.

Instance methods

gtk_text_buffer_add_mark

Adds the mark at position where.

gtk_text_buffer_add_selection_clipboard

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

gtk_text_buffer_apply_tag

Emits the “apply-tag” signal on buffer.

gtk_text_buffer_apply_tag_by_name

Emits the “apply-tag” signal on buffer.

gtk_text_buffer_backspace

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

gtk_text_buffer_begin_irreversible_action

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

gtk_text_buffer_begin_user_action

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.

gtk_text_buffer_copy_clipboard

Copies the currently-selected text to a clipboard.

gtk_text_buffer_create_child_anchor

Creates and inserts a child anchor.

gtk_text_buffer_create_mark

Creates a mark at position where.

gtk_text_buffer_create_tag

Creates a tag and adds it to the tag table for buffer.

gtk_text_buffer_cut_clipboard

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

gtk_text_buffer_delete

Deletes text between start and end.

gtk_text_buffer_delete_interactive

Deletes all editable text in the given range.

gtk_text_buffer_delete_mark

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

gtk_text_buffer_delete_mark_by_name

Deletes the mark named name; the mark must exist.

gtk_text_buffer_delete_selection

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

gtk_text_buffer_end_irreversible_action

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

gtk_text_buffer_end_user_action

Ends a user-visible operation.

gtk_text_buffer_get_bounds

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

gtk_text_buffer_get_can_redo

Gets whether there is a redoable action in the history.

gtk_text_buffer_get_can_undo

Gets whether there is an undoable action in the history.

gtk_text_buffer_get_char_count

Gets the number of characters in the buffer.

gtk_text_buffer_get_enable_undo

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

gtk_text_buffer_get_end_iter

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

gtk_text_buffer_get_has_selection

Indicates whether the buffer has some text currently selected.

gtk_text_buffer_get_insert

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

gtk_text_buffer_get_iter_at_child_anchor

Obtains the location of anchor within buffer.

gtk_text_buffer_get_iter_at_line

Initializes iter to the start of the given line.

gtk_text_buffer_get_iter_at_line_index

Obtains an iterator pointing to byte_index within the given line.

gtk_text_buffer_get_iter_at_line_offset

Obtains an iterator pointing to char_offset within the given line.

gtk_text_buffer_get_iter_at_mark

Initializes iter with the current position of mark.

gtk_text_buffer_get_iter_at_offset

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

gtk_text_buffer_get_line_count

Obtains the number of lines in the buffer.

gtk_text_buffer_get_mark

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

gtk_text_buffer_get_max_undo_levels

Gets the maximum number of undo levels to perform.

gtk_text_buffer_get_modified

Indicates whether the buffer has been modified since the last call to gtk_text_buffer_set_modified() set the modification flag to FALSE.

gtk_text_buffer_get_selection_bound

Returns the mark that represents the selection bound.

gtk_text_buffer_get_selection_bounds

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

gtk_text_buffer_get_selection_content

Get a content provider for this buffer.

gtk_text_buffer_get_slice

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

gtk_text_buffer_get_start_iter

Initialized iter with the first position in the text buffer.

gtk_text_buffer_get_tag_table

Get the GtkTextTagTable associated with this buffer.

gtk_text_buffer_get_text

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

gtk_text_buffer_insert

Inserts len bytes of text at position iter.

gtk_text_buffer_insert_at_cursor

Inserts text in buffer.

gtk_text_buffer_insert_child_anchor

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

gtk_text_buffer_insert_interactive

Inserts text in buffer.

gtk_text_buffer_insert_markup

Inserts the text in markup at position iter.

gtk_text_buffer_insert_paintable

Inserts an image into the text buffer at iter.

gtk_text_buffer_insert_range

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

gtk_text_buffer_insert_range_interactive

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

gtk_text_buffer_insert_with_tags

Inserts text into buffer at iter, applying the list of tags to the newly-inserted text.

gtk_text_buffer_insert_with_tags_by_name

Inserts text into buffer at iter, applying the list of tags to the newly-inserted text.

gtk_text_buffer_move_mark

Moves mark to the new location where.

gtk_text_buffer_move_mark_by_name

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

gtk_text_buffer_paste_clipboard

Pastes the contents of a clipboard.

gtk_text_buffer_place_cursor

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

gtk_text_buffer_redo

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

gtk_text_buffer_remove_all_tags

Removes all tags in the range between start and end.

gtk_text_buffer_remove_selection_clipboard

Removes a GdkClipboard added with gtk_text_buffer_add_selection_clipboard().

gtk_text_buffer_remove_tag

Emits the “remove-tag” signal.

gtk_text_buffer_remove_tag_by_name

Emits the “remove-tag” signal.

gtk_text_buffer_select_range

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

gtk_text_buffer_set_enable_undo

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

gtk_text_buffer_set_max_undo_levels

Sets the maximum number of undo levels to perform.

gtk_text_buffer_set_modified

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

gtk_text_buffer_set_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_delete() and gtk_text_buffer_insert() directly instead.

gtk_text_buffer_undo

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

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Gtk.TextBuffer:can-redo

Denotes that the buffer can reapply the last undone action.

Gtk.TextBuffer:can-undo

Denotes that the buffer can undo the last applied action.

Gtk.TextBuffer:cursor-position

The position of the insert mark.

Gtk.TextBuffer:enable-undo

Denotes if support for undoing and redoing changes to the buffer is allowed.

Gtk.TextBuffer:has-selection

Whether the buffer has some text currently selected.

Gtk.TextBuffer:tag-table

The GtkTextTagTable for the buffer.

Gtk.TextBuffer:text

The text content of the buffer.

Signals

Gtk.TextBuffer::apply-tag

Emitted to apply a tag to a range of text in a GtkTextBuffer.

Gtk.TextBuffer::begin-user-action

Emitted at the beginning of a single user-visible operation on a GtkTextBuffer.

Gtk.TextBuffer::changed

Emitted when the content of a GtkTextBuffer has changed.

Gtk.TextBuffer::delete-range

Emitted to delete a range from a GtkTextBuffer.

Gtk.TextBuffer::end-user-action

Emitted at the end of a single user-visible operation on the GtkTextBuffer.

Gtk.TextBuffer::insert-child-anchor

Emitted to insert a GtkTextChildAnchor in a GtkTextBuffer.

Gtk.TextBuffer::insert-paintable

Emitted to insert a GdkPaintable in a GtkTextBuffer.

Gtk.TextBuffer::insert-text

Emitted to insert text in a GtkTextBuffer.

Gtk.TextBuffer::mark-deleted

Emitted as notification after a GtkTextMark is deleted.

Gtk.TextBuffer::mark-set

Emitted as notification after a GtkTextMark is set.

Gtk.TextBuffer::modified-changed

Emitted when the modified bit of a GtkTextBuffer flips.

Gtk.TextBuffer::paste-done

Emitted after paste operation has been completed.

Gtk.TextBuffer::redo

Emitted when a request has been made to redo the previously undone operation.

Gtk.TextBuffer::remove-tag

Emitted to remove all occurrences of tag from a range of text in a GtkTextBuffer.

Gtk.TextBuffer::undo

Emitted when a request has been made to undo the previous operation or set of operations that have been grouped together.

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GtkTextBufferClass {
  GObjectClass parent_class;
  void (* insert_text) (
    GtkTextBuffer* buffer,
    GtkTextIter* pos,
    const char* new_text,
    int new_text_length
  );
  void (* insert_paintable) (
    GtkTextBuffer* buffer,
    GtkTextIter* iter,
    GdkPaintable* paintable
  );
  void (* insert_child_anchor) (
    GtkTextBuffer* buffer,
    GtkTextIter* iter,
    GtkTextChildAnchor* anchor
  );
  void (* delete_range) (
    GtkTextBuffer* buffer,
    GtkTextIter* start,
    GtkTextIter* end
  );
  void (* changed) (
    GtkTextBuffer* buffer
  );
  void (* modified_changed) (
    GtkTextBuffer* buffer
  );
  void (* mark_set) (
    GtkTextBuffer* buffer,
    const GtkTextIter* location,
    GtkTextMark* mark
  );
  void (* mark_deleted) (
    GtkTextBuffer* buffer,
    GtkTextMark* mark
  );
  void (* apply_tag) (
    GtkTextBuffer* buffer,
    GtkTextTag* tag,
    const GtkTextIter* start,
    const GtkTextIter* end
  );
  void (* remove_tag) (
    GtkTextBuffer* buffer,
    GtkTextTag* tag,
    const GtkTextIter* start,
    const GtkTextIter* end
  );
  void (* begin_user_action) (
    GtkTextBuffer* buffer
  );
  void (* end_user_action) (
    GtkTextBuffer* buffer
  );
  void (* paste_done) (
    GtkTextBuffer* buffer,
    GdkClipboard* clipboard
  );
  void (* undo) (
    GtkTextBuffer* buffer
  );
  void (* redo) (
    GtkTextBuffer* buffer
  );
  void (* _gtk_reserved1) (
void
  );
  void (* _gtk_reserved2) (
void
  );
  void (* _gtk_reserved3) (
void
  );
  void (* _gtk_reserved4) (
void
  );
  
}

The class structure for GtkTextBuffer.

Class members
parent_class: GObjectClass

The object class structure needs to be the first.

insert_text: void (* insert_text) ( GtkTextBuffer* buffer, GtkTextIter* pos, const char* new_text, int new_text_length )

The class handler for the GtkTextBuffer::insert-text signal.

insert_paintable: void (* insert_paintable) ( GtkTextBuffer* buffer, GtkTextIter* iter, GdkPaintable* paintable )

The class handler for the GtkTextBuffer::insert-paintable signal.

insert_child_anchor: void (* insert_child_anchor) ( GtkTextBuffer* buffer, GtkTextIter* iter, GtkTextChildAnchor* anchor )

The class handler for the GtkTextBuffer::insert-child-anchor signal.

delete_range: void (* delete_range) ( GtkTextBuffer* buffer, GtkTextIter* start, GtkTextIter* end )

The class handler for the GtkTextBuffer::delete-range signal.

changed: void (* changed) ( GtkTextBuffer* buffer )

The class handler for the GtkTextBuffer::changed signal.

modified_changed: void (* modified_changed) ( GtkTextBuffer* buffer )

The class handler for the GtkTextBuffer::modified-changed signal.

mark_set: void (* mark_set) ( GtkTextBuffer* buffer, const GtkTextIter* location, GtkTextMark* mark )

The class handler for the GtkTextBuffer::mark-set signal.

mark_deleted: void (* mark_deleted) ( GtkTextBuffer* buffer, GtkTextMark* mark )

The class handler for the GtkTextBuffer::mark-deleted signal.

apply_tag: void (* apply_tag) ( GtkTextBuffer* buffer, GtkTextTag* tag, const GtkTextIter* start, const GtkTextIter* end )

The class handler for the GtkTextBuffer::apply-tag signal.

remove_tag: void (* remove_tag) ( GtkTextBuffer* buffer, GtkTextTag* tag, const GtkTextIter* start, const GtkTextIter* end )

The class handler for the GtkTextBuffer::remove-tag signal.

begin_user_action: void (* begin_user_action) ( GtkTextBuffer* buffer )

The class handler for the GtkTextBuffer::begin-user-action signal.

end_user_action: void (* end_user_action) ( GtkTextBuffer* buffer )

The class handler for the GtkTextBuffer::end-user-action signal.

paste_done: void (* paste_done) ( GtkTextBuffer* buffer, GdkClipboard* clipboard )

The class handler for the GtkTextBuffer::paste-done signal.

undo: void (* undo) ( GtkTextBuffer* buffer )

The class handler for the GtkTextBuffer::undo signal.

redo: void (* redo) ( GtkTextBuffer* buffer )

The class handler for the GtkTextBuffer::redo signal.

_gtk_reserved1: void (* _gtk_reserved1) ( void )

No description available.

_gtk_reserved2: void (* _gtk_reserved2) ( void )

No description available.

_gtk_reserved3: void (* _gtk_reserved3) ( void )

No description available.

_gtk_reserved4: void (* _gtk_reserved4) ( void )

No description available.

Virtual methods

Gtk.TextBufferClass.apply_tag

Emits the “apply-tag” signal on buffer.

Gtk.TextBufferClass.begin_user_action

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.

Gtk.TextBufferClass.changed

The class handler for the GtkTextBuffer::changed signal.

Gtk.TextBufferClass.delete_range

The class handler for the GtkTextBuffer::delete-range signal.

Gtk.TextBufferClass.end_user_action

Ends a user-visible operation.

Gtk.TextBufferClass.insert_child_anchor

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

Gtk.TextBufferClass.insert_paintable

Inserts an image into the text buffer at iter.

Gtk.TextBufferClass.insert_text

The class handler for the GtkTextBuffer::insert-text signal.

Gtk.TextBufferClass.mark_deleted

The class handler for the GtkTextBuffer::mark-deleted signal.

Gtk.TextBufferClass.mark_set

The class handler for the GtkTextBuffer::mark-set signal.

Gtk.TextBufferClass.modified_changed

The class handler for the GtkTextBuffer::modified-changed signal.

Gtk.TextBufferClass.paste_done

The class handler for the GtkTextBuffer::paste-done signal.

Gtk.TextBufferClass.redo

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

Gtk.TextBufferClass.remove_tag

Emits the “remove-tag” signal.

Gtk.TextBufferClass.undo

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