Top |
GtkSourceMarkAttributes is an object specifying attributes used by a GtkSourceView to visually show lines marked with GtkSourceMarks of a specific category. It allows you to define a background color of a line, an icon shown in gutter and tooltips.
The background color is used as a background of a line where a mark is placed
and it can be set with gtk_source_mark_attributes_set_background()
. To check
if any custom background color was defined and what color it is, use
gtk_source_mark_attributes_get_background()
.
An icon is a graphic element which is shown in the gutter of a view. An
example use is showing a red filled circle in a debugger to show that a
breakpoint was set in certain line. To get an icon that will be placed in
a gutter, first a base for it must be specified and then
gtk_source_mark_attributes_render_icon()
must be called.
There are several ways to specify a base for an icon:
Using any of the above functions overrides the one used earlier. But note that a getter counterpart of earlier used function can still return some value, but it is just not used when rendering the proper icon.
To provide meaningful tooltips for a given mark of a category, you should connect to “query-tooltip-text” or “query-tooltip-markup” where the latter takes precedence.
GtkSourceMarkAttributes *
gtk_source_mark_attributes_new (void
);
Creates a new source mark attributes.
void gtk_source_mark_attributes_set_background (GtkSourceMarkAttributes *attributes
,const GdkRGBA *background
);
Sets background color to the one given in background
.
gboolean gtk_source_mark_attributes_get_background (GtkSourceMarkAttributes *attributes
,GdkRGBA *background
);
Stores background color in background
.
void gtk_source_mark_attributes_set_icon_name (GtkSourceMarkAttributes *attributes
,const gchar *icon_name
);
Sets a name of an icon to be used as a base for rendered icon.
const gchar *
gtk_source_mark_attributes_get_icon_name
(GtkSourceMarkAttributes *attributes
);
Gets a name of an icon to be used as a base for rendered icon. Note that the
icon name can be NULL
if it wasn't set earlier.
void gtk_source_mark_attributes_set_gicon (GtkSourceMarkAttributes *attributes
,GIcon *gicon
);
Sets an icon to be used as a base for rendered icon.
GIcon *
gtk_source_mark_attributes_get_gicon (GtkSourceMarkAttributes *attributes
);
Gets a GIcon to be used as a base for rendered icon. Note that the icon can
be NULL
if it wasn't set earlier.
void gtk_source_mark_attributes_set_pixbuf (GtkSourceMarkAttributes *attributes
,const GdkPixbuf *pixbuf
);
Sets a pixbuf to be used as a base for rendered icon.
const GdkPixbuf *
gtk_source_mark_attributes_get_pixbuf (GtkSourceMarkAttributes *attributes
);
Gets a GdkPixbuf to be used as a base for rendered icon. Note that the
pixbuf can be NULL
if it wasn't set earlier.
const GdkPixbuf * gtk_source_mark_attributes_render_icon (GtkSourceMarkAttributes *attributes
,GtkWidget *widget
,gint size
);
Renders an icon of given size. The base of the icon is set by the last call
to one of: gtk_source_mark_attributes_set_pixbuf()
,
gtk_source_mark_attributes_set_gicon()
or
gtk_source_mark_attributes_set_icon_name()
. size
cannot be lower than 1.
gchar * gtk_source_mark_attributes_get_tooltip_text (GtkSourceMarkAttributes *attributes
,GtkSourceMark *mark
);
Queries for a tooltip by emitting a “query-tooltip-text” signal. The tooltip is a plain text.
A tooltip. The returned string should be freed by
using g_free()
when done with it.
[transfer full]
gchar * gtk_source_mark_attributes_get_tooltip_markup (GtkSourceMarkAttributes *attributes
,GtkSourceMark *mark
);
Queries for a tooltip by emitting a “query-tooltip-markup” signal. The tooltip may contain a markup.
A tooltip. The returned string should be freed by
using g_free()
when done with it.
[transfer full]
“background”
property“background” GdkRGBA *
A color used for background of a line.
Owner: GtkSourceMarkAttributes
Flags: Read / Write
“gicon”
property“gicon” GIcon *
A GIcon that may be a base of a rendered icon.
Owner: GtkSourceMarkAttributes
Flags: Read / Write
“icon-name”
property “icon-name” char *
An icon name that may be a base of a rendered icon.
Owner: GtkSourceMarkAttributes
Flags: Read / Write
Default value: NULL
“query-tooltip-markup”
signalchar* user_function (GtkSourceMarkAttributes *attributes, GtkSourceMark *mark, gpointer user_data)
The code should connect to this signal to provide a tooltip for given
mark
. The tooltip can contain a markup.
attributes |
The GtkSourceMarkAttributes which emits the signal. |
|
mark |
The GtkSourceMark. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last
“query-tooltip-text”
signalchar* user_function (GtkSourceMarkAttributes *attributes, GtkSourceMark *mark, gpointer user_data)
The code should connect to this signal to provide a tooltip for given
mark
. The tooltip should be just a plain text.
attributes |
The GtkSourceMarkAttributes which emits the signal. |
|
mark |
The GtkSourceMark. |
|
user_data |
user data set when the signal handler was connected. |
Flags: Run Last