# gtksourceview::SourceView Class Reference

Multi-line source editing widget. More...

`#include <sourceview.h>`

List of all members.

## Public Types
typedef SourceView | CppObjectType
typedef SourceView_Class | CppClassType
typedef GtkSourceView | BaseObjectType
typedef GtkSourceViewClass | BaseClassType
## Public Member Functions
virtual | ~SourceView ()
GtkSourceView * | gobj ()
| Provides access to the underlying C GtkObject.
const GtkSourceView * | gobj () const
| Provides access to the underlying C GtkObject.
| SourceView ()
| default constructor
| SourceView (const Glib::RefPtr< SourceBuffer > &buffer)
| constructor.
Glib::RefPtr< const SourceBuffer > | get_source_buffer () const
| get the source buffer associated to the current instance
Glib::RefPtr< SourceBuffer > | get_source_buffer ()
| get the source buffer associated to the current instance
void | set_source_buffer (const Glib::RefPtr< SourceBuffer > &source_buffer)
| set the source buffer to be displayed by the SourceView
void | set_show_line_numbers (bool show=true)
| display line numbers beside the text, or not
bool | get_show_line_numbers () const
| test whether line numbers are displayed beside the text
void | set_tab_width (guint width)
| set tabs width
guint | get_tab_width () const
| get tab width
void | set_auto_indent (bool enable=true)
| set automatic text indention or not
bool | get_auto_indent () const
| test whether automatic text indentation is activated
void | set_insert_spaces_instead_of_tabs (bool enable=true)
| activate (or de-activate) the replacement of any inserted tabulator character by a group of space character
bool | get_insert_spaces_instead_of_tabs () const
| test whether the replacement of any inserted tabulator character by a group of space character is activated
void | set_show_right_margin (bool show=true)
| activate (or de-activate) the display of a margin
bool | get_show_right_margin () const
| test if a margin is displayed
void | set_highlight_current_line (bool highlight=true)
| do highlight the currently selected line, or not
bool | get_highlight_current_line () const
| test if the currently selected line is to be hightlighted
void | set_right_margin_position (guint margin)
| set the position of the right margin
guint | get_right_margin_position () const
| get the position of the right margin
void | set_smart_home_end (SourceSmartHomeEndType smart_he)
| activate whether if HOME and END keys will move to the first/last non space character of the line before moving to the start/end
SourceSmartHomeEndType | get_smart_home_end () const
| test whether if HOME and END keys will move to the first/last non space character of the line before moving to the start/end
void | set_show_line_marks (bool show=true)
bool | get_show_line_marks () const
void | set_indent_on_tab (bool show=true)
bool | get_indent_on_tab () const
void | set_indent_width (gint width)
gint | get_indent_width () const
void | set_mark_category_priority (const Glib::ustring &category, gint priority)
gint | get_mark_category_priority (const Glib::ustring &category) const
void | set_mark_category_pixbuf (const Glib::ustring &category, const Glib::RefPtr< Gdk::Pixbuf > &pixbuf)
Glib::RefPtr< Gdk::Pixbuf > | get_mark_category_pixbuf (const Glib::ustring &category)
Glib::RefPtr< const Gdk::Pixbuf > | get_mark_category_pixbuf (const Glib::ustring &category) const
Glib::SignalProxy0< void > | signal_redo ()
Glib::SignalProxy0< void > | signal_undo ()
## Static Public Member Functions
static GType | get_type () G_GNUC_CONST
static GType | get_base_type () G_GNUC_CONST
static Glib::RefPtr< SourceView > | create ()
static Glib::RefPtr< SourceView > | create (const Glib::RefPtr< SourceBuffer > &buffer)
## Protected Member Functions
| SourceView (const Glib::ConstructParams &construct_params)
| SourceView (GtkSourceView *castitem)
## Friends
class | SourceView_Class
## Related Functions
(Note that these are not member functions.)
gtksourceview::SourceView * | wrap (GtkSourceView *object, bool take_copy=false)

## Detailed Description

Multi-line source editing widget.

It displays a Gtk::SourceBuffer.

## Member Typedef Documentation

typedef SourceView gtksourceview::SourceView::CppObjectType

typedef SourceView_Class gtksourceview::SourceView::CppClassType

typedef GtkSourceView gtksourceview::SourceView::BaseObjectType

typedef GtkSourceViewClass gtksourceview::SourceView::BaseClassType

## Constructor & Destructor Documentation

virtual gtksourceview::SourceView::~SourceView | ( |  | ) | `[virtual]`

gtksourceview::SourceView::SourceView | ( | const Glib::ConstructParams & | construct_params | ) | `[explicit, protected]`

gtksourceview::SourceView::SourceView | ( | GtkSourceView * | castitem | ) | `[explicit, protected]`

gtksourceview::SourceView::SourceView | ( |  | ) | `[explicit]`

default constructor

gtksourceview::SourceView::SourceView | ( | const Glib::RefPtr< SourceBuffer > & | buffer | ) | `[explicit]`

constructor.

create an instance of SourceView displaying a given buffer

Parameters:

  | buffer | the buffer to display in the SourceView

## Member Function Documentation

static GType gtksourceview::SourceView::get_type | ( |  | ) | `[static]`

static GType gtksourceview::SourceView::get_base_type | ( |  | ) | `[static]`

GtkSourceView* gtksourceview::SourceView::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

const GtkSourceView* gtksourceview::SourceView::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

static Glib::RefPtr<SourceView> gtksourceview::SourceView::create | ( |  | ) | `[static]`

static Glib::RefPtr<SourceView> gtksourceview::SourceView::create | ( | const Glib::RefPtr< SourceBuffer > & | buffer | ) | `[static]`

Glib::RefPtr<const SourceBuffer> gtksourceview::SourceView::get_source_buffer | ( |  | ) | const

get the source buffer associated to the current instance

Returns:
  the source buffer associated to the current instance

Glib::RefPtr<SourceBuffer> gtksourceview::SourceView::get_source_buffer | ( |  | ) |

get the source buffer associated to the current instance

Returns:
  the source buffer associated to the current instance

void gtksourceview::SourceView::set_source_buffer | ( | const Glib::RefPtr< SourceBuffer > & | source_buffer | ) |

set the source buffer to be displayed by the SourceView

Parameters:

  | source_buffer | the source buffer to set

void gtksourceview::SourceView::set_show_line_numbers | ( | bool | show = `true` | ) |

display line numbers beside the text, or not

Parameters:

  | show | if true, line numbers will be displayed beside test text. If `true` line numbers will be displayed beside the text.
  | show | Whether line numbers should be displayed.

bool gtksourceview::SourceView::get_show_line_numbers | ( |  | ) | const

test whether line numbers are displayed beside the text

Returns:
  true if line numbers are displayed beside the text, false otherwise Return value: `true` if the line numbers are displayed.

  `true` if the line numbers are displayed.

void gtksourceview::SourceView::set_tab_width | ( | guint | width | ) |

set tabs width

Parameters:

  | width | the new tab width Sets the width of tabulation in characters.
  | width | Width of tab in characters.

guint gtksourceview::SourceView::get_tab_width | ( |  | ) | const

get tab width

Returns:
  the tab width Return value: width of tab.

  Width of tab.

void gtksourceview::SourceView::set_auto_indent | ( | bool | enable = `true` | ) |

set automatic text indention or not

Parameters:

  | enable | if true, automatic text indentation is activated If `true` auto indentation of text is enabled.
  | enable | Whether to enable auto indentation.

bool gtksourceview::SourceView::get_auto_indent | ( |  | ) | const

test whether automatic text indentation is activated

Returns:
  true if automatic text indentation is activated, false otherwise Return value: `true` if auto indentation is enabled.

  `true` if auto indentation is enabled.

void gtksourceview::SourceView::set_insert_spaces_instead_of_tabs | ( | bool | enable = `true` | ) |

activate (or de-activate) the replacement of any inserted tabulator character by a group of space character

Parameters:

  | enable | if true, any tabulator character inserted is replaced by a group of space character If `true` any tabulator character inserted is replaced by a group of space characters.
  | enable | Whether to insert spaces instead of tabs.

bool gtksourceview::SourceView::get_insert_spaces_instead_of_tabs | ( |  | ) | const

test whether the replacement of any inserted tabulator character by a group of space character is activated

Returns:
  true if the replacement of any inserted tabulator character by a group of space character is activated, false otherwise Return value: `true` if spaces are inserted instead of tabs.

  `true` if spaces are inserted instead of tabs.

void gtksourceview::SourceView::set_show_right_margin | ( | bool | show = `true` | ) |

activate (or de-activate) the display of a margin

Parameters:

  | show | if true, activate the display of a margin If `true` a right margin is displayed
  | show | Whether to show a right margin.

bool gtksourceview::SourceView::get_show_right_margin | ( |  | ) | const

test if a margin is displayed

Returns:
  true if a margin is displayed, false otherwise Return value: `true` if the right margin is shown.

  `true` if the right margin is shown.

void gtksourceview::SourceView::set_highlight_current_line | ( | bool | highlight = `true` | ) |

do highlight the currently selected line, or not

Parameters:

  | highlight | if true, do highlight the currently selected line If show is `true` the current line is highlighted.
  | show | Whether to highlight the current line.

bool gtksourceview::SourceView::get_highlight_current_line | ( |  | ) | const

test if the currently selected line is to be hightlighted

Returns:
  true if the currently selected line is to be highlighted, false otherwise Return value: `true` if the current line is highlighted.

  `true` if the current line is highlighted.

void gtksourceview::SourceView::set_right_margin_position | ( | guint | margin | ) |

set the position of the right margin

Parameters:

  | margin | the position (in pixels) of the right margin Sets the position of the right margin in the given view.
  | pos | The width in characters where to position the right margin.
  | pos | The width in characters where to position the right margin.

guint gtksourceview::SourceView::get_right_margin_position | ( |  | ) | const

get the position of the right margin

Returns:
  the position of the right margin Gets the position of the right margin in the given view.

  The position of the right margin.

void gtksourceview::SourceView::set_smart_home_end | ( | SourceSmartHomeEndType | smart_he | ) |

activate whether if HOME and END keys will move to the first/last non space character of the line before moving to the start/end

if true, HOME and END keys will move to the first/last non space character of the line before moving to the start/end Set the desired movement of the cursor when HOME and END keys are pressed.

Parameters:

  | smart_he | The desired behavior among Gtk::SourceSmartHomeEndType.

SourceSmartHomeEndType gtksourceview::SourceView::get_smart_home_end | ( |  | ) | const

test whether if HOME and END keys will move to the first/last non space character of the line before moving to the start/end

Returns:
  true if HOME and END keys will move to the first/last non space character of the line before moving to the start/end, false otherwise Return value: a Gtk::SourceSmartHomeEndType

  A Gtk::SourceSmartHomeEndType.

void gtksourceview::SourceView::set_show_line_marks | ( | bool | show = `true` | ) |

If `true` line marks will be displayed beside the text.

Parameters:

  | show | Whether line marks should be displayed.

bool gtksourceview::SourceView::get_show_line_marks | ( |  | ) | const

Return value: `true` if the line marks are displayed.

Returns:
  `true` if the line marks are displayed.

.

void gtksourceview::SourceView::set_indent_on_tab | ( | bool | show = `true` | ) |

If `true`, when the tab key is pressed and there is a selection, the selected text is indented of one level instead of being replaced with the characters. Shift+Tab unindents the selection.

Since: 1.8

Parameters:

  | enable | Whether to indent a block when tab is pressed.

bool gtksourceview::SourceView::get_indent_on_tab | ( |  | ) | const

Return value: `true` if the selection is indented when tab is pressed.

Returns:
  `true` if the selection is indented when tab is pressed.

Since: 1.8.

void gtksourceview::SourceView::set_indent_width | ( | gint | width | ) |

Sets the number of spaces to use for each step of indent. If width is -1, the value of the GtkSourceView::tab-width property will be used.

Parameters:

  | width | Indent width in characters.

gint gtksourceview::SourceView::get_indent_width | ( |  | ) | const

Return value: indent width.

Returns:
  Indent width.

void gtksourceview::SourceView::set_mark_category_priority | ( | const Glib::ustring & | category,
|  | gint | priority |
| ) |  |  |

Set the priority for the given mark category. When there are multiple marks on the same line, marks of categories with higher priorities will be drawn on top.

Parameters:

  | category | A mark category.
  | priority | The priority for the category.

gint gtksourceview::SourceView::get_mark_category_priority | ( | const Glib::ustring & | category | ) | const

Gets the priority which is associated with the given category.

Parameters:

  | category | A mark category.

Returns:
  The priority or if category exists but no priority was set, it defaults to 0.

.

void gtksourceview::SourceView::set_mark_category_pixbuf | ( | const Glib::ustring & | category,
|  | const Glib::RefPtr< Gdk::Pixbuf > & | pixbuf |
| ) |  |  |

Associates a given pixbuf with a given mark category. If pixbuf is #`0`, the pixbuf is unset.

Parameters:

  | category | A mark category.
  | pixbuf | A Gdk::Pixbuf or #`0`.

Glib::RefPtr<Gdk::Pixbuf> gtksourceview::SourceView::get_mark_category_pixbuf | ( | const Glib::ustring & | category | ) |

Gets the pixbuf which is associated with the given mark category.

Parameters:

  | category | A mark category.

Returns:
  The associated Gdk::Pixbuf, or `0` if not found.

.

Glib::RefPtr<const Gdk::Pixbuf> gtksourceview::SourceView::get_mark_category_pixbuf | ( | const Glib::ustring & | category | ) | const

Gets the pixbuf which is associated with the given mark category.

Parameters:

  | category | A mark category.

Returns:
  The associated Gdk::Pixbuf, or `0` if not found.

.

Glib::SignalProxy0< void > gtksourceview::SourceView::signal_redo | ( |  | ) |

Prototype:
  `void on_my_redo()`

Glib::SignalProxy0< void > gtksourceview::SourceView::signal_undo | ( |  | ) |

Prototype:
  `void on_my_undo()`

## Friends And Related Function Documentation

friend class SourceView_Class`[friend]`

gtksourceview::SourceView * wrap | ( | GtkSourceView * | 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:

- sourceview.h