gtksourceview2.Gutter — Mark object for gtksourceview.SourceView
class gtksourceview2.Gutter(gobject.GObject): |
|
def callback( | |
def callback( |
The gtksourceview2.Gutter
object represents the left and right gutters of the text view. It is used by
gtksourceview2.View
to draw the line numbers and category marks that might be present on a line.
By packing additional
gtk.CellRenderer
objects in the gutter, you can extend the gutter by 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
gtksourceview2.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.CellRenderer.set_fixed_size
()
) or dynamic, in which case you MUST set
gtksourceview2.Gutter.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.
def get_window()
Returns : | the gtk.gdk.Window
of the gutter, or None if the gutter has no window. |
The get_window
() method returns the
gtk.gdk.Window
of the gutter. The window will only be available when the gutter has at
least one, non-zero width, cell renderer packed.
def insert(renderer
, position
)
| a gtk.CellRenderer
|
| the renderers position. |
The insert
() method inserts renderer into gutter at position.
def queue_draw()
The queue_draw
() method 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.
def remove(renderer
)
| a gtk.CellRenderer
|
The renderer
() method removes renderer from gutter.
def reorder(renderer
, position
)
| a gtk.CellRenderer
|
| the new renderer position. |
The renderer
() method reorders renderer in gutter to new position.
def set_cell_data_func(renderer
, func
, func_data
)
| a gtk.CellRenderer
|
| the function. |
| the data to pass whitin func. |
The set_cell_data_func
() method sets the func to use for renderer.
This function is used to setup the cell renderer properties for rendering the current cell.
def gutterdatafunc(cell, line_number, current_line, user_data)
Where cell is the gtk.CellRenderer
to use,
line_number is the line number for the gutter and current_line is a boolean indicating if it's the current line,
user_data is the data passed to set_cell_data_func().
def set_cell_data_func(renderer
, func
, func_data
)
| a gtk.CellRenderer
|
| the function. |
| the data to pass whitin func. |
The set_cell_size_func
() method sets the func to use for renderer.
This function is used to setup the cell renderer properties for measuring the maximum size of the cell.
def guttersizefunc(cell, user_data)
Where cell is the gtk.CellRenderer
to use,
and user_data is the data passed to set_cell_data_func().
def callback(gutter
, renderer
, iter
, event
, user_param1
, ...
)
| the gtksourceview2.Gutter |
| the gtk.CellRenderer which was activated.
|
| the gtk.TextIter at which the cell was activated
|
| the gtk.gdk.Event with which the cell was activated
|
| the first user parameter (if any) specified with the
connect ()
method |
| additional user parameters (if any) |
The "cell-activated" signal is 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
.
def callback(gutter
, renderer
, iter
, tooltip
, user_param1
, ...
)
| the gtksourceview2.Gutter |
| the gtk.CellRenderer which was activated.
|
| the gtk.TextIter at which the cell was activated
|
| the gtk.Tooltip
|
| the first user parameter (if any) specified with the
connect ()
method |
| additional user parameters (if any) |
The "query-tooltip" signal is emitted when a tooltip is requested for a specific cell.
Signal handlers can return True
to notify the tooltip has been handled.