gtksourceviewmm 3.18.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gsv::Buffer Class Reference

Buffer object for View. More...

`#include <gtksourceviewmm/buffer.h>`

Inheritance diagram for Gsv::Buffer:
[legend]

## Public Member Functions
| Buffer (Buffer&& src) noexcept
Buffer& | operator= (Buffer&& src) noexcept
| ~Buffer () noexcept override
GtkSourceBuffer* | gobj ()
| Provides access to the underlying C GObject.
const GtkSourceBuffer* | gobj () const
| Provides access to the underlying C GObject.
GtkSourceBuffer* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
bool | get_highlight_matching_brackets () const
| Determines whether bracket match highlighting is activated for the source buffer.
void | set_highlight_matching_brackets (bool highlight=true)
| Controls the bracket match highlighting function in the buffer.
bool | get_highlight_syntax () const
| Determines whether syntax highlighting is activated in the source buffer.
void | set_highlight_syntax (bool highlight=true)
| Controls whether syntax is highlighted in the buffer.
int | get_max_undo_levels () const
| Determines the number of undo levels the buffer will track for buffer edits.
void | set_max_undo_levels (int max_undo_levels)
| Sets the number of undo levels for user actions the buffer will track.
Glib::RefPtr< Language > | get_language ()
| Returns the Language associated with the buffer.
Glib::RefPtr< const Language > | get_language () const
| Returns the Language associated with the buffer.
void | set_language (const Glib::RefPtr< Language >& language)
| Associate a Language with the source buffer.
bool | can_undo () const
| Determines whether a source buffer can undo the last action.
bool | can_redo () const
| Determines whether a source buffer can redo the last action (i.e. if the last operation was an undo).
void | undo ()
| Undoes the last user action which modified the buffer.
void | redo ()
| Redoes the last undo operation.
void | begin_not_undoable_action ()
| Marks the beginning of a not undoable action on the buffer, disabling the undo manager.
void | end_not_undoable_action ()
| Marks the end of a not undoable action on the buffer.
bool | backward_iter_to_source_mark (Gtk::TextIter& iter, const Glib::ustring& category)
| Moves iter to the position of the previous Mark of the given category.
bool | backward_iter_to_source_mark (Gtk::TextIter& iter)
| Moves iter to the position of the previous Mark of any category.
bool | forward_iter_to_source_mark (Gtk::TextIter& iter, const Glib::ustring& category)
| Moves iter to the position of the next Mark of the given category.
bool | forward_iter_to_source_mark (Gtk::TextIter& iter)
| Moves iter to the position of the next Mark of the given category.
void | ensure_highlight (const Gtk::TextIter&start, const Gtk::TextIter&end)
| Forces buffer to analyze and highlight the given area synchronously.
Glib::RefPtr< StyleScheme > | get_style_scheme ()
| Returns the StyleScheme currently used in buffer.
Glib::RefPtr< const StyleScheme > | get_style_scheme () const
| Returns the StyleScheme currently used in buffer.
void | set_style_scheme (const Glib::RefPtr< StyleScheme >& scheme)
| Sets style scheme used by the buffer.
void | unset_style_scheme ()
| Unsets style scheme used by the buffer.
Glib::RefPtr< Gsv::Mark > | create_source_mark (const Glib::ustring& name, const Glib::ustring& category, const Gtk::TextIter& where)
| Creates a source mark in the buffer of category category.
Glib::RefPtr< Gsv::Mark > | create_source_mark (const Glib::ustring& category, const Gtk::TextIter& where)
| Creates an anonymous source mark in the buffer of category category.
std::vector< Glib::RefPtr< Gsv::Mark > > | get_source_marks_at_line (int line, const Glib::ustring& category) const
| Returns the list of marks of the given category at line.
std::vector< Glib::RefPtr< Gsv::Mark > > | get_source_marks_at_line (int line) const
| Returns the list of marks of any category at line.
std::vector< Glib::RefPtr< Gsv::Mark > > | get_source_marks_at_iter (Gtk::TextIter& iter, const Glib::ustring& category) const
| Returns the list of marks of the given category at iter.
std::vector< Glib::RefPtr< Gsv::Mark > > | get_source_marks_at_iter (Gtk::TextIter& iter) const
| Returns the list of marks of any category at iter.
void | remove_source_marks (const Gtk::TextIter&start, const Gtk::TextIter&end, const Glib::ustring& category)
| Remove all marks of category between start and end from the buffer.
void | remove_source_marks (const Gtk::TextIter&start, const Gtk::TextIter&end)
| Remove all marks of any category between start and end from the buffer.
bool | iter_has_context_class (const Gtk::TextIter& iter, const Glib::ustring& context_class) const
| Check if the class context_class is set on `iter`.
bool | iter_backward_to_context_class_toggle (Gtk::TextIter& iter, const Glib::ustring& context_class) const
| Moves backward to the next toggle (on or off) of the context class.
bool | iter_forward_to_context_class_toggle (Gtk::TextIter& iter, const Glib::ustring& context_class) const
| Moves forward to the next toggle (on or off) of the context class.
std::vector< Glib::ustring > | get_context_classes_at_iter (const Gtk::TextIter& iter) const
| Get all defined context classes at iter.
Glib::RefPtr< UndoManager > | get_undo_manager ()
| Get the undo manager associated with the buffer.
Glib::RefPtr< const UndoManager > | get_undo_manager () const
| Get the undo manager associated with the buffer.
void | set_undo_manager (const Glib::RefPtr< const UndoManager >& undo_manager)
| Set the buffer undo manager.
void | set_default_undo_manager ()
| Set the default buffer undo manager.
Glib::PropertyProxy< bool > | property_highlight_syntax ()
| Whether to highlight syntax in the buffer.
Glib::PropertyProxy_ReadOnly< bool > | property_highlight_syntax () const
| Whether to highlight syntax in the buffer.
Glib::PropertyProxy< bool > | property_highlight_matching_brackets ()
| Whether to highlight matching brackets.
Glib::PropertyProxy_ReadOnly< bool > | property_highlight_matching_brackets () const
| Whether to highlight matching brackets.
Glib::PropertyProxy< int > | property_max_undo_levels ()
| Number of undo levels for the buffer.
Glib::PropertyProxy_ReadOnly< int > | property_max_undo_levels () const
| Number of undo levels for the buffer.
Glib::PropertyProxy< Glib::RefPtr< Language > > | property_language ()
| Language object to get highlighting patterns from.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Language > > | property_language () const
| Language object to get highlighting patterns from.
Glib::PropertyProxy_ReadOnly< bool > | property_can_undo () const
| Whether Undo operation is possible.
Glib::PropertyProxy_ReadOnly< bool > | property_can_redo () const
| Whether Redo operation is possible.
Glib::PropertyProxy< Glib::RefPtr< StyleScheme > > | property_style_scheme ()
| Style scheme.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< StyleScheme > > | property_style_scheme () const
| Style scheme.
Glib::PropertyProxy< Glib::RefPtr< UndoManager > > | property_undo_manager ()
| The buffer undo manager.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< UndoManager > > | property_undo_manager () const
| The buffer undo manager.
Glib::SignalProxy< void, Gtk::TextIter&, Gtk::TextIter& > | signal_highlight_updated ()
| Emitted whenever the syntax highlighting information has been updated, so that views can request a redraw if the region changed is visible.
Glib::SignalProxy< void, const Glib::RefPtr< Gtk::TextMark >& > | signal_source_mark_updated ()
| Emitted whenever a marker of sourcebuffer has changed and needs to be redisplayed by the view.
Glib::SignalProxy< void > | signal_undo ()
| Emitted whenever undo is requested.
Glib::SignalProxy< void > | signal_redo ()
| Emitted whenever redo is requested.
Glib::SignalProxy< void, Gtk::TextIter&, BracketMatchType > | signal_bracket_matched ()
| Sets iter to a valid iterator pointing to the matching bracket if state is BracketMatchType::BRACKET_MATCH_FOUND.
Public Member Functions inherited from Gtk::TextBuffer
| TextBuffer (TextBuffer &&src) noexcept
TextBuffer & | operator= (TextBuffer &&src) noexcept
| ~TextBuffer () noexcept override
GtkTextBuffer * | gobj ()
const GtkTextBuffer * | gobj () const
GtkTextBuffer * | gobj_copy ()
int | get_line_count () const
int | get_char_count () const
int | size () const
Glib::RefPtr< TextBuffer::TagTable > | get_tag_table ()
Glib::RefPtr< const TextBuffer::TagTable > | get_tag_table () const
void | set_text (const Glib::ustring &text)
void | set_text (const char *text_begin, const char *text_end)
iterator | insert (const iterator &pos, const Glib::ustring &text)
iterator | insert (const iterator &pos, const char *text_begin, const char *text_end)
void | insert_at_cursor (const Glib::ustring &text)
void | insert_at_cursor (const char *text_begin, const char *text_end)
std::pair< iterator, bool > | insert_interactive (const iterator &pos, const Glib::ustring &text, bool default_editable=true)
std::pair< iterator, bool > | insert_interactive (const iterator &pos, const char *text_begin, const char *text_end, bool default_editable=true)
bool | insert_interactive_at_cursor (const Glib::ustring &text, bool default_editable=true)
bool | insert_interactive_at_cursor (const char *text_begin, const char *text_end, bool default_editable=true)
iterator | insert (const iterator &pos, const iterator &range_begin, const iterator &range_end)
std::pair< iterator, bool > | insert_interactive (const iterator &pos, const iterator &range_begin, const iterator &range_end, bool default_editable=true)
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)
iterator | insert_with_tags (const iterator &pos, const char *text_begin, const char *text_end, const std::vector< Glib::RefPtr< Tag > > &tags)
iterator | insert_with_tags_by_name (const iterator &pos, const Glib::ustring &text, const std::vector< Glib::ustring > &tag_names)
iterator | insert_with_tags_by_name (const iterator &pos, const char *text_begin, const char *text_end, const std::vector< Glib::ustring > &tag_names)
iterator | insert_markup (const iterator &pos, const Glib::ustring &markup)
iterator | insert_markup (const iterator &pos, const char *markup_begin, const char *markup_end)
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)
Glib::ustring | get_text (const iterator &range_start, const iterator &range_end, bool include_hidden_chars=true) const
Glib::ustring | get_text (bool include_hidden_chars=true) const
Glib::ustring | get_slice (const iterator &range_start, const iterator &range_end, bool include_hidden_chars=true) const
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)
Glib::RefPtr< TextBuffer::Mark > | create_mark (const Glib::ustring &mark_name, const iterator &where, bool left_gravity=true)
Glib::RefPtr< Mark > | create_mark (const iterator &where, bool left_gravity=true)
void | move_mark (const Glib::RefPtr< Mark > &mark, const iterator &where)
void | delete_mark (const Glib::RefPtr< Mark > &mark)
Glib::RefPtr< TextBuffer::Mark > | get_mark (const Glib::ustring &name)
Glib::RefPtr< const TextBuffer::Mark > | get_mark (const Glib::ustring &name) const
void | move_mark_by_name (const Glib::ustring &name, const iterator &where)
void | delete_mark_by_name (const Glib::ustring &name)
Glib::RefPtr< TextBuffer::Mark > | get_insert ()
Glib::RefPtr< TextBuffer::Mark > | get_selection_bound ()
void | place_cursor (const iterator &where)
void | apply_tag (const Glib::RefPtr< Tag > &tag, const iterator &range_start, const iterator &range_end)
void | remove_tag (const Glib::RefPtr< Tag > &tag, const iterator &range_start, const iterator &range_end)
void | apply_tag_by_name (const Glib::ustring &name, const iterator &range_start, const iterator &range_end)
void | remove_tag_by_name (const Glib::ustring &name, const iterator &range_start, const iterator &range_end)
void | remove_all_tags (const iterator &range_start, const iterator &range_end)
Glib::RefPtr< Tag > | create_tag (const Glib::ustring &tag_name)
Glib::RefPtr< Tag > | create_tag ()
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)
iterator | get_iter_at_child_anchor (const Glib::RefPtr< ChildAnchor > &anchor)
bool | get_modified () const
void | set_modified (bool setting=true)
bool | get_has_selection () const
void | add_selection_clipboard (const Glib::RefPtr< Clipboard > &clipboard)
void | remove_selection_clipboard (const Glib::RefPtr< Clipboard > &clipboard)
void | cut_clipboard (const Glib::RefPtr< Clipboard > &clipboard, bool default_editable=true)
void | copy_clipboard (const Glib::RefPtr< Clipboard > &clipboard)
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
bool | erase_selection (bool interactive=true, bool default_editable=true)
void | select_range (const iterator &ins, const iterator &bound)
void | begin_user_action ()
void | end_user_action ()
Glib::RefPtr< TargetList > | get_copy_target_list () const
Glib::RefPtr< TargetList > | get_paste_target_list () const
Glib::ustring | register_serialize_format (const Glib::ustring &mime_type, const SlotSerialize &slot)
Glib::ustring | register_serialize_tagset (const Glib::ustring &tagset_name)
Glib::ustring | register_deserialize_format (const Glib::ustring &mime_type, const SlotDeserialize &slot)
Glib::ustring | register_deserialize_tagset (const Glib::ustring &tagset_name)
void | unregister_serialize_format (const Glib::ustring &format)
void | unregister_deserialize_format (const Glib::ustring &format)
void | set_can_create_tags (const Glib::ustring &format, bool can_create_tags=true)
bool | get_can_create_tags (const Glib::ustring &format) const
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)
bool | deserialize (const Glib::RefPtr< TextBuffer > &content_buffer, const Glib::ustring &format, iterator &iter, const guint8 *data, gsize length)
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
Glib::PropertyProxy< Glib::ustring > | property_text ()
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_text () const
Glib::PropertyProxy_ReadOnly< bool > | property_has_selection () const
Glib::PropertyProxy_ReadOnly< int > | property_cursor_position () const
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TargetList > > | property_copy_target_list () const
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< TargetList > > | property_paste_target_list () const
Glib::RefPtr< Gtk::TextBuffer > | wrap (GtkTextBuffer *object, bool take_copy=false)

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Glib::RefPtr< Buffer > | create ()
| Create a new source buffer.
static Glib::RefPtr< Buffer > | create (const Glib::RefPtr< Gtk::TextTagTable >& tag_table)
| Create a new source buffer.
static Glib::RefPtr< Buffer > | create (const Glib::RefPtr< Language >& language)
| Creates a new source buffer using the highlighting patterns in language.
Static Public Member Functions inherited from Gtk::TextBuffer
static GType | get_type ()
static Glib::RefPtr< TextBuffer > | create ()
static Glib::RefPtr< TextBuffer > | create (const Glib::RefPtr< TagTable > &tag_table)

## Protected Member Functions
| Buffer ()
| Buffer (const Glib::RefPtr< Gtk::TextTagTable >& tag_table)
| Buffer (const Glib::RefPtr< Language >& language)
virtual void | on_undo ()
| This is a default handler for the signal signal_undo().
virtual void | on_redo ()
| This is a default handler for the signal signal_redo().
virtual void | on_bracket_matched (Gtk::TextIter& iter, BracketMatchType state)
| This is a default handler for the signal signal_bracket_matched().
Protected Member Functions inherited from Gtk::TextBuffer
| TextBuffer ()
| TextBuffer (const Glib::RefPtr< TagTable > &tag_table)
virtual void | on_insert (const TextBuffer::iterator &pos, const Glib::ustring &text, int bytes)
virtual void | on_insert_pixbuf (const TextBuffer::iterator &pos, const Glib::RefPtr< Gdk::Pixbuf > &pixbuf)
virtual void | on_insert_child_anchor (const TextBuffer::iterator &pos, const Glib::RefPtr< ChildAnchor > &anchor)
virtual void | on_erase (const TextBuffer::iterator &range_start, const TextBuffer::iterator &range_end)
virtual void | on_changed ()
virtual void | on_modified_changed ()
virtual void | on_mark_set (const TextBuffer::iterator &location, const Glib::RefPtr< TextBuffer::Mark > &mark)
virtual void | on_mark_deleted (const Glib::RefPtr< TextBuffer::Mark > &mark)
virtual void | on_apply_tag (const Glib::RefPtr< TextBuffer::Tag > &tag, const TextBuffer::iterator &range_begin, const TextBuffer::iterator &range_end)
virtual void | on_remove_tag (const Glib::RefPtr< TextBuffer::Tag > &tag, const TextBuffer::iterator &range_begin, const TextBuffer::iterator &range_end)
virtual void | on_begin_user_action ()
virtual void | on_end_user_action ()
virtual void | on_paste_done (const Glib::RefPtr< Gtk::Clipboard > &clipboard)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gsv::Buffer > | wrap (GtkSourceBuffer* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Gtk::TextBuffer
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
typedef sigc::slot< bool, const Glib::RefPtr< TextBuffer > &, iterator &, const guint8 *, gsize, bool > | SlotDeserialize

## Detailed Description

Buffer object for View.

The Buffer class is the model for View widgets. It extends the Gtk::TextBuffer class by adding features useful to display and edit source code as syntax highlighting and bracket matching. It also implements support for undo/redo operations.

To create a Buffer use Buffer::create(). A convenience overload for initial setting a Language is also provided.

By default highlighting is enabled, but you can disable it with Buffer::set_highlight_syntax().

## Constructor & Destructor Documentation

## ◆ Buffer() [1/4]

Gsv::Buffer::Buffer | ( | Buffer&& | src | ) |
| noexcept

## ◆ ~Buffer()

Gsv::Buffer::~Buffer | ( |  | ) |
| override noexcept

## ◆ Buffer() [2/4]

Gsv::Buffer::Buffer | ( |  | ) |
| explicit protected

## ◆ Buffer() [3/4]

Gsv::Buffer::Buffer | ( | const Glib::RefPtr< Gtk::TextTagTable > & | tag_table | ) |
| explicit protected

## ◆ Buffer() [4/4]

Gsv::Buffer::Buffer | ( | const Glib::RefPtr< Language >& | language | ) |
| explicit protected

## Member Function Documentation

## ◆ backward_iter_to_source_mark() [1/2]

bool Gsv::Buffer::backward_iter_to_source_mark | ( | Gtk::TextIter & | iter | ) |

Moves iter to the position of the previous Mark of any category.

Parameters

  iter | An iterator.

Returns
  `true` if iter was moved.

## ◆ backward_iter_to_source_mark() [2/2]

bool Gsv::Buffer::backward_iter_to_source_mark | ( | Gtk::TextIter & | iter,
|  | const Glib::ustring & | category )

Moves iter to the position of the previous Mark of the given category.

Parameters

  iter | An iterator.
  category | Category to search.

Returns
  `true` if iter was moved.

## ◆ begin_not_undoable_action()

void Gsv::Buffer::begin_not_undoable_action | ( |  | ) |

Marks the beginning of a not undoable action on the buffer, disabling the undo manager.

Typically you would call this function before initially setting the contents of the buffer (e.g. when loading a file in a text editor).

You may nest begin_not_undoable_action() / end_not_undoable_action() blocks.

## ◆ can_redo()

bool Gsv::Buffer::can_redo | ( |  | ) | const

Determines whether a source buffer can redo the last action (i.e. if the last operation was an undo).

Returns
  `true` if a redo is possible.

## ◆ can_undo()

bool Gsv::Buffer::can_undo | ( |  | ) | const

Determines whether a source buffer can undo the last action.

Returns
  `true` if it's possible to undo the last action.

## ◆ create() [1/3]

static Glib::RefPtr< Buffer > Gsv::Buffer::create | ( |  | ) |
| static

Create a new source buffer.

Internally it will create a new Gtk::TextTagTable also.

Returns
  A new Buffer.

Since gtksourceviewmm 2.10

## ◆ create() [2/3]

static Glib::RefPtr< Buffer > Gsv::Buffer::create | ( | const Glib::RefPtr< Gtk::TextTagTable > & | tag_table | ) |
| static

Create a new source buffer.

Parameters

  tag_table | A Gtk::TextTagTable or empty Glib::RefPtr, to create new.

Returns
  A new Buffer.

## ◆ create() [3/3]

static Glib::RefPtr< Buffer > Gsv::Buffer::create | ( | const Glib::RefPtr< Language >& | language | ) |
| static

Creates a new source buffer using the highlighting patterns in language.

Parameters

  language | A Language.

Returns
  A new Buffer

## ◆ create_source_mark() [1/2]

Glib::RefPtr< Gsv::Mark > Gsv::Buffer::create_source_mark | ( | const Glib::ustring & | category,
|  | const Gtk::TextIter & | where )

Creates an anonymous source mark in the buffer of category category.

A source mark is a Gtk::TextMark but organised into categories. Depending on the category a pixbuf can be specified that will be displayed along the line of the mark.

Like a Gtk::TextMark, a Mark can be anonymous.

Marks always have left gravity and are moved to the beginning of the line when the user deletes the line they were in.

Typical uses for a source mark are bookmarks, breakpoints, current executing instruction indication in a source file, etc.

Parameters

  category | A string defining the mark category.
  where | Location to place the mark.

Returns
  A new Mark.

Since gtksourceviewmm 2.10

## ◆ create_source_mark() [2/2]

Glib::RefPtr< Gsv::Mark > Gsv::Buffer::create_source_mark | ( | const Glib::ustring & | name,
|  | const Glib::ustring & | category,
|  | const Gtk::TextIter & | where )

Creates a source mark in the buffer of category category.

A source mark is a Gtk::TextMark but organised into categories. Depending on the category a pixbuf can be specified that will be displayed along the line of the mark.

Marks always have left gravity and are moved to the beginning of the line when the user deletes the line they were in.

Typical uses for a source mark are bookmarks, breakpoints, current executing instruction indication in a source file, etc.

Parameters

  name | The name of the mark.
  category | A string defining the mark category.
  where | Location to place the mark.

Returns
  A new Mark.

## ◆ end_not_undoable_action()

void Gsv::Buffer::end_not_undoable_action | ( |  | ) |

Marks the end of a not undoable action on the buffer.

When the last not undoable block is closed through the call to this function, the list of undo actions is cleared and the undo manager is re-enabled.

## ◆ ensure_highlight()

void Gsv::Buffer::ensure_highlight | ( | const Gtk::TextIter & | start,
|  | const Gtk::TextIter & | end )

Forces buffer to analyze and highlight the given area synchronously.

Note
  This is a potentially slow operation and should be used only when you need to make sure that some text not currently visible is highlighted, for instance before printing.

Parameters

  start | Start of the area to highlight.
  end | End of the area to highlight.

## ◆ forward_iter_to_source_mark() [1/2]

bool Gsv::Buffer::forward_iter_to_source_mark | ( | Gtk::TextIter & | iter | ) |

Moves iter to the position of the next Mark of the given category.

Parameters

  iter | An iterator.

Returns
  `true` if iter was moved.

## ◆ forward_iter_to_source_mark() [2/2]

bool Gsv::Buffer::forward_iter_to_source_mark | ( | Gtk::TextIter & | iter,
|  | const Glib::ustring & | category )

Moves iter to the position of the next Mark of the given category.

Parameters

  iter | An iterator.
  category | Category to search.

Returns
  `true` if iter was moved.

## ◆ get_context_classes_at_iter()

std::vector< Glib::ustring > Gsv::Buffer::get_context_classes_at_iter | ( | const Gtk::TextIter & | iter | ) | const

Get all defined context classes at iter.

Parameters

  iter | A Gtk::TextIter.

Returns
  An array of context class names.

Since gtksourceviewmm 2.10

## ◆ get_highlight_matching_brackets()

bool Gsv::Buffer::get_highlight_matching_brackets | ( |  | ) | const

Determines whether bracket match highlighting is activated for the source buffer.

Returns
  `true` if the source buffer will highlight matching brackets.

## ◆ get_highlight_syntax()

bool Gsv::Buffer::get_highlight_syntax | ( |  | ) | const

Determines whether syntax highlighting is activated in the source buffer.

Returns
  `true` if syntax highlighting is enabled, `false` otherwise.

## ◆ get_language() [1/2]

Glib::RefPtr< Language > Gsv::Buffer::get_language | ( |  | ) |

Returns the Language associated with the buffer.

Returns
  A Language associated with the buffer, or empty Glib::RefPtr.

## ◆ get_language() [2/2]

Glib::RefPtr< const Language > Gsv::Buffer::get_language | ( |  | ) | const

Returns the Language associated with the buffer.

Returns
  A Language associated with the buffer, or empty Glib::RefPtr.

## ◆ get_max_undo_levels()

int Gsv::Buffer::get_max_undo_levels | ( |  | ) | const

Determines the number of undo levels the buffer will track for buffer edits.

Returns
  The maximum number of possible undo levels or -1 if no limit is set.

## ◆ get_source_marks_at_iter() [1/2]

std::vector< Glib::RefPtr< Gsv::Mark > > Gsv::Buffer::get_source_marks_at_iter | ( | Gtk::TextIter & | iter | ) | const

Returns the list of marks of any category at iter.

Parameters

  iter | An iterator.

Returns
  A list of source marks.

## ◆ get_source_marks_at_iter() [2/2]

std::vector< Glib::RefPtr< Gsv::Mark > > Gsv::Buffer::get_source_marks_at_iter | ( | Gtk::TextIter & | iter,
|  | const Glib::ustring & | category ) const

Returns the list of marks of the given category at iter.

Parameters

  iter | An iterator.
  category | Category to search for.

Returns
  A list of source marks.

## ◆ get_source_marks_at_line() [1/2]

std::vector< Glib::RefPtr< Gsv::Mark > > Gsv::Buffer::get_source_marks_at_line | ( | int | line | ) | const

Returns the list of marks of any category at line.

Parameters

  line | A line number.

Returns
  A list of source marks.

## ◆ get_source_marks_at_line() [2/2]

std::vector< Glib::RefPtr< Gsv::Mark > > Gsv::Buffer::get_source_marks_at_line | ( | int | line,
|  | const Glib::ustring & | category ) const

Returns the list of marks of the given category at line.

Parameters

  line | A line number.
  category | Category to search for.

Returns
  A list of source marks.

## ◆ get_style_scheme() [1/2]

Glib::RefPtr< StyleScheme > Gsv::Buffer::get_style_scheme | ( |  | ) |

Returns the StyleScheme currently used in buffer.

Returns
  The StyleScheme set by set_style_scheme(), or empty Glib::RefPtr.

## ◆ get_style_scheme() [2/2]

Glib::RefPtr< const StyleScheme > Gsv::Buffer::get_style_scheme | ( |  | ) | const

Returns the StyleScheme currently used in buffer.

Returns
  The StyleScheme set by set_style_scheme(), or empty Glib::RefPtr.

## ◆ get_type()

static GType Gsv::Buffer::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_undo_manager() [1/2]

Glib::RefPtr< UndoManager > Gsv::Buffer::get_undo_manager | ( |  | ) |

Get the undo manager associated with the buffer.

Returns
  A UndoManager.

Since gtksourceviewmm 2.10

## ◆ get_undo_manager() [2/2]

Glib::RefPtr< const UndoManager > Gsv::Buffer::get_undo_manager | ( |  | ) | const

Get the undo manager associated with the buffer.

Returns
  A UndoManager.

Since gtksourceviewmm 2.10

## ◆ gobj() [1/2]

GtkSourceBuffer * Gsv::Buffer::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkSourceBuffer * Gsv::Buffer::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkSourceBuffer * Gsv::Buffer::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ iter_backward_to_context_class_toggle()

bool Gsv::Buffer::iter_backward_to_context_class_toggle | ( | Gtk::TextIter & | iter,
|  | const Glib::ustring & | context_class ) const

Moves backward to the next toggle (on or off) of the context class.

If no matching context class toggles are found, returns `false`, otherwise `true`. Does not return toggles located at iter, only toggles after iter. Sets iter to the location of the toggle, or to the end of the buffer if no toggle is found.

Parameters

  iter | A Gtk::TextIter.
  context_class | The context class.

Returns
  Whether we found a context class toggle before iter.

Since gtksourceviewmm 2.10

## ◆ iter_forward_to_context_class_toggle()

bool Gsv::Buffer::iter_forward_to_context_class_toggle | ( | Gtk::TextIter & | iter,
|  | const Glib::ustring & | context_class ) const

Moves forward to the next toggle (on or off) of the context class.

If no matching context class toggles are found, returns `false`, otherwise `true`. Does not return toggles located at iter, only toggles after iter. Sets iter to the location of the toggle, or to the end of the buffer if no toggle is found.

Parameters

  iter | A Gtk::TextIter.
  context_class | The context class.

Returns
  Whether we found a context class toggle after iter.

Since gtksourceviewmm 2.10

## ◆ iter_has_context_class()

bool Gsv::Buffer::iter_has_context_class | ( | const Gtk::TextIter & | iter,
|  | const Glib::ustring & | context_class ) const

Check if the class context_class is set on `iter`.

Parameters

  iter | A Gtk::TextIter.
  context_class | Class to search for.

Returns
  `true` if context_class is set on `iter`.

Since gtksourceviewmm 2.10

## ◆ on_bracket_matched()

virtual void Gsv::Buffer::on_bracket_matched | ( | Gtk::TextIter & | iter,
|  | BracketMatchType | state )
| protected virtual

This is a default handler for the signal signal_bracket_matched().

## ◆ on_redo()

virtual void Gsv::Buffer::on_redo | ( |  | ) |
| protected virtual

This is a default handler for the signal signal_redo().

## ◆ on_undo()

virtual void Gsv::Buffer::on_undo | ( |  | ) |
| protected virtual

This is a default handler for the signal signal_undo().

## ◆ operator=()

Buffer& Gsv::Buffer::operator= | ( | Buffer&& | src | ) |
| noexcept

## ◆ property_can_redo()

Glib::PropertyProxy_ReadOnly< bool > Gsv::Buffer::property_can_redo | ( |  | ) | const

Whether Redo operation is possible.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_can_undo()

Glib::PropertyProxy_ReadOnly< bool > Gsv::Buffer::property_can_undo | ( |  | ) | const

Whether Undo operation is possible.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_highlight_matching_brackets() [1/2]

Glib::PropertyProxy< bool > Gsv::Buffer::property_highlight_matching_brackets | ( |  | ) |

Whether to highlight matching brackets.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_highlight_matching_brackets() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gsv::Buffer::property_highlight_matching_brackets | ( |  | ) | const

Whether to highlight matching brackets.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_highlight_syntax() [1/2]

Glib::PropertyProxy< bool > Gsv::Buffer::property_highlight_syntax | ( |  | ) |

Whether to highlight syntax in the buffer.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_highlight_syntax() [2/2]

Glib::PropertyProxy_ReadOnly< bool > Gsv::Buffer::property_highlight_syntax | ( |  | ) | const

Whether to highlight syntax in the buffer.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_language() [1/2]

Glib::PropertyProxy< Glib::RefPtr< Language > > Gsv::Buffer::property_language | ( |  | ) |

Language object to get highlighting patterns from.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_language() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Language > > Gsv::Buffer::property_language | ( |  | ) | const

Language object to get highlighting patterns from.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_max_undo_levels() [1/2]

Glib::PropertyProxy< int > Gsv::Buffer::property_max_undo_levels | ( |  | ) |

Number of undo levels for the buffer.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_max_undo_levels() [2/2]

Glib::PropertyProxy_ReadOnly< int > Gsv::Buffer::property_max_undo_levels | ( |  | ) | const

Number of undo levels for the buffer.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_style_scheme() [1/2]

Glib::PropertyProxy< Glib::RefPtr< StyleScheme > > Gsv::Buffer::property_style_scheme | ( |  | ) |

Style scheme.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_style_scheme() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< StyleScheme > > Gsv::Buffer::property_style_scheme | ( |  | ) | const

Style scheme.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_undo_manager() [1/2]

Glib::PropertyProxy< Glib::RefPtr< UndoManager > > Gsv::Buffer::property_undo_manager | ( |  | ) |

The buffer undo manager.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_undo_manager() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< UndoManager > > Gsv::Buffer::property_undo_manager | ( |  | ) | const

The buffer undo manager.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ redo()

void Gsv::Buffer::redo | ( |  | ) |

Redoes the last undo operation.

Use can_redo() to check whether a call to this function will have any effect.

## ◆ remove_source_marks() [1/2]

void Gsv::Buffer::remove_source_marks | ( | const Gtk::TextIter & | start,
|  | const Gtk::TextIter & | end )

Remove all marks of any category between start and end from the buffer.

Parameters

  start | A Gtk::TextIter.
  end | A Gtk::TextIter.

Since gtksourceviewmm 2.10

## ◆ remove_source_marks() [2/2]

void Gsv::Buffer::remove_source_marks | ( | const Gtk::TextIter & | start,
|  | const Gtk::TextIter & | end,
|  | const Glib::ustring & | category )

Remove all marks of category between start and end from the buffer.

Parameters

  start | A Gtk::TextIter.
  end | A Gtk::TextIter.
  category | Category to search for.

## ◆ set_default_undo_manager()

void Gsv::Buffer::set_default_undo_manager | ( |  | ) |

Set the default buffer undo manager.

Since gtksourceviewmm 2.10

## ◆ set_highlight_matching_brackets()

void Gsv::Buffer::set_highlight_matching_brackets | ( | bool | highlight = true | ) |

Controls the bracket match highlighting function in the buffer.

If activated, when you position your cursor over a bracket character (a parenthesis, a square bracket, etc.) the matching opening or closing bracket character will be highlighted. You can specify the style with the gtk_source_buffer_set_bracket_match_style() function.

Parameters

  highlight | `true` if you want matching brackets highlighted.

## ◆ set_highlight_syntax()

void Gsv::Buffer::set_highlight_syntax | ( | bool | highlight = true | ) |

Controls whether syntax is highlighted in the buffer.

If highlight is `true`, the text will be highlighted according to the syntax patterns specified in the language set with set_language(). If highlight is `false`, syntax highlighting is disabled and all the Gtk::TextTag objects that have been added by the syntax highlighting engine are removed from the buffer.

Parameters

  highlight | `true` to enable syntax highlighting, `false` to disable it.

## ◆ set_language()

void Gsv::Buffer::set_language | ( | const Glib::RefPtr< Language >& | language | ) |

Associate a Language with the source buffer.

If language is not empty and syntax highlighting is enabled, the syntax patterns defined in language will be used to highlight the text contained in the buffer. If language is empty, the text contained in the buffer is not highlighted.

The buffer holds a reference to language.

Parameters

  language | A Language to set, or empty Glib::RefPtr.

## ◆ set_max_undo_levels()

void Gsv::Buffer::set_max_undo_levels | ( | int | max_undo_levels | ) |

Sets the number of undo levels for user actions the buffer will track.

If the number of user actions exceeds the limit set by this function, older actions will be discarded.

If max_undo_levels is -1, no limit is set.

A new action is started whenever the method Gtk::TextBuffer::begin_user_action() is called. In general, this happens whenever the user presses any key which modifies the buffer, but the undo manager will try to merge similar consecutive actions, such as multiple character insertions into one action. But, inserting a newline does start a new action.

Parameters

  max_undo_levels | The desired maximum number of undo levels.

## ◆ set_style_scheme()

void Gsv::Buffer::set_style_scheme | ( | const Glib::RefPtr< StyleScheme >& | scheme | ) |

Sets style scheme used by the buffer.

If scheme is empty no style scheme is used.

Parameters

  scheme | Style scheme.

## ◆ set_undo_manager()

void Gsv::Buffer::set_undo_manager | ( | const Glib::RefPtr< const UndoManager >& | undo_manager | ) |

Set the buffer undo manager.

Parameters

  undo_manager | A UndoManager.

Since gtksourceviewmm 2.10

## ◆ signal_bracket_matched()

Glib::SignalProxy< void, Gtk::TextIter&, BracketMatchType > Gsv::Buffer::signal_bracket_matched | ( |  | ) |

Sets iter to a valid iterator pointing to the matching bracket if state is BracketMatchType::BRACKET_MATCH_FOUND.

Handler parameters:
  iter Iterator to initialize. state State of bracket matching.

Since gtksourceviewmm 3.0

Slot Prototype:
  `void on_my_bracket_matched(Gtk::TextIter& iter, BracketMatchType state)`

Flags: Run Last

## ◆ signal_highlight_updated()

Glib::SignalProxy< void, Gtk::TextIter &, Gtk::TextIter & > Gsv::Buffer::signal_highlight_updated | ( |  | ) |

Emitted whenever the syntax highlighting information has been updated, so that views can request a redraw if the region changed is visible.

Usually only view widgets displaying this buffer will be interested in this signal.

Handler parameters:
  start An iterator at the start of the updated region. end An iterator at the end of the updated region.

Slot Prototype:
  `void on_my_highlight_updated(Gtk::TextIter& start, Gtk::TextIter& end)`

Flags: Run Last

## ◆ signal_redo()

Glib::SignalProxy< void > Gsv::Buffer::signal_redo | ( |  | ) |

Emitted whenever redo is requested.

In fact, it is emitted when redo() is called.

Since gtksourceviewmm 2.10

Slot Prototype:
  `void on_my_redo()`

Flags: Run Last

## ◆ signal_source_mark_updated()

Glib::SignalProxy< void, const Glib::RefPtr< Gtk::TextMark > & > Gsv::Buffer::signal_source_mark_updated | ( |  | ) |

Emitted whenever a marker of sourcebuffer has changed and needs to be redisplayed by the view.

A change in a marker's type or location can trigger this signal. Note that moving a marker causes the emission of this signal twice: one for the old location and one for the new.

Handler parameters:
  where An iterator at the location where the change occurred.

Slot Prototype:
  `void on_my_source_mark_updated(const Glib::RefPtr<Gtk::TextMark>& where)`

Flags: Run Last

## ◆ signal_undo()

Glib::SignalProxy< void > Gsv::Buffer::signal_undo | ( |  | ) |

Emitted whenever undo is requested.

In fact, it is emitted when undo() is called.

Since gtksourceviewmm 2.10

Slot Prototype:
  `void on_my_undo()`

Flags: Run Last

## ◆ undo()

void Gsv::Buffer::undo | ( |  | ) |

Undoes the last user action which modified the buffer.

Use can_undo() to check whether a call to this function will have any effect.

Actions are defined as groups of operations between a call to Gtk::TextBuffer::begin_user_action() and Gtk::TextBuffer::end_user_action(), or sequences of similar edits (inserts or deletes) on the same line.

## ◆ unset_style_scheme()

void Gsv::Buffer::unset_style_scheme | ( |  | ) |

Unsets style scheme used by the buffer.

It is the same like calling set_style_scheme() with empty pointer.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gsv::Buffer > wrap | ( | GtkSourceBuffer * | object,
|  | bool | take_copy = false )
| related

A Glib::wrap() method for this object.

Parameters

  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.

Returns
  A C++ instance that wraps this C instance.