## GtkSourceGutterRenderer

GtkSourceGutterRenderer

## Synopsis

    #include <gtksourceview/gtksourcegutterrenderer.h>

    struct              GtkSourceGutterRenderer;
    enum                GtkSourceGutterRendererState;
    enum                GtkSourceGutterRendererAlignmentMode;
    void                gtk_source_gutter_renderer_begin    (GtkSourceGutterRenderer *renderer,
                                                             cairo_t *cr,
                                                             GdkRectangle *background_area,
                                                             GdkRectangle *cell_area,
                                                             GtkTextIter *start,
                                                             GtkTextIter *end);
    void                gtk_source_gutter_renderer_draw     (GtkSourceGutterRenderer *renderer,
                                                             cairo_t *cr,
                                                             GdkRectangle *background_area,
                                                             GdkRectangle *cell_area,
                                                             GtkTextIter *start,
                                                             GtkTextIter *end,
                                                             GtkSourceGutterRendererState state);
    void                gtk_source_gutter_renderer_end      (GtkSourceGutterRenderer *renderer);
    gint                gtk_source_gutter_renderer_get_size (GtkSourceGutterRenderer *renderer);
    void                gtk_source_gutter_renderer_set_size (GtkSourceGutterRenderer *renderer,
                                                             gint size);
    void                gtk_source_gutter_renderer_set_visible
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gboolean visible);
    gboolean            gtk_source_gutter_renderer_get_visible
                                                            (GtkSourceGutterRenderer *renderer);
    void                gtk_source_gutter_renderer_get_padding
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gint *xpad,
                                                             gint *ypad);
    void                gtk_source_gutter_renderer_set_padding
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gint xpad,
                                                             gint ypad);
    void                gtk_source_gutter_renderer_get_alignment
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gfloat *xalign,
                                                             gfloat *yalign);
    void                gtk_source_gutter_renderer_set_alignment
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gfloat xalign,
                                                             gfloat yalign);
    void                gtk_source_gutter_renderer_set_alignment_mode
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GtkSourceGutterRendererAlignmentMode mode);
    GtkTextWindowType   gtk_source_gutter_renderer_get_window_type
                                                            (GtkSourceGutterRenderer *renderer);
    GtkTextView *       gtk_source_gutter_renderer_get_view (GtkSourceGutterRenderer *renderer);
    GtkSourceGutterRendererAlignmentMode gtk_source_gutter_renderer_get_alignment_mode
                                                            (GtkSourceGutterRenderer *renderer);
    gboolean            gtk_source_gutter_renderer_get_background
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GdkRGBA *color);
    void                gtk_source_gutter_renderer_set_background
                                                            (GtkSourceGutterRenderer *renderer,
                                                             const GdkRGBA *color);
    void                gtk_source_gutter_renderer_activate (GtkSourceGutterRenderer *renderer,
                                                             GtkTextIter *iter,
                                                             GdkRectangle *area,
                                                             GdkEvent *event);
    gboolean            gtk_source_gutter_renderer_query_activatable
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GtkTextIter *iter,
                                                             GdkRectangle *area,
                                                             GdkEvent *event);
    void                gtk_source_gutter_renderer_queue_draw
                                                            (GtkSourceGutterRenderer *renderer);
    gboolean            gtk_source_gutter_renderer_query_tooltip
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GtkTextIter *iter,
                                                             GdkRectangle *area,
                                                             gint x,
                                                             gint y,
                                                             GtkTooltip *tooltip);
    void                gtk_source_gutter_renderer_query_data
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GtkTextIter *start,
                                                             GtkTextIter *end,
                                                             GtkSourceGutterRendererState state);

## Description

## Details

### struct GtkSourceGutterRenderer

    struct GtkSourceGutterRenderer {
    	GInitiallyUnowned parent;
    };

### enum GtkSourceGutterRendererState

    typedef enum
    {
    	GTK_SOURCE_GUTTER_RENDERER_STATE_NORMAL = 0,
    	GTK_SOURCE_GUTTER_RENDERER_STATE_CURSOR = 1 << 0,
    	GTK_SOURCE_GUTTER_RENDERER_STATE_PRELIT = 1 << 1,
    	GTK_SOURCE_GUTTER_RENDERER_STATE_SELECTED = 1 << 2
    } GtkSourceGutterRendererState;

`GTK_SOURCE_GUTTER_RENDERER_STATE_NORMAL`: normal state `GTK_SOURCE_GUTTER_RENDERER_STATE_CURSOR`: area in the renderer represents the line on which the insert cursor is currently positioned `GTK_SOURCE_GUTTER_RENDERER_STATE_PRELIT`: the mouse pointer is currently over the activatable area of the renderer `GTK_SOURCE_GUTTER_RENDERER_STATE_SELECTED`: area in the renderer represents a line in the buffer which contains part of the selection

### enum GtkSourceGutterRendererAlignmentMode

    typedef enum
    {
    	GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_CELL,
    	GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_FIRST,
    	GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_LAST
    } GtkSourceGutterRendererAlignmentMode;

### gtk_source_gutter_renderer_begin ()

    void                gtk_source_gutter_renderer_begin    (GtkSourceGutterRenderer *renderer,
                                                             cairo_t *cr,
                                                             GdkRectangle *background_area,
                                                             GdkRectangle *cell_area,
                                                             GtkTextIter *start,
                                                             GtkTextIter *end);

Called when drawing a region begins. The region to be drawn is indicated by `start` and `end`. The purpose is to allow the implementation to precompute some state before the ::draw method is called for each cell.

`renderer` : | a GtkSourceGutterRenderer
`cr` : | a cairo_t
`background_area` : | a GdkRectangle
`cell_area` : | a GdkRectangle
`start` : | a GtkTextIter
`end` : | a GtkTextIter

### gtk_source_gutter_renderer_draw ()

    void                gtk_source_gutter_renderer_draw     (GtkSourceGutterRenderer *renderer,
                                                             cairo_t *cr,
                                                             GdkRectangle *background_area,
                                                             GdkRectangle *cell_area,
                                                             GtkTextIter *start,
                                                             GtkTextIter *end,
                                                             GtkSourceGutterRendererState state);

Main renderering method. Implementations should implement this method to draw onto the cairo context. The `background_area` indicates total area of the cell (without padding or margin) to be drawn. The `cell_area` indicates the area where content can be drawn (text, images, etc).

The `state` argument indicates the current state of the renderer and should be taken into account to properly draw the different possible states (cursor, prelit, selected) if appropriate.

`renderer` : | a GtkSourceGutterRenderer
`cr` : | the cairo render context
`background_area` : | a GdkRectangle indicating the total area to be drawn
`cell_area` : | a GdkRectangle indicating the area to draw content
`start` : | a GtkTextIter
`end` : | a GtkTextIter
`state` : | a GtkSourceGutterRendererState

### gtk_source_gutter_renderer_end ()

    void                gtk_source_gutter_renderer_end      (GtkSourceGutterRenderer *renderer);

Called when drawing a region of lines has ended.

`renderer` : | a GtkSourceGutterRenderer

### gtk_source_gutter_renderer_get_size ()

    gint                gtk_source_gutter_renderer_get_size (GtkSourceGutterRenderer *renderer);

Get the size of the renderer.

`renderer` : | a GtkSourceGutterRenderer
Returns : | the size of the renderer.

### gtk_source_gutter_renderer_set_size ()

    void                gtk_source_gutter_renderer_set_size (GtkSourceGutterRenderer *renderer,
                                                             gint size);

Sets the size of the renderer. A value of -1 specifies that the size is to be determined dynamically.

`renderer` : | a GtkSourceGutterRenderer
`size` : | the size

### gtk_source_gutter_renderer_set_visible ()

    void                gtk_source_gutter_renderer_set_visible
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gboolean visible);

Set whether the gutter renderer is visible.

`renderer` : | a GtkSourceGutterRenderer
`visible` : | the visibility

### gtk_source_gutter_renderer_get_visible ()

    gboolean            gtk_source_gutter_renderer_get_visible
                                                            (GtkSourceGutterRenderer *renderer);

Get whether the gutter renderer is visible.

`renderer` : | a GtkSourceGutterRenderer
Returns : | `TRUE` if the renderer is visible, `FALSE` otherwise

### gtk_source_gutter_renderer_get_padding ()

    void                gtk_source_gutter_renderer_get_padding
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gint *xpad,
                                                             gint *ypad);

Get the x-padding and y-padding of the gutter renderer.

`renderer` : | a GtkSourceGutterRenderer
`xpad` : | return location for the x-padding (can be `NULL`). [out caller-allocates][allow-none]
`ypad` : | return location for the y-padding (can be `NULL`). [out caller-allocates][allow-none]

### gtk_source_gutter_renderer_set_padding ()

    void                gtk_source_gutter_renderer_set_padding
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gint xpad,
                                                             gint ypad);

Set the padding of the gutter renderer. Both `xpad` and `ypad` can be -1, which means the values will not be changed (this allows changing only one of the values).

`renderer` : | a GtkSourceGutterRenderer
`xpad` : | the x-padding
`ypad` : | the y-padding

### gtk_source_gutter_renderer_get_alignment ()

    void                gtk_source_gutter_renderer_get_alignment
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gfloat *xalign,
                                                             gfloat *yalign);

Get the x-alignment and y-alignment of the gutter renderer.

`renderer` : | a GtkSourceGutterRenderer
`xalign` : | return location for the x-alignment (can be `NULL`). [out caller-allocates][allow-none]
`yalign` : | return location for the y-alignment (can be `NULL`). [out caller-allocates][allow-none]

### gtk_source_gutter_renderer_set_alignment ()

    void                gtk_source_gutter_renderer_set_alignment
                                                            (GtkSourceGutterRenderer *renderer,
                                                             gfloat xalign,
                                                             gfloat yalign);

Set the alignment of the gutter renderer. Both `xalign` and `yalign` can be -1, which means the values will not be changed (this allows changing only one of the values).

`renderer` : | a GtkSourceGutterRenderer
`xalign` : | the x-alignment
`yalign` : | the y-alignment

### gtk_source_gutter_renderer_set_alignment_mode ()

    void                gtk_source_gutter_renderer_set_alignment_mode
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GtkSourceGutterRendererAlignmentMode mode);

Set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :xalign and :yalign).

`renderer` : | a GtkSourceGutterRenderer
`mode` : | a GtkSourceGutterRendererAlignmentMode

### gtk_source_gutter_renderer_get_window_type ()

    GtkTextWindowType   gtk_source_gutter_renderer_get_window_type
                                                            (GtkSourceGutterRenderer *renderer);

Get the GtkTextWindowType associated with the gutter renderer.

`renderer` : | a GtkSourceGutterRenderer
Returns : | a GtkTextWindowType

### gtk_source_gutter_renderer_get_view ()

    GtkTextView *       gtk_source_gutter_renderer_get_view (GtkSourceGutterRenderer *renderer);

Get the view associated to the gutter renderer

`renderer` : | a GtkSourceGutterRenderer
Returns : | a GtkTextView. [transfer none]

### gtk_source_gutter_renderer_get_alignment_mode ()

    GtkSourceGutterRendererAlignmentMode gtk_source_gutter_renderer_get_alignment_mode
                                                            (GtkSourceGutterRenderer *renderer);

Get the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :xalign and :yalign).

`renderer` : | a GtkSourceGutterRenderer
Returns : | a GtkSourceGutterRendererAlignmentMode

### gtk_source_gutter_renderer_get_background ()

    gboolean            gtk_source_gutter_renderer_get_background
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GdkRGBA *color);

Get the background color of the renderer.

`renderer` : | a GtkSourceGutterRenderer
`color` : | return value for a GdkRGBA. [out caller-allocates][allow-none]
Returns : | `TRUE` if the background color is set, `FALSE` otherwise

### gtk_source_gutter_renderer_set_background ()

    void                gtk_source_gutter_renderer_set_background
                                                            (GtkSourceGutterRenderer *renderer,
                                                             const GdkRGBA *color);

Set the background color of the renderer. If `color` is set to `NULL`, the renderer will not have a background color.

`renderer` : | a GtkSourceGutterRenderer
`color` : | a GdkRGBA or `NULL`. [allow-none]

### gtk_source_gutter_renderer_activate ()

    void                gtk_source_gutter_renderer_activate (GtkSourceGutterRenderer *renderer,
                                                             GtkTextIter *iter,
                                                             GdkRectangle *area,
                                                             GdkEvent *event);

Emits the ::activate signal of the renderer. This is called from GtkSourceGutter and should never have to be called manually.

`renderer` : | a GtkSourceGutterRenderer
`iter` : | a GtkTextIter at the start of the line where the renderer is activated
`area` : | a GdkRectangle of the cell area where the renderer is activated
`event` : | the event that triggered the activation

### gtk_source_gutter_renderer_query_activatable ()

    gboolean            gtk_source_gutter_renderer_query_activatable
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GtkTextIter *iter,
                                                             GdkRectangle *area,
                                                             GdkEvent *event);

Get whether the renderer is activatable at the location in `event`. This is called from GtkSourceGutter to determine whether a renderer is activatable using the mouse pointer.

`renderer` : | a GtkSourceGutterRenderer
`iter` : | a GtkTextIter at the start of the line to be activated
`area` : | a GdkRectangle of the cell area to be activated
`event` : | the event that triggered the query
Returns : | `TRUE` if the renderer can be activated, `FALSE` otherwise

### gtk_source_gutter_renderer_queue_draw ()

    void                gtk_source_gutter_renderer_queue_draw
                                                            (GtkSourceGutterRenderer *renderer);

Emits the ::queue-draw signal of the renderer. Call this from an implementation to inform that the renderer has changed such that it needs to redraw.

`renderer` : | a GtkSourceGutterRenderer

### gtk_source_gutter_renderer_query_tooltip ()

    gboolean            gtk_source_gutter_renderer_query_tooltip
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GtkTextIter *iter,
                                                             GdkRectangle *area,
                                                             gint x,
                                                             gint y,
                                                             GtkTooltip *tooltip);

Emits the ::query-tooltip signal. This function is called from GtkSourceGutter. Implementations can override the default signal handler or can connect to the signal externally.

`renderer` : | a GtkSourceGutterRenderer.
`iter` : | a GtkTextIter.
`area` : | a GdkRectangle.
`x` : | The x position of the tooltip.
`y` : | The y position of the tooltip.
`tooltip` : | a GtkTooltip.
Returns : | `TRUE` if the tooltip has been set, `FALSE` otherwise

### gtk_source_gutter_renderer_query_data ()

    void                gtk_source_gutter_renderer_query_data
                                                            (GtkSourceGutterRenderer *renderer,
                                                             GtkTextIter *start,
                                                             GtkTextIter *end,
                                                             GtkSourceGutterRendererState state);

Emit the ::query-data signal. This function is called to query for data just before rendering a cell. This is called from the GtkSourceGutter. Implementations can override the default signal handler or can connect a signal handler externally to the ::query-data signal.

`renderer` : | a GtkSourceGutterRenderer.
`start` : | a GtkTextIter.
`end` : | a GtkTextIter.
`state` : | a GtkSourceGutterRendererState.