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()
.
Instance methods
gtk_text_buffer_add_commit_notify
Adds a GtkTextBufferCommitNotify
to be called when a change
is to be made to the GtkTextBuffer
.
since: 4.16
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_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_cut_clipboard
Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.
gtk_text_buffer_delete_selection
Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text.
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_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_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_offset
Initializes iter
to a position char_offset
chars from the start
of the entire 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_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_bounds
Returns TRUE
if some text is selected; places the bounds
of the selection in start
and end
.
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_place_cursor
This function moves the “insert” and “selection_bound” marks simultaneously.
gtk_text_buffer_remove_commit_notify
Removes the GtkTextBufferCommitNotify
handler previously registered
with gtk_text_buffer_add_commit_notify()
.
since: 4.16
gtk_text_buffer_remove_selection_clipboard
Removes a GdkClipboard
added with
gtk_text_buffer_add_selection_clipboard()
.
gtk_text_buffer_select_range
This function moves the “insert” and “selection_bound” marks simultaneously.
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.
Properties
Gtk.TextBuffer:enable-undo
Denotes if support for undoing and redoing changes to the buffer is allowed.
Signals
Gtk.TextBuffer::begin-user-action
Emitted at the beginning of a single user-visible
operation on a GtkTextBuffer
.
Gtk.TextBuffer::end-user-action
Emitted at the end of a single user-visible
operation on the GtkTextBuffer
.
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.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.modified_changed
The class handler for the GtkTextBuffer::modified-changed
signal.