GtkSourceGutter

## GtkSourceGutter GtkSourceGutter — Gutter object for GtkSourceView |

## Synopsis

    #include <gtksourceview/gtksourcegutter.h>

                        GtkSourceGutter;
    void                (*GtkSourceGutterDataFunc)          (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *cell,
                                                             gint line_number,
                                                             gboolean current_line,
                                                             gpointer data);
    void                (*GtkSourceGutterSizeFunc)          (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *cell,
                                                             gpointer data);
    GdkWindow *         gtk_source_gutter_get_window        (GtkSourceGutter *gutter);
    void                gtk_source_gutter_insert            (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer,
                                                             gint position);
    void                gtk_source_gutter_reorder           (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer,
                                                             gint position);
    void                gtk_source_gutter_remove            (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer);
    void                gtk_source_gutter_set_cell_data_func
                                                            (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer,
                                                             GtkSourceGutterDataFunc func,
                                                             gpointer func_data,
                                                             GDestroyNotify destroy);
    void                gtk_source_gutter_set_cell_size_func
                                                            (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer,
                                                             GtkSourceGutterSizeFunc func,
                                                             gpointer func_data,
                                                             GDestroyNotify destroy);
    void                gtk_source_gutter_queue_draw        (GtkSourceGutter *gutter);

## Object Hierarchy

      GObject
       +----GtkSourceGutter

## Properties

      "view"                     GtkSourceView*        : Read / Write / Construct Only
      "window-type"              GtkTextWindowType     : Read / Write / Construct Only

## Signals

      "cell-activated"                                 : Run Last
      "query-tooltip"                                  : Run Last

## Description

The GtkSourceGutter object represents the left and right gutters of the text view. It is used by GtkSourceView to draw the line numbers and category marks that might be present on a line. By packing additional GtkCellRenderer objects in the gutter, you can extend the gutter with your own custom drawings.

The gutter works very much the same way as cells rendered in a GtkTreeView. The concept is similar, with the exception that the gutter does not have an underlying GtkTreeModel. Instead, you should use gtk_source_gutter_set_cell_data_func to set a callback to fill in any of the cell renderers properties, given the line for which the cell is to be rendered. Renderers are inserted into the gutter at a certain position. The builtin line number renderer is at position

GTK_SOURCE_VIEW_GUTTER_POSITION_LINES (-30) and the marks renderer is at GTK_SOURCE_VIEW_GUTTER_POSITION_MARKS (-20). You can use these values to position custom renderers accordingly. The width of a cell renderer can be specified as either fixed (using

gtk_cell_renderer_set_fixed_size) or dynamic, in which case you must set gtk_source_gutter_set_cell_size_func. This callback is used to set the properties of the renderer such that gtk_cell_renderer_get_size yields the maximum width of the cell.

## Details

### GtkSourceGutter

    typedef struct _GtkSourceGutter GtkSourceGutter;

### GtkSourceGutterDataFunc ()

    void                (*GtkSourceGutterDataFunc)          (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *cell,
                                                             gint line_number,
                                                             gboolean current_line,
                                                             gpointer data);

### GtkSourceGutterSizeFunc ()

    void                (*GtkSourceGutterSizeFunc)          (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *cell,
                                                             gpointer data);

### gtk_source_gutter_get_window ()

    GdkWindow *         gtk_source_gutter_get_window        (GtkSourceGutter *gutter);

Get the GdkWindow of the gutter. The window will only be available when the gutter has at least one, non-zero width, cell renderer packed.

`gutter` : | a GtkSourceGutter
Returns : | the GdkWindow of the gutter, or `NULL` if the gutter has no window.

Since 2.8

### gtk_source_gutter_insert ()

    void                gtk_source_gutter_insert            (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer,
                                                             gint position);

Inserts `renderer` into `gutter` at `position`.

`gutter` : | a GtkSourceGutter
`renderer` : | a GtkCellRenderer
`position` : | the renderers position

Since 2.8

### gtk_source_gutter_reorder ()

    void                gtk_source_gutter_reorder           (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer,
                                                             gint position);

Reorders `renderer` in `gutter` to new `position`.

`gutter` : | a GtkSourceGutter
`renderer` : | a GtkCellRenderer
`position` : | the new renderer position

Since 2.8

### gtk_source_gutter_remove ()

    void                gtk_source_gutter_remove            (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer);

Removes `renderer` from `gutter`.

`gutter` : | a GtkSourceGutter
`renderer` : | a GtkCellRenderer

Since 2.8

### gtk_source_gutter_set_cell_data_func ()

    void                gtk_source_gutter_set_cell_data_func
                                                            (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer,
                                                             GtkSourceGutterDataFunc func,
                                                             gpointer func_data,
                                                             GDestroyNotify destroy);

Sets the GtkSourceGutterDataFunc to use for `renderer`. This function is used to setup the cell renderer properties for rendering the current cell.

`gutter` : | a GtkSourceGutter
`renderer` : | a GtkCellRenderer
`func` : | the GtkSourceGutterDataFunc to use
`func_data` : | the user data for `func`
`destroy` : | the destroy notification for `func_data`

Since 2.8

### gtk_source_gutter_set_cell_size_func ()

    void                gtk_source_gutter_set_cell_size_func
                                                            (GtkSourceGutter *gutter,
                                                             GtkCellRenderer *renderer,
                                                             GtkSourceGutterSizeFunc func,
                                                             gpointer func_data,
                                                             GDestroyNotify destroy);

Sets the GtkSourceGutterSizeFunc to use for `renderer`. This function is used to setup the cell renderer properties for measuring the maximum size of the cell.

`gutter` : | a GtkSourceGutter
`renderer` : | a GtkCellRenderer
`func` : | the GtkSourceGutterSizeFunc to use
`func_data` : | the user data for `func`
`destroy` : | the destroy notification for `func_data`

Since 2.8

### gtk_source_gutter_queue_draw ()

    void                gtk_source_gutter_queue_draw        (GtkSourceGutter *gutter);

Invalidates the drawable area of the gutter. You can use this to force a redraw of the gutter if something has changed and needs to be redrawn.

`gutter` : | a GtkSourceGutter

Since 2.8

## Property Details

### The `"view"` property

      "view"                     GtkSourceView*        : Read / Write / Construct Only

The GtkSourceView of the gutter

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

      "window-type"              GtkTextWindowType     : Read / Write / Construct Only

The text window type on which the window is placed

Default value: GTK_TEXT_WINDOW_PRIVATE

## Signal Details

### The `"cell-activated"` signal

    void                user_function                      (GtkSourceGutter *gutter,
                                                            GtkCellRenderer *renderer,
                                                            GtkTextIter     *iter,
                                                            GdkEvent        *event,
                                                            gpointer         user_data)      : Run Last

Emitted when a cell has been activated (for instance when there was a button press on the cell). The signal is only emitted for cells that have the activatable property set to `TRUE`.

`gutter` : | the GtkSourceGutter
`renderer` : | the GtkCellRenderer which was activated
`iter` : | the GtkTextIter at which the cell was activated
`event` : | the GdkEvent with which the cell was activated
`user_data` : | user data set when the signal handler was connected.

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

    gboolean            user_function                      (GtkSourceGutter *gutter,
                                                            GtkCellRenderer *renderer,
                                                            GtkTextIter     *iter,
                                                            GtkTooltip      *tooltip,
                                                            gpointer         user_data)      : Run Last

Emitted when a tooltip is requested for a specific cell. Signal handlers can return `TRUE` to notify the tooltip has been handled.

`gutter` : | the GtkSourceGutter
`renderer` : | the GtkCellRenderer which was activated
`iter` : | the GtkTextIter at which the cell was activated
`tooltip` : | the GtkTooltip
`user_data` : | user data set when the signal handler was connected.

## See Also

GtkSourceView