Class GutterRenderer
- All Implemented Interfaces:
Proxy
,Accessible
,Buildable
,ConstraintTarget
- Direct Known Subclasses:
GutterRenderer.GutterRendererImpl
,GutterRendererPixbuf
,GutterRendererText
A GtkSourceGutterRenderer
represents a column in a Gutter
. The
column contains one cell for each visible line of the TextBuffer
. Due to
text wrapping, a cell can thus span multiple lines of the TextView
. In
this case, GutterRendererAlignmentMode
controls the alignment of
the cell.
The gutter renderer is a 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 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 setAlignmentMode(org.gnome.gtksourceview.GutterRendererAlignmentMode)
.
The cells rendering occurs using Widget.snapshot(org.gnome.gtk.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
alignCell(int, float, float, io.github.jwharm.javagi.base.Out<java.lang.Float>, io.github.jwharm.javagi.base.Out<java.lang.Float>)
for a given line number with the
width and height measurement of the content they width to render.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theActivateCallback
callback.static class
GutterRenderer.Builder<B extends GutterRenderer.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
static class
The GutterRendererImpl type represents a native instance of the abstract GutterRenderer class.static interface
Functional interface declaration of theQueryActivatableCallback
callback.static interface
Functional interface declaration of theQueryDataCallback
callback.Nested classes/interfaces inherited from class org.gnome.gtk.Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.WidgetClass, Widget.WidgetImpl
Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.AccessibleImpl, Accessible.AccessibleInterface
Nested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.BuildableIface, Buildable.BuildableImpl
Nested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTargetImpl, ConstraintTarget.ConstraintTargetInterface
-
Constructor Summary
ConstructorDescriptionGutterRenderer
(MemorySegment address) Create a GutterRenderer proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoid
activate
(TextIter iter, Rectangle area, int button, Set<ModifierType> state, int nPresses) Emits theGutterRenderer::activate
signal of the renderer.void
activate
(TextIter iter, Rectangle area, int button, ModifierType state, int nPresses) Emits theGutterRenderer::activate
signal of the renderer.void
Locates where to render content that iswidth
xheight
based on the renderers alignment and padding.protected GutterRenderer
asParent()
Returns this instance as if it were its parent type.protected void
begin
(GutterLines lines) static GutterRenderer.Builder
<? extends GutterRenderer.Builder> builder()
AGutterRenderer.Builder
object constructs aGutterRenderer
with the specified properties.protected void
changeBuffer
(@Nullable Buffer oldBuffer) This is called when the text buffer changes for this GutterRenderer.protected void
changeView
(@Nullable View oldView) This is called when the text view changes for this GutterRenderer.void
emitActivate
(TextIter iter, Rectangle area, int button, Set<ModifierType> state, int nPresses) Emits the "activate" signal.boolean
emitQueryActivatable
(TextIter iter, Rectangle area) Emits the "query-activatable" signal.void
emitQueryData
(GObject object, int p0) protected void
end()
Get the alignment mode.Gets theBuffer
for which the gutter renderer is drawing.static MemoryLayout
The memory layout of the native struct.static Type
getType()
Get the GType of the GutterRenderer classgetView()
Get the view associated to the gutter rendererfloat
Gets thexalign
property.int
getXpad()
Gets thexpad
property.float
Gets theyalign
property.int
getYpad()
Gets theypad
property.The signal is emitted when the renderer is activated.The signal is emitted when the renderer can possibly be activated.boolean
queryActivatable
(TextIter iter, Rectangle area) Get whether the renderer is activatable at the location provided.protected void
queryData
(GutterLines lines, int line) void
Set the alignment mode.void
setXalign
(float xalign) Adjusts thexalign
property.void
setXpad
(int xpad) Adjusts thexpad
property.void
setYalign
(float yalign) Adjusts theyalign
property.void
setYpad
(int ypad) Adjusts theypad
property.protected void
snapshotLine
(Snapshot snapshot, GutterLines lines, int line) Methods inherited from class org.gnome.gtk.Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlags
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, 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
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updateProperty, updateRelation, updateState
Methods inherited from interface org.gnome.gtk.Buildable
getBuildableId
-
Constructor Details
-
GutterRenderer
Create a GutterRenderer proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
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. -
activate
public void activate(TextIter iter, Rectangle area, int button, Set<ModifierType> state, int nPresses) Emits theGutterRenderer::activate
signal of the renderer. This is called fromGutter
and should never have to be called manually.- Parameters:
iter
- aGtkTextIter
at the start of the line where the renderer is activatedarea
- aGdkRectangle
of the cell area where the renderer is activatedbutton
- the button that was pressedstate
- aGdkModifierType
nPresses
- the number of button presses
-
activate
Emits theGutterRenderer::activate
signal of the renderer. This is called fromGutter
and should never have to be called manually.- Parameters:
iter
- aGtkTextIter
at the start of the line where the renderer is activatedarea
- aGdkRectangle
of the cell area where the renderer is activatedbutton
- the button that was pressedstate
- aGdkModifierType
nPresses
- the number of button presses
-
alignCell
Locates where to render content that iswidth
xheight
based on the renderers alignment and padding.The location will be placed into
x
andy
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.
- Parameters:
line
- the line number for contentwidth
- the width of the content to drawheight
- the height of the content to drawx
- the X position to render the contenty
- the Y position to render the content
-
getAlignmentMode
Get the alignment mode.The alignment mode describes the manner in which the renderer is aligned (see
GutterRenderer:xalign
andGutterRenderer:yalign
).- Returns:
- a
GtkSourceGutterRendererAlignmentMode
-
getBuffer
-
getView
-
getXalign
public float getXalign()Gets thexalign
property.This may be used to adjust where within the cell rectangle the renderer will draw.
-
getXpad
public int getXpad()Gets thexpad
property.This may be used to adjust the cell rectangle that the renderer will use to draw.
-
getYalign
public float getYalign()Gets theyalign
property.This may be used to adjust where within the cell rectangle the renderer will draw.
-
getYpad
public int getYpad()Gets theypad
property.This may be used to adjust the cell rectangle that the renderer will use to draw.
-
queryActivatable
Get whether the renderer is activatable at the location provided. This is called fromGutter
to determine whether a renderer is activatable using the mouse pointer.- Parameters:
iter
- aGtkTextIter
at the start of the line to be activatedarea
- aGdkRectangle
of the cell area to be activated- Returns:
true
if the renderer can be activated,false
otherwise
-
setAlignmentMode
Set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (seeGutterRenderer:xalign
andGutterRenderer:yalign
).- Parameters:
mode
- aGtkSourceGutterRendererAlignmentMode
-
setXalign
public void setXalign(float xalign) Adjusts thexalign
property.This may be used to adjust where within the cell rectangle the renderer will draw.
- Parameters:
xalign
- the Y padding for the drawing cell
-
setXpad
public void setXpad(int xpad) Adjusts thexpad
property.This may be used to adjust the cell rectangle that the renderer will use to draw.
- Parameters:
xpad
- the Y padding for the drawing cell
-
setYalign
public void setYalign(float yalign) Adjusts theyalign
property.This may be used to adjust where within the cell rectangle the renderer will draw.
- Parameters:
yalign
- the Y padding for the drawing cell
-
setYpad
public void setYpad(int ypad) Adjusts theypad
property.This may be used to adjust the cell rectangle that the renderer will use to draw.
- Parameters:
ypad
- the Y padding for the drawing cell
-
begin
-
changeBuffer
This is called when the text buffer changes for this GutterRenderer.- Parameters:
oldBuffer
- the oldGtkTextBuffer
.
-
changeView
This is called when the text view changes for this GutterRenderer.- Parameters:
oldView
- the oldGtkTextView
.
-
end
protected void end() -
queryData
-
snapshotLine
-
onActivate
public SignalConnection<GutterRenderer.ActivateCallback> onActivate(GutterRenderer.ActivateCallback handler) The signal is emitted when the renderer is activated.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitActivate
public void emitActivate(TextIter iter, Rectangle area, int button, Set<ModifierType> state, int nPresses) Emits the "activate" signal. SeeonActivate(org.gnome.gtksourceview.GutterRenderer.ActivateCallback)
. -
onQueryActivatable
public SignalConnection<GutterRenderer.QueryActivatableCallback> onQueryActivatable(GutterRenderer.QueryActivatableCallback handler) The signal is emitted when the renderer can possibly be activated.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitQueryActivatable
Emits the "query-activatable" signal. SeeonQueryActivatable(org.gnome.gtksourceview.GutterRenderer.QueryActivatableCallback)
. -
onQueryData
public SignalConnection<GutterRenderer.QueryDataCallback> onQueryData(GutterRenderer.QueryDataCallback handler) - See Also:
-
emitQueryData
-
builder
AGutterRenderer.Builder
object constructs aGutterRenderer
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withGutterRenderer.Builder.build()
.
-