gtksourceviewmm  2.10.3
Public Member Functions | Static Public Member Functions | Related Functions
gtksourceview::SourceBuffer Class Reference

Buffer object for SourceView. More...

#include <gtksourceviewmm/sourcebuffer.h>

Inheritance diagram for gtksourceview::SourceBuffer:
Inheritance graph
[legend]

List of all members.

Public Member Functions

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< SourceLanguageget_language ()
 Returns the SourceLanguage associated with the buffer.
Glib::RefPtr< const
SourceLanguage
get_language () const
 Returns the SourceLanguage associated with the buffer.
void set_language (const Glib::RefPtr< SourceLanguage >& language)
 Associate a SourceLanguage 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 SourceMark of the given category.
bool backward_iter_to_source_mark (Gtk::TextIter& iter)
 Moves iter to the position of the previous SourceMark of any category.
bool forward_iter_to_source_mark (Gtk::TextIter& iter, const Glib::ustring& category)
 Moves iter to the position of the next SourceMark of the given category.
bool forward_iter_to_source_mark (Gtk::TextIter& iter)
 Moves iter to the position of the next SourceMark 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< SourceStyleSchemeget_style_scheme ()
 Returns the SourceStyleScheme currently used in buffer.
Glib::RefPtr< const
SourceStyleScheme
get_style_scheme () const
 Returns the SourceStyleScheme currently used in buffer.
void set_style_scheme (const Glib::RefPtr< SourceStyleScheme >& scheme)
 Sets style scheme used by the buffer.
void unset_style_scheme ()
 Unsets style scheme used by the buffer.
Glib::RefPtr< SourceMarkcreate_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< SourceMarkcreate_source_mark (const Glib::ustring& category, const Gtk::TextIter& where)
 Creates an anonymous source mark in the buffer of category category.
Glib::SListHandle
< Glib::RefPtr< SourceMark > > 
get_source_marks_at_line (int line, const Glib::ustring& category) const
 Returns the list of marks of the given category at line.
Glib::SListHandle
< Glib::RefPtr< SourceMark > > 
get_source_marks_at_line (int line) const
 Returns the list of marks of any category at line.
Glib::SListHandle
< Glib::RefPtr< SourceMark > > 
get_source_marks_at_iter (Gtk::TextIter& iter, const Glib::ustring& category) const
 Returns the list of marks of the given category at iter.
Glib::SListHandle
< Glib::RefPtr< SourceMark > > 
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.
Glib::StringArrayHandle get_context_classes_at_iter (const Gtk::TextIter& iter) const
 Get all defined context classes at iter.
Glib::RefPtr< SourceUndoManagerget_undo_manager ()
 Get the undo manager associated with the buffer.
Glib::RefPtr< const
SourceUndoManager
get_undo_manager () const
 Get the undo manager associated with the buffer.
void set_undo_manager (const Glib::RefPtr< const SourceUndoManager >& 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< SourceLanguage > > 
property_language ()
 Language object to get highlighting patterns from.
Glib::PropertyProxy_ReadOnly
< Glib::RefPtr< SourceLanguage > > 
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
< SourceStyleScheme > > 
property_style_scheme ()
 Style scheme.
Glib::PropertyProxy_ReadOnly
< Glib::RefPtr
< SourceStyleScheme > > 
property_style_scheme () const
 Style scheme.
Glib::PropertyProxy
< Glib::RefPtr
< SourceUndoManager > > 
property_undo_manager ()
 The buffer undo manager.
Glib::PropertyProxy_ReadOnly
< Glib::RefPtr
< SourceUndoManager > > 
property_undo_manager () const
 The buffer undo manager.
Glib::SignalProxy2< 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::SignalProxy1< void,
const Glib::RefPtr< SourceMark >& > 
signal_source_mark_updated ()
 Emitted whenever a marker of sourcebuffer has changed and needs to be redisplayed by the view.
Glib::SignalProxy0< void > signal_undo ()
 Emitted whenever undo is requested.
Glib::SignalProxy0< void > signal_redo ()
 Emitted whenever redo is requested.

Static Public Member Functions

static Glib::RefPtr< SourceBuffercreate ()
 Create a new source buffer.
static Glib::RefPtr< SourceBuffercreate (const Glib::RefPtr< Gtk::TextTagTable >& tag_table)
 Create a new source buffer.
static Glib::RefPtr< SourceBuffercreate (const Glib::RefPtr< SourceLanguage >& language)
 Creates a new source buffer using the highlighting patterns in language.

Related Functions

(Note that these are not member functions.)

Glib::RefPtr
< gtksourceview::SourceBuffer
wrap (GtkSourceBuffer* object, bool take_copy=false)
 A Glib::wrap() method for this object.

Detailed Description

Buffer object for SourceView.

The SourceBuffer class is the model for SourceView 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 SourceBuffer use SourceBuffer::create(). A convenience overload for initial setting a SourceLanguage is also provided.

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


Member Function Documentation

bool gtksourceview::SourceBuffer::backward_iter_to_source_mark ( Gtk::TextIter iter,
const Glib::ustring category 
)

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

Parameters:
iterAn iterator.
categoryCategory to search.
Returns:
true if iter was moved.
bool gtksourceview::SourceBuffer::backward_iter_to_source_mark ( Gtk::TextIter iter)

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

Parameters:
iterAn iterator.
Returns:
true if iter was moved.
void gtksourceview::SourceBuffer::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.

bool gtksourceview::SourceBuffer::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.
bool gtksourceview::SourceBuffer::can_undo ( ) const

Determines whether a source buffer can undo the last action.

Returns:
true if it's possible to undo the last action.
static Glib::RefPtr<SourceBuffer> gtksourceview::SourceBuffer::create ( ) [static]

Create a new source buffer.

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

Returns:
A new SourceBuffer.
Since gtksourceviewmm 2.10:

Reimplemented from Gtk::TextBuffer.

static Glib::RefPtr<SourceBuffer> gtksourceview::SourceBuffer::create ( const Glib::RefPtr< Gtk::TextTagTable > &  tag_table) [static]

Create a new source buffer.

Parameters:
tag_tableA Gtk::TextTagTable or empty Glib::RefPtr, to create new.

Reimplemented from Gtk::TextBuffer.

static Glib::RefPtr<SourceBuffer> gtksourceview::SourceBuffer::create ( const Glib::RefPtr< SourceLanguage >&  language) [static]

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

Parameters:
languageA SourceLanguage.
Returns:
A new SourceBuffer
Glib::RefPtr<SourceMark> gtksourceview::SourceBuffer::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:
nameThe name of the mark.
categoryA string defining the mark category.
whereLocation to place the mark.
Returns:
A new SourceMark, owned by the buffer.
Glib::RefPtr<SourceMark> gtksourceview::SourceBuffer::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 SourceMark 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:
categoryA string defining the mark category.
whereLocation to place the mark.
Returns:
A new SourceMark, owned by the buffer.
Since gtksourceviewmm 2.10:
void gtksourceview::SourceBuffer::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.

void gtksourceview::SourceBuffer::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:
startStart of the area to highlight.
endEnd of the area to highlight.
bool gtksourceview::SourceBuffer::forward_iter_to_source_mark ( Gtk::TextIter iter,
const Glib::ustring category 
)

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

Parameters:
iterAn iterator.
categoryCategory to search.
Returns:
true if iter was moved.
bool gtksourceview::SourceBuffer::forward_iter_to_source_mark ( Gtk::TextIter iter)

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

Parameters:
iterAn iterator.
Returns:
true if iter was moved.
Glib::StringArrayHandle gtksourceview::SourceBuffer::get_context_classes_at_iter ( const Gtk::TextIter iter) const

Get all defined context classes at iter.

Parameters:
iterA Gtk::TextIter.
Returns:
An array of context class names.
Since gtksourceviewmm 2.10:
bool gtksourceview::SourceBuffer::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.
bool gtksourceview::SourceBuffer::get_highlight_syntax ( ) const

Determines whether syntax highlighting is activated in the source buffer.

Returns:
true if syntax highlighting is enabled, false otherwise.
Glib::RefPtr<SourceLanguage> gtksourceview::SourceBuffer::get_language ( )

Returns the SourceLanguage associated with the buffer.

Returns:
A SourceLanguage associated with the buffer, or empty Glib::RefPtr.
Glib::RefPtr<const SourceLanguage> gtksourceview::SourceBuffer::get_language ( ) const

Returns the SourceLanguage associated with the buffer.

Returns:
A SourceLanguage associated with the buffer, or empty Glib::RefPtr.
int gtksourceview::SourceBuffer::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.
Glib::SListHandle<Glib::RefPtr<SourceMark> > gtksourceview::SourceBuffer::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:
iterAn iterator.
categoryCategory to search for.
Returns:
A list of source marks.
Glib::SListHandle<Glib::RefPtr<SourceMark> > gtksourceview::SourceBuffer::get_source_marks_at_iter ( Gtk::TextIter iter) const

Returns the list of marks of any category at iter.

Parameters:
iterAn iterator.
Returns:
A list of source marks.
Glib::SListHandle<Glib::RefPtr<SourceMark> > gtksourceview::SourceBuffer::get_source_marks_at_line ( int  line,
const Glib::ustring category 
) const

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

Parameters:
lineA line number.
categoryCategory to search for.
Returns:
A list of source marks.
Glib::SListHandle<Glib::RefPtr<SourceMark> > gtksourceview::SourceBuffer::get_source_marks_at_line ( int  line) const

Returns the list of marks of any category at line.

Parameters:
lineA line number.
Returns:
A list of source marks.
Glib::RefPtr<SourceStyleScheme> gtksourceview::SourceBuffer::get_style_scheme ( )

Returns the SourceStyleScheme currently used in buffer.

Returns:
The SourceStyleScheme set by set_style_scheme(), or empty Glib::RefPtr.
Glib::RefPtr<const SourceStyleScheme> gtksourceview::SourceBuffer::get_style_scheme ( ) const

Returns the SourceStyleScheme currently used in buffer.

Returns:
The SourceStyleScheme set by set_style_scheme(), or empty Glib::RefPtr.
Glib::RefPtr<SourceUndoManager> gtksourceview::SourceBuffer::get_undo_manager ( )

Get the undo manager associated with the buffer.

Returns:
A SourceUndoManager.
Since gtksourceviewmm 2.10:
Glib::RefPtr<const SourceUndoManager> gtksourceview::SourceBuffer::get_undo_manager ( ) const

Get the undo manager associated with the buffer.

Returns:
A SourceUndoManager.
Since gtksourceviewmm 2.10:
bool gtksourceview::SourceBuffer::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:
iterA Gtk::TextIter.
context_classThe context class.
Returns:
Whether we found a context class toggle before iter.
Since gtksourceviewmm 2.10:
bool gtksourceview::SourceBuffer::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:
iterA Gtk::TextIter.
context_classThe context class.
Returns:
Whether we found a context class toggle after iter.
Since gtksourceviewmm 2.10:
bool gtksourceview::SourceBuffer::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:
iterA Gtk::TextIter.
context_classClass to search for.
Returns:
true if context_class is set on iter.
Since gtksourceviewmm 2.10:
Glib::PropertyProxy_ReadOnly<bool> gtksourceview::SourceBuffer::property_can_redo ( ) const

Whether Redo operation is possible.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly<bool> gtksourceview::SourceBuffer::property_can_undo ( ) const

Whether Undo operation is possible.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy<bool> gtksourceview::SourceBuffer::property_highlight_matching_brackets ( )

Whether to highlight matching brackets.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly<bool> gtksourceview::SourceBuffer::property_highlight_matching_brackets ( ) const

Whether to highlight matching brackets.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy<bool> gtksourceview::SourceBuffer::property_highlight_syntax ( )

Whether to highlight syntax in the buffer.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly<bool> gtksourceview::SourceBuffer::property_highlight_syntax ( ) const

Whether to highlight syntax in the buffer.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::RefPtr<SourceLanguage> > gtksourceview::SourceBuffer::property_language ( )

Language object to get highlighting patterns from.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SourceLanguage> > gtksourceview::SourceBuffer::property_language ( ) const

Language object to get highlighting patterns from.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy<int> gtksourceview::SourceBuffer::property_max_undo_levels ( )

Number of undo levels for the buffer.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly<int> gtksourceview::SourceBuffer::property_max_undo_levels ( ) const

Number of undo levels for the buffer.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::RefPtr<SourceStyleScheme> > gtksourceview::SourceBuffer::property_style_scheme ( )

Style scheme.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SourceStyleScheme> > gtksourceview::SourceBuffer::property_style_scheme ( ) const

Style scheme.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy< Glib::RefPtr<SourceUndoManager> > gtksourceview::SourceBuffer::property_undo_manager ( )

The buffer undo manager.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<SourceUndoManager> > gtksourceview::SourceBuffer::property_undo_manager ( ) const

The buffer undo manager.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.
void gtksourceview::SourceBuffer::redo ( )

Redoes the last undo operation.

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

void gtksourceview::SourceBuffer::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:
startA Gtk::TextIter.
endA Gtk::TextIter.
categoryCategory to search for.
void gtksourceview::SourceBuffer::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:
startA Gtk::TextIter.
endA Gtk::TextIter.
Since gtksourceviewmm 2.10:
void gtksourceview::SourceBuffer::set_default_undo_manager ( )

Set the default buffer undo manager.

Since gtksourceviewmm 2.10:
void gtksourceview::SourceBuffer::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:
highlighttrue if you want matching brackets highlighted.
void gtksourceview::SourceBuffer::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:
highlighttrue to enable syntax highlighting, false to disable it.
void gtksourceview::SourceBuffer::set_language ( const Glib::RefPtr< SourceLanguage >&  language)

Associate a SourceLanguage 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:
languageA SourceLanguage to set, or empty Glib::RefPtr.
void gtksourceview::SourceBuffer::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_levelsThe desired maximum number of undo levels.
void gtksourceview::SourceBuffer::set_style_scheme ( const Glib::RefPtr< SourceStyleScheme >&  scheme)

Sets style scheme used by the buffer.

If scheme is empty no style scheme is used.

Parameters:
schemeStyle scheme.
void gtksourceview::SourceBuffer::set_undo_manager ( const Glib::RefPtr< const SourceUndoManager >&  undo_manager)

Set the buffer undo manager.

Parameters:
undo_managerA SourceUndoManager.
Since gtksourceviewmm 2.10:
Glib::SignalProxy2< void,Gtk::TextIter&,Gtk::TextIter& > gtksourceview::SourceBuffer::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.
Prototype:
void on_my_highlight_updated(Gtk::TextIter& start, Gtk::TextIter& end)
Glib::SignalProxy0< void > gtksourceview::SourceBuffer::signal_redo ( )

Emitted whenever redo is requested.

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

Since gtksourceviewmm 2.10:
Prototype:
void on_my_redo()
Glib::SignalProxy1< void,const Glib::RefPtr<SourceMark>& > gtksourceview::SourceBuffer::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.
Prototype:
void on_my_source_mark_updated(const Glib::RefPtr<SourceMark>& where)
Glib::SignalProxy0< void > gtksourceview::SourceBuffer::signal_undo ( )

Emitted whenever undo is requested.

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

Since gtksourceviewmm 2.10:
Prototype:
void on_my_undo()
void gtksourceview::SourceBuffer::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.

void gtksourceview::SourceBuffer::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 Function Documentation

Glib::RefPtr< gtksourceview::SourceBuffer > wrap ( GtkSourceBuffer *  object,
bool  take_copy = false 
) [related]

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

Parameters:
objectThe C instance.
take_copyFalse 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.