gtksourceviewmm: Gsv::Gutter Class Reference

gtksourceviewmm 3.2.0

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Related Functions
Gsv::Gutter Class Reference

Gutter object for View. More...

`#include <gtksourceviewmm/gutter.h>`

Inheritance diagram for Gsv::Gutter:
[legend]

List of all members.

## Public Member Functions
GtkSourceGutter* | gobj ()
| Provides access to the underlying C GObject.
const GtkSourceGutter* | gobj () const
| Provides access to the underlying C GObject.
GtkSourceGutter* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< Gdk::Window > | get_window ()
| Get the Gdk::Window of the gutter.
Glib::RefPtr< const Gdk::Window > | get_window () const
| Get the Gdk::Window of the gutter.
void | insert (GutterRenderer* renderer, int position)
| Insert renderer into the gutter.
void | remove (GutterRenderer* renderer)
| Removes renderer from gutter.
void | reorder (GutterRenderer* renderer, int position)
| Reorders renderer in gutter to new position.
void | queue_draw ()
| Invalidates the drawable area of the gutter.
GutterRenderer* | get_renderer_at_pos (int x, int y)
| Finds the Gtk::SourceGutterRenderer at (x, y).
const GutterRenderer* | get_renderer_at_pos (int x, int y) const
| Finds the Gtk::SourceGutterRenderer at (x, y).
Glib::PropertyProxy_ReadOnly < View* > | property_view () const
| The gutters' GtkSourceView.
Glib::PropertyProxy_ReadOnly < Gtk::TextWindowType > | property_window_type () const
| The gutters text window type.
Glib::PropertyProxy< int > | property_xpad ()
| The x-padding.
Glib::PropertyProxy_ReadOnly< int > | property_xpad () const
| The x-padding.
Glib::PropertyProxy< int > | property_ypad ()
| The y-padding.
Glib::PropertyProxy_ReadOnly< int > | property_ypad () const
| The y-padding.
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gsv::Gutter > | wrap (GtkSourceGutter* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Gutter object for View.

The Gutter object represents the left and right gutters of the text view. It is used by View to draw the line numbers and category marks that might be present on a line. By packing additional CellRenderer 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 Gtk::TreeView. The concept is similar, with the exception that the gutter does not have an underlying Gtk::TreeModel. Instead, you should use 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 View::gutter_position_lines (-30) and the marks renderer is at 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::CellRenderer::set_fixed_size()) or dynamic, in which case you must set set_cell_size_func(). This callback is used to set the properties of the renderer such that Gtk::CellRenderer::get_size() yields the maximum width of the cell.

Since gtksourceviewmm 2.10:

## Member Function Documentation

GutterRenderer* Gsv::Gutter::get_renderer_at_pos | ( | int | x,
|  | int | y
| ) |  |

Finds the Gtk::SourceGutterRenderer at (x, y).

Parameters:

  x | The x position to get identified.
  y | The y position to get identified.

Returns:
  The renderer at (x, y) or `0`.

const GutterRenderer* Gsv::Gutter::get_renderer_at_pos | ( | int | x,
|  | int | y
| ) |  | const

Finds the Gtk::SourceGutterRenderer at (x, y).

Parameters:

  x | The x position to get identified.
  y | The y position to get identified.

Returns:
  The renderer at (x, y) or `0`.

Glib::RefPtr<Gdk::Window> Gsv::Gutter::get_window | ( |  | ) |

Get the Gdk::Window of the gutter.

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

Returns:
  The Gdk::Window of the gutter, or empty Glib::RefPtr if the gutter has no window.

Since gtksourceviewmm 2.10:

Glib::RefPtr<const Gdk::Window> Gsv::Gutter::get_window | ( |  | ) | const

Get the Gdk::Window of the gutter.

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

Returns:
  The Gdk::Window of the gutter, or empty Glib::RefPtr if the gutter has no window.

Since gtksourceviewmm 2.10:

void Gsv::Gutter::insert | ( | GutterRenderer * | renderer,
|  | int | position
| ) |  |

Insert renderer into the gutter.

If renderer is yet unowned then gutter claims its ownership. Otherwise just increases renderer's reference count. renderer cannot be already inserted to another gutter.

Since gtksourceviewmm 3.0:

Parameters:

  renderer | A gutter renderer (must inherit from Gtk::SourceGutterRenderer).
  position | The renderer position.

Returns:
  `true` if operation succeeded. Otherwise `false`.

Glib::PropertyProxy_ReadOnly<View*> Gsv::Gutter::property_view | ( |  | ) | const

The gutters' GtkSourceView.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<Gtk::TextWindowType> Gsv::Gutter::property_window_type | ( |  | ) | const

The gutters text window type.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gsv::Gutter::property_xpad | ( |  | ) |

The x-padding.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gsv::Gutter::property_xpad | ( |  | ) | const

The x-padding.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy<int> Gsv::Gutter::property_ypad | ( |  | ) |

The y-padding.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<int> Gsv::Gutter::property_ypad | ( |  | ) | const

The y-padding.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gsv::Gutter::queue_draw | ( |  | ) |

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.

Since gtksourceviewmm 2.8:

void Gsv::Gutter::remove | ( | GutterRenderer * | renderer | ) |

Removes renderer from gutter.

Since gtksourceviewmm 2.8:

Parameters:

  renderer | A Gtk::SourceGutterRenderer.

void Gsv::Gutter::reorder | ( | GutterRenderer * | renderer,
|  | int | position
| ) |  |

Reorders renderer in gutter to new position.

Since gtksourceviewmm 2.8:

Parameters:

  renderer | A Gtk::CellRenderer.
  position | The new renderer position.

## Friends And Related Function Documentation

Glib::RefPtr< Gsv::Gutter > wrap | ( | GtkSourceGutter * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.