Class MarkAttributes
- All Implemented Interfaces:
Proxy
GtkSourceMarkAttributes
is an object specifying attributes used by
a View
to visually show lines marked with 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 setBackground(org.gnome.gdk.RGBA)
. To check
if any custom background color was defined and what color it is, use
getBackground(org.gnome.gdk.RGBA)
.
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
renderIcon(org.gnome.gtk.Widget, int)
must be called.
There are several ways to specify a base for an icon:
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 MarkAttributes::query-tooltip-text
or
MarkAttributes::query-tooltip-markup
where the latter
takes precedence.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
MarkAttributes.Builder<B extends MarkAttributes.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
static interface
Functional interface declaration of theQueryTooltipMarkupCallback
callback.static interface
Functional interface declaration of theQueryTooltipTextCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionCreates a new source mark attributes.MarkAttributes
(MemorySegment address) Create a MarkAttributes proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected MarkAttributes
asParent()
Returns this instance as if it were its parent type.static MarkAttributes.Builder
<? extends MarkAttributes.Builder> builder()
AMarkAttributes.Builder
object constructs aMarkAttributes
with the specified properties.emitQueryTooltipMarkup
(Mark mark) Emits the "query-tooltip-markup" signal.emitQueryTooltipText
(Mark mark) Emits the "query-tooltip-text" signal.boolean
getBackground
(RGBA background) Stores background color inbackground
.getGicon()
Gets aIcon
to be used as a base for rendered icon.Gets a name of an icon to be used as a base for rendered icon.Gets aPixbuf
to be used as a base for rendered icon.getTooltipMarkup
(Mark mark) Queries for a tooltip by emitting aMarkAttributes::query-tooltip-markup
signal.getTooltipText
(Mark mark) Queries for a tooltip by emitting aMarkAttributes::query-tooltip-text
signal.static Type
getType()
Get the GType of the MarkAttributes classThe code should connect to this signal to provide a tooltip for givenmark
.The code should connect to this signal to provide a tooltip for givenmark
.renderIcon
(Widget widget, int size) Renders an icon of given size.void
setBackground
(RGBA background) Sets background color to the one given inbackground
.void
Sets an icon to be used as a base for rendered icon.void
setIconName
(String iconName) Sets a name of an icon to be used as a base for rendered icon.void
Sets a pixbuf to be used as a base for rendered icon.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
MarkAttributes
Create a MarkAttributes proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
MarkAttributes
public MarkAttributes()Creates a new source mark attributes.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getBackground
Stores background color inbackground
.- Parameters:
background
- aGdkRGBA
.- Returns:
- whether background color for this MarkAttributes was set.
-
getGicon
-
getIconName
Gets a name of an icon to be used as a base for rendered icon.Note that the icon name can be
null
if it wasn't set earlier.- Returns:
- An icon name. The string belongs to this MarkAttributes and should not be freed.
-
getPixbuf
-
getTooltipMarkup
-
getTooltipText
-
renderIcon
Renders an icon of given size.The base of the icon is set by the last call to one of:
size
cannot be lower than 1.- Parameters:
widget
- widget of which style settings may be used.size
- size of the rendered icon.- Returns:
- A
GdkPaintable
. The paintable belongs to this MarkAttributes and should not be unreffed.
-
setBackground
Sets background color to the one given inbackground
.- Parameters:
background
- aGdkRGBA
.
-
setGicon
Sets an icon to be used as a base for rendered icon.- Parameters:
gicon
- aGIcon
to be used.
-
setIconName
Sets a name of an icon to be used as a base for rendered icon.- Parameters:
iconName
- name of an icon to be used.
-
setPixbuf
Sets a pixbuf to be used as a base for rendered icon.- Parameters:
pixbuf
- aGdkPixbuf
to be used.
-
onQueryTooltipMarkup
public SignalConnection<MarkAttributes.QueryTooltipMarkupCallback> onQueryTooltipMarkup(MarkAttributes.QueryTooltipMarkupCallback handler) The code should connect to this signal to provide a tooltip for givenmark
. The tooltip can contain a markup.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitQueryTooltipMarkup
Emits the "query-tooltip-markup" signal. SeeonQueryTooltipMarkup(org.gnome.gtksourceview.MarkAttributes.QueryTooltipMarkupCallback)
. -
onQueryTooltipText
public SignalConnection<MarkAttributes.QueryTooltipTextCallback> onQueryTooltipText(MarkAttributes.QueryTooltipTextCallback handler) The code should connect to this signal to provide a tooltip for givenmark
. The tooltip should be just a plain text.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitQueryTooltipText
Emits the "query-tooltip-text" signal. SeeonQueryTooltipText(org.gnome.gtksourceview.MarkAttributes.QueryTooltipTextCallback)
. -
builder
AMarkAttributes.Builder
object constructs aMarkAttributes
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withMarkAttributes.Builder.build()
.
-