![]() |
![]() |
![]() |
GtkSourceView Reference Manual | ![]() |
---|---|---|---|---|
GtkSourceStyleSchemeGtkSourceStyleScheme — Object controlling apperance of GtkSourceView |
#include <gtksourceview/gtksourcestylescheme.h> GtkSourceStyleScheme; const gchar* gtk_source_style_scheme_get_id (GtkSourceStyleScheme *scheme); const gchar* gtk_source_style_scheme_get_name (GtkSourceStyleScheme *scheme); GtkSourceStyle* gtk_source_style_scheme_get_matching_brackets_style (GtkSourceStyleScheme *scheme); gboolean gtk_source_style_scheme_get_current_line_color (GtkSourceStyleScheme *scheme, GdkColor *color); void gtk_source_style_scheme_set_style (GtkSourceStyleScheme *scheme, const gchar *name, const GtkSourceStyle *style); GtkSourceStyle* gtk_source_style_scheme_get_style (GtkSourceStyleScheme *scheme, const gchar *style_name);
GtkSourceStyleScheme contains all the text styles to be used in GtkSourceView and GtkSourceBuffer. For instance, it contains text styles for syntax highlighting, it may contain foreground and background color for non-highlighted text, etc.
Style schemes are stored in XML files. The format of scheme file is the following.
The toplevel tag in a style scheme file is <style-scheme>
.
It has the following attributes:
id (mandatory) |
Identifier for the style scheme. This is must be unique among style schemes. |
name (mandatory) |
Name of the style scheme. This is the name of the scheme to display to user, e.g. in a preferences dialog. |
_name |
This is the same as |
parent-scheme (optional) |
Style schemes may have <em>parent</em> schemes: all styles but those specified in the scheme will be taken from the parent scheme. In this way a scheme may be customized without copying all its content. |
style-scheme
content is list of style
tags. Each
style
tag describes a single element of style scheme (it corresponds
to GtkSourceStyle object). It has the following attributes:
name (mandatory) |
Name of the style. It can be anything, syntax highlighting uses <em>lang-id:style-id</em>, and there are few special styles which are used to control general appearance of the text. Style scheme may contain other names to be used in an application. For instance, it may define color to highlight compilation errors in a build log or a color for bookmarks. |
foreground |
Foreground color, in hexadecimal format, e.g. "#000000", or symbolic name understood by Gdk, e.g. "magenta" or "darkred". |
background |
Background color, in hexadecimal format, e.g. "#000000", or symbolic name understood by Gdk, e.g. "magenta" or "darkred". |
italic |
"true" or "false" |
bold |
"true" or "false" |
underline |
"true" or "false" |
strikethrough |
"true" or "false" |
The following are names of styles which control GtkSourceView appearance:
text |
Default style of text. |
text-selected |
Style of selected text. |
cursor |
Text cursor style. Only |
secondary-cursor |
Secondary cursor style (used in bidi text). Only |
current-line |
Current line style. Only |
line-numbers |
Text and background colors for the left margin, on which line numbers are drawn |
bracket-match |
Style to use for matching brackets. |
bracket-mismatch |
Style to use for mismatching brackets. |
typedef struct _GtkSourceStyleScheme GtkSourceStyleScheme;
GtkSourceStyleScheme structure contains only private members and should not be accessed directly.
const gchar* gtk_source_style_scheme_get_id (GtkSourceStyleScheme *scheme);
scheme : |
a GtkSourceStyleScheme. |
Returns : | scheme id.
|
Since 2.0
const gchar* gtk_source_style_scheme_get_name (GtkSourceStyleScheme *scheme);
scheme : |
a GtkSourceStyleScheme. |
Returns : | scheme name.
|
Since 2.0
GtkSourceStyle* gtk_source_style_scheme_get_matching_brackets_style (GtkSourceStyleScheme *scheme);
scheme : |
a GtkSourceStyleScheme. |
Returns : | style which corresponds to "bracket-match" name, to use
in an editor. Call g_object_unref() when you are done with it.
|
Since 2.0
gboolean gtk_source_style_scheme_get_current_line_color (GtkSourceStyleScheme *scheme, GdkColor *color);
scheme : |
a GtkSourceStyleScheme. |
color : |
a GdkColor structure to fill. |
Returns : | TRUE if scheme has style for current line set, or FALSE
otherwise.
|
Since 2.0
void gtk_source_style_scheme_set_style (GtkSourceStyleScheme *scheme, const gchar *name, const GtkSourceStyle *style);
scheme : |
a GtkSourceStyleScheme. |
name : |
style name. |
style : |
style to set or NULL .
|
Since 2.0
GtkSourceStyle* gtk_source_style_scheme_get_style (GtkSourceStyleScheme *scheme, const gchar *style_name);
scheme : |
a GtkSourceStyleScheme. |
style_name : |
style name to find. |
Returns : | style which corresponds to style_name in the scheme ,
or NULL when no style with this name found. Call g_object_unref()
when you are done with it.
|
Since 2.0
id
" property"id" gchararray : Read / Write / Construct Only
Style scheme id, a unique string used to identify the style scheme in GtkSourceStyleManager.
Default value: NULL
Since 2.0