:right-sidebar: True GutterRenderer =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: GutterRenderer(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.GtkSource.GutterRendererPixbuf`, :class:`~gi.repository.GtkSource.GutterRendererText` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` Gutter cell renderer. A ``GtkSourceGutterRenderer`` represents a column in a :obj:`~gi.repository.GtkSource.Gutter`\. The column contains one cell for each visible line of the :obj:`~gi.repository.Gtk.TextBuffer`\. Due to text wrapping, a cell can thus span multiple lines of the :obj:`~gi.repository.Gtk.TextView`\. In this case, :obj:`~gi.repository.GtkSource.GutterRendererAlignmentMode` controls the alignment of the cell. The gutter renderer is a :obj:`~gi.repository.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 :obj:`~gi.repository.GtkSource.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 :obj:`~gi.repository.GutterRenderer.set_alignment_mode`\. The cells rendering occurs using :obj:`~gi.repository.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 :obj:`~gi.repository.GutterRenderer.align_cell` for a given line number with the width and height measurement of the content they width to render. Methods ------- .. rst-class:: interim-class .. class:: GutterRenderer :no-index: .. method:: activate(iter: ~gi.repository.Gtk.TextIter, area: ~gi.repository.Gdk.Rectangle, button: int, state: ~gi.repository.Gdk.ModifierType, n_presses: int) -> None Emits the :obj:`~gi.repository.GtkSource.GutterRenderer.signals.activate` signal of the renderer. This is called from :obj:`~gi.repository.GtkSource.Gutter` and should never have to be called manually. :param iter: a :obj:`~gi.repository.Gtk.TextIter` at the start of the line where the renderer is activated :param area: a :obj:`~gi.repository.Gdk.Rectangle` of the cell area where the renderer is activated :param button: the button that was pressed :param state: a :obj:`~gi.repository.Gdk.ModifierType` :param n_presses: the number of button presses .. method:: align_cell(line: int, width: float, height: float) -> ~typing.Tuple[float, float] 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. :param line: the line number for content :param width: the width of the content to draw :param height: the height of the content to draw .. method:: do_activate(self, iter: ~gi.repository.Gtk.TextIter, area: ~gi.repository.Gdk.Rectangle, button: int, state: ~gi.repository.Gdk.ModifierType, n_presses: int) -> None :param iter: :param area: :param button: :param state: :param n_presses: .. method:: do_begin(self, lines: ~gi.repository.GtkSource.GutterLines) -> None :param lines: .. method:: do_change_buffer(self, old_buffer: ~gi.repository.GtkSource.Buffer | None = None) -> None :param old_buffer: .. method:: do_change_view(self, old_view: ~gi.repository.GtkSource.View | None = None) -> None :param old_view: .. method:: do_end(self) -> None .. method:: do_query_activatable(self, iter: ~gi.repository.Gtk.TextIter, area: ~gi.repository.Gdk.Rectangle) -> bool :param iter: :param area: .. method:: do_query_data(self, lines: ~gi.repository.GtkSource.GutterLines, line: int) -> None :param lines: :param line: .. method:: do_snapshot_line(self, snapshot: ~gi.repository.Gtk.Snapshot, lines: ~gi.repository.GtkSource.GutterLines, line: int) -> None :param snapshot: :param lines: :param line: .. method:: get_alignment_mode() -> ~gi.repository.GtkSource.GutterRendererAlignmentMode Get the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :obj:`~gi.repository.GtkSource.GutterRenderer.props.xalign` and :obj:`~gi.repository.GtkSource.GutterRenderer.props.yalign`\). .. method:: get_buffer() -> ~gi.repository.GtkSource.Buffer | None Gets the :obj:`~gi.repository.GtkSource.Buffer` for which the gutter renderer is drawing. .. method:: get_view() -> ~gi.repository.GtkSource.View Get the view associated to the gutter renderer .. method:: get_xalign() -> float Gets the ``xalign`` property. This may be used to adjust where within the cell rectangle the renderer will draw. .. method:: get_xpad() -> int Gets the ``xpad`` property. This may be used to adjust the cell rectangle that the renderer will use to draw. .. method:: get_yalign() -> float Gets the ``yalign`` property. This may be used to adjust where within the cell rectangle the renderer will draw. .. method:: get_ypad() -> int Gets the ``ypad`` property. This may be used to adjust the cell rectangle that the renderer will use to draw. .. method:: query_activatable(iter: ~gi.repository.Gtk.TextIter, area: ~gi.repository.Gdk.Rectangle) -> bool Get whether the renderer is activatable at the location provided. This is called from :obj:`~gi.repository.GtkSource.Gutter` to determine whether a renderer is activatable using the mouse pointer. :param iter: a :obj:`~gi.repository.Gtk.TextIter` at the start of the line to be activated :param area: a :obj:`~gi.repository.Gdk.Rectangle` of the cell area to be activated .. method:: set_alignment_mode(mode: ~gi.repository.GtkSource.GutterRendererAlignmentMode) -> None Set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (see :obj:`~gi.repository.GtkSource.GutterRenderer.props.xalign` and :obj:`~gi.repository.GtkSource.GutterRenderer.props.yalign`\). :param mode: a :obj:`~gi.repository.GtkSource.GutterRendererAlignmentMode` .. method:: set_xalign(xalign: float) -> None Adjusts the ``xalign`` property. This may be used to adjust where within the cell rectangle the renderer will draw. :param xalign: the Y padding for the drawing cell .. method:: set_xpad(xpad: int) -> None Adjusts the ``xpad`` property. This may be used to adjust the cell rectangle that the renderer will use to draw. :param xpad: the Y padding for the drawing cell .. method:: set_yalign(yalign: float) -> None Adjusts the ``yalign`` property. This may be used to adjust where within the cell rectangle the renderer will draw. :param yalign: the Y padding for the drawing cell .. method:: set_ypad(ypad: int) -> None Adjusts the ``ypad`` property. This may be used to adjust the cell rectangle that the renderer will use to draw. :param ypad: the Y padding for the drawing cell Properties ---------- .. rst-class:: interim-class .. class:: GutterRenderer :no-index: .. attribute:: props.alignment_mode :type: ~gi.repository.GtkSource.GutterRendererAlignmentMode The type of the None singleton. .. attribute:: props.lines :type: ~gi.repository.GtkSource.GutterLines The type of the None singleton. .. attribute:: props.view :type: ~gi.repository.Gtk.TextView The type of the None singleton. .. attribute:: props.xalign :type: float The type of the None singleton. .. attribute:: props.xpad :type: int The type of the None singleton. .. attribute:: props.yalign :type: float The type of the None singleton. .. attribute:: props.ypad :type: int The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: GutterRenderer.signals :no-index: .. method:: activate(iter: ~gi.repository.Gtk.TextIter, area: ~gi.repository.Gdk.Rectangle, button: int, state: ~gi.repository.Gdk.ModifierType, n_presses: int) -> None The signal is emitted when the renderer is activated. :param iter: a :obj:`~gi.repository.Gtk.TextIter` :param area: a :obj:`~gi.repository.Gdk.Rectangle` :param button: the button that was pressed :param state: a :obj:`~gi.repository.Gdk.ModifierType` of state :param n_presses: the number of button presses .. method:: query_activatable(iter: ~gi.repository.Gtk.TextIter, area: ~gi.repository.Gdk.Rectangle) -> bool The type of the None singleton. :param iter: a :obj:`~gi.repository.Gtk.TextIter` :param area: a :obj:`~gi.repository.Gdk.Rectangle` .. method:: query_data(object: ~gi.repository.GObject.Object, p0: int) -> None The type of the None singleton. :param object: :param p0: Virtual Methods --------------- .. rst-class:: interim-class .. class:: GutterRenderer :no-index: .. method:: do_activate(iter: ~gi.repository.Gtk.TextIter, area: ~gi.repository.Gdk.Rectangle, button: int, state: ~gi.repository.Gdk.ModifierType, n_presses: int) -> None Emits the :obj:`~gi.repository.GtkSource.GutterRenderer.signals.activate` signal of the renderer. This is called from :obj:`~gi.repository.GtkSource.Gutter` and should never have to be called manually. :param iter: a :obj:`~gi.repository.Gtk.TextIter` at the start of the line where the renderer is activated :param area: a :obj:`~gi.repository.Gdk.Rectangle` of the cell area where the renderer is activated :param button: the button that was pressed :param state: a :obj:`~gi.repository.Gdk.ModifierType` :param n_presses: the number of button presses .. method:: do_begin(lines: ~gi.repository.GtkSource.GutterLines) -> None The type of the None singleton. :param lines: .. method:: do_change_buffer(old_buffer: ~gi.repository.GtkSource.Buffer | None = None) -> None The type of the None singleton. :param old_buffer: the old :obj:`~gi.repository.Gtk.TextBuffer`\. .. method:: do_change_view(old_view: ~gi.repository.GtkSource.View | None = None) -> None The type of the None singleton. :param old_view: the old :obj:`~gi.repository.Gtk.TextView`\. .. method:: do_end() -> None The type of the None singleton. .. method:: do_query_activatable(iter: ~gi.repository.Gtk.TextIter, area: ~gi.repository.Gdk.Rectangle) -> bool Get whether the renderer is activatable at the location provided. This is called from :obj:`~gi.repository.GtkSource.Gutter` to determine whether a renderer is activatable using the mouse pointer. :param iter: a :obj:`~gi.repository.Gtk.TextIter` at the start of the line to be activated :param area: a :obj:`~gi.repository.Gdk.Rectangle` of the cell area to be activated .. method:: do_query_data(lines: ~gi.repository.GtkSource.GutterLines, line: int) -> None The type of the None singleton. :param lines: :param line: .. method:: do_snapshot_line(snapshot: ~gi.repository.Gtk.Snapshot, lines: ~gi.repository.GtkSource.GutterLines, line: int) -> None The type of the None singleton. :param snapshot: :param lines: :param line: Fields ------ .. rst-class:: interim-class .. class:: GutterRenderer :no-index: .. attribute:: parent_instance