GtkSource.MarkAttributes¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
The background |
||
r/w/en |
The |
||
r/w/en |
The icon name |
||
r/w/en |
The pixbuf |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The code should connect to this signal to provide a tooltip for given mark. |
|
The code should connect to this signal to provide a tooltip for given mark. |
Fields¶
- Inherited:
Class Details¶
- class GtkSource.MarkAttributes(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
The source mark attributes object.
GtkSourceMarkAttributes
is an object specifying attributes used by a [class`View`] to visually show lines marked with [class`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 [method`MarkAttributes`.set_background]. To check if any custom background color was defined and what color it is, use [method`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 [method`MarkAttributes`.render_icon] must be called. There are several ways to specify a base for an icon:
[method`MarkAttributes`.set_icon_name]
[method`MarkAttributes`.set_gicon]
[method`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 [signal`MarkAttributes`:py:func:::query-tooltip-text<GtkSource.MarkAttributes.signals.query_tooltip_text>] or [signal`MarkAttributes`:py:func:::query-tooltip-markup<GtkSource.MarkAttributes.signals.query_tooltip_markup>] where the latter takes precedence.
- classmethod new()¶
- Returns:
a new source mark attributes.
- Return type:
Creates a new source mark attributes.
- get_background()¶
- Returns:
whether background color for self was set.
- background:
a
Gdk.RGBA
.
- Return type:
Stores background color in background.
- get_gicon()¶
- Returns:
An icon. The icon belongs to self and should not be unreffed.
- Return type:
Gets a [iface`Gio`.Icon] to be used as a base for rendered icon.
Note that the icon can be
None
if it wasn’t set earlier.
- get_icon_name()¶
- Returns:
An icon name. The string belongs to self and should not be freed.
- Return type:
Gets a name of an icon to be used as a base for rendered icon.
Note that the icon name can be
None
if it wasn’t set earlier.
- get_pixbuf()¶
- Returns:
A pixbuf. The pixbuf belongs to self and should not be unreffed.
- Return type:
Gets a [class`GdkPixbuf`.Pixbuf] to be used as a base for rendered icon.
Note that the pixbuf can be
None
if it wasn’t set earlier.
- get_tooltip_markup(mark)¶
- Parameters:
mark (
GtkSource.Mark
) – aGtkSource.Mark
.- Returns:
A tooltip. The returned string should be freed by using
GLib.free
() when done with it.- Return type:
Queries for a tooltip by emitting a [signal`MarkAttributes`:py:func:::query-tooltip-markup<GtkSource.MarkAttributes.signals.query_tooltip_markup>] signal.
The tooltip may contain a markup.
- get_tooltip_text(mark)¶
- Parameters:
mark (
GtkSource.Mark
) – aGtkSource.Mark
.- Returns:
A tooltip. The returned string should be freed by using
GLib.free
() when done with it.- Return type:
Queries for a tooltip by emitting a [signal`MarkAttributes`:py:func:::query-tooltip-text<GtkSource.MarkAttributes.signals.query_tooltip_text>] signal.
The tooltip is a plain text.
- render_icon(widget, size)¶
- Parameters:
widget (
Gtk.Widget
) – widget of which style settings may be used.size (
int
) – size of the rendered icon.
- Returns:
A
Gdk.Paintable
. The paintable belongs to self and should not be unreffed.- Return type:
Renders an icon of given size.
The base of the icon is set by the last call to one of:
[method`MarkAttributes`.set_pixbuf]
[method`MarkAttributes`.set_gicon]
[method`MarkAttributes`.set_icon_name]
size cannot be lower than 1.
- set_background(background)¶
-
Sets background color to the one given in background.
- set_gicon(gicon)¶
-
Sets an icon to be used as a base for rendered icon.
- set_icon_name(icon_name)¶
- Parameters:
icon_name (
str
) – name of an icon to be used.
Sets a name of an icon to be used as a base for rendered icon.
- set_pixbuf(pixbuf)¶
- Parameters:
pixbuf (
GdkPixbuf.Pixbuf
) – aGdkPixbuf.Pixbuf
to be used.
Sets a pixbuf to be used as a base for rendered icon.
Signal Details¶
- GtkSource.MarkAttributes.signals.query_tooltip_markup(mark_attributes, mark)¶
- Signal Name:
query-tooltip-markup
- Flags:
- Parameters:
mark_attributes (
GtkSource.MarkAttributes
) – The object which received the signalmark (
GtkSource.Mark
) – TheGtkSource.Mark
.
- Returns:
A tooltip. The string should be freed with
GLib.free
() when done with it.- Return type:
The code should connect to this signal to provide a tooltip for given mark. The tooltip can contain a markup.
- GtkSource.MarkAttributes.signals.query_tooltip_text(mark_attributes, mark)¶
- Signal Name:
query-tooltip-text
- Flags:
- Parameters:
mark_attributes (
GtkSource.MarkAttributes
) – The object which received the signalmark (
GtkSource.Mark
) – TheGtkSource.Mark
.
- Returns:
A tooltip. The string should be freed with
GLib.free
() when done with it.- Return type:
The code should connect to this signal to provide a tooltip for given mark. The tooltip should be just a plain text.
Property Details¶
- GtkSource.MarkAttributes.props.background¶
- Name:
background
- Type:
- Default Value:
- Flags:
A color used for background of a line.
- GtkSource.MarkAttributes.props.gicon¶
- Name:
gicon
- Type:
- Default Value:
- Flags:
A
Gio.Icon
that may be a base of a rendered icon.
- GtkSource.MarkAttributes.props.icon_name¶
- Name:
icon-name
- Type:
- Default Value:
- Flags:
An icon name that may be a base of a rendered icon.
- GtkSource.MarkAttributes.props.pixbuf¶
- Name:
pixbuf
- Type:
- Default Value:
- Flags:
A
GdkPixbuf.Pixbuf
that may be a base of a rendered icon.