GtkSourceView

GtkSourceView — The view object

Synopsis

#include <gtksourceview/gtksourceview.h>

                    GtkSourceView;
                    GtkSourceViewClass;
gchar *             (*GtkSourceViewMarkTooltipFunc)     (GtkSourceMark *mark,
                                                         gpointer user_data);
enum                GtkSourceSmartHomeEndType;
enum                GtkSourceDrawSpacesFlags;
enum                GtkSourceViewGutterPosition;
GtkWidget *         gtk_source_view_new                 (void);
GtkWidget *         gtk_source_view_new_with_buffer     (GtkSourceBuffer *buffer);
void                gtk_source_view_set_auto_indent     (GtkSourceView *view,
                                                         gboolean enable);
gboolean            gtk_source_view_get_auto_indent     (GtkSourceView *view);
void                gtk_source_view_set_indent_on_tab   (GtkSourceView *view,
                                                         gboolean enable);
gboolean            gtk_source_view_get_indent_on_tab   (GtkSourceView *view);
void                gtk_source_view_set_indent_width    (GtkSourceView *view,
                                                         gint width);
gint                gtk_source_view_get_indent_width    (GtkSourceView *view);
void                gtk_source_view_set_insert_spaces_instead_of_tabs
                                                        (GtkSourceView *view,
                                                         gboolean enable);
gboolean            gtk_source_view_get_insert_spaces_instead_of_tabs
                                                        (GtkSourceView *view);
void                gtk_source_view_set_smart_home_end  (GtkSourceView *view,
                                                         GtkSourceSmartHomeEndType smart_he);
GtkSourceSmartHomeEndType  gtk_source_view_get_smart_home_end
                                                        (GtkSourceView *view);
void                gtk_source_view_set_mark_category_priority
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         gint priority);
gint                gtk_source_view_get_mark_category_priority
                                                        (GtkSourceView *view,
                                                         const gchar *category);
void                gtk_source_view_set_mark_category_pixbuf
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GdkPixbuf *pixbuf);
GdkPixbuf *         gtk_source_view_get_mark_category_pixbuf
                                                        (GtkSourceView *view,
                                                         const gchar *category);
void                gtk_source_view_set_mark_category_icon_from_pixbuf
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GdkPixbuf *pixbuf);
void                gtk_source_view_set_mark_category_icon_from_stock
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         const gchar *stock_id);
void                gtk_source_view_set_mark_category_icon_from_icon_name
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         const gchar *name);
gboolean            gtk_source_view_get_mark_category_background
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GdkColor *dest);
void                gtk_source_view_set_mark_category_background
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         const GdkColor *color);
void                gtk_source_view_set_mark_category_tooltip_func
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GtkSourceViewMarkTooltipFunc func,
                                                         gpointer user_data,
                                                         GDestroyNotify user_data_notify);
void                gtk_source_view_set_mark_category_tooltip_markup_func
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GtkSourceViewMarkTooltipFunc markup_func,
                                                         gpointer user_data,
                                                         GDestroyNotify user_data_notify);
void                gtk_source_view_set_highlight_current_line
                                                        (GtkSourceView *view,
                                                         gboolean show);
gboolean            gtk_source_view_get_highlight_current_line
                                                        (GtkSourceView *view);
void                gtk_source_view_set_show_line_marks (GtkSourceView *view,
                                                         gboolean show);
gboolean            gtk_source_view_get_show_line_marks (GtkSourceView *view);
void                gtk_source_view_set_show_line_numbers
                                                        (GtkSourceView *view,
                                                         gboolean show);
gboolean            gtk_source_view_get_show_line_numbers
                                                        (GtkSourceView *view);
void                gtk_source_view_set_show_right_margin
                                                        (GtkSourceView *view,
                                                         gboolean show);
gboolean            gtk_source_view_get_show_right_margin
                                                        (GtkSourceView *view);
void                gtk_source_view_set_right_margin_position
                                                        (GtkSourceView *view,
                                                         guint pos);
guint               gtk_source_view_get_right_margin_position
                                                        (GtkSourceView *view);
void                gtk_source_view_set_tab_width       (GtkSourceView *view,
                                                         guint width);
guint               gtk_source_view_get_tab_width       (GtkSourceView *view);
void                gtk_source_view_set_draw_spaces     (GtkSourceView *view,
                                                         GtkSourceDrawSpacesFlags flags);
GtkSourceDrawSpacesFlags  gtk_source_view_get_draw_spaces
                                                        (GtkSourceView *view);
GtkSourceCompletion * gtk_source_view_get_completion    (GtkSourceView *view);
GtkSourceGutter *   gtk_source_view_get_gutter          (GtkSourceView *view,
                                                         GtkTextWindowType window_type);

Object Hierarchy

  GObject
   +----GInitiallyUnowned
         +----GtkObject
               +----GtkWidget
                     +----GtkContainer
                           +----GtkTextView
                                 +----GtkSourceView

Implemented Interfaces

GtkSourceView implements AtkImplementorIface, GtkBuildable and GtkExtendedLayout.

Properties

  "auto-indent"              gboolean              : Read / Write
  "completion"               GtkSourceCompletion*  : Read
  "draw-spaces"              GtkSourceDrawSpacesFlags  : Read / Write
  "highlight-current-line"   gboolean              : Read / Write
  "indent-on-tab"            gboolean              : Read / Write
  "indent-width"             gint                  : Read / Write
  "insert-spaces-instead-of-tabs" gboolean              : Read / Write
  "right-margin-position"    guint                 : Read / Write
  "show-line-marks"          gboolean              : Read / Write
  "show-line-numbers"        gboolean              : Read / Write
  "show-right-margin"        gboolean              : Read / Write
  "smart-home-end"           GtkSourceSmartHomeEndType  : Read / Write
  "tab-width"                guint                 : Read / Write

Signals

  "line-mark-activated"                            : Run Last
  "move-lines"                                     : Run Last / Action
  "move-words"                                     : Run Last / Action
  "redo"                                           : Run Last / Action
  "show-completion"                                : Run Last / Action
  "smart-home-end"                                 : Run Last
  "undo"                                           : Run Last / Action

Description

GtkSourceView is the main object of the gtksourceview library. It provides a text view which syntax highlighting, undo/redo and text marks. Use a GtkSourceBuffer to display text with a GtkSourceView.

Details

GtkSourceView

typedef struct _GtkSourceView GtkSourceView;

GtkSourceViewClass

typedef struct {
	GtkTextViewClass parent_class;

	void (*undo) (GtkSourceView *view);
	void (*redo) (GtkSourceView *view);
	void (*line_mark_activated) (GtkSourceView *view, 
	                             GtkTextIter   *iter,
	                             GdkEvent      *event);
	void (*show_completion) (GtkSourceView *view);
	void (*move_lines) (GtkSourceView *view,
	                    gboolean       copy,
	                    gint           step);

	void (*move_words) (GtkSourceView *view,
	                    gint           step);

	/* Padding for future expansion */
} GtkSourceViewClass;

GtkSourceViewMarkTooltipFunc ()

gchar *             (*GtkSourceViewMarkTooltipFunc)     (GtkSourceMark *mark,
                                                         gpointer user_data);

Function type for setting up a tooltip for GtkSourceMark.

mark :

the GtkSourceMark

user_data :

user data pointer which was passed to gtk_source_view_set_mark_category_tooltip_func()

Returns :

a newly-allocated string that is going to be shown as tooltip text.

enum GtkSourceSmartHomeEndType

typedef enum
{
	GTK_SOURCE_SMART_HOME_END_DISABLED,
	GTK_SOURCE_SMART_HOME_END_BEFORE,
	GTK_SOURCE_SMART_HOME_END_AFTER,
	GTK_SOURCE_SMART_HOME_END_ALWAYS
} GtkSourceSmartHomeEndType;

GTK_SOURCE_SMART_HOME_END_DISABLED

smart-home-end disabled.

GTK_SOURCE_SMART_HOME_END_BEFORE

move to the first/last non-whitespace character on the first press of the HOME/END keys and to the beginning/end of the line on the second press.

GTK_SOURCE_SMART_HOME_END_AFTER

move to the beginning/end of the line on the first press of the HOME/END keys and to the first/last non-whitespace character on the second press.

GTK_SOURCE_SMART_HOME_END_ALWAYS

always move to the first/last non-whitespace character when the HOME/END keys are pressed.

enum GtkSourceDrawSpacesFlags

typedef enum
{
	GTK_SOURCE_DRAW_SPACES_SPACE      = 1 << 0,
	GTK_SOURCE_DRAW_SPACES_TAB        = 1 << 1,
	GTK_SOURCE_DRAW_SPACES_NEWLINE    = 1 << 2,
	GTK_SOURCE_DRAW_SPACES_NBSP       = 1 << 3,
	GTK_SOURCE_DRAW_SPACES_LEADING    = 1 << 4,
	GTK_SOURCE_DRAW_SPACES_TEXT       = 1 << 5,
	GTK_SOURCE_DRAW_SPACES_TRAILING   = 1 << 6,
	GTK_SOURCE_DRAW_SPACES_ALL        = (GTK_SOURCE_DRAW_SPACES_SPACE   | \
	                                     GTK_SOURCE_DRAW_SPACES_TAB     | \
	                                     GTK_SOURCE_DRAW_SPACES_NEWLINE | \
	                                     GTK_SOURCE_DRAW_SPACES_NBSP | \
	                                     GTK_SOURCE_DRAW_SPACES_LEADING | \
	                                     GTK_SOURCE_DRAW_SPACES_TEXT | \
	                                     GTK_SOURCE_DRAW_SPACES_TRAILING)
} GtkSourceDrawSpacesFlags;

GtkSourceDrawSpacesFlags determine what kind of spaces whould be drawn. If none of GTK_SOURCE_DRAW_SPACES_LEADING, GTK_SOURCE_DRAW_SPACES_TEXT or GTK_SOURCE_DRAW_SPACES_TRAILING is specified, whitespaces at any position in the line will be drawn (i.e. it has the same effect as specifying all of them).

GTK_SOURCE_DRAW_SPACES_SPACE

whether the space character should be drawn.

GTK_SOURCE_DRAW_SPACES_TAB

whether the tab character should be drawn.

GTK_SOURCE_DRAW_SPACES_NEWLINE

whether the line breaks should be drawn.

GTK_SOURCE_DRAW_SPACES_NBSP

whether the non-breaking whitespaces should be drawn.

GTK_SOURCE_DRAW_SPACES_LEADING

whether leading whitespaces should be drawn.

GTK_SOURCE_DRAW_SPACES_TEXT

whether whitespaces inside text should be drawn.

GTK_SOURCE_DRAW_SPACES_TRAILING

whether trailing whitespaces should be drawn.

GTK_SOURCE_DRAW_SPACES_ALL

wheter all kind of spaces should be drawn.

enum GtkSourceViewGutterPosition

typedef enum
{
	GTK_SOURCE_VIEW_GUTTER_POSITION_LINES = -30,
	GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS = -20
} GtkSourceViewGutterPosition;

GTK_SOURCE_VIEW_GUTTER_POSITION_LINES

the gutter position of the lines renderer

GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS

the gutter position of the marks renderer

gtk_source_view_new ()

GtkWidget *         gtk_source_view_new                 (void);

Creates a new GtkSourceView. An empty default buffer will be created for you. If you want to specify your own buffer, consider gtk_source_view_new_with_buffer().

Returns :

a new GtkSourceView.

gtk_source_view_new_with_buffer ()

GtkWidget *         gtk_source_view_new_with_buffer     (GtkSourceBuffer *buffer);

Creates a new GtkSourceView widget displaying the buffer buffer. One buffer can be shared among many widgets.

buffer :

a GtkSourceBuffer.

Returns :

a new GtkSourceView.

gtk_source_view_set_auto_indent ()

void                gtk_source_view_set_auto_indent     (GtkSourceView *view,
                                                         gboolean enable);

If TRUE auto indentation of text is enabled.

view :

a GtkSourceView.

enable :

whether to enable auto indentation.

gtk_source_view_get_auto_indent ()

gboolean            gtk_source_view_get_auto_indent     (GtkSourceView *view);

Returns whether auto indentation of text is enabled.

view :

a GtkSourceView.

Returns :

TRUE if auto indentation is enabled.

gtk_source_view_set_indent_on_tab ()

void                gtk_source_view_set_indent_on_tab   (GtkSourceView *view,
                                                         gboolean enable);

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 \t characters. Shift+Tab unindents the selection.

view :

a GtkSourceView.

enable :

whether to indent a block when tab is pressed.

Since 1.8


gtk_source_view_get_indent_on_tab ()

gboolean            gtk_source_view_get_indent_on_tab   (GtkSourceView *view);

Returns whether when the tab key is pressed the current selection should get indented instead of replaced with the \t character.

view :

a GtkSourceView.

Returns :

TRUE if the selection is indented when tab is pressed.

Since 1.8


gtk_source_view_set_indent_width ()

void                gtk_source_view_set_indent_width    (GtkSourceView *view,
                                                         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.

view :

a GtkSourceView.

width :

indent width in characters.

gtk_source_view_get_indent_width ()

gint                gtk_source_view_get_indent_width    (GtkSourceView *view);

Returns the number of spaces to use for each step of indent. See gtk_source_view_set_indent_width() for details.

view :

a GtkSourceView.

Returns :

indent width.

gtk_source_view_set_insert_spaces_instead_of_tabs ()

void                gtk_source_view_set_insert_spaces_instead_of_tabs
                                                        (GtkSourceView *view,
                                                         gboolean enable);

If TRUE any tabulator character inserted is replaced by a group of space characters.

view :

a GtkSourceView.

enable :

whether to insert spaces instead of tabs.

gtk_source_view_get_insert_spaces_instead_of_tabs ()

gboolean            gtk_source_view_get_insert_spaces_instead_of_tabs
                                                        (GtkSourceView *view);

Returns whether when inserting a tabulator character it should be replaced by a group of space characters.

view :

a GtkSourceView.

Returns :

TRUE if spaces are inserted instead of tabs.

gtk_source_view_set_smart_home_end ()

void                gtk_source_view_set_smart_home_end  (GtkSourceView *view,
                                                         GtkSourceSmartHomeEndType smart_he);

Set the desired movement of the cursor when HOME and END keys are pressed.

view :

a GtkSourceView.

smart_he :

the desired behavior among GtkSourceSmartHomeEndType.

gtk_source_view_get_smart_home_end ()

GtkSourceSmartHomeEndType  gtk_source_view_get_smart_home_end
                                                        (GtkSourceView *view);

Returns a GtkSourceSmartHomeEndType end value specifying how the cursor will move when HOME and END keys are pressed.

view :

a GtkSourceView.

Returns :

a GtkSourceSmartHomeEndTypeend value.

gtk_source_view_set_mark_category_priority ()

void                gtk_source_view_set_mark_category_priority
                                                        (GtkSourceView *view,
                                                         const gchar *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.

view :

a GtkSourceView.

category :

a mark category.

priority :

the priority for the category

Since 2.2


gtk_source_view_get_mark_category_priority ()

gint                gtk_source_view_get_mark_category_priority
                                                        (GtkSourceView *view,
                                                         const gchar *category);

Gets the priority which is associated with the given category.

view :

a GtkSourceView.

category :

a mark category.

Returns :

the priority or if category exists but no priority was set, it defaults to 0.

Since 2.2


gtk_source_view_set_mark_category_pixbuf ()

void                gtk_source_view_set_mark_category_pixbuf
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GdkPixbuf *pixbuf);

Warning

gtk_source_view_set_mark_category_pixbuf is deprecated and should not be used in newly-written code. Use gtk_source_view_set_mark_category_icon_from_pixbuf instead.

Associates a given pixbuf with a given mark category. If pixbuf is NULL, the pixbuf is unset.

view :

a GtkSourceView.

category :

a mark category.

pixbuf :

a GdkPixbuf, or NULL. [allow-none]

Since 2.2


gtk_source_view_get_mark_category_pixbuf ()

GdkPixbuf *         gtk_source_view_get_mark_category_pixbuf
                                                        (GtkSourceView *view,
                                                         const gchar *category);

Warning

gtk_source_view_get_mark_category_pixbuf is deprecated and should not be used in newly-written code.

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

view :

a GtkSourceView.

category :

a mark category.

Returns :

the associated GdkPixbuf, or NULL if not found.

Since 2.2


gtk_source_view_set_mark_category_icon_from_pixbuf ()

void                gtk_source_view_set_mark_category_icon_from_pixbuf
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GdkPixbuf *pixbuf);

Sets the icon to be used for category to pixbuf. If pixbuf is NULL, the icon is unset.

view :

a GtkSourceView.

category :

a mark category.

pixbuf :

a GdkPixbuf, or NULL. [allow-none]

Since 2.8


gtk_source_view_set_mark_category_icon_from_stock ()

void                gtk_source_view_set_mark_category_icon_from_stock
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         const gchar *stock_id);

Sets the icon to be used for category to the stock item stock_id. If stock_id is NULL, the icon is unset.

view :

a GtkSourceView.

category :

a mark category.

stock_id :

the stock id, or NULL. [allow-none]

Since 2.8


gtk_source_view_set_mark_category_icon_from_icon_name ()

void                gtk_source_view_set_mark_category_icon_from_icon_name
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         const gchar *name);

Sets the icon to be used for category to the named theme item name. If name is NULL, the icon is unset.

view :

a GtkSourceView.

category :

a mark category.

name :

the themed icon name, or NULL. [allow-none]

Since 2.8


gtk_source_view_get_mark_category_background ()

gboolean            gtk_source_view_get_mark_category_background
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GdkColor *dest);

Gets the background color associated with given category.

view :

a GtkSourceView.

category :

a mark category.

dest :

destination GdkColor structure to fill in.

Returns :

TRUE if background color for category was set and dest is set to a valid color, or FALSE otherwise.

Since 2.4


gtk_source_view_set_mark_category_background ()

void                gtk_source_view_set_mark_category_background
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         const GdkColor *color);

Sets given background color for mark category. If color is NULL, the background color is unset.

view :

a GtkSourceView.

category :

a mark category.

color :

background color or NULL to unset it. [allow-none]

Since 2.4


gtk_source_view_set_mark_category_tooltip_func ()

void                gtk_source_view_set_mark_category_tooltip_func
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GtkSourceViewMarkTooltipFunc func,
                                                         gpointer user_data,
                                                         GDestroyNotify user_data_notify);

Set a GtkSourceViewMarkTooltipFunc used to set tooltip on marks from the given mark category. If you also specified a function with gtk_source_view_set_mark_category_tooltip_markup_func() the markup variant takes precedence.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
static gchar *
tooltip_func (GtkSourceMark *mark,
              gpointer       user_data)
{
  gchar *text;

  text = get_tooltip_for_mark (mark, user_data);

  return text;
}

...

GtkSourceView *view;

gtk_source_view_set_mark_category_tooltip_func (view, "other-mark",
                                                tooltip_func,
                                                NULL, NULL);

view :

a GtkSourceView.

category :

a mark category.

func :

a GtkSourceViewMarkTooltipFunc or NULL. [allow-none]

user_data :

user data which will be passed to func. [allow-none]

user_data_notify :

a function to free the memory allocated for user_data or NULL if you do not want to supply such a function. [allow-none]

Since 2.8


gtk_source_view_set_mark_category_tooltip_markup_func ()

void                gtk_source_view_set_mark_category_tooltip_markup_func
                                                        (GtkSourceView *view,
                                                         const gchar *category,
                                                         GtkSourceViewMarkTooltipFunc markup_func,
                                                         gpointer user_data,
                                                         GDestroyNotify user_data_notify);

See gtk_source_view_set_mark_category_tooltip_func() for more information.

view :

a GtkSourceView.

category :

a mark category.

markup_func :

a GtkSourceViewMarkTooltipFunc or NULL. [allow-none]

user_data :

user data which will be passed to func. [allow-none]

user_data_notify :

a function to free the memory allocated for user_data or NULL if you do not want to supply such a function. [allow-none]

Since 2.8


gtk_source_view_set_highlight_current_line ()

void                gtk_source_view_set_highlight_current_line
                                                        (GtkSourceView *view,
                                                         gboolean show);

If show is TRUE the current line is highlighted.

view :

a GtkSourceView.

show :

whether to highlight the current line.

gtk_source_view_get_highlight_current_line ()

gboolean            gtk_source_view_get_highlight_current_line
                                                        (GtkSourceView *view);

Returns whether the current line is highlighted.

view :

a GtkSourceView.

Returns :

TRUE if the current line is highlighted.

gtk_source_view_set_show_line_marks ()

void                gtk_source_view_set_show_line_marks (GtkSourceView *view,
                                                         gboolean show);

If TRUE line marks will be displayed beside the text.

view :

a GtkSourceView.

show :

whether line marks should be displayed.

Since 2.2


gtk_source_view_get_show_line_marks ()

gboolean            gtk_source_view_get_show_line_marks (GtkSourceView *view);

Returns whether line marks are displayed beside the text.

view :

a GtkSourceView.

Returns :

TRUE if the line marks are displayed.

Since 2.2


gtk_source_view_set_show_line_numbers ()

void                gtk_source_view_set_show_line_numbers
                                                        (GtkSourceView *view,
                                                         gboolean show);

If TRUE line numbers will be displayed beside the text.

view :

a GtkSourceView.

show :

whether line numbers should be displayed.

gtk_source_view_get_show_line_numbers ()

gboolean            gtk_source_view_get_show_line_numbers
                                                        (GtkSourceView *view);

Returns whether line numbers are displayed beside the text.

view :

a GtkSourceView.

Returns :

TRUE if the line numbers are displayed.

gtk_source_view_set_show_right_margin ()

void                gtk_source_view_set_show_right_margin
                                                        (GtkSourceView *view,
                                                         gboolean show);

If TRUE a right margin is displayed.

view :

a GtkSourceView.

show :

whether to show a right margin.

gtk_source_view_get_show_right_margin ()

gboolean            gtk_source_view_get_show_right_margin
                                                        (GtkSourceView *view);

Returns whether a right margin is displayed.

view :

a GtkSourceView.

Returns :

TRUE if the right margin is shown.

gtk_source_view_set_right_margin_position ()

void                gtk_source_view_set_right_margin_position
                                                        (GtkSourceView *view,
                                                         guint pos);

Sets the position of the right margin in the given view.

view :

a GtkSourceView.

pos :

the width in characters where to position the right margin.

gtk_source_view_get_right_margin_position ()

guint               gtk_source_view_get_right_margin_position
                                                        (GtkSourceView *view);

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

view :

a GtkSourceView.

Returns :

the position of the right margin.

gtk_source_view_set_tab_width ()

void                gtk_source_view_set_tab_width       (GtkSourceView *view,
                                                         guint width);

Sets the width of tabulation in characters.

view :

a GtkSourceView.

width :

width of tab in characters.

gtk_source_view_get_tab_width ()

guint               gtk_source_view_get_tab_width       (GtkSourceView *view);

Returns the width of tabulation in characters.

view :

a GtkSourceView.

Returns :

width of tab.

gtk_source_view_set_draw_spaces ()

void                gtk_source_view_set_draw_spaces     (GtkSourceView *view,
                                                         GtkSourceDrawSpacesFlags flags);

Set if and how the spaces should be visualized. Specifying flags as 0 will disable display of spaces.

view :

a GtkSourceView.

flags :

GtkSourceDrawSpacesFlags specifing how white spaces should be displayed

gtk_source_view_get_draw_spaces ()

GtkSourceDrawSpacesFlags  gtk_source_view_get_draw_spaces
                                                        (GtkSourceView *view);

Returns the GtkSourceDrawSpacesFlags specifying if and how spaces should be displayed for this view.

view :

a GtkSourceView

Returns :

the GtkSourceDrawSpacesFlags, 0 if no spaces should be drawn.

gtk_source_view_get_completion ()

GtkSourceCompletion * gtk_source_view_get_completion    (GtkSourceView *view);

Gets the GtkSourceCompletion associated with view.

view :

a GtkSourceView.

Returns :

the GtkSourceCompletion associated with view.

gtk_source_view_get_gutter ()

GtkSourceGutter *   gtk_source_view_get_gutter          (GtkSourceView *view,
                                                         GtkTextWindowType window_type);

Returns the GtkSourceGutter object associated with window_type for view. Only GTK_TEXT_WINDOW_LEFT and GTK_TEXT_WINDOW_RIGHT are supported, respectively corresponding to the left and right gutter. The line numbers and mark category icons are rendered in the gutter corresponding to GTK_TEXT_WINDOW_LEFT.

view :

a GtkSourceView.

window_type :

the gutter window type.

Returns :

the GtkSourceGutter. [transfer none]

Since 2.8

Property Details

The "auto-indent" property

  "auto-indent"              gboolean              : Read / Write

Whether to enable auto indentation.

Default value: FALSE


The "completion" property

  "completion"               GtkSourceCompletion*  : Read

The completion object associated with the view.


The "draw-spaces" property

  "draw-spaces"              GtkSourceDrawSpacesFlags  : Read / Write

Set if and how the spaces should be visualized.

Since 2.4


The "highlight-current-line" property

  "highlight-current-line"   gboolean              : Read / Write

Whether to highlight the current line.

Default value: FALSE


The "indent-on-tab" property

  "indent-on-tab"            gboolean              : Read / Write

Whether to indent the selected text when the tab key is pressed.

Default value: TRUE


The "indent-width" property

  "indent-width"             gint                  : Read / Write

Width of an indentation step expressed in number of spaces.

Allowed values: [G_MAXULONG,32]

Default value: -1


The "insert-spaces-instead-of-tabs" property

  "insert-spaces-instead-of-tabs" gboolean              : Read / Write

Whether to insert spaces instead of tabs.

Default value: FALSE


The "right-margin-position" property

  "right-margin-position"    guint                 : Read / Write

Position of the right margin.

Allowed values: [1,1000]

Default value: 80


The "show-line-marks" property

  "show-line-marks"          gboolean              : Read / Write

Whether to display line mark pixbufs

Default value: FALSE


The "show-line-numbers" property

  "show-line-numbers"        gboolean              : Read / Write

Whether to display line numbers

Default value: FALSE


The "show-right-margin" property

  "show-right-margin"        gboolean              : Read / Write

Whether to display the right margin.

Default value: FALSE


The "smart-home-end" property

  "smart-home-end"           GtkSourceSmartHomeEndType  : Read / Write

Set the behavior of the HOME and END keys.

Default value: GTK_SOURCE_SMART_HOME_END_DISABLED

Since 2.0


The "tab-width" property

  "tab-width"                guint                 : Read / Write

Width of an tab character expressed in number of spaces.

Allowed values: [1,32]

Default value: 8

Signal Details

The "line-mark-activated" signal

void                user_function                      (GtkSourceView *view,
                                                        GtkTextIter   *iter,
                                                        GdkEvent      *event,
                                                        gpointer       user_data)      : Run Last

Emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter). You can use iter to determine on which line the activation took place.

view :

the GtkSourceView

iter :

a GtkTextIter

event :

the GdkEvent that activated the event

user_data :

user data set when the signal handler was connected.

The "move-lines" signal

void                user_function                      (GtkSourceView *view,
                                                        gboolean       copy,
                                                        gint           count,
                                                        gpointer       user_data)      : Run Last / Action

The ::move-lines signal is a keybinding which gets emitted when the user initiates moving a line. The default binding key is Alt+Up/Down arrow. And moves the currently selected lines, or the current line by count. For the moment, only count of -1 or 1 is valid.

view :

the GtkSourceView which received the signal

copy :

TRUE if the line should be copied, FALSE if it should be moved

count :

the number of lines to move over.

user_data :

user data set when the signal handler was connected.

Since 2.10


The "move-words" signal

void                user_function                      (GtkSourceView *view,
                                                        gint           count,
                                                        gpointer       user_data)      : Run Last / Action

The ::move-words signal is a keybinding which gets emitted when the user initiates moving a word. The default binding key is Alt+Left/Right Arrow and moves the current selection, or the current word by one word.

view :

the GtkSourceView which received the signal

count :

the number of words to move over

user_data :

user data set when the signal handler was connected.

Since 3.0


The "redo" signal

void                user_function                      (GtkSourceView *sourceview,
                                                        gpointer       user_data)       : Run Last / Action

The "show-completion" signal

void                user_function                      (GtkSourceView *view,
                                                        gpointer       user_data)      : Run Last / Action

The ::show-completion signal is a keybinding signal which gets emitted when the user initiates a completion in default mode.

Applications should not connect to it, but may emit it with g_signal_emit_by_name if they need to control the default mode completion activation.

view :

The GtkSourceView who emits the signal

user_data :

user data set when the signal handler was connected.

The "smart-home-end" signal

void                user_function                      (GtkSourceView *view,
                                                        GtkTextIter   *iter,
                                                        gint           count,
                                                        gpointer       user_data)      : Run Last

Emitted when a the cursor was moved according to the smart home end setting. The signal is emitted after the cursor is moved, but during the GtkTextView::move-cursor action. This can be used to find out whether the cursor was moved by a normal home/end or by a smart home/end.

view :

the GtkSourceView

iter :

a GtkTextIter

count :

the count

user_data :

user data set when the signal handler was connected.

Since 3.0


The "undo" signal

void                user_function                      (GtkSourceView *sourceview,
                                                        gpointer       user_data)       : Run Last / Action

See Also

GtkTextView,GtkSourceBuffer