gtksourceviewmm: gtksourceview::SourceGutter Class Reference

gtksourceviewmm 2.10.3

- Main Page
- Related Pages
- Modules
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Related Functions
gtksourceview::SourceGutter Class Reference

Gutter object for SourceView. More...

`#include <gtksourceviewmm/sourcegutter.h>`

Inheritance diagram for gtksourceview::SourceGutter:
[legend]

List of all members.

## Public Types
typedef sigc::slot< void, Gtk::CellRenderer*, int, bool > | SlotData
| Slot holding a function.
typedef sigc::slot< void, Gtk::CellRenderer* > | SlotSize
| Slot holding a function.
## 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 (Gtk::CellRenderer* renderer, int position)
| Inserts renderer into a gutter at position.
void | reorder (Gtk::CellRenderer* renderer, int position)
| Reorders renderer in a gutter to new position.
void | remove (Gtk::CellRenderer* renderer)
| Removes renderer from a gutter.
void | queue_draw ()
| Invalidates the drawable area of the gutter.
void | set_cell_data_func (Gtk::CellRenderer* renderer, const SlotData& slot)
| Sets the SlotData to use for renderer.
void | set_cell_size_func (Gtk::CellRenderer* renderer, const SlotSize& slot)
| Sets the SlotSize to use for renderer.
void | reset_cell_data_func (Gtk::CellRenderer* renderer)
| Resets a SlotData to use for renderer.
void | reset_cell_size_func (Gtk::CellRenderer* renderer)
| Resets a SlotSize to use for renderer.
Glib::PropertyProxy_ReadOnly < SourceView* > | property_view () const
| The gutters' GtkSourceView.
Glib::PropertyProxy_ReadOnly < Gtk::TextWindowType > | property_window_type () const
| The gutters text window type.
Glib::SignalProxy3< void, Gtk::CellRenderer *, const Gtk::TextIter&, GdkEvent* > | signal_cell_activated ()
| Emitted when a cell has been activated (for instance when there was a button press on the cell).
Glib::SignalProxy3< bool, Gtk::CellRenderer *, const Gtk::TextIter &, const Glib::RefPtr< Gtk::Tooltip >& > | signal_query_tooltip ()
| Emitted when a tooltip is requested for a specific cell.
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr < gtksourceview::SourceGutter > | wrap (GtkSourceGutter* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Gutter object for SourceView.

The SourceGutter object represents the left and right gutters of the text view. It is used by SourceView 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 SourceView::gutter_position_lines (-30) and the marks renderer is at SourceView::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 Typedef Documentation

typedef sigc::slot<void, Gtk::CellRenderer* , int , bool > gtksourceview::SourceGutter::SlotData

Slot holding a function.

Prototype:
  `void on_cell_data(Gtk::CellRenderer& cell, int line_number, bool current_line);`

Since gtksourceviewmm 2.10:

typedef sigc::slot<void, Gtk::CellRenderer* > gtksourceview::SourceGutter::SlotSize

Slot holding a function.

Prototype:
  `void on_cell_size(Gtk::CellRenderer& cell);`

Since gtksourceviewmm 2.10:

## Member Function Documentation

Glib::RefPtr<Gdk::Window> gtksourceview::SourceGutter::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> gtksourceview::SourceGutter::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 gtksourceview::SourceGutter::insert | ( | Gtk::CellRenderer * | renderer,
|  | int | position
| ) |  |

Inserts renderer into a gutter at position.

Parameters:

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

Since gtksourceviewmm 2.10:

Glib::PropertyProxy_ReadOnly<SourceView*> gtksourceview::SourceGutter::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> gtksourceview::SourceGutter::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.

void gtksourceview::SourceGutter::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.10:

void gtksourceview::SourceGutter::remove | ( | Gtk::CellRenderer * | renderer | ) |

Removes renderer from a gutter.

Parameters:

  renderer | A Gtk::CellRenderer.

Since gtksourceviewmm 2.10:

void gtksourceview::SourceGutter::reorder | ( | Gtk::CellRenderer * | renderer,
|  | int | position
| ) |  |

Reorders renderer in a gutter to new position.

Parameters:

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

Since gtksourceviewmm 2.10:

void gtksourceview::SourceGutter::reset_cell_data_func | ( | Gtk::CellRenderer * | renderer | ) |

Resets a SlotData to use for renderer.

Parameters:

  renderer | A Gtk::CellRenderer.

Since gtksourceviewmm 2.10:

void gtksourceview::SourceGutter::reset_cell_size_func | ( | Gtk::CellRenderer * | renderer | ) |

Resets a SlotSize to use for renderer.

Parameters:

  renderer | A Gtk::CellRenderer.

Since gtksourceviewmm 2.10:

void gtksourceview::SourceGutter::set_cell_data_func | ( | Gtk::CellRenderer * | renderer,
|  | const SlotData& | slot
| ) |  |

Sets the SlotData to use for renderer.

This function is used to setup the cell renderer properties for rendering the current cell.

Parameters:

  renderer | A Gtk::CellRenderer.
  slot | A slot containing function to use.

Since gtksourceviewmm 2.10:

void gtksourceview::SourceGutter::set_cell_size_func | ( | Gtk::CellRenderer * | renderer,
|  | const SlotSize& | slot
| ) |  |

Sets the SlotSize to use for renderer.

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

Parameters:

  renderer | A Gtk::CellRenderer.
  slot | A slot containing function to use.

Since gtksourceviewmm 2.10:

Glib::SignalProxy3< void,Gtk::CellRenderer*,const Gtk::TextIter&,GdkEvent* > gtksourceview::SourceGutter::signal_cell_activated | ( |  | ) |

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

Handler parameters:
  renderer A Gtk::CellRenderer which was activated. iter The Gtk::TextIter at which the cell was activated. event An event with which the cell was activated.

Since gtksourceviewmm 2.10:

Prototype:
  `void on_my_cell_activated(Gtk::CellRenderer* renderer, const Gtk::TextIter& iter, GdkEvent* event)`

Glib::SignalProxy3< bool,Gtk::CellRenderer*,const Gtk::TextIter&,const Glib::RefPtr<Gtk::Tooltip>& > gtksourceview::SourceGutter::signal_query_tooltip | ( |  | ) |

Emitted when a tooltip is requested for a specific cell.

Signal handlers can return `true` to notify the tooltip has been handled.

Handler parameters:
  renderer A Gtk::CellRenderer which was activated. iter The Gtk::TextIter at which the cell was activated. tooltip A Gtk::Tooltip.

Returns:
  `true` if tooltip has been handled, otherwise `false`.

Since gtksourceviewmm 2.10:

Prototype:
  `bool on_my_query_tooltip(Gtk::CellRenderer* renderer, const Gtk::TextIter& iter, const Glib::RefPtr<Gtk::Tooltip>& tooltip)`

## Friends And Related Function Documentation

Glib::RefPtr< gtksourceview::SourceGutter > 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.