| GtkSourceView Reference Manual | ||||
|---|---|---|---|---|
#include <gtksourceview/gtksourceview.h>
GtkSourceView;
GtkSourceViewClass;
enum GtkSourceSmartHomeEndType;
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_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_margin (GtkSourceView *view,
guint margin);
guint gtk_source_view_get_margin (GtkSourceView *view);
void gtk_source_view_set_marker_pixbuf (GtkSourceView *view,
const gchar *marker_type,
GdkPixbuf *pixbuf);
GdkPixbuf* gtk_source_view_get_marker_pixbuf (GtkSourceView *view,
const gchar *marker_type);
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_markers
(GtkSourceView *view,
gboolean show);
gboolean gtk_source_view_get_show_line_markers
(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_margin (GtkSourceView *view,
gboolean show);
gboolean gtk_source_view_get_show_margin (GtkSourceView *view);
void gtk_source_view_set_tabs_width (GtkSourceView *view,
guint width);
guint gtk_source_view_get_tabs_width (GtkSourceView *view);
GObject
+----GInitiallyUnowned
+----GtkObject
+----GtkWidget
+----GtkContainer
+----GtkTextView
+----GtkSourceView
"auto-indent" gboolean : Read / Write "highlight-current-line" gboolean : Read / Write "indent-on-tab" gboolean : Read / Write "insert-spaces-instead-of-tabs" gboolean : Read / Write "margin" guint : Read / Write "show-line-markers" gboolean : Read / Write "show-line-numbers" gboolean : Read / Write "show-margin" gboolean : Read / Write "smart-home-end" GtkSourceSmartHomeEndType : Read / Write "tabs-width" guint : Read / Write
"right-margin-line-alpha" gint : Read "right-margin-line-color" GdkColor : Read "right-margin-overlay-alpha" gint : Read "right-margin-overlay-color" GdkColor : Read "right-margin-overlay-toggle" gchararray : Read
typedef struct {
GtkTextViewClass parent_class;
void (*undo) (GtkSourceView *view);
void (*redo) (GtkSourceView *view);
/* Padding for future expansion */
void (*_gtk_source_reserved1) (void);
void (*_gtk_source_reserved2) (void);
void (*_gtk_source_reserved3) (void);
void (*_gtk_source_reserved4) (void);
} GtkSourceViewClass;
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;
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 |
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 GtkTextView. |
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. |
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.
|
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
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
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. |
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.
|
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 |
GtkSourceSmartHomeEndType gtk_source_view_get_smart_home_end (GtkSourceView *view);
view : |
a GtkSourceView. |
| Returns : | a GtkSourceSmartHomeEndTypeend value specifying how the cursor will move when HOME and END keys are pressed. |
void gtk_source_view_set_margin (GtkSourceView *view, guint margin);
Sets the position of the right margin in the given view.
view : |
a GtkSourceView. |
margin : |
the position of the margin to set. |
guint gtk_source_view_get_margin (GtkSourceView *view);
Gets the position of the right margin in the given view.
view : |
a GtkSourceView. |
| Returns : | the position of the right margin. |
void gtk_source_view_set_marker_pixbuf (GtkSourceView *view, const gchar *marker_type, GdkPixbuf *pixbuf);
Associates a given pixbuf with a given marker_type.
view : |
a GtkSourceView. |
marker_type : |
a marker type. |
pixbuf : |
a GdkPixbuf. |
GdkPixbuf* gtk_source_view_get_marker_pixbuf (GtkSourceView *view, const gchar *marker_type);
Gets the pixbuf which is associated with the given marker_type.
view : |
a GtkSourceView. |
marker_type : |
a marker type. |
| Returns : | a GdkPixbuf if found, or NULL if not found.
|
void gtk_source_view_set_highlight_current_line
(GtkSourceView *view,
gboolean show);
If TRUE the current line is highlighted
view : |
a GtkSourceView |
show : |
whether to highlight the 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 |
void gtk_source_view_set_show_line_markers
(GtkSourceView *view,
gboolean show);
If TRUE line markers will be displayed beside the text.
view : |
a GtkSourceView. |
show : |
whether line markers should be displayed. |
gboolean gtk_source_view_get_show_line_markers
(GtkSourceView *view);
Returns whether line markers are displayed beside the text.
view : |
a GtkSourceView. |
| Returns : | TRUE if the line markers are displayed.
|
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. |
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.
|
void gtk_source_view_set_show_margin (GtkSourceView *view, gboolean show);
If TRUE a margin is displayed
view : |
a GtkSourceView. |
show : |
whether to show a margin. |
gboolean gtk_source_view_get_show_margin (GtkSourceView *view);
Returns whether a margin is displayed.
view : |
a GtkSourceView. |
| Returns : | TRUE if the margin is showed.
|
void gtk_source_view_set_tabs_width (GtkSourceView *view, guint width);
Sets the width of tabulation in characters.
view : |
a GtkSourceView. |
width : |
width of tab in characters. |
guint gtk_source_view_get_tabs_width (GtkSourceView *view);
Returns the width of tabulation in characters.
view : |
a GtkSourceView. |
| Returns : | width of tab. |
auto-indent" property"auto-indent" gboolean : Read / Write
Whether to enable auto indentation.
Default value: FALSE
highlight-current-line" property"highlight-current-line" gboolean : Read / Write
Whether to highlight the current line.
Default value: FALSE
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
insert-spaces-instead-of-tabs" property"insert-spaces-instead-of-tabs" gboolean : Read / Write
Whether to insert spaces instead of tabs.
Default value: FALSE
margin" property"margin" guint : Read / Write
Position of the right margin.
Allowed values: [1,200]
Default value: 80
show-line-markers" property"show-line-markers" gboolean : Read / Write
Whether to display line marker pixbufs.
Default value: FALSE
show-line-numbers" property"show-line-numbers" gboolean : Read / Write
Whether to display line numbers.
Default value: FALSE
show-margin" property"show-margin" gboolean : Read / Write
Whether to display the right margin.
Default value: FALSE
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
right-margin-line-alpha" style property"right-margin-line-alpha" gint : Read
The ::right-margin-line-alpha determines the alpha component with which the vertical line will be drawn. 0 means it is fully transparent (invisible). 255 means it has full opacity (text under the line won't be visible).
Allowed values: [0,255]
Default value: 40
Since 1.6
right-margin-line-color" style property"right-margin-line-color" GdkColor : Read
The ::right-margin-line-color property contains the color with which the right margin line (vertical line indicating the right margin) will be drawn.
Since 1.6
right-margin-overlay-alpha" style property"right-margin-overlay-alpha" gint : Read
The ::right-margin-overlay-alpha determines the alpha component with which the overlay will be drawn. 0 means it is fully transparent (invisible). 255 means it has full opacity (text under the overlay won't be visible).
Allowed values: [0,255]
Default value: 15
Since 1.6
right-margin-overlay-color" style property"right-margin-overlay-color" GdkColor : Read
The ::right-margin-overlay-color property contains the color with which the right margin overlay will be drawn. Setting this property will only have an effect if ::right-margin-overlay-toggle is TRUE.
Since 1.6
right-margin-overlay-toggle" style property"right-margin-overlay-toggle" gchararray : Read
The ::right-margin-overlay-toggle property determines whether the widget will draw a transparent overlay on top of the area on the right side of the right margin line. On some systems, this has a noticable performance impact, so this property is FALSE by default.
Default value: "FALSE"
Since 1.6
void user_function (GtkSourceView *sourceview, gpointer user_data) : Run Last / Action
sourceview : |
the object which received the signal. |
user_data : |
user data set when the signal handler was connected. |
void user_function (GtkSourceView *sourceview, gpointer user_data) : Run Last / Action
sourceview : |
the object which received the signal. |
user_data : |
user data set when the signal handler was connected. |