## GtkSourceGutterRenderer GtkSourceGutterRenderer |

## Synopsis

    #include <gtksourceview/gtksource.h>

                        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);

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----GtkSourceGutterRenderer
                   +----GtkSourceGutterRendererPixbuf
                   +----GtkSourceGutterRendererText

## Properties

      "alignment-mode"           GtkSourceGutterRendererAlignmentMode  : Read / Write / Construct
      "background-rgba"          GdkRGBA*              : Read / Write
      "background-set"           gboolean              : Read / Write / Construct
      "size"                     gint                  : Read / Write / Construct
      "view"                     GtkTextView*          : Read
      "visible"                  gboolean              : Read / Write / Construct
      "window-type"              GtkTextWindowType     : Read
      "xalign"                   gfloat                : Read / Write / Construct
      "xpad"                     gint                  : Read / Write / Construct
      "yalign"                   gfloat                : Read / Write / Construct
      "ypad"                     gint                  : Read / Write / Construct

## Signals

      "activate"                                       : Run Last
      "query-activatable"                              : Run Last
      "query-data"                                     : Run Last
      "query-tooltip"                                  : Run Last
      "queue-draw"                                     : Run Last

## Description

## Details

### GtkSourceGutterRenderer

    typedef struct _GtkSourceGutterRenderer GtkSourceGutterRenderer;

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

The alignment mode of the renderer, when a cell spans multiple lines (due to text wrapping).

`GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_CELL` | The full cell.
`GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_FIRST` | The first line.
`GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_LAST` | The last line.

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

## Property Details

### The `"alignment-mode"` property

      "alignment-mode"           GtkSourceGutterRendererAlignmentMode  : Read / Write / Construct

The alignment mode of the renderer. This can be used to indicate that in the case a cell spans multiple lines (due to text wrapping) the alignment should work on either the full cell, the first line or the last line.

Default value: GTK_SOURCE_GUTTER_RENDERER_ALIGNMENT_MODE_CELL

### The `"background-rgba"` property

      "background-rgba"          GdkRGBA*              : Read / Write

The background color.

### The `"background-set"` property

      "background-set"           gboolean              : Read / Write / Construct

Whether the background color is set.

Default value: FALSE

### The `"size"` property

      "size"                     gint                  : Read / Write / Construct

The size.

Allowed values: >= 0

Default value: 0

### The `"view"` property

      "view"                     GtkTextView*          : Read

The view on which the renderer is placed.

### The `"visible"` property

      "visible"                  gboolean              : Read / Write / Construct

The visibility of the renderer.

Default value: TRUE

### The `"window-type"` property

      "window-type"              GtkTextWindowType     : Read

The window type of the view on which the renderer is placed (left, or right).

Default value: GTK_TEXT_WINDOW_PRIVATE

### The `"xalign"` property

      "xalign"                   gfloat                : Read / Write / Construct

The x-alignment of the renderer.

Allowed values: [-1,1]

Default value: 0

### The `"xpad"` property

      "xpad"                     gint                  : Read / Write / Construct

The x-padding of the renderer.

Allowed values: >= -1

Default value: 0

### The `"yalign"` property

      "yalign"                   gfloat                : Read / Write / Construct

The y-alignment of the renderer.

Allowed values: [-1,1]

Default value: 0

### The `"ypad"` property

      "ypad"                     gint                  : Read / Write / Construct

The y-padding of the renderer.

Allowed values: >= -1

Default value: 0

## Signal Details

### The `"activate"` signal

    void                user_function                      (GtkSourceGutterRenderer *renderer,
                                                            GtkTextIter             *iter,
                                                            GdkRectangle            *area,
                                                            GdkEvent                *event,
                                                            gpointer                 user_data)      : Run Last

The ::activate signal is emitted when the renderer is activated.

`renderer` : | the GtkSourceGutterRenderer who emits the signal
`iter` : | a GtkTextIter
`area` : | a GdkRectangle
`event` : | the event that caused the activation
`user_data` : | user data set when the signal handler was connected.

### The `"query-activatable"` signal

    gboolean            user_function                      (GtkSourceGutterRenderer *renderer,
                                                            GtkTextIter             *iter,
                                                            GdkRectangle            *area,
                                                            GdkEvent                *event,
                                                            gpointer                 user_data)      : Run Last

The ::query-activatable signal is emitted when the renderer can possibly be activated.

`renderer` : | the GtkSourceGutterRenderer who emits the signal
`iter` : | a GtkTextIter
`area` : | a GdkRectangle
`event` : | the GdkEvent that is causing the activatable query
`user_data` : | user data set when the signal handler was connected.

### The `"query-data"` signal

    void                user_function                      (GtkSourceGutterRenderer     *renderer,
                                                            GtkTextIter                 *start,
                                                            GtkTextIter                 *end,
                                                            GtkSourceGutterRendererState state,
                                                            gpointer                     user_data)      : Run Last

The ::query-data signal is emitted when the renderer needs to be filled with data just before a cell is drawn. This can be used by general renderer implementations to allow render data to be filled in externally.

`renderer` : | the GtkSourceGutterRenderer who emits the signal
`start` : | a GtkTextIter
`end` : | a GtkTextIter
`state` : | the renderer state
`user_data` : | user data set when the signal handler was connected.

### The `"query-tooltip"` signal

    gboolean            user_function                      (GtkSourceGutterRenderer *renderer,
                                                            GtkTextIter             *iter,
                                                            GdkRectangle            *area,
                                                            gint                     x,
                                                            gint                     y,
                                                            GtkTooltip              *tooltip,
                                                            gpointer                 user_data)      : Run Last

The ::query-tooltip signal is emitted when the renderer can show a tooltip.

`renderer` : | the GtkSourceGutterRenderer who emits the signal
`iter` : | a GtkTextIter
`area` : | a GdkRectangle
`x` : | the x position (in window coordinates)
`y` : | the y position (in window coordinates)
`tooltip` : | a GtkTooltip
`user_data` : | user data set when the signal handler was connected.

### The `"queue-draw"` signal

    void                user_function                      (GtkSourceGutterRenderer *renderer,
                                                            gpointer                 user_data)      : Run Last

The ::queue-draw signal is emitted when the renderer needs to be redrawn. Use `gtk_source_gutter_renderer_queue_draw()` to emit this signal from an implementation of the GtkSourceGutterRenderer interface.

`renderer` : | the GtkSourceGutterRenderer who emits the signal
`user_data` : | user data set when the signal handler was connected.