GtkSource.GutterRenderer

g GObject.InitiallyUnowned GObject.InitiallyUnowned GtkSource.GutterRenderer GtkSource.GutterRenderer GObject.InitiallyUnowned->GtkSource.GutterRenderer GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned

Subclasses:GtkSource.GutterRendererPixbuf, GtkSource.GutterRendererText

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
  activate (iter, area, event)
  begin (cr, background_area, cell_area, start, end)
  draw (cr, background_area, cell_area, start, end, state)
  end ()
  get_alignment ()
  get_alignment_mode ()
  get_background ()
  get_padding ()
  get_size ()
  get_view ()
  get_visible ()
  get_window_type ()
  query_activatable (iter, area, event)
  query_data (start, end, state)
  query_tooltip (iter, area, x, y, tooltip)
  queue_draw ()
  set_alignment (xalign, yalign)
  set_alignment_mode (mode)
  set_background (color)
  set_padding (xpad, ypad)
  set_size (size)
  set_visible (visible)

Virtual Methods

Inherited:GObject.Object (7)
  do_activate (iter, area, event)
  do_begin (cr, background_area, cell_area, start, end)
  do_change_buffer (old_buffer)
  do_change_view (old_view)
  do_draw (cr, background_area, cell_area, start, end, state)
  do_end ()
  do_query_activatable (iter, area, event)
  do_query_data (start, end, state)
  do_query_tooltip (iter, area, x, y, tooltip)
  do_queue_draw ()

Properties

Name Type Flags Short Description
alignment-mode GtkSource.GutterRendererAlignmentMode r/w/c The alignment mode
background-rgba Gdk.RGBA r/w The background color
background-set bool r/w/c Whether the background color is set
size int r/w/c The size
view Gtk.TextView r The view
visible bool r/w/c Visible
window-type Gtk.TextWindowType r The window type
xalign float r/w/c The x-alignment
xpad int r/w/c The x-padding
yalign float r/w/c The y-alignment
ypad int r/w/c The y-padding

Signals

Inherited:GObject.Object (1)
Name Short Description
activate The ::activate signal is emitted when the renderer is activated.
query-activatable The ::query-activatable signal is emitted when the renderer can possibly be activated.
query-data The ::query-data signal is emitted when the renderer needs to be filled with data just before a cell is drawn.
query-tooltip The ::query-tooltip signal is emitted when the renderer can show a tooltip.
queue-draw The ::queue-draw signal is emitted when the renderer needs to be redrawn.

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent GObject.InitiallyUnowned r  

Class Details

class GtkSource.GutterRenderer(**kwargs)
Bases:GObject.InitiallyUnowned
Abstract:Yes
Structure:GtkSource.GutterRendererClass
activate(iter, area, event)
Parameters:

Emits the GtkSource.GutterRenderer ::activate signal of the renderer. This is called from GtkSource.Gutter and should never have to be called manually.

begin(cr, background_area, cell_area, start, end)
Parameters:

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.

draw(cr, background_area, cell_area, start, end, state)
Parameters:

Main renderering method. Implementations should implement this method to draw onto the cairo context. The background_area indicates the total area of the cell to be drawn. The cell_area indicates the area where content can be drawn (text, images, etc).

The background_area is the cell_area plus the padding on each side (two times the GtkSource.GutterRenderer :xpad horizontally and two times the GtkSource.GutterRenderer :ypad vertically, so that the cell_area is centered inside background_area).

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.

end()

Called when drawing a region of lines has ended.

get_alignment()
Returns:
xalign:return location for the x-alignment, or None to ignore.
yalign:return location for the y-alignment, or None to ignore.
Return type:(xalign: float, yalign: float)

Get the x-alignment and y-alignment of the gutter renderer.

get_alignment_mode()
Returns:a GtkSource.GutterRendererAlignmentMode
Return type:GtkSource.GutterRendererAlignmentMode

Get the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :xalign and :yalign).

get_background()
Returns:True if the background color is set, False otherwise
color:return value for a Gdk.RGBA
Return type:(bool, color: Gdk.RGBA)

Get the background color of the renderer.

get_padding()
Returns:
xpad:return location for the x-padding, or None to ignore.
ypad:return location for the y-padding, or None to ignore.
Return type:(xpad: int, ypad: int)

Get the x-padding and y-padding of the gutter renderer.

get_size()
Returns:the size of the renderer.
Return type:int

Get the size of the renderer.

get_view()
Returns:a Gtk.TextView
Return type:Gtk.TextView

Get the view associated to the gutter renderer

get_visible()
Returns:True if the renderer is visible, False otherwise
Return type:bool

Get whether the gutter renderer is visible.

get_window_type()
Returns:a Gtk.TextWindowType
Return type:Gtk.TextWindowType

Get the Gtk.TextWindowType associated with the gutter renderer.

query_activatable(iter, area, event)
Parameters:
Returns:

True if the renderer can be activated, False otherwise

Return type:

bool

Get whether the renderer is activatable at the location in event. This is called from GtkSource.Gutter to determine whether a renderer is activatable using the mouse pointer.

query_data(start, end, state)
Parameters:

Emit the GtkSource.GutterRenderer ::query-data signal. This function is called to query for data just before rendering a cell. This is called from the GtkSource.Gutter. Implementations can override the default signal handler or can connect a signal handler externally to the GtkSource.GutterRenderer ::query-data signal.

query_tooltip(iter, area, x, y, tooltip)
Parameters:
Returns:

True if the tooltip has been set, False otherwise

Return type:

bool

Emits the GtkSource.GutterRenderer ::query-tooltip signal. This function is called from GtkSource.Gutter. Implementations can override the default signal handler or can connect to the signal externally.

queue_draw()

Emits the GtkSource.GutterRenderer ::queue-draw signal of the renderer. Call this from an implementation to inform that the renderer has changed such that it needs to redraw.

set_alignment(xalign, yalign)
Parameters:
  • xalign (float) – the x-alignment
  • yalign (float) – the y-alignment

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

xalign is the horizontal alignment. Set to 0 for a left alignment. 1 for a right alignment. And 0.5 for centering the cells. yalign is the vertical alignment. Set to 0 for a top alignment. 1 for a bottom alignment.

set_alignment_mode(mode)
Parameters:mode (GtkSource.GutterRendererAlignmentMode) – a GtkSource.GutterRendererAlignmentMode

Set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :xalign and :yalign).

set_background(color)
Parameters:color (Gdk.RGBA or None) – a Gdk.RGBA or None

Set the background color of the renderer. If color is set to None, the renderer will not have a background color.

set_padding(xpad, ypad)
Parameters:
  • xpad (int) – the x-padding
  • ypad (int) – the y-padding

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

xpad is the left and right padding. ypad is the top and bottom padding.

set_size(size)
Parameters:size (int) – the size

Sets the size of the renderer. A value of -1 specifies that the size is to be determined dynamically.

set_visible(visible)
Parameters:visible (bool) – the visibility

Set whether the gutter renderer is visible.

do_activate(iter, area, event) virtual
Parameters:

Emits the GtkSource.GutterRenderer ::activate signal of the renderer. This is called from GtkSource.Gutter and should never have to be called manually.

do_begin(cr, background_area, cell_area, start, end) virtual
Parameters:

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.

do_change_buffer(old_buffer) virtual
Parameters:old_buffer (Gtk.TextBuffer or None) – the old Gtk.TextBuffer.

This is called when the text buffer changes for renderer.

do_change_view(old_view) virtual
Parameters:old_view (Gtk.TextView or None) – the old Gtk.TextView.

This is called when the text view changes for renderer.

do_draw(cr, background_area, cell_area, start, end, state) virtual
Parameters:

Main renderering method. Implementations should implement this method to draw onto the cairo context. The background_area indicates the total area of the cell to be drawn. The cell_area indicates the area where content can be drawn (text, images, etc).

The background_area is the cell_area plus the padding on each side (two times the GtkSource.GutterRenderer :xpad horizontally and two times the GtkSource.GutterRenderer :ypad vertically, so that the cell_area is centered inside background_area).

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.

do_end() virtual

Called when drawing a region of lines has ended.

do_query_activatable(iter, area, event) virtual
Parameters:
Returns:

True if the renderer can be activated, False otherwise

Return type:

bool

Get whether the renderer is activatable at the location in event. This is called from GtkSource.Gutter to determine whether a renderer is activatable using the mouse pointer.

do_query_data(start, end, state) virtual
Parameters:

Emit the GtkSource.GutterRenderer ::query-data signal. This function is called to query for data just before rendering a cell. This is called from the GtkSource.Gutter. Implementations can override the default signal handler or can connect a signal handler externally to the GtkSource.GutterRenderer ::query-data signal.

do_query_tooltip(iter, area, x, y, tooltip) virtual
Parameters:
Returns:

True if the tooltip has been set, False otherwise

Return type:

bool

Emits the GtkSource.GutterRenderer ::query-tooltip signal. This function is called from GtkSource.Gutter. Implementations can override the default signal handler or can connect to the signal externally.

do_queue_draw() virtual

Emits the GtkSource.GutterRenderer ::queue-draw signal of the renderer. Call this from an implementation to inform that the renderer has changed such that it needs to redraw.

Signal Details

GtkSource.GutterRenderer.signals.activate(gutter_renderer, iter, area, event)
Signal Name:

activate

Flags:

RUN_LAST

Parameters:

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

GtkSource.GutterRenderer.signals.query_activatable(gutter_renderer, iter, area, event)
Signal Name:

query-activatable

Flags:

RUN_LAST

Parameters:
Return type:

bool

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

GtkSource.GutterRenderer.signals.query_data(gutter_renderer, start, end, state)
Signal Name:

query-data

Flags:

RUN_LAST

Parameters:

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.

GtkSource.GutterRenderer.signals.query_tooltip(gutter_renderer, iter, area, x, y, tooltip)
Signal Name:

query-tooltip

Flags:

RUN_LAST

Parameters:
Return type:

bool

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

GtkSource.GutterRenderer.signals.queue_draw(gutter_renderer)
Signal Name:queue-draw
Flags:RUN_LAST
Parameters:gutter_renderer (GtkSource.GutterRenderer) – The object which received the signal

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

Property Details

GtkSource.GutterRenderer.props.alignment_mode
Name:alignment-mode
Type:GtkSource.GutterRendererAlignmentMode
Default Value:GtkSource.GutterRendererAlignmentMode.CELL
Flags:READABLE, WRITABLE, 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.

GtkSource.GutterRenderer.props.background_rgba
Name:background-rgba
Type:Gdk.RGBA
Default Value:None
Flags:READABLE, WRITABLE

The background color

GtkSource.GutterRenderer.props.background_set
Name:background-set
Type:bool
Default Value:False
Flags:READABLE, WRITABLE, CONSTRUCT

Whether the background color is set

GtkSource.GutterRenderer.props.size
Name:size
Type:int
Default Value:0
Flags:READABLE, WRITABLE, CONSTRUCT

The size

GtkSource.GutterRenderer.props.view
Name:view
Type:Gtk.TextView
Default Value:None
Flags:READABLE

The view on which the renderer is placed.

GtkSource.GutterRenderer.props.visible
Name:visible
Type:bool
Default Value:True
Flags:READABLE, WRITABLE, CONSTRUCT

The visibility of the renderer.

GtkSource.GutterRenderer.props.window_type
Name:window-type
Type:Gtk.TextWindowType
Default Value:Gtk.TextWindowType.PRIVATE
Flags:READABLE

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

GtkSource.GutterRenderer.props.xalign
Name:xalign
Type:float
Default Value:0.0
Flags:READABLE, WRITABLE, CONSTRUCT

The horizontal alignment of the renderer. Set to 0 for a left alignment. 1 for a right alignment. And 0.5 for centering the cells. A value lower than 0 doesn’t modify the alignment.

GtkSource.GutterRenderer.props.xpad
Name:xpad
Type:int
Default Value:0
Flags:READABLE, WRITABLE, CONSTRUCT

The left and right padding of the renderer.

GtkSource.GutterRenderer.props.yalign
Name:yalign
Type:float
Default Value:0.0
Flags:READABLE, WRITABLE, CONSTRUCT

The vertical alignment of the renderer. Set to 0 for a top alignment. 1 for a bottom alignment. And 0.5 for centering the cells. A value lower than 0 doesn’t modify the alignment.

GtkSource.GutterRenderer.props.ypad
Name:ypad
Type:int
Default Value:0
Flags:READABLE, WRITABLE, CONSTRUCT

The top and bottom padding of the renderer.