## GtkSourceMarkAttributes GtkSourceMarkAttributes — The source mark attributes object |

## Functions

GtkSourceMarkAttributes * | gtk_source_mark_attributes_new ()
void | gtk_source_mark_attributes_set_background ()
gboolean | gtk_source_mark_attributes_get_background ()
void | gtk_source_mark_attributes_set_icon_name ()
const gchar * | gtk_source_mark_attributes_get_icon_name ()
void | gtk_source_mark_attributes_set_gicon ()
GIcon * | gtk_source_mark_attributes_get_gicon ()
void | gtk_source_mark_attributes_set_pixbuf ()
const GdkPixbuf * | gtk_source_mark_attributes_get_pixbuf ()
const GdkPixbuf * | gtk_source_mark_attributes_render_icon ()
gchar * | gtk_source_mark_attributes_get_tooltip_text ()
gchar * | gtk_source_mark_attributes_get_tooltip_markup ()

## Properties

GdkRGBA * | background | Read / Write
GIcon * | gicon | Read / Write
gchar * | icon-name | Read / Write
GdkPixbuf * | pixbuf | Read / Write

## Signals

gchar* | query-tooltip-markup | Run Last
gchar* | query-tooltip-text | Run Last

## Types and Values

| GtkSourceMarkAttributes

## Object Hierarchy

        GObject
        ╰── GtkSourceMarkAttributes

## Includes

    #include <gtksourceview/gtksource.h>

## 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:

- `gtk_source_mark_attributes_set_icon_name()`

- `gtk_source_mark_attributes_set_gicon()`

- `gtk_source_mark_attributes_set_pixbuf()`

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.

## Functions

### 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` .

#### Parameters

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` .

#### Parameters

attributes | a GtkSourceMarkAttributes. |
background | a GdkRGBA. | [out caller-allocates]

#### Returns

whether background color for `attributes` was set.

### 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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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.

#### Parameters

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

#### Parameters

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.

#### Parameters

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.

#### Parameters

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]

## Types and Values

### GtkSourceMarkAttributes

    typedef struct _GtkSourceMarkAttributes GtkSourceMarkAttributes;

## Property Details

### The `“background”` property

      “background”               GdkRGBA *

A color used for background of a line.

Flags: Read / Write

### The `“gicon”` property

      “gicon”                    GIcon *

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

Flags: Read / Write

### The `“icon-name”` property

      “icon-name”                gchar *

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

Flags: Read / Write

Default value: NULL

### The `“pixbuf”` property

      “pixbuf”                   GdkPixbuf *

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

Flags: Read / Write

## Signal Details

### The `“query-tooltip-markup”` signal

    gchar*
    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.

#### Parameters

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]

Flags: Run Last

### The `“query-tooltip-text”` signal

    gchar*
    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.

#### Parameters

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]

Flags: Run Last

## See Also

GtkSourceMark