gtksourceview::SourceBuffer Class Reference

The model for SourceView widgets. More...

#include <sourcebuffer.h>

List of all members.

Public Types

typedef SourceBuffer CppObjectType
typedef SourceBuffer_Class CppClassType
typedef GtkSourceBuffer BaseObjectType
typedef GtkSourceBufferClass BaseClassType

Public Member Functions

virtual ~SourceBuffer ()
GtkSourceBuffergobj ()
 Provides access to the underlying C GObject.
const GtkSourceBuffergobj () const
 Provides access to the underlying C GObject.
GtkSourceBuffergobj_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 text highlighting is activated in the source buffer.
void set_highlight_syntax (bool highlight=true)
 controls whether text 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 ()
 Determines the GtkSourceLanguage used by the buffer.
Glib::RefPtr< const SourceLanguageget_language () const
 Determines the GtkSourceLanguage used by the buffer.
void set_language (const Glib::RefPtr< SourceLanguage > &language)
 Sets the GtkSourceLanguage the source buffer will use.
bool can_undo () const
 Determines the escaping character used by the source buffer highlighting engine.Sets the escape character to be used by the highlighting engine.Determines whether a source buffer can undo the last action.
bool can_redo () const
 Determines whether a source buffer can redo the last action.
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)
bool backward_iter_to_source_mark (Gtk::TextIter &iter)
bool forward_iter_to_source_mark (Gtk::TextIter &iter, const Glib::ustring &category)
bool forward_iter_to_source_mark (Gtk::TextIter &iter)
void ensure_highlight (const Gtk::TextIter &start, const Gtk::TextIter &end)
void set_style_scheme (const Glib::RefPtr< SourceStyleScheme > &scheme)
Glib::RefPtr< SourceStyleSchemeget_style_scheme ()
Glib::RefPtr< const SourceStyleSchemeget_style_scheme () const
Glib::RefPtr< SourceMarkcreate_source_mark (const Glib::ustring &name, const Glib::ustring &category, const Gtk::TextIter &where)
Glib::SListHandle< Glib::RefPtr<
SourceMark > > 
get_source_marks_at_line (int line, const Glib::ustring &category) const
Glib::SListHandle< Glib::RefPtr<
SourceMark > > 
get_source_marks_at_line (int line) const
Glib::SListHandle< Glib::RefPtr<
SourceMark > > 
get_source_marks_at_iter (Gtk::TextIter &iter, const Glib::ustring &category) const
Glib::SListHandle< Glib::RefPtr<
SourceMark > > 
get_source_marks_at_iter (Gtk::TextIter &iter) const
signals
Glib::SignalProxy2< void,
Gtk::TextIter &, Gtk::TextIter & > 
signal_highlight_updated ()
 Emitted whenever there is a change in the buffer's ability to redo an operation.Emitted whenever there is a change in the buffer's ability to undo an operation.Emitted whenever the syntax highlighting information has been updated, so that views can request a redraw if the region changed is visible.

Static Public Member Functions

static GType get_type () G_GNUC_CONST
static GType get_base_type () G_GNUC_CONST
static Glib::RefPtr< SourceBuffercreate (const Glib::RefPtr< Gtk::TextTagTable > &tagtable)
 create a new SourceBuffer, from a Gtk::TextTagTable.
static Glib::RefPtr< SourceBuffercreate (const Glib::RefPtr< SourceLanguage > &language)

Protected Member Functions

 SourceBuffer (const Glib::ConstructParams &construct_params)
 SourceBuffer (GtkSourceBuffer *castitem)
 SourceBuffer ()
 SourceBuffer (const Glib::RefPtr< Gtk::TextTagTable > &tagtable)
 SourceBuffer (const Glib::RefPtr< SourceLanguage > &language)

Friends

class SourceBuffer_Class

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< gtksourceview::SourceBufferwrap (GtkSourceBuffer *object, bool take_copy=false)


Detailed Description

The model for SourceView widgets.

It extends the TextBuffer object by adding features necessary to display and edit source code: syntax highlighting, bracket matching and markers. It also implements support for undo/redo operations. To create a SourceBuffer use SourceBuffer::create(). By default highlighting is enabled, but you can disable it with SourceBuffer::set_highlight_syntax(). This can be useful if you're not using SourceLanguage objects to set the highlighting patterns, and instead you're manually adding SourceTag objects to the buffer's tag table.


Member Typedef Documentation

typedef SourceBuffer gtksourceview::SourceBuffer::CppObjectType

typedef SourceBuffer_Class gtksourceview::SourceBuffer::CppClassType

typedef GtkSourceBuffer gtksourceview::SourceBuffer::BaseObjectType

typedef GtkSourceBufferClass gtksourceview::SourceBuffer::BaseClassType


Constructor & Destructor Documentation

gtksourceview::SourceBuffer::SourceBuffer ( const Glib::ConstructParams &  construct_params  )  [explicit, protected]

gtksourceview::SourceBuffer::SourceBuffer ( GtkSourceBuffer castitem  )  [explicit, protected]

virtual gtksourceview::SourceBuffer::~SourceBuffer (  )  [virtual]

gtksourceview::SourceBuffer::SourceBuffer (  )  [protected]

gtksourceview::SourceBuffer::SourceBuffer ( const Glib::RefPtr< Gtk::TextTagTable > &  tagtable  )  [explicit, protected]

gtksourceview::SourceBuffer::SourceBuffer ( const Glib::RefPtr< SourceLanguage > &  language  )  [explicit, protected]


Member Function Documentation

static GType gtksourceview::SourceBuffer::get_type (  )  [static]

static GType gtksourceview::SourceBuffer::get_base_type (  )  [static]

GtkSourceBuffer* gtksourceview::SourceBuffer::gobj (  )  [inline]

Provides access to the underlying C GObject.

const GtkSourceBuffer* gtksourceview::SourceBuffer::gobj (  )  const [inline]

Provides access to the underlying C GObject.

GtkSourceBuffer* gtksourceview::SourceBuffer::gobj_copy (  ) 

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

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

create a new SourceBuffer, from a Gtk::TextTagTable.

Parameters:
tagtable a tag table to be taken in account
Returns:
a new SourceBuffer

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

brief create a new SourceBuffer

Parameters:
language the language to be considered by the SourceBuffer for syntax highlighting.
Returns:
a new SourceBuffer

bool gtksourceview::SourceBuffer::get_highlight_matching_brackets (  )  const

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

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

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

void gtksourceview::SourceBuffer::set_highlight_matching_brackets ( bool  highlight = true  ) 

controls the bracket match highlighting function in the buffer.

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.

bool gtksourceview::SourceBuffer::get_highlight_syntax (  )  const

Determines whether text highlighting is activated in the source buffer.

Determines whether syntax highlighting is activated in the source buffer.

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

void gtksourceview::SourceBuffer::set_highlight_syntax ( bool  highlight = true  ) 

controls whether text is highlighted in the buffer.

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 GtkTextTag 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.

int gtksourceview::SourceBuffer::get_max_undo_levels (  )  const

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

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.

void gtksourceview::SourceBuffer::set_max_undo_levels ( int  max_undo_levels  ) 

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

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 function gtk_text_buffer_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.

Glib::RefPtr<SourceLanguage> gtksourceview::SourceBuffer::get_language (  ) 

Determines the GtkSourceLanguage used by the buffer.

Return value: Gtk::SourceLanguage associated with the buffer, or 0.

Returns:
Gtk::SourceLanguage associated with the buffer, or 0.

Glib::RefPtr<const SourceLanguage> gtksourceview::SourceBuffer::get_language (  )  const

Determines the GtkSourceLanguage used by the buffer.

Return value: Gtk::SourceLanguage associated with the buffer, or 0.

Returns:
Gtk::SourceLanguage associated with the buffer, or 0.

void gtksourceview::SourceBuffer::set_language ( const Glib::RefPtr< SourceLanguage > &  language  ) 

Sets the GtkSourceLanguage the source buffer will use.

Associate a Gtk::SourceLanguage with the source buffer. If language is not-0 and syntax highlighting is enabled (see set_highlight_syntax()), the syntax patterns defined in language will be used to highlight the text contained in the buffer. If language is 0, the text contained in the buffer is not highlighted.

The buffer holds a reference to language.

Parameters:
language A Gtk::SourceLanguage to set, or 0.

bool gtksourceview::SourceBuffer::can_undo (  )  const

Determines the escaping character used by the source buffer highlighting engine.Sets the escape character to be used by the highlighting engine.Determines whether a source buffer can undo the last action.

Determines whether a source buffer can undo the last action.

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

bool gtksourceview::SourceBuffer::can_redo (  )  const

Determines whether a source buffer can redo the last action.

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.

void gtksourceview::SourceBuffer::undo (  ) 

Undoes the last user action which modified the buffer.

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_text_buffer_begin_user_action() and gtk_text_buffer_end_user_action(), or sequences of similar edits (inserts or deletes) on the same line.

void gtksourceview::SourceBuffer::redo (  ) 

redoes the last undo operation.

Redoes the last undo operation. Use can_redo() to check whether a call to this function will have any effect.

void gtksourceview::SourceBuffer::begin_not_undoable_action (  ) 

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

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.

void gtksourceview::SourceBuffer::end_not_undoable_action (  ) 

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

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.

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

bool gtksourceview::SourceBuffer::backward_iter_to_source_mark ( Gtk::TextIter &  iter  ) 

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

bool gtksourceview::SourceBuffer::forward_iter_to_source_mark ( Gtk::TextIter &  iter  ) 

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.

</note>

Parameters:
start Start of the area to highlight.
end End of the area to highlight.

void gtksourceview::SourceBuffer::set_style_scheme ( const Glib::RefPtr< SourceStyleScheme > &  scheme  ) 

Sets style scheme used by the buffer.

Parameters:
scheme Style scheme.

Glib::RefPtr<SourceStyleScheme> gtksourceview::SourceBuffer::get_style_scheme (  ) 

Returns: the Gtk::SourceStyleScheme set by

Returns:
The Gtk::SourceStyleScheme set by set_style_scheme(), or 0.

Glib::RefPtr<const SourceStyleScheme> gtksourceview::SourceBuffer::get_style_scheme (  )  const

Returns: the Gtk::SourceStyleScheme set by

Returns:
The Gtk::SourceStyleScheme set by set_style_scheme(), or 0.

Glib::RefPtr<SourceMark> gtksourceview::SourceBuffer::create_source_mark ( const Glib::ustring &  name,
const Glib::ustring &  category,
const Gtk::TextIter &  where 
)

Glib::SListHandle<Glib::RefPtr<SourceMark> > gtksourceview::SourceBuffer::get_source_marks_at_line ( int  line,
const Glib::ustring &  category 
) const

Glib::SListHandle<Glib::RefPtr<SourceMark> > gtksourceview::SourceBuffer::get_source_marks_at_line ( int  line  )  const

Glib::SListHandle<Glib::RefPtr<SourceMark> > gtksourceview::SourceBuffer::get_source_marks_at_iter ( Gtk::TextIter &  iter,
const Glib::ustring &  category 
) const

Glib::SListHandle<Glib::RefPtr<SourceMark> > gtksourceview::SourceBuffer::get_source_marks_at_iter ( Gtk::TextIter &  iter  )  const

Glib::SignalProxy2< void,Gtk::TextIter&,Gtk::TextIter& > gtksourceview::SourceBuffer::signal_highlight_updated (  ) 

Emitted whenever there is a change in the buffer's ability to redo an operation.Emitted whenever there is a change in the buffer's ability to undo an operation.Emitted whenever the syntax highlighting information has been updated, so that views can request a redraw if the region changed is visible.

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


Friends And Related Function Documentation

friend class SourceBuffer_Class [friend]

Glib::RefPtr< gtksourceview::SourceBuffer > 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.


The documentation for this class was generated from the following file:
Generated on Wed Feb 6 02:24:40 2008 for libgtksourceviewmm by  doxygen 1.5.1