GtkSourceMarkAttributes

GtkSourceMarkAttributes — The source mark attributes object

Synopsis

#include <gtksourceview/gtksource.h>

                    GtkSourceMarkAttributes;
GtkSourceMarkAttributes * gtk_source_mark_attributes_new
                                                        (void);
void                gtk_source_mark_attributes_set_background
                                                        (GtkSourceMarkAttributes *attributes,
                                                         const GdkRGBA *background);
gboolean            gtk_source_mark_attributes_get_background
                                                        (GtkSourceMarkAttributes *attributes,
                                                         GdkRGBA *background);
void                gtk_source_mark_attributes_set_stock_id
                                                        (GtkSourceMarkAttributes *attributes,
                                                         const gchar *stock_id);
const gchar *       gtk_source_mark_attributes_get_stock_id
                                                        (GtkSourceMarkAttributes *attributes);
void                gtk_source_mark_attributes_set_icon_name
                                                        (GtkSourceMarkAttributes *attributes,
                                                         const gchar *icon_name);
const gchar *       gtk_source_mark_attributes_get_icon_name
                                                        (GtkSourceMarkAttributes *attributes);
void                gtk_source_mark_attributes_set_gicon
                                                        (GtkSourceMarkAttributes *attributes,
                                                         GIcon *gicon);
GIcon *             gtk_source_mark_attributes_get_gicon
                                                        (GtkSourceMarkAttributes *attributes);
void                gtk_source_mark_attributes_set_pixbuf
                                                        (GtkSourceMarkAttributes *attributes,
                                                         const GdkPixbuf *pixbuf);
const GdkPixbuf *   gtk_source_mark_attributes_get_pixbuf
                                                        (GtkSourceMarkAttributes *attributes);
const GdkPixbuf *   gtk_source_mark_attributes_render_icon
                                                        (GtkSourceMarkAttributes *attributes,
                                                         GtkWidget *widget,
                                                         gint size);
gchar *             gtk_source_mark_attributes_get_tooltip_text
                                                        (GtkSourceMarkAttributes *attributes,
                                                         GtkSourceMark *mark);
gchar *             gtk_source_mark_attributes_get_tooltip_markup
                                                        (GtkSourceMarkAttributes *attributes,
                                                         GtkSourceMark *mark);

Object Hierarchy

  GObject
   +----GtkSourceMarkAttributes

Properties

  "background"               GdkRGBA*              : Read / Write
  "gicon"                    GIcon*                : Read / Write
  "icon-name"                gchar*                : Read / Write
  "pixbuf"                   GdkPixbuf*            : Read / Write
  "stock-id"                 gchar*                : Read / Write

Signals

  "query-tooltip-markup"                           : Run Last
  "query-tooltip-text"                             : Run Last

Description

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.

Details

GtkSourceMarkAttributes

typedef struct _GtkSourceMarkAttributes GtkSourceMarkAttributes;

gtk_source_mark_attributes_new ()

GtkSourceMarkAttributes * gtk_source_mark_attributes_new
                                                        (void);

Creates a new source mark attributes.

Returns :

a new source mark attributes. [transfer full]

gtk_source_mark_attributes_set_background ()

void                gtk_source_mark_attributes_set_background
                                                        (GtkSourceMarkAttributes *attributes,
                                                         const GdkRGBA *background);

Sets background color to the one given in background.

attributes :

a GtkSourceMarkAttributes.

background :

a GdkRGBA.

gtk_source_mark_attributes_get_background ()

gboolean            gtk_source_mark_attributes_get_background
                                                        (GtkSourceMarkAttributes *attributes,
                                                         GdkRGBA *background);

Stores background color in background.

attributes :

a GtkSourceMarkAttributes.

background :

a GdkRGBA. [out caller-allocates]

Returns :

whether background color for attributes was set.

gtk_source_mark_attributes_set_stock_id ()

void                gtk_source_mark_attributes_set_stock_id
                                                        (GtkSourceMarkAttributes *attributes,
                                                         const gchar *stock_id);

Warning

gtk_source_mark_attributes_set_stock_id has been deprecated since version 3.10 and should not be used in newly-written code. Don't use this function.

Sets stock id to be used as a base for rendered icon.

attributes :

a GtkSourceMarkAttributes.

stock_id :

a stock id.

gtk_source_mark_attributes_get_stock_id ()

const gchar *       gtk_source_mark_attributes_get_stock_id
                                                        (GtkSourceMarkAttributes *attributes);

Warning

gtk_source_mark_attributes_get_stock_id has been deprecated since version 3.10 and should not be used in newly-written code. Don't use this function.

Gets a stock id of an icon used by this attributes. Note that the stock id can be NULL if it wasn't set earlier.

attributes :

a GtkSourceMarkAttributes.

Returns :

Stock id. Returned string is owned by attributes and shouldn't be freed. [transfer none]

gtk_source_mark_attributes_set_icon_name ()

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.

attributes :

a GtkSourceMarkAttributes.

icon_name :

name of an icon to be used.

gtk_source_mark_attributes_get_icon_name ()

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.

attributes :

a GtkSourceMarkAttributes.

Returns :

An icon name. The string belongs to attributes and should not be freed. [transfer none]

gtk_source_mark_attributes_set_gicon ()

void                gtk_source_mark_attributes_set_gicon
                                                        (GtkSourceMarkAttributes *attributes,
                                                         GIcon *gicon);

Sets an icon to be used as a base for rendered icon.

attributes :

a GtkSourceMarkAttributes.

gicon :

a GIcon to be used.

gtk_source_mark_attributes_get_gicon ()

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.

attributes :

a GtkSourceMarkAttributes.

Returns :

An icon. The icon belongs to attributes and should not be unreffed. [transfer none]

gtk_source_mark_attributes_set_pixbuf ()

void                gtk_source_mark_attributes_set_pixbuf
                                                        (GtkSourceMarkAttributes *attributes,
                                                         const GdkPixbuf *pixbuf);

Sets a pixbuf to be used as a base for rendered icon.

attributes :

a GtkSourceMarkAttributes.

pixbuf :

a GdkPixbuf to be used.

gtk_source_mark_attributes_get_pixbuf ()

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.

attributes :

a GtkSourceMarkAttributes.

Returns :

A pixbuf. The pixbuf belongs to attributes and should not be unreffed. [transfer none]

gtk_source_mark_attributes_render_icon ()

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(), gtk_source_mark_attributes_set_icon_name() or gtk_source_mark_attributes_set_stock_id(). size cannot be lower than 1.

attributes :

a GtkSourceMarkAttributes.

widget :

widget of which style settings may be used.

size :

size of the rendered icon.

Returns :

A rendered pixbuf. The pixbuf belongs to attributes and should not be unreffed. [transfer none]

gtk_source_mark_attributes_get_tooltip_text ()

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.

attributes :

a GtkSourceMarkAttributes.

mark :

a GtkSourceMark.

Returns :

A tooltip. The returned string should be freed by using g_free() when done with it. [transfer full]

gtk_source_mark_attributes_get_tooltip_markup ()

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.

attributes :

a GtkSourceMarkAttributes.

mark :

a GtkSourceMark.

Returns :

A tooltip. The returned string should be freed by using g_free() when done with it. [transfer full]

Property Details

The "background" property

  "background"               GdkRGBA*              : Read / Write

A color used for background of a line.


The "gicon" property

  "gicon"                    GIcon*                : Read / Write

A GIcon that may be a base of a rendered icon.


The "icon-name" property

  "icon-name"                gchar*                : Read / Write

An icon name that may be a base of a rendered icon.

Default value: NULL


The "pixbuf" property

  "pixbuf"                   GdkPixbuf*            : Read / Write

A GdkPixbuf that may be a base of a rendered icon.


The "stock-id" property

  "stock-id"                 gchar*                : Read / Write

Warning

GtkSourceMarkAttributes:stock-id has been deprecated since version 3.10 and should not be used in newly-written code. Don't use this property.

A stock id that may be a base of a rendered icon.

Default value: NULL

Signal Details

The "query-tooltip-markup" signal

gchar*              user_function                      (GtkSourceMarkAttributes *attributes,
                                                        GtkSourceMark           *mark,
                                                        gpointer                 user_data)       : Run Last

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.

Returns :

A tooltip. The string should be freed with g_free() when done with it. [transfer full]

The "query-tooltip-text" signal

gchar*              user_function                      (GtkSourceMarkAttributes *attributes,
                                                        GtkSourceMark           *mark,
                                                        gpointer                 user_data)       : Run Last

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.

Returns :

A tooltip. The string should be freed with g_free() when done with it. [transfer full]

See Also

GtkSourceMark