| Top |
| gboolean | auto-indent | Read / Write |
| GtkSourceCompletion * | completion | Read |
| GtkSourceDrawSpacesFlags | draw-spaces | Read / Write |
| gboolean | highlight-current-line | Read / Write |
| gboolean | indent-on-tab | Read / Write |
| gint | indent-width | Read / Write |
| gboolean | insert-spaces-instead-of-tabs | Read / Write |
| guint | right-margin-position | Read / Write |
| gboolean | show-line-marks | Read / Write |
| gboolean | show-line-numbers | Read / Write |
| gboolean | show-right-margin | Read / Write |
| GtkSourceSmartHomeEndType | smart-home-end | Read / Write |
| guint | tab-width | Read / Write |
| void | line-mark-activated | Run Last |
| void | move-lines | Action |
| void | redo | Action |
| void | show-completion | Action |
| void | undo | Action |
| struct | GtkSourceView |
| struct | GtkSourceViewClass |
| enum | GtkSourceSmartHomeEndType |
| enum | GtkSourceDrawSpacesFlags |
| enum | GtkSourceViewGutterPosition |
GObject
╰── GInitiallyUnowned
╰── GtkObject
╰── GtkWidget
╰── GtkContainer
╰── GtkTextView
╰── GtkSourceView
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.
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 |
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().
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.
void gtk_source_view_set_auto_indent (GtkSourceView *view,gboolean enable);
If TRUE auto indentation of text is enabled.
gboolean
gtk_source_view_get_auto_indent (GtkSourceView *view);
Returns whether auto indentation of text is enabled.
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.
Since: 1.8
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.
Since: 1.8
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.
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.
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.
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.
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.
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.
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.
Since: 2.2
gint gtk_source_view_get_mark_category_priority (GtkSourceView *view,const gchar *category);
Gets the priority which is associated with the given category
.
Since: 2.2
void gtk_source_view_set_mark_category_pixbuf (GtkSourceView *view,const gchar *category,GdkPixbuf *pixbuf);
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.
Since: 2.2
GdkPixbuf * gtk_source_view_get_mark_category_pixbuf (GtkSourceView *view,const gchar *category);
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
.
Since: 2.2
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.
Since: 2.8
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.
Since: 2.8
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.
Since: 2.8
gboolean gtk_source_view_get_mark_category_background (GtkSourceView *view,const gchar *category,GdkColor *dest);
Gets the background color associated with given category
.
TRUE if background color for category
was set
and dest
is set to a valid color, or FALSE otherwise.
Since: 2.4
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.
Since: 2.4
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 |
||
category |
a mark category. |
|
func |
||
user_data |
user data which will be passed to |
|
user_data_notify |
a function to free the memory allocated for |
Since: 2.8
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 |
||
category |
a mark category. |
|
markup_func |
||
user_data |
user data which will be passed to |
|
user_data_notify |
a function to free the memory allocated for |
Since: 2.8
void gtk_source_view_set_highlight_current_line (GtkSourceView *view,gboolean show);
If show
is TRUE the current line is highlighted.
gboolean
gtk_source_view_get_highlight_current_line
(GtkSourceView *view);
Returns whether the current line is highlighted
void gtk_source_view_set_show_line_marks (GtkSourceView *view,gboolean show);
If TRUE line marks will be displayed beside the text.
Since: 2.2
gboolean
gtk_source_view_get_show_line_marks (GtkSourceView *view);
Returns whether line marks are displayed beside the text.
Since: 2.2
void gtk_source_view_set_show_line_numbers (GtkSourceView *view,gboolean show);
If TRUE line numbers will be displayed beside the text.
gboolean
gtk_source_view_get_show_line_numbers (GtkSourceView *view);
Returns whether line numbers are displayed beside the text.
void gtk_source_view_set_show_right_margin (GtkSourceView *view,gboolean show);
If TRUE a right margin is displayed
gboolean
gtk_source_view_get_show_right_margin (GtkSourceView *view);
Returns whether a right margin is displayed.
void gtk_source_view_set_right_margin_position (GtkSourceView *view,guint pos);
Sets the position of the right margin in the given view
.
guint
gtk_source_view_get_right_margin_position
(GtkSourceView *view);
Gets the position of the right margin in the given view
.
void gtk_source_view_set_tab_width (GtkSourceView *view,guint width);
Sets the width of tabulation in characters.
guint
gtk_source_view_get_tab_width (GtkSourceView *view);
Returns the width of tabulation in characters.
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.
GtkSourceDrawSpacesFlags
gtk_source_view_get_draw_spaces (GtkSourceView *view);
Returns the GtkSourceDrawSpacesFlags specifying if and how spaces
should be displayed for this view
.
GtkSourceCompletion *
gtk_source_view_get_completion (GtkSourceView *view);
Gets the GtkSourceCompletion associated with view
.
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.
Since: 2.8
struct GtkSourceViewClass {
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);
/* Padding for future expansion */
void (*_gtk_source_reserved1) (void);
};
|
smart-home-end disabled. |
||
|
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. |
||
|
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. |
||
|
always move to the first/last non-whitespace character when the HOME/END keys are pressed. |
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).
|
whether the space character should be drawn. |
||
|
whether the tab character should be drawn. |
||
|
whether the line breaks should be drawn. |
||
|
whether the non-breaking whitespaces should be drawn. |
||
|
whether leading whitespaces should be drawn. |
||
|
whether whitespaces inside text should be drawn. |
||
|
whether trailing whitespaces should be drawn. |
||
|
wheter all kind of spaces should be drawn. |
“auto-indent” property “auto-indent” gboolean
Whether to enable auto indentation.
Flags: Read / Write
Default value: FALSE
“completion” property“completion” GtkSourceCompletion *
The completion object associated with the view.
Flags: Read
“draw-spaces” property“draw-spaces” GtkSourceDrawSpacesFlags
Set if and how the spaces should be visualized.
Flags: Read / Write
Since: 2.4
“highlight-current-line” property “highlight-current-line” gboolean
Whether to highlight the current line.
Flags: Read / Write
Default value: FALSE
“indent-on-tab” property “indent-on-tab” gboolean
Whether to indent the selected text when the tab key is pressed.
Flags: Read / Write
Default value: TRUE
“indent-width” property “indent-width” gint
Width of an indentation step expressed in number of spaces.
Flags: Read / Write
Allowed values: [-1,32]
Default value: -1
“insert-spaces-instead-of-tabs” property “insert-spaces-instead-of-tabs” gboolean
Whether to insert spaces instead of tabs.
Flags: Read / Write
Default value: FALSE
“right-margin-position” property “right-margin-position” guint
Position of the right margin.
Flags: Read / Write
Allowed values: [1,200]
Default value: 80
“show-line-marks” property “show-line-marks” gboolean
Whether to display line mark pixbufs
Flags: Read / Write
Default value: FALSE
“show-line-numbers” property “show-line-numbers” gboolean
Whether to display line numbers
Flags: Read / Write
Default value: FALSE
“show-right-margin” property “show-right-margin” gboolean
Whether to display the right margin.
Flags: Read / Write
Default value: FALSE
“smart-home-end” property“smart-home-end” GtkSourceSmartHomeEndType
Set the behavior of the HOME and END keys.
Flags: Read / Write
Default value: GTK_SOURCE_SMART_HOME_END_DISABLED
Since: 2.0
“line-mark-activated” signalvoid user_function (GtkSourceView *view, GtkTextIter *iter, GdkEvent *event, gpointer user_data)
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. |
Flags: Run Last
“move-lines” signalvoid user_function (GtkSourceView *view, gboolean copy, gint count, gpointer user_data)
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 |
|
|
count |
the number of lines to move over. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Action
Since: 2.10
“show-completion” signalvoid user_function (GtkSourceView *view, gpointer user_data)
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. |
Flags: Action