gtkmm 3.24.7
|
Multi-line attributed text that can be displayed by one or more Gtk::TextView widgets. More...
#include <gtkmm/textbuffer.h>
Inherits Glib::Object.
Public Types | |
typedef TextIter | iterator |
typedef TextTag | Tag |
typedef TextTagTable | TagTable |
typedef TextMark | Mark |
typedef TextChildAnchor | ChildAnchor |
typedef sigc::slot< guint8 *, const Glib::RefPtr< TextBuffer > &, const iterator &, const iterator &, gsize & > | SlotSerialize |
For instance, guint8* on_serialize(const Glib::RefPtr<TextBuffer>& content_buffer, const iterator& start, const iterator& end, gsize& length);. More... | |
typedef sigc::slot< bool, const Glib::RefPtr< TextBuffer > &, iterator &, const guint8 *, gsize, bool > | SlotDeserialize |
For instance, bool on_deserialize(const Glib::RefPtr<TextBuffer>& content_buffer, iterator& iter, const guint8* data, gsize length, bool create_tags);. More... | |
Public Member Functions | |
TextBuffer (TextBuffer && src) noexcept | |
TextBuffer & | operator= (TextBuffer && src) noexcept |
~TextBuffer () noexcept override | |
GtkTextBuffer * | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkTextBuffer * | gobj () const |
Provides access to the underlying C GObject. More... | |
GtkTextBuffer * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
int | get_line_count () const |
Obtains the number of lines in the buffer. More... | |
int | get_char_count () const |
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. More... | |
int | size () const |
See get_char_count(). More... | |
Glib::RefPtr< TextBuffer::TagTable > | get_tag_table () |
Get the Gtk::TextTagTable associated with this buffer. More... | |
Glib::RefPtr< const TextBuffer::TagTable > | get_tag_table () const |
Get the Gtk::TextTagTable associated with this buffer. More... | |
void | set_text (const Glib::ustring & text) |
Removes the current contents of the buffer, and inserts text instead. More... | |
void | set_text (const char * text_begin, const char * text_end) |
Removes the current contents of the buffer, and inserts text instead. More... | |
iterator | insert (const iterator & pos, const Glib::ustring & text) |
Inserts text at position pos. More... | |
iterator | insert (const iterator & pos, const char * text_begin, const char * text_end) |
Inserts text at position pos. More... | |
void | insert_at_cursor (const Glib::ustring & text) |
Inserts text, using the current cursor position as the insertion point. More... | |
void | insert_at_cursor (const char * text_begin, const char * text_end) |
Inserts text, using the current cursor position as the insertion point. More... | |
std::pair< iterator, bool > | insert_interactive (const iterator & pos, const Glib::ustring & text, bool default_editable=true) |
Like insert(), but the insertion will not occur if iter is at a non-editable location in the buffer. More... | |
std::pair< iterator, bool > | insert_interactive (const iterator & pos, const char * text_begin, const char * text_end, bool default_editable=true) |
Like insert(), but the insertion will not occur if pos is at a non-editable location in the buffer. More... | |
bool | insert_interactive_at_cursor (const Glib::ustring & text, bool default_editable=true) |
Calls insert_interactive() at the cursor position. More... | |
bool | insert_interactive_at_cursor (const char * text_begin, const char * text_end, bool default_editable=true) |
Calls insert_interactive() at the cursor position. More... | |
iterator | insert (const iterator & pos, const iterator & range_begin, const iterator & range_end) |
Copies text, tags, and pixbufs between range_begin and range_end (the order of range_begin and range_begin doesn't matter) and inserts the copy at pos. More... | |
std::pair< iterator, bool > | insert_interactive (const iterator & pos, const iterator & range_begin, const iterator & range_end, bool default_editable=true) |
Same as insert_range(), but does nothing if the insertion point isn't editable. More... | |
iterator | insert_with_tag (const iterator & pos, const Glib::ustring & text, const Glib::RefPtr< Tag > & tag) |
iterator | insert_with_tag (const iterator & pos, const char * text_begin, const char * text_end, const Glib::RefPtr< Tag > & tag) |
iterator | insert_with_tag (const iterator & pos, const Glib::ustring & text, const Glib::ustring & tag_name) |
iterator | insert_with_tag (const iterator & pos, const char * text_begin, const char * text_end, const Glib::ustring & tag_name) |
iterator | insert_with_tags (const iterator & pos, const Glib::ustring & text, const std::vector< Glib::RefPtr< Tag > > & tags) |
Inserts text into buffer at pos, applying the list of tags to the newly-inserted text. More... | |
iterator | insert_with_tags (const iterator & pos, const char * text_begin, const char * text_end, const std::vector< Glib::RefPtr< Tag > > & tags) |
Inserts text into buffer at pos, applying the list of tags to the newly-inserted text. More... | |
iterator | insert_with_tags_by_name (const iterator & pos, const Glib::ustring & text, const std::vector< Glib::ustring > & tag_names) |
Inserts text into buffer at pos, applying the list of tags to the newly-inserted text. More... | |
iterator | insert_with_tags_by_name (const iterator & pos, const char * text_begin, const char * text_end, const std::vector< Glib::ustring > & tag_names) |
Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function. More... | |
iterator | insert_markup (const iterator & pos, const Glib::ustring & markup) |
Inserts text in markup at position pos. More... | |
iterator | insert_markup (const iterator & pos, const char * markup_begin, const char * markup_end) |
Inserts markup text at position pos. More... | |
iterator | erase (const iterator & range_begin, const iterator & range_end) |
std::pair< iterator, bool > | erase_interactive (const iterator & range_begin, const iterator & range_end, bool default_editable=true) |
iterator | backspace (const iterator & iter, bool interactive=true, bool default_editable=true) |
Performs the appropriate action as if the user hit the delete key with the cursor at the position specified by iter. More... | |
Glib::ustring | get_text (const iterator & range_start, const iterator & range_end, bool include_hidden_chars=true) const |
Returns the text in the range [ range_start, range_end). More... | |
Glib::ustring | get_text (bool include_hidden_chars=true) const |
Returns all the text in the buffer. More... | |
Glib::ustring | get_slice (const iterator & range_start, const iterator & range_end, bool include_hidden_chars=true) const |
Returns the text in the range [ range_start, range_end). More... | |
iterator | insert_pixbuf (const iterator & pos, const Glib::RefPtr< Gdk::Pixbuf > & pixbuf) |
iterator | insert_child_anchor (const iterator & pos, const Glib::RefPtr< ChildAnchor > & anchor) |
Glib::RefPtr< ChildAnchor > | create_child_anchor (const iterator & pos) |
void | add_mark (const Glib::RefPtr< TextBuffer::Mark > & mark, const iterator & where) |
Adds the mark at position where. More... | |
Glib::RefPtr< TextBuffer::Mark > | create_mark (const Glib::ustring & mark_name, const iterator & where, bool left_gravity=true) |
Creates a mark at position where. More... | |
Glib::RefPtr< Mark > | create_mark (const iterator & where, bool left_gravity=true) |
Create an anonymous mark. More... | |
void | move_mark (const Glib::RefPtr< Mark > & mark, const iterator & where) |
Moves mark to the new location where. More... | |
void | delete_mark (const Glib::RefPtr< Mark > & mark) |
Deletes mark, so that it's no longer located anywhere in the buffer. More... | |
Glib::RefPtr< TextBuffer::Mark > | get_mark (const Glib::ustring & name) |
Returns the mark named name in buffer buffer, or nullptr if no such mark exists in the buffer. More... | |
Glib::RefPtr< const TextBuffer::Mark > | get_mark (const Glib::ustring & name) const |
Returns the mark named name in buffer buffer, or nullptr if no such mark exists in the buffer. More... | |
void | move_mark_by_name (const Glib::ustring & name, const iterator & where) |
Moves the mark named name (which must exist) to location where. More... | |
void | delete_mark_by_name (const Glib::ustring & name) |
Deletes the mark named name; the mark must exist. More... | |
Glib::RefPtr< TextBuffer::Mark > | get_insert () |
Returns the mark that represents the cursor (insertion point). More... | |
Glib::RefPtr< TextBuffer::Mark > | get_selection_bound () |
Returns the mark that represents the selection bound. More... | |
void | place_cursor (const iterator & where) |
This function moves the “insert” and “selection_bound” marks simultaneously. More... | |
void | apply_tag (const Glib::RefPtr< Tag > & tag, const iterator & range_start, const iterator & range_end) |
Emits the “apply-tag” signal on buffer. More... | |
void | remove_tag (const Glib::RefPtr< Tag > & tag, const iterator & range_start, const iterator & range_end) |
Emits the “remove-tag” signal. More... | |
void | apply_tag_by_name (const Glib::ustring & name, const iterator & range_start, const iterator & range_end) |
Calls Gtk::TextTagTable::lookup() on the buffer’s tag table to get a Gtk::TextTag, then calls apply_tag(). More... | |
void | remove_tag_by_name (const Glib::ustring & name, const iterator & range_start, const iterator & range_end) |
Calls Gtk::TextTagTable::lookup() on the buffer’s tag table to get a Gtk::TextTag, then calls remove_tag(). More... | |
void | remove_all_tags (const iterator & range_start, const iterator & range_end) |
Removes all tags in the range between range_start and range_end. More... | |
Glib::RefPtr< Tag > | create_tag (const Glib::ustring & tag_name) |
Creates a tag and adds it to the tag table for buffer. More... | |
Glib::RefPtr< Tag > | create_tag () |
Creates an anoymous tag and adds it to the tag table for buffer. More... | |
iterator | get_iter_at_line_offset (int line_number, int char_offset) |
iterator | get_iter_at_line_index (int line_number, int byte_index) |
iterator | get_iter_at_offset (int char_offset) |
iterator | get_iter_at_line (int line_number) |
iterator | begin () |
iterator | end () |
void | get_bounds (iterator & range_begin, iterator & range_end) |
iterator | get_iter_at_mark (const Glib::RefPtr< Mark > & mark) |
Get the current position of a mark. More... | |
iterator | get_iter_at_child_anchor (const Glib::RefPtr< ChildAnchor > & anchor) |
Get the current position of an anchor. More... | |
bool | get_modified () const |
Indicates whether the buffer has been modified since the last call to set_modified() set the modification flag to false . More... | |
void | set_modified (bool setting=true) |
Used to keep track of whether the buffer has been modified since the last time it was saved. More... | |
bool | get_has_selection () const |
Indicates whether the buffer has some text currently selected. More... | |
void | add_selection_clipboard (const Glib::RefPtr< Clipboard > & clipboard) |
Adds clipboard to the list of clipboards in which the selection contents of buffer are available. More... | |
void | remove_selection_clipboard (const Glib::RefPtr< Clipboard > & clipboard) |
Removes a Gtk::Clipboard added with add_selection_clipboard(). More... | |
void | cut_clipboard (const Glib::RefPtr< Clipboard > & clipboard, bool default_editable=true) |
Copies the currently-selected text to a clipboard, then deletes said text if it’s editable. More... | |
void | copy_clipboard (const Glib::RefPtr< Clipboard > & clipboard) |
Copies the currently-selected text to a clipboard. More... | |
void | paste_clipboard (const Glib::RefPtr< Clipboard > & clipboard, const iterator & override_location, bool default_editable=true) |
void | paste_clipboard (const Glib::RefPtr< Clipboard > & clipboard, bool default_editable=true) |
bool | get_selection_bounds (iterator & range_start, iterator & range_end) const |
Returns true if some text is selected; places the bounds of the selection in range_start and range_end (if the selection has length 0, then range_start and range_end are filled in with the same value). More... | |
bool | erase_selection (bool interactive=true, bool default_editable=true) |
Deletes the range between the “insert” and “selection_bound” marks, that is, the currently-selected text. More... | |
void | select_range (const iterator & ins, const iterator & bound) |
This function moves the “insert” and “selection_bound” marks simultaneously. More... | |
void | begin_user_action () |
Called to indicate that the buffer operations between here and a call to end_user_action() are part of a single user-visible operation. More... | |
void | end_user_action () |
Should be paired with a call to begin_user_action(). More... | |
Glib::RefPtr< TargetList > | get_copy_target_list () const |
This function returns the list of targets this text buffer can provide for copying and as DND source. More... | |
Glib::RefPtr< TargetList > | get_paste_target_list () const |
This function returns the list of targets this text buffer supports for pasting and as DND destination. More... | |
Glib::ustring | register_serialize_format (const Glib::ustring & mime_type, const SlotSerialize & slot) |
This function registers a rich text serialization slot along with its mime_type with this TextBuffer. More... | |
Glib::ustring | register_serialize_tagset (const Glib::ustring & tagset_name) |
This function registers GTK+’s internal rich text serialization format with the passed buffer. More... | |
Glib::ustring | register_deserialize_format (const Glib::ustring & mime_type, const SlotDeserialize & slot) |
This function registers a rich text deserialization slot along with its mime_type with this TextBuffer. More... | |
Glib::ustring | register_deserialize_tagset (const Glib::ustring & tagset_name) |
This function registers GTK+’s internal rich text serialization format with the passed buffer. More... | |
void | unregister_serialize_format (const Glib::ustring & format) |
This function unregisters a rich text format that was previously registered using register_serialize_format() or register_serialize_tagset() More... | |
void | unregister_deserialize_format (const Glib::ustring & format) |
This function unregisters a rich text format that was previously registered using register_deserialize_format() or register_deserialize_tagset(). More... | |
void | set_can_create_tags (const Glib::ustring & format, bool can_create_tags=true) |
Use this function to allow a rich text deserialization function to create new tags in the receiving buffer. More... | |
bool | get_can_create_tags (const Glib::ustring & format) const |
This functions returns the value set with deserialize_set_can_create_tags() More... | |
std::vector< Glib::ustring > | get_serialize_formats () const |
std::vector< Glib::ustring > | get_deserialize_formats () const |
guint8 * | serialize (const Glib::RefPtr< TextBuffer > & content_buffer, const Glib::ustring & format, const iterator & range_start, const iterator & range_end, gsize & length) |
This function serializes the portion of text between range_start and range_end in the rich text format represented by format. More... | |
bool | deserialize (const Glib::RefPtr< TextBuffer > & content_buffer, const Glib::ustring & format, iterator & iter, const guint8 *data, gsize length) |
This function deserializes rich text in format format and inserts it at iter. More... | |
Glib::SignalProxy< void, const TextBuffer::iterator &, const Glib::ustring &, int > | signal_insert () |
Glib::SignalProxy< void, const TextBuffer::iterator &, const Glib::RefPtr< Gdk::Pixbuf > & > | signal_insert_pixbuf () |
Glib::SignalProxy< void, const TextBuffer::iterator &, const Glib::RefPtr< ChildAnchor > & > | signal_insert_child_anchor () |
Glib::SignalProxy< void, const TextBuffer::iterator &, const TextBuffer::iterator & > | signal_erase () |
Glib::SignalProxy< void > | signal_changed () |
Glib::SignalProxy< void > | signal_modified_changed () |
Glib::SignalProxy< void, const TextBuffer::iterator &, const Glib::RefPtr< TextBuffer::Mark > & > | signal_mark_set () |
Glib::SignalProxy< void, const Glib::RefPtr< TextBuffer::Mark > & > | signal_mark_deleted () |
Glib::SignalProxy< void, const Glib::RefPtr< TextBuffer::Tag > &, const TextBuffer::iterator &, const TextBuffer::iterator & > | signal_apply_tag () |
Glib::SignalProxy< void, const Glib::RefPtr< TextBuffer::Tag > &, const TextBuffer::iterator &, const TextBuffer::iterator & > | signal_remove_tag () |
Glib::SignalProxy< void > | signal_begin_user_action () |
Glib::SignalProxy< void > | signal_end_user_action () |
Glib::SignalProxy< void, const Glib::RefPtr< Gtk::Clipboard > & > | signal_paste_done () |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TextBuffer::TagTable > > | property_tag_table () const |
Text Tag Table. More... | |
Glib::PropertyProxy< Glib::ustring > | property_text () |
The text content of the buffer. More... | |
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_text () const |
The text content of the buffer. More... | |
Glib::PropertyProxy_ReadOnly< bool > | property_has_selection () const |
Whether the buffer has some text currently selected. More... | |
Glib::PropertyProxy_ReadOnly< int > | property_cursor_position () const |
The position of the insert mark (as offset from the beginning of the buffer). More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TargetList > > | property_copy_target_list () const |
The list of targets this buffer supports for clipboard copying and as DND source. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TargetList > > | property_paste_target_list () const |
The list of targets this buffer supports for clipboard pasting and as DND destination. More... | |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
static Glib::RefPtr< TextBuffer > | create () |
static Glib::RefPtr< TextBuffer > | create (const Glib::RefPtr< TagTable > & tag_table) |
Protected Member Functions | |
TextBuffer () | |
TextBuffer (const Glib::RefPtr< TagTable > & tag_table) | |
virtual void | on_insert (const TextBuffer::iterator & pos, const Glib::ustring & text, int bytes) |
This is a default handler for the signal signal_insert(). More... | |
virtual void | on_insert_pixbuf (const TextBuffer::iterator & pos, const Glib::RefPtr< Gdk::Pixbuf > & pixbuf) |
This is a default handler for the signal signal_insert_pixbuf(). More... | |
virtual void | on_insert_child_anchor (const TextBuffer::iterator & pos, const Glib::RefPtr< ChildAnchor > & anchor) |
This is a default handler for the signal signal_insert_child_anchor(). More... | |
virtual void | on_erase (const TextBuffer::iterator & range_start, const TextBuffer::iterator & range_end) |
This is a default handler for the signal signal_erase(). More... | |
virtual void | on_changed () |
This is a default handler for the signal signal_changed(). More... | |
virtual void | on_modified_changed () |
This is a default handler for the signal signal_modified_changed(). More... | |
virtual void | on_mark_set (const TextBuffer::iterator & location, const Glib::RefPtr< TextBuffer::Mark > & mark) |
This is a default handler for the signal signal_mark_set(). More... | |
virtual void | on_mark_deleted (const Glib::RefPtr< TextBuffer::Mark > & mark) |
This is a default handler for the signal signal_mark_deleted(). More... | |
virtual void | on_apply_tag (const Glib::RefPtr< TextBuffer::Tag > & tag, const TextBuffer::iterator & range_begin, const TextBuffer::iterator & range_end) |
This is a default handler for the signal signal_apply_tag(). More... | |
virtual void | on_remove_tag (const Glib::RefPtr< TextBuffer::Tag > & tag, const TextBuffer::iterator & range_begin, const TextBuffer::iterator & range_end) |
This is a default handler for the signal signal_remove_tag(). More... | |
virtual void | on_begin_user_action () |
This is a default handler for the signal signal_begin_user_action(). More... | |
virtual void | on_end_user_action () |
This is a default handler for the signal signal_end_user_action(). More... | |
virtual void | on_paste_done (const Glib::RefPtr< Gtk::Clipboard > & clipboard) |
This is a default handler for the signal signal_paste_done(). More... | |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gtk::TextBuffer > | wrap (GtkTextBuffer * object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Multi-line attributed text that can be displayed by one or more Gtk::TextView widgets.
Text in a buffer can be marked with tags. A Gtk::TextBuffer::Tag is an attribute that can be applied to some range of text. For example, a tag might be called "bold" and make the text inside the tag bold. However, the tag concept is more general than that; tags don't have to affect appearance. They can instead affect the behavior of mouse and key presses, "lock" a range of text so the user can't edit it, or countless other things. A tag is represented by a Gtk::TextBuffer::Tag object. One Gtk::TextBuffer::Tag can be applied to any number of text ranges in any number of Gtk::TextBuffers.
Each tag is stored in a Gtk::TextBuffer::TagTable. A tag table defines a set of tags that can be used together. Each buffer has one tag table associated with it; only tags from that tag table can be used with the buffer. A single tag table can be shared between multiple buffers, however.
Most text manipulation is accomplished with iterators, represented by an iterator. The iterator can be used to navigate over characters, words, lines, and sentences.
But iterators can't be used to preserve positions across buffer modifications. To preserve a position, the Gtk::TextBuffer::Mark object is ideal. There are two marks built-in to GtkTextBuffer; these are named "insert" and "selection_bound" and refer to the insertion point and the boundary of the selection which is not the insertion point. If no text is selected, these two marks will be in the same position. You can manipulate what is selected and where the cursor appears by moving these marks around.
Text buffers always contain at least one line, but may be empty (that is, buffers can contain zero characters). The last line in the text buffer never ends in a line separator (such as newline); the other lines in the buffer always end in a line separator. Line separators count as characters when computing character counts and character offsets. Note that some Unicode line separators are represented with multiple bytes in UTF-8, and the two-character sequence "\r\n" is also considered a line separator.
typedef TextIter Gtk::TextBuffer::iterator |
typedef TextMark Gtk::TextBuffer::Mark |
typedef sigc::slot<bool, const Glib::RefPtr<TextBuffer>&, iterator&, const guint8*, gsize, bool> Gtk::TextBuffer::SlotDeserialize |
For instance,
bool on_deserialize(const Glib::RefPtr<TextBuffer>& content_buffer, iterator& iter, const guint8* data, gsize length, bool create_tags);.
content_buffer | The TextBuffer to deserialize into. It may be different from the TextBuffer where the deserialize format is registered. |
iter | Insertion point for the deserialized text. |
data | Data to deserialize. |
length | Length of data. |
create_tags | true if deserializing may create tags. |
true
on success, false
otherwise. Glib::Error | If the deserialize slot throws a Glib::Error or an object derived from Glib::Error, the exception will be propagated out from the calling deserialize() method. |
typedef sigc::slot<guint8*, const Glib::RefPtr<TextBuffer>&, const iterator&, const iterator&, gsize&> Gtk::TextBuffer::SlotSerialize |
For instance,
guint8* on_serialize(const Glib::RefPtr<TextBuffer>& content_buffer, const iterator& start, const iterator& end, gsize& length);.
content_buffer | The TextBuffer to serialize. It may be different from the TextBuffer where the serialize format is registered. | |
start | Start of the block of text to serialize. | |
end | End of the block of text to serialize. | |
[out] | length | The length of the serialized data. |
0
if an error occurred. typedef TextTag Gtk::TextBuffer::Tag |
|
noexcept |
|
overridenoexcept |
|
protected |
|
explicitprotected |
void Gtk::TextBuffer::add_mark | ( | const Glib::RefPtr< TextBuffer::Mark > & | mark, |
const iterator & | where | ||
) |
Adds the mark at position where.
The mark must not be added to another buffer, and if its name is not nullptr
then there must not be another mark in the buffer with the same name.
Emits the Gtk::TextBuffer::signal_mark_set() signal as notification of the mark's initial placement.
mark | The mark to add. |
where | Location to place mark. |
void Gtk::TextBuffer::add_selection_clipboard | ( | const Glib::RefPtr< 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 Gtk::Clipboard of type GDK_SELECTION_PRIMARY for a view of buffer.
clipboard | A Gtk::Clipboard. |
void Gtk::TextBuffer::apply_tag | ( | const Glib::RefPtr< Tag > & | tag, |
const iterator & | range_start, | ||
const iterator & | range_end | ||
) |
Emits the “apply-tag” signal on buffer.
The default handler for the signal applies tag to the given range. range_start and range_end do not have to be in order.
tag | A Gtk::TextTag. |
range_start | One bound of range to be tagged. |
range_end | Other bound of range to be tagged. |
void Gtk::TextBuffer::apply_tag_by_name | ( | const Glib::ustring & | name, |
const iterator & | range_start, | ||
const iterator & | range_end | ||
) |
Calls Gtk::TextTagTable::lookup() on the buffer’s tag table to get a Gtk::TextTag, then calls apply_tag().
name | Name of a named Gtk::TextTag. |
range_start | One bound of range to be tagged. |
range_end | Other bound of range to be tagged. |
iterator Gtk::TextBuffer::backspace | ( | const iterator & | iter, |
bool | interactive = true , |
||
bool | default_editable = true |
||
) |
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 method; however, this method returns a valid iterator that points to the location where text was deleted.
iter | A position in the buffer. |
interactive | Whether the deletion is caused by user interaction. |
default_editable | Whether the buffer is editable by default. |
iterator Gtk::TextBuffer::begin | ( | ) |
void Gtk::TextBuffer::begin_user_action | ( | ) |
Called to indicate that the buffer operations between here and a call to end_user_action() are part of a single user-visible operation.
The operations between begin_user_action() and end_user_action() can then be grouped when creating an undo stack. Gtk::TextBuffer maintains a count of calls to begin_user_action() that have not been closed with a call to 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 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.
void Gtk::TextBuffer::copy_clipboard | ( | const Glib::RefPtr< Clipboard > & | clipboard | ) |
Copies the currently-selected text to a clipboard.
clipboard | The Gtk::Clipboard object to copy to. |
|
static |
|
static |
Glib::RefPtr< ChildAnchor > Gtk::TextBuffer::create_child_anchor | ( | const iterator & | pos | ) |
Glib::RefPtr< TextBuffer::Mark > Gtk::TextBuffer::create_mark | ( | const Glib::ustring & | mark_name, |
const iterator & | where, | ||
bool | left_gravity = true |
||
) |
Creates a mark at position where.
The mark can be retrieved by name using 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).
Emits the "mark_set" signal as notification of the mark's initial placement.
mark_name | Name for mark, or nullptr . |
where | Location to place mark. |
left_gravity | Whether the mark has left gravity. |
Glib::RefPtr< Mark > Gtk::TextBuffer::create_mark | ( | const iterator & | where, |
bool | left_gravity = true |
||
) |
Create an anonymous mark.
Creates an anonymous mark at position where.
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).
Emits the "mark_set" signal as notification of the mark's initial placement.
where | Location to place mark. |
left_gravity | Whether the mark has left gravity. |
Glib::RefPtr< Tag > Gtk::TextBuffer::create_tag | ( | ) |
Creates an anoymous tag and adds it to the tag table for buffer.
Equivalent to calling Gtk::TextBuffer::Tag::create() and then adding the tag to the buffer's tag table.
Glib::RefPtr< Tag > Gtk::TextBuffer::create_tag | ( | const Glib::ustring & | tag_name | ) |
Creates a tag and adds it to the tag table for buffer.
Equivalent to calling Gtk::TextBuffer::Tag::create() and then adding the tag to the buffer's tag table. A tag called tag_name must not already exist in the tag table for this buffer.
tag_name | The name for the new tag. |
void Gtk::TextBuffer::cut_clipboard | ( | const Glib::RefPtr< Clipboard > & | clipboard, |
bool | default_editable = true |
||
) |
Copies the currently-selected text to a clipboard, then deletes said text if it’s editable.
clipboard | The Gtk::Clipboard object to cut to. |
default_editable | Default editability of the buffer. |
void Gtk::TextBuffer::delete_mark | ( | const Glib::RefPtr< Mark > & | 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 don't keep a Glib::RefPtr to the mark, it will be freed. Even if the mark isn't freed, most operations on mark become invalid. There is no way to undelete a mark. Gtk::TextMark::get_deleted() will return true
after this function has been called on a mark; Gtk::TextMark::get_deleted() indicates that a mark no longer belongs to a buffer. The "mark_deleted" signal will be emitted as notification after the mark is deleted.
mark | A Gtk::TextMark in buffer. |
void Gtk::TextBuffer::delete_mark_by_name | ( | const Glib::ustring & | name | ) |
Deletes the mark named name; the mark must exist.
See delete_mark() for details.
name | Name of a mark in buffer. |
bool Gtk::TextBuffer::deserialize | ( | const Glib::RefPtr< TextBuffer > & | content_buffer, |
const Glib::ustring & | format, | ||
iterator & | iter, | ||
const guint8 * | data, | ||
gsize | length | ||
) |
This function deserializes rich text in format format and inserts it at iter.
formats to be used must be registered using register_deserialize_format() or register_deserialize_tagset() beforehand.
content_buffer | The Gtk::TextBuffer to deserialize into. |
format | The rich text format to use for deserializing. |
iter | Insertion point for the deserialized text. |
data | Data to deserialize. |
length | Length of data. |
true
on success, false
otherwise.Glib::Error |
iterator Gtk::TextBuffer::end | ( | ) |
void Gtk::TextBuffer::end_user_action | ( | ) |
Should be paired with a call to begin_user_action().
See that function for a full explanation.
std::pair< iterator, bool > Gtk::TextBuffer::erase_interactive | ( | const iterator & | range_begin, |
const iterator & | range_end, | ||
bool | default_editable = true |
||
) |
bool Gtk::TextBuffer::erase_selection | ( | bool | interactive = true , |
bool | default_editable = true |
||
) |
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).
interactive | Whether the deletion is caused by user interaction. |
default_editable | Whether the buffer is editable by default. |
bool Gtk::TextBuffer::get_can_create_tags | ( | const Glib::ustring & | format | ) | const |
This functions returns the value set with deserialize_set_can_create_tags()
format | A Gdk::Atom representing a registered rich text format. |
int Gtk::TextBuffer::get_char_count | ( | ) | const |
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.
Glib::RefPtr< TargetList > Gtk::TextBuffer::get_copy_target_list | ( | ) | const |
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 Gtk::TextBufferTargetInfo enum, using Gtk::TargetList::add_rich_text_targets() and Gtk::TargetList::add_text_targets().
std::vector< Glib::ustring > Gtk::TextBuffer::get_deserialize_formats | ( | ) | const |
bool Gtk::TextBuffer::get_has_selection | ( | ) | const |
Indicates whether the buffer has some text currently selected.
true
if the there is text selected. Glib::RefPtr< TextBuffer::Mark > Gtk::TextBuffer::get_insert | ( | ) |
Returns the mark that represents the cursor (insertion point).
Equivalent to calling get_mark() to get the mark named “insert”, but very slightly more efficient, and involves less typing.
iterator Gtk::TextBuffer::get_iter_at_child_anchor | ( | const Glib::RefPtr< ChildAnchor > & | anchor | ) |
Get the current position of an anchor.
anchor | A Gtk::TextBuffer::Anchor that appears in the buffer. |
iterator Gtk::TextBuffer::get_iter_at_line | ( | int | line_number | ) |
iterator Gtk::TextBuffer::get_iter_at_line_index | ( | int | line_number, |
int | byte_index | ||
) |
iterator Gtk::TextBuffer::get_iter_at_line_offset | ( | int | line_number, |
int | char_offset | ||
) |
Get the current position of a mark.
mark | The Gtk::TextBuffer::Mark |
iterator Gtk::TextBuffer::get_iter_at_offset | ( | int | char_offset | ) |
int Gtk::TextBuffer::get_line_count | ( | ) | const |
Obtains the number of lines in the buffer.
This value is cached, so the function is very fast.
Glib::RefPtr< TextBuffer::Mark > Gtk::TextBuffer::get_mark | ( | const Glib::ustring & | name | ) |
Returns the mark named name in buffer buffer, or nullptr
if no such mark exists in the buffer.
name | A mark name. |
nullptr
. Glib::RefPtr< const TextBuffer::Mark > Gtk::TextBuffer::get_mark | ( | const Glib::ustring & | name | ) | const |
Returns the mark named name in buffer buffer, or nullptr
if no such mark exists in the buffer.
name | A mark name. |
nullptr
. bool Gtk::TextBuffer::get_modified | ( | ) | const |
Indicates whether the buffer has been modified since the last call to set_modified() set the modification flag to false
.
Used for example to enable a “save” function in a text editor.
true
if the buffer has been modified. Glib::RefPtr< TargetList > Gtk::TextBuffer::get_paste_target_list | ( | ) | const |
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 Gtk::TextBufferTargetInfo enum, using Gtk::TargetList::add_rich_text_targets() and Gtk::TargetList::add_text_targets().
Glib::RefPtr< TextBuffer::Mark > Gtk::TextBuffer::get_selection_bound | ( | ) |
Returns the mark that represents the selection bound.
Equivalent to calling 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. 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.
Returns true
if some text is selected; places the bounds of the selection in range_start and range_end (if the selection has length 0, then range_start and range_end are filled in with the same value).
range_start and range_end will be in ascending order. If range_start and range_end are nullptr
, then they are not filled in, but the return value still indicates whether text is selected.
range_start | Iterator to initialize with selection start. |
range_end | Iterator to initialize with selection end. |
std::vector< Glib::ustring > Gtk::TextBuffer::get_serialize_formats | ( | ) | const |
Glib::ustring Gtk::TextBuffer::get_slice | ( | const iterator & | range_start, |
const iterator & | range_end, | ||
bool | include_hidden_chars = true |
||
) | const |
Returns the text in the range [ range_start, range_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 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.
range_start | Start of a range. |
range_end | End of a range. |
include_hidden_chars | Whether to include invisible text. |
Glib::RefPtr< TextBuffer::TagTable > Gtk::TextBuffer::get_tag_table | ( | ) |
Get the Gtk::TextTagTable associated with this buffer.
Glib::RefPtr< const TextBuffer::TagTable > Gtk::TextBuffer::get_tag_table | ( | ) | const |
Get the Gtk::TextTagTable associated with this buffer.
Glib::ustring Gtk::TextBuffer::get_text | ( | bool | include_hidden_chars = true | ) | const |
Returns all the text in the buffer.
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 get_slice().
include_hidden_chars | Whether to include invisible text. |
Glib::ustring Gtk::TextBuffer::get_text | ( | const iterator & | range_start, |
const iterator & | range_end, | ||
bool | include_hidden_chars = true |
||
) | const |
Returns the text in the range [ range_start, range_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 get_slice().
range_start | Start of a range. |
range_end | End of a range. |
include_hidden_chars | Whether to include invisible text. |
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GtkTextBuffer * Gtk::TextBuffer::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
iterator Gtk::TextBuffer::insert | ( | const iterator & | pos, |
const char * | text_begin, | ||
const char * | text_end | ||
) |
Inserts text at position pos.
Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. The pos iterator is invalidated when insertion occurs (because the buffer contents change).
pos | An iterator pointing to the position at which the text should be inserted. |
text_begin | The start of a UTF8 character array. |
text_end | The end of the UTF8 character array. |
Inserts text at position pos.
Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. The pos iterator is invalidated when insertion occurs (because the buffer contents change).
pos | An iterator pointing to the position at which the text should be inserted. |
text | The text to be inserted in the buffer. |
iterator Gtk::TextBuffer::insert | ( | const iterator & | pos, |
const iterator & | range_begin, | ||
const iterator & | range_end | ||
) |
Copies text, tags, and pixbufs between range_begin and range_end (the order of range_begin and range_begin doesn't matter) and inserts the copy at pos.
Used instead of simply getting/inserting text because it preserves images and tags. If range_begin and range_end are in a different buffer, the two buffers must share the same tag table.
Implemented via emissions of the insert_text and apply_tag signals, so expect those.
pos | An iterator pointing to the position at which the text should be inserted. |
range_begin | A position in a buffer. |
range_end | Another position in the same buffer as range_begin. |
void Gtk::TextBuffer::insert_at_cursor | ( | const char * | text_begin, |
const char * | text_end | ||
) |
Inserts text, using the current cursor position as the insertion point.
Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal.
text_begin | The start of a UTF8 character array. |
text_end | The end of the UTF8 character array. |
void Gtk::TextBuffer::insert_at_cursor | ( | const Glib::ustring & | text | ) |
Inserts text, using the current cursor position as the insertion point.
Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal.
text | The text to be inserted in the buffer. |
iterator Gtk::TextBuffer::insert_child_anchor | ( | const iterator & | pos, |
const Glib::RefPtr< ChildAnchor > & | anchor | ||
) |
std::pair< iterator, bool > Gtk::TextBuffer::insert_interactive | ( | const iterator & | pos, |
const char * | text_begin, | ||
const char * | text_end, | ||
bool | default_editable = true |
||
) |
Like insert(), but the insertion will not occur if pos 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::TextView::get_editable() is appropriate here.
pos | An iterator pointing to the position at which the text should be inserted. |
text_begin | The start of a UTF8 character array. |
text_end | The end of the UTF8 character array. |
default_editable | Default editability of buffer. |
std::pair< iterator, bool > Gtk::TextBuffer::insert_interactive | ( | const iterator & | pos, |
const Glib::ustring & | text, | ||
bool | default_editable = true |
||
) |
Like 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::TextView::get_editable() is appropriate here.
pos | An iterator pointing to the position at which the text should be inserted. |
text | The text to be inserted in the buffer. |
default_editable | Default editability of buffer |
std::pair< iterator, bool > Gtk::TextBuffer::insert_interactive | ( | const iterator & | pos, |
const iterator & | range_begin, | ||
const iterator & | range_end, | ||
bool | default_editable = true |
||
) |
Same as insert_range(), but does nothing if the insertion point isn't editable.
The default_editable parameter indicates whether the text is editable at pos if no tags enclosing pos affect editability. Typically the result of Gtk::TextView::get_editable() is appropriate here.
pos | An iterator pointing to the position at which the text should be inserted. |
range_begin | A position in a buffer. |
range_end | Another position in the same buffer as range_begin. |
default_editable | Default editability of buffer. |
bool Gtk::TextBuffer::insert_interactive_at_cursor | ( | const char * | text_begin, |
const char * | text_end, | ||
bool | default_editable = true |
||
) |
Calls 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::TextView::get_editable() is appropriate here.
text_begin | The start of a UTF8 character array. |
text_end | The end of the UTF8 character array. |
default_editable | Default editability of buffer |
bool Gtk::TextBuffer::insert_interactive_at_cursor | ( | const Glib::ustring & | text, |
bool | default_editable = true |
||
) |
Calls 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::TextView::get_editable() is appropriate here.
text | The text to be inserted in the buffer. |
default_editable | Default editability of buffer |
iterator Gtk::TextBuffer::insert_markup | ( | const iterator & | pos, |
const char * | markup_begin, | ||
const char * | markup_end | ||
) |
Inserts markup text at position pos.
Emits the "insert_text" signal; insertion actually occurs in the default handler for the signal. The pos iterator will point to the end of the inserted text on return.
pos | Location to insert the markup. |
markup_begin | The start of a UTF8 character array containing pango markup. |
markup_end | The end of the UTF8 character array containing pango markup. |
Inserts text in markup at position pos.
Emits the "insert_text" signal, possibly multiple times; insertion actually occurs in the default handler for the signal. The pos iterator will point to the end of the inserted text on return.
pos | Location to insert the markup. |
markup | The text containing pango markup to be inserted in the buffer. |
iterator Gtk::TextBuffer::insert_pixbuf | ( | const iterator & | pos, |
const Glib::RefPtr< Gdk::Pixbuf > & | pixbuf | ||
) |
iterator Gtk::TextBuffer::insert_with_tag | ( | const iterator & | pos, |
const char * | text_begin, | ||
const char * | text_end, | ||
const Glib::RefPtr< Tag > & | tag | ||
) |
iterator Gtk::TextBuffer::insert_with_tag | ( | const iterator & | pos, |
const char * | text_begin, | ||
const char * | text_end, | ||
const Glib::ustring & | tag_name | ||
) |
iterator Gtk::TextBuffer::insert_with_tag | ( | const iterator & | pos, |
const Glib::ustring & | text, | ||
const Glib::RefPtr< Tag > & | tag | ||
) |
iterator Gtk::TextBuffer::insert_with_tag | ( | const iterator & | pos, |
const Glib::ustring & | text, | ||
const Glib::ustring & | tag_name | ||
) |
iterator Gtk::TextBuffer::insert_with_tags | ( | const iterator & | pos, |
const char * | text_begin, | ||
const char * | text_end, | ||
const std::vector< Glib::RefPtr< Tag > > & | tags | ||
) |
Inserts text into buffer at pos, applying the list of tags to the newly-inserted text.
Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function.
pos | An iterator pointing to the position at which the text should be inserted. |
text_begin | The start of a UTF8 character array. |
text_end | The end of the UTF8 character array. |
tags | A standard C++ container of Gtk::TextBuffer::Tags. |
iterator Gtk::TextBuffer::insert_with_tags | ( | const iterator & | pos, |
const Glib::ustring & | text, | ||
const std::vector< Glib::RefPtr< Tag > > & | tags | ||
) |
Inserts text into buffer at pos, applying the list of tags to the newly-inserted text.
Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function.
pos | An iterator pointing to the position at which the text should be inserted. |
text | The text to be inserted in the buffer. |
tags | A standard C++ container of Gtk::TextBuffer::Tags. |
iterator Gtk::TextBuffer::insert_with_tags_by_name | ( | const iterator & | pos, |
const char * | text_begin, | ||
const char * | text_end, | ||
const std::vector< Glib::ustring > & | tag_names | ||
) |
Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function.
pos | An iterator pointing to the position at which the text should be inserted. |
text_begin | The start of a UTF8 character array. |
text_end | The end of the UTF8 character array. |
tag_names | A standard C++ container of tag names. |
iterator Gtk::TextBuffer::insert_with_tags_by_name | ( | const iterator & | pos, |
const Glib::ustring & | text, | ||
const std::vector< Glib::ustring > & | tag_names | ||
) |
Inserts text into buffer at pos, applying the list of tags to the newly-inserted text.
Equivalent to calling insert(), then apply_tag() on the inserted text; This is just a convenience function.
pos | An iterator pointing to the position at which the text should be inserted. |
text | The text to be inserted in the buffer. |
tag_names | A standard C++ container of tag names. |
Moves mark to the new location where.
Emits the Gtk::TextBuffer::signal_mark_set() signal as notification of the move.
mark | A Gtk::TextMark. |
where | New location for mark in buffer. |
void Gtk::TextBuffer::move_mark_by_name | ( | const Glib::ustring & | name, |
const iterator & | where | ||
) |
Moves the mark named name (which must exist) to location where.
See move_mark() for details.
name | Name of a mark. |
where | New location for mark. |
|
protectedvirtual |
This is a default handler for the signal signal_apply_tag().
|
protectedvirtual |
This is a default handler for the signal signal_begin_user_action().
|
protectedvirtual |
This is a default handler for the signal signal_changed().
|
protectedvirtual |
This is a default handler for the signal signal_end_user_action().
|
protectedvirtual |
This is a default handler for the signal signal_erase().
|
protectedvirtual |
This is a default handler for the signal signal_insert().
|
protectedvirtual |
This is a default handler for the signal signal_insert_child_anchor().
|
protectedvirtual |
This is a default handler for the signal signal_insert_pixbuf().
|
protectedvirtual |
This is a default handler for the signal signal_mark_deleted().
|
protectedvirtual |
This is a default handler for the signal signal_mark_set().
|
protectedvirtual |
This is a default handler for the signal signal_modified_changed().
|
protectedvirtual |
This is a default handler for the signal signal_paste_done().
|
protectedvirtual |
This is a default handler for the signal signal_remove_tag().
|
noexcept |
void Gtk::TextBuffer::paste_clipboard | ( | const Glib::RefPtr< Clipboard > & | clipboard, |
bool | default_editable = true |
||
) |
void Gtk::TextBuffer::paste_clipboard | ( | const Glib::RefPtr< Clipboard > & | clipboard, |
const iterator & | override_location, | ||
bool | default_editable = true |
||
) |
void Gtk::TextBuffer::place_cursor | ( | const iterator & | where | ) |
This function moves the “insert” and “selection_bound” marks simultaneously.
If you move them to the same place in two steps with 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.
where | Where to put the cursor. |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TargetList > > Gtk::TextBuffer::property_copy_target_list | ( | ) | const |
The list of targets this buffer supports for clipboard copying and as DND source.
Glib::PropertyProxy_ReadOnly< int > Gtk::TextBuffer::property_cursor_position | ( | ) | const |
The position of the insert mark (as offset from the beginning of the buffer).
It is useful for getting notified when the cursor moves.
Default value: 0
Glib::PropertyProxy_ReadOnly< bool > Gtk::TextBuffer::property_has_selection | ( | ) | const |
Whether the buffer has some text currently selected.
Default value: false
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TargetList > > Gtk::TextBuffer::property_paste_target_list | ( | ) | const |
The list of targets this buffer supports for clipboard pasting and as DND destination.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TextBuffer::TagTable > > Gtk::TextBuffer::property_tag_table | ( | ) | const |
Text Tag Table.
Glib::PropertyProxy< Glib::ustring > Gtk::TextBuffer::property_text | ( | ) |
The text content of the buffer.
Without child widgets and images, see Gtk::TextBuffer::get_text() for more information.
Default value: ""
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::TextBuffer::property_text | ( | ) | const |
The text content of the buffer.
Without child widgets and images, see Gtk::TextBuffer::get_text() for more information.
Default value: ""
Glib::ustring Gtk::TextBuffer::register_deserialize_format | ( | const Glib::ustring & | mime_type, |
const SlotDeserialize & | slot | ||
) |
This function registers a rich text deserialization slot along with its mime_type with this TextBuffer.
mime_type | The format’s mime-type. |
slot | The deserialize slot to register. |
Glib::ustring Gtk::TextBuffer::register_deserialize_tagset | ( | const Glib::ustring & | tagset_name | ) |
This function registers GTK+’s internal rich text serialization format with the passed buffer.
See register_serialize_tagset() for details.
tagset_name | An optional tagset name, on nullptr . |
Glib::ustring Gtk::TextBuffer::register_serialize_format | ( | const Glib::ustring & | mime_type, |
const SlotSerialize & | slot | ||
) |
This function registers a rich text serialization slot along with its mime_type with this TextBuffer.
mime_type | The format’s mime-type. |
slot | The serialize slot to register. |
Glib::ustring Gtk::TextBuffer::register_serialize_tagset | ( | const Glib::ustring & | tagset_name | ) |
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 Gtk::TextBuffer instances. It is capable of serializing all of a text buffer’s tags and embedded pixbufs.
This function is just a wrapper around 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 != nullptr
here, since the nullptr
tagset requires the receiving buffer to deal with with pasting of arbitrary tags.
tagset_name | An optional tagset name, on nullptr . |
Removes all tags in the range between range_start and range_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.
range_start | One bound of range to be untagged. |
range_end | Other bound of range to be untagged. |
void Gtk::TextBuffer::remove_selection_clipboard | ( | const Glib::RefPtr< Clipboard > & | clipboard | ) |
Removes a Gtk::Clipboard added with add_selection_clipboard().
clipboard | A Gtk::Clipboard added to buffer by add_selection_clipboard(). |
void Gtk::TextBuffer::remove_tag | ( | const Glib::RefPtr< Tag > & | tag, |
const iterator & | range_start, | ||
const iterator & | range_end | ||
) |
Emits the “remove-tag” signal.
The default handler for the signal removes all occurrences of tag from the given range. range_start and range_end don’t have to be in order.
tag | A Gtk::TextTag. |
range_start | One bound of range to be untagged. |
range_end | Other bound of range to be untagged. |
void Gtk::TextBuffer::remove_tag_by_name | ( | const Glib::ustring & | name, |
const iterator & | range_start, | ||
const iterator & | range_end | ||
) |
Calls Gtk::TextTagTable::lookup() on the buffer’s tag table to get a Gtk::TextTag, then calls remove_tag().
name | Name of a Gtk::TextTag. |
range_start | One bound of range to be untagged. |
range_end | Other bound of range to be untagged. |
This function moves the “insert” and “selection_bound” marks simultaneously.
If you move them in two steps with 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.
ins | Where to put the “insert” mark. |
bound | Where to put the “selection_bound” mark. |
guint8 * Gtk::TextBuffer::serialize | ( | const Glib::RefPtr< TextBuffer > & | content_buffer, |
const Glib::ustring & | format, | ||
const iterator & | range_start, | ||
const iterator & | range_end, | ||
gsize & | length | ||
) |
This function serializes the portion of text between range_start and range_end in the rich text format represented by format.
formats to be used must be registered using register_serialize_format() or register_serialize_tagset() beforehand.
content_buffer | The Gtk::TextBuffer to serialize. |
format | The rich text format to use for serializing. |
range_start | Start of block of text to serialize. |
range_end | End of block of test to serialize. |
length | Return location for the length of the serialized data. |
void Gtk::TextBuffer::set_can_create_tags | ( | const Glib::ustring & | format, |
bool | can_create_tags = true |
||
) |
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 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.
format | A Gdk::Atom representing a registered rich text format. |
can_create_tags | Whether deserializing this format may create tags. |
void Gtk::TextBuffer::set_modified | ( | bool | setting = true | ) |
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 Gtk::TextBuffer::signal_modified_changed() signal.
setting | Modification flag setting. |
void Gtk::TextBuffer::set_text | ( | const char * | text_begin, |
const char * | text_end | ||
) |
Removes the current contents of the buffer, and inserts text instead.
text_begin | The start of a UTF8 character array. |
text_end | The end of the UTF8 character array. |
void Gtk::TextBuffer::set_text | ( | const Glib::ustring & | text | ) |
Removes the current contents of the buffer, and inserts text instead.
text | The text to put in the buffer. |
Glib::SignalProxy< void, const Glib::RefPtr< TextBuffer::Tag > &, const TextBuffer::iterator &, const TextBuffer::iterator & > Gtk::TextBuffer::signal_apply_tag | ( | ) |
void on_my_apply_tag(const Glib::RefPtr<TextBuffer::Tag>& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end)
Flags: Run Last
The signal_apply_tag() signal is emitted to apply a tag to a range of text in a Gtk::TextBuffer. Applying actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the range_begin and range_end iters (or has to revalidate them).
See also: Gtk::TextBuffer::apply_tag(), Gtk::TextBuffer::insert_with_tags(), Gtk::TextBuffer::insert_range().
tag | The applied tag. |
range_begin | The start of the range the tag is applied to. |
range_end | The end of the range the tag is applied to. |
Glib::SignalProxy< void > Gtk::TextBuffer::signal_begin_user_action | ( | ) |
void on_my_begin_user_action()
Flags: Run Last
The signal_begin_user_action() signal is emitted at the beginning of a single user-visible operation on a Gtk::TextBuffer.
See also: Gtk::TextBuffer::begin_user_action(), Gtk::TextBuffer::insert_interactive(), Gtk::TextBuffer::insert_range_interactive(), Gtk::TextBuffer::delete_interactive(), Gtk::TextBuffer::backspace(), Gtk::TextBuffer::delete_selection().
Glib::SignalProxy< void > Gtk::TextBuffer::signal_changed | ( | ) |
void on_my_changed()
Flags: Run Last
The signal_changed() signal is emitted when the content of a Gtk::TextBuffer has changed.
Glib::SignalProxy< void > Gtk::TextBuffer::signal_end_user_action | ( | ) |
void on_my_end_user_action()
Flags: Run Last
The signal_end_user_action() signal is emitted at the end of a single user-visible operation on the Gtk::TextBuffer.
See also: Gtk::TextBuffer::end_user_action(), Gtk::TextBuffer::insert_interactive(), Gtk::TextBuffer::insert_range_interactive(), Gtk::TextBuffer::delete_interactive(), Gtk::TextBuffer::backspace(), Gtk::TextBuffer::delete_selection(), Gtk::TextBuffer::backspace().
Glib::SignalProxy< void, const TextBuffer::iterator &, const TextBuffer::iterator & > Gtk::TextBuffer::signal_erase | ( | ) |
void on_my_erase(const TextBuffer::iterator& range_start, const TextBuffer::iterator& range_end)
Flags: Run Last
The signal_delete_range() signal is emitted to delete a range from a Gtk::TextBuffer.
Note that if your handler runs before the default handler it must not invalidate the range_start and range_end iters (or has to revalidate them). The default signal handler revalidates the range_start and range_end iters to both point to the location where text was deleted. Handlers which run after the default handler (see Glib::signal_connect_after()) do not have access to the deleted text.
See also: Gtk::TextBuffer::delete().
range_start | The start of the range to be deleted. |
range_end | The end of the range to be deleted. |
Glib::SignalProxy< void, const TextBuffer::iterator &, const Glib::ustring &, int > Gtk::TextBuffer::signal_insert | ( | ) |
void on_my_insert(const TextBuffer::iterator& pos, const Glib::ustring& text, int bytes)
Flags: Run Last
The signal_insert_text() signal is emitted to insert text in a Gtk::TextBuffer. Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the pos iter (or has to revalidate it). The default signal handler revalidates it to point to the end of the inserted text.
See also: Gtk::TextBuffer::insert(), Gtk::TextBuffer::insert_range().
pos | Position to insert text in textbuffer. |
text | The UTF-8 text to be inserted. |
bytes | Length of the inserted text in bytes. |
Glib::SignalProxy< void, const TextBuffer::iterator &, const Glib::RefPtr< ChildAnchor > & > Gtk::TextBuffer::signal_insert_child_anchor | ( | ) |
void on_my_insert_child_anchor(const TextBuffer::iterator& pos, const Glib::RefPtr<ChildAnchor>& anchor)
Flags: Run Last
The signal_insert_child_anchor() signal is emitted to insert a Gtk::TextChildAnchor in a Gtk::TextBuffer. Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the pos iter (or has to revalidate it). The default signal handler revalidates it to be placed after the inserted anchor.
See also: Gtk::TextBuffer::insert_child_anchor().
pos | Position to insert anchor in textbuffer. |
anchor | The Gtk::TextChildAnchor to be inserted. |
Glib::SignalProxy< void, const TextBuffer::iterator &, const Glib::RefPtr< Gdk::Pixbuf > & > Gtk::TextBuffer::signal_insert_pixbuf | ( | ) |
void on_my_insert_pixbuf(const TextBuffer::iterator& pos, const Glib::RefPtr<Gdk::Pixbuf>& pixbuf)
Flags: Run Last
The signal_insert_pixbuf() signal is emitted to insert a Gdk::Pixbuf in a Gtk::TextBuffer. Insertion actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the pos iter (or has to revalidate it). The default signal handler revalidates it to be placed after the inserted pixbuf.
See also: Gtk::TextBuffer::insert_pixbuf().
pos | Position to insert pixbuf in textbuffer. |
pixbuf | The Gdk::Pixbuf to be inserted. |
Glib::SignalProxy< void, const Glib::RefPtr< TextBuffer::Mark > & > Gtk::TextBuffer::signal_mark_deleted | ( | ) |
void on_my_mark_deleted(const Glib::RefPtr<TextBuffer::Mark>& mark)
Flags: Run Last
The signal_mark_deleted() signal is emitted as notification after a Gtk::TextMark is deleted.
See also: Gtk::TextBuffer::delete_mark().
mark | The mark that was deleted. |
Glib::SignalProxy< void, const TextBuffer::iterator &, const Glib::RefPtr< TextBuffer::Mark > & > Gtk::TextBuffer::signal_mark_set | ( | ) |
void on_my_mark_set(const TextBuffer::iterator& location, const Glib::RefPtr<TextBuffer::Mark>& mark)
Flags: Run Last
The signal_mark_set() signal is emitted as notification after a Gtk::TextMark is set.
See also: Gtk::TextBuffer::create_mark(), Gtk::TextBuffer::move_mark().
location | The location of mark in textbuffer. |
mark | The mark that is set. |
Glib::SignalProxy< void > Gtk::TextBuffer::signal_modified_changed | ( | ) |
void on_my_modified_changed()
Flags: Run Last
The signal_modified_changed() signal is emitted when the modified bit of a Gtk::TextBuffer flips.
See also: Gtk::TextBuffer::set_modified().
Glib::SignalProxy< void, const Glib::RefPtr< Gtk::Clipboard > & > Gtk::TextBuffer::signal_paste_done | ( | ) |
void on_my_paste_done(const Glib::RefPtr<Gtk::Clipboard>& clipboard)
Flags: Run Last
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::TextBuffer::paste_clipboard() for more details.
clipboard | The Gtk::Clipboard pasted from. |
Glib::SignalProxy< void, const Glib::RefPtr< TextBuffer::Tag > &, const TextBuffer::iterator &, const TextBuffer::iterator & > Gtk::TextBuffer::signal_remove_tag | ( | ) |
void on_my_remove_tag(const Glib::RefPtr<TextBuffer::Tag>& tag, const TextBuffer::iterator& range_begin, const TextBuffer::iterator& range_end)
Flags: Run Last
The signal_remove_tag() signal is emitted to remove all occurrences of tag from a range of text in a Gtk::TextBuffer. Removal actually occurs in the default handler.
Note that if your handler runs before the default handler it must not invalidate the range_begin and range_end iters (or has to revalidate them).
See also: Gtk::TextBuffer::remove_tag().
tag | The tag to be removed. |
range_begin | The start of the range the tag is removed from. |
range_end | The end of the range the tag is removed from. |
int Gtk::TextBuffer::size | ( | ) | const |
See get_char_count().
void Gtk::TextBuffer::unregister_deserialize_format | ( | const Glib::ustring & | format | ) |
This function unregisters a rich text format that was previously registered using register_deserialize_format() or register_deserialize_tagset().
format | A Gdk::Atom representing a registered rich text format. |
void Gtk::TextBuffer::unregister_serialize_format | ( | const Glib::ustring & | format | ) |
This function unregisters a rich text format that was previously registered using register_serialize_format() or register_serialize_tagset()
format | A Gdk::Atom representing a registered rich text format. |
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |