:right-sidebar: True MarkAttributes =================================================================== .. currentmodule:: gi.repository.GtkSource .. class:: MarkAttributes(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` The source mark attributes object. ``GtkSourceMarkAttributes`` is an object specifying attributes used by a :obj:`~gi.repository.GtkSource.View` to visually show lines marked with :obj:`~gi.repository.GtkSource.Mark`\s of a specific category. It allows you to define a background color of a line, an icon shown in gutter and tooltips. The background color is used as a background of a line where a mark is placed and it can be set with :obj:`~gi.repository.MarkAttributes.set_background`\. To check if any custom background color was defined and what color it is, use :obj:`~gi.repository.MarkAttributes.get_background`\. An icon is a graphic element which is shown in the gutter of a view. An example use is showing a red filled circle in a debugger to show that a breakpoint was set in certain line. To get an icon that will be placed in a gutter, first a base for it must be specified and then :obj:`~gi.repository.MarkAttributes.render_icon` must be called. There are several ways to specify a base for an icon: - :obj:`~gi.repository.MarkAttributes.set_icon_name` - :obj:`~gi.repository.MarkAttributes.set_gicon` - :obj:`~gi.repository.MarkAttributes.set_pixbuf` Using any of the above functions overrides the one used earlier. But note that a getter counterpart of earlier used function can still return some value, but it is just not used when rendering the proper icon. To provide meaningful tooltips for a given mark of a category, you should connect to :obj:`~gi.repository.GtkSource.MarkAttributes.signals.query_tooltip_text` or :obj:`~gi.repository.GtkSource.MarkAttributes.signals.query_tooltip_markup` where the latter takes precedence. Constructors ------------ .. rst-class:: interim-class .. class:: MarkAttributes :no-index: .. classmethod:: new() -> ~gi.repository.GtkSource.MarkAttributes Creates a new source mark attributes. Methods ------- .. rst-class:: interim-class .. class:: MarkAttributes :no-index: .. method:: get_background() -> ~typing.Tuple[bool, ~gi.repository.Gdk.RGBA] Stores background color in ``background``\. .. method:: get_gicon() -> ~gi.repository.Gio.Icon Gets a :obj:`~gi.repository.Gio.Icon` to be used as a base for rendered icon. Note that the icon can be :const:`None` if it wasn't set earlier. .. method:: get_icon_name() -> str Gets a name of an icon to be used as a base for rendered icon. Note that the icon name can be :const:`None` if it wasn't set earlier. .. method:: get_pixbuf() -> ~gi.repository.GdkPixbuf.Pixbuf Gets a :obj:`~gi.repository.GdkPixbuf.Pixbuf` to be used as a base for rendered icon. Note that the pixbuf can be :const:`None` if it wasn't set earlier. .. method:: get_tooltip_markup(mark: ~gi.repository.GtkSource.Mark) -> str Queries for a tooltip by emitting a :obj:`~gi.repository.GtkSource.MarkAttributes.signals.query_tooltip_markup` signal. The tooltip may contain a markup. :param mark: a :obj:`~gi.repository.GtkSource.Mark`\. .. method:: get_tooltip_text(mark: ~gi.repository.GtkSource.Mark) -> str Queries for a tooltip by emitting a :obj:`~gi.repository.GtkSource.MarkAttributes.signals.query_tooltip_text` signal. The tooltip is a plain text. :param mark: a :obj:`~gi.repository.GtkSource.Mark`\. .. method:: render_icon(widget: ~gi.repository.Gtk.Widget, size: int) -> ~gi.repository.Gdk.Paintable Renders an icon of given size. The base of the icon is set by the last call to one of: - :obj:`~gi.repository.MarkAttributes.set_pixbuf` - :obj:`~gi.repository.MarkAttributes.set_gicon` - :obj:`~gi.repository.MarkAttributes.set_icon_name` ``size`` cannot be lower than 1. :param widget: widget of which style settings may be used. :param size: size of the rendered icon. .. method:: set_background(background: ~gi.repository.Gdk.RGBA) -> None Sets background color to the one given in ``background``\. :param background: a :obj:`~gi.repository.Gdk.RGBA`\. .. method:: set_gicon(gicon: ~gi.repository.Gio.Icon) -> None Sets an icon to be used as a base for rendered icon. :param gicon: a :obj:`~gi.repository.Gio.Icon` to be used. .. method:: set_icon_name(icon_name: str) -> None Sets a name of an icon to be used as a base for rendered icon. :param icon_name: name of an icon to be used. .. method:: set_pixbuf(pixbuf: ~gi.repository.GdkPixbuf.Pixbuf) -> None Sets a pixbuf to be used as a base for rendered icon. :param pixbuf: a :obj:`~gi.repository.GdkPixbuf.Pixbuf` to be used. Properties ---------- .. rst-class:: interim-class .. class:: MarkAttributes :no-index: .. attribute:: props.background :type: ~gi.repository.Gdk.RGBA The type of the None singleton. .. attribute:: props.gicon :type: ~gi.repository.Gio.Icon The type of the None singleton. .. attribute:: props.icon_name :type: str The type of the None singleton. .. attribute:: props.pixbuf :type: ~gi.repository.GdkPixbuf.Pixbuf The type of the None singleton. Signals ------- .. rst-class:: interim-class .. class:: MarkAttributes.signals :no-index: .. method:: query_tooltip_markup(mark: ~gi.repository.GtkSource.Mark) -> str The type of the None singleton. :param mark: The :obj:`~gi.repository.GtkSource.Mark`\. .. method:: query_tooltip_text(mark: ~gi.repository.GtkSource.Mark) -> str The type of the None singleton. :param mark: The :obj:`~gi.repository.GtkSource.Mark`\.