GtkSource.GutterRenderer¶
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w |
The alignment mode |
||
r |
Information about the lines to render |
||
r |
The view |
||
r/w |
The x-alignment |
||
r/w |
The x-padding |
||
r/w |
The y-alignment |
||
r/w |
The y-padding |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The signal is emitted when the renderer is activated. |
|
The signal is emitted when the renderer can possibly be activated. |
|
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class GtkSource.GutterRenderer(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
Gutter cell renderer.
A
GtkSourceGutterRenderer
represents a column in a [class`Gutter`]. The column contains one cell for each visible line of the [class`Gtk`.TextBuffer]. Due to text wrapping, a cell can thus span multiple lines of the [class`Gtk`.TextView]. In this case, [enum`GutterRendererAlignmentMode`] controls the alignment of the cell.The gutter renderer is a [class`Gtk`.Widget] and is measured using the normal widget measurement facilities. The width of the gutter will be determined by the measurements of the gutter renderers.
The width of a gutter renderer generally takes into account the entire text buffer. For instance, to display the line numbers, if the buffer contains 100 lines, the gutter renderer will always set its width such as three digits can be printed, even if only the first 20 lines are shown. Another strategy is to take into account only the visible lines. In this case, only two digits are necessary to display the line numbers of the first 20 lines. To take another example, the gutter renderer for [class`Mark`]s doesn’t need to take into account the text buffer to announce its width. It only depends on the icons size displayed in the gutter column.
When the available size to render a cell is greater than the required size to render the cell contents, the cell contents can be aligned horizontally and vertically with [method`GutterRenderer`.set_alignment_mode].
The cells rendering occurs using [vfunc`Gtk`.Widget.snapshot]. Implementations should use
gtk_source_gutter_renderer_get_lines()
to retrieve information about the lines to be rendered. To help with aligning content which takes into account the padding and alignment of a cell, implementations may call [method`GutterRenderer`.align_cell] for a given line number with the width and height measurement of the content they width to render.- activate(iter, area, button, state, n_presses)¶
- Parameters:
iter (
Gtk.TextIter
) – aGtk.TextIter
at the start of the line where the renderer is activatedarea (
Gdk.Rectangle
) – aGdk.Rectangle
of the cell area where the renderer is activatedbutton (
int
) – the button that was pressedstate (
Gdk.ModifierType
) – aGdk.ModifierType
n_presses (
int
) – the number of button presses
Emits the [signal`GutterRenderer`:py:func:::activate<GtkSource.GutterRenderer.signals.activate>] signal of the renderer. This is called from [class`Gutter`] and should never have to be called manually.
- align_cell(line, width, height)¶
- Parameters:
- Returns:
- x:
the X position to render the content
- y:
the Y position to render the content
- Return type:
Locates where to render content that is width x height based on the renderers alignment and padding.
The location will be placed into x and y and is relative to the renderer’s coordinates.
It is encouraged that renderers use this function when snappshotting to ensure consistent placement of their contents.
- get_alignment_mode()¶
- Returns:
- Return type:
Get the alignment mode.
The alignment mode describes the manner in which the renderer is aligned (see [property`GutterRenderer`:py:data::xalign<GtkSource.GutterRenderer.props.xalign>] and [property`GutterRenderer`:py:data::yalign<GtkSource.GutterRenderer.props.yalign>]).
- get_buffer()¶
- Returns:
a
Gtk.TextBuffer
orNone
- Return type:
Gets the [class`Buffer`] for which the gutter renderer is drawing.
- get_view()¶
- Returns:
- Return type:
Get the view associated to the gutter renderer
- get_xalign()¶
- Return type:
Gets the
xalign
property.This may be used to adjust where within the cell rectangle the renderer will draw.
- get_xpad()¶
- Return type:
Gets the
xpad
property.This may be used to adjust the cell rectangle that the renderer will use to draw.
- get_yalign()¶
- Return type:
Gets the
yalign
property.This may be used to adjust where within the cell rectangle the renderer will draw.
- get_ypad()¶
- Return type:
Gets the
ypad
property.This may be used to adjust the cell rectangle that the renderer will use to draw.
- query_activatable(iter, area)¶
- Parameters:
iter (
Gtk.TextIter
) – aGtk.TextIter
at the start of the line to be activatedarea (
Gdk.Rectangle
) – aGdk.Rectangle
of the cell area to be activated
- Returns:
- Return type:
Get whether the renderer is activatable at the location provided. This is called from [class`Gutter`] to determine whether a renderer is activatable using the mouse pointer.
- set_alignment_mode(mode)¶
- Parameters:
mode (
GtkSource.GutterRendererAlignmentMode
) – aGtkSource.GutterRendererAlignmentMode
Set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see [property`GutterRenderer`:py:data::xalign<GtkSource.GutterRenderer.props.xalign>] and [property`GutterRenderer`:py:data::yalign<GtkSource.GutterRenderer.props.yalign>]).
- set_xalign(xalign)¶
- Parameters:
xalign (
float
) – the Y padding for the drawing cell
Adjusts the
xalign
property.This may be used to adjust where within the cell rectangle the renderer will draw.
- set_xpad(xpad)¶
- Parameters:
xpad (
int
) – the Y padding for the drawing cell
Adjusts the
xpad
property.This may be used to adjust the cell rectangle that the renderer will use to draw.
- set_yalign(yalign)¶
- Parameters:
yalign (
float
) – the Y padding for the drawing cell
Adjusts the
yalign
property.This may be used to adjust where within the cell rectangle the renderer will draw.
- set_ypad(ypad)¶
- Parameters:
ypad (
int
) – the Y padding for the drawing cell
Adjusts the
ypad
property.This may be used to adjust the cell rectangle that the renderer will use to draw.
- do_activate(iter, area, button, state, n_presses) virtual¶
- Parameters:
iter (
Gtk.TextIter
) – aGtk.TextIter
at the start of the line where the renderer is activatedarea (
Gdk.Rectangle
) – aGdk.Rectangle
of the cell area where the renderer is activatedbutton (
int
) – the button that was pressedstate (
Gdk.ModifierType
) – aGdk.ModifierType
n_presses (
int
) – the number of button presses
Emits the [signal`GutterRenderer`:py:func:::activate<GtkSource.GutterRenderer.signals.activate>] signal of the renderer. This is called from [class`Gutter`] and should never have to be called manually.
- do_begin(lines) virtual¶
- Parameters:
lines (
GtkSource.GutterLines
) –
- do_change_buffer(old_buffer) virtual¶
- Parameters:
old_buffer (
GtkSource.Buffer
orNone
) – the oldGtk.TextBuffer
.
This is called when the text buffer changes for renderer.
- do_change_view(old_view) virtual¶
- Parameters:
old_view (
GtkSource.View
orNone
) – the oldGtk.TextView
.
This is called when the text view changes for renderer.
- do_end() virtual¶
- do_query_activatable(iter, area) virtual¶
- Parameters:
iter (
Gtk.TextIter
) – aGtk.TextIter
at the start of the line to be activatedarea (
Gdk.Rectangle
) – aGdk.Rectangle
of the cell area to be activated
- Returns:
- Return type:
Get whether the renderer is activatable at the location provided. This is called from [class`Gutter`] to determine whether a renderer is activatable using the mouse pointer.
- do_query_data(lines, line) virtual¶
- Parameters:
lines (
GtkSource.GutterLines
) –line (
int
) –
- do_snapshot_line(snapshot, lines, line) virtual¶
- Parameters:
snapshot (
Gtk.Snapshot
) –lines (
GtkSource.GutterLines
) –line (
int
) –
Signal Details¶
- GtkSource.GutterRenderer.signals.activate(gutter_renderer, iter, area, button, state, n_presses)¶
- Signal Name:
activate
- Flags:
- Parameters:
gutter_renderer (
GtkSource.GutterRenderer
) – The object which received the signaliter (
Gtk.TextIter
) – aGtk.TextIter
area (
Gdk.Rectangle
) – aGdk.Rectangle
button (
int
) – the button that was pressedstate (
Gdk.ModifierType
) – aGdk.ModifierType
of staten_presses (
int
) – the number of button presses
The signal is emitted when the renderer is activated.
- GtkSource.GutterRenderer.signals.query_activatable(gutter_renderer, iter, area)¶
- Signal Name:
query-activatable
- Flags:
- Parameters:
gutter_renderer (
GtkSource.GutterRenderer
) – The object which received the signaliter (
Gtk.TextIter
) – aGtk.TextIter
area (
Gdk.Rectangle
) – aGdk.Rectangle
- Return type:
The signal is emitted when the renderer can possibly be activated.
- GtkSource.GutterRenderer.signals.query_data(gutter_renderer, object, p0)¶
- Signal Name:
query-data
- Flags:
- Parameters:
gutter_renderer (
GtkSource.GutterRenderer
) – The object which received the signalobject (
GObject.Object
) –p0 (
int
) –
Property Details¶
- GtkSource.GutterRenderer.props.alignment_mode¶
- Name:
alignment-mode
- Type:
- Default Value:
- Flags:
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.lines¶
- Name:
lines
- Type:
- Default Value:
- Flags:
Contains information about the lines to be rendered.
It should be used by
GtkSource.GutterRenderer
implementations from [vfunc`Gtk`.Widget.snapshot].
- GtkSource.GutterRenderer.props.view¶
- Name:
view
- Type:
- Default Value:
- Flags:
The view on which the renderer is placed.
- GtkSource.GutterRenderer.props.xalign¶
-
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¶
-
The left and right padding of the renderer.
- GtkSource.GutterRenderer.props.yalign¶
-
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.