Class GutterRenderer
- All Implemented Interfaces:
Accessible,Buildable,ConstraintTarget,Proxy
- Direct Known Subclasses:
GutterRenderer.GutterRenderer$Impl,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 Marks 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, org.javagi.base.Out<java.lang.Float>, org.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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theActivateCallbackcallback.static classGutterRenderer.Builder<B extends GutterRenderer.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classThe GutterRenderer$Impl type represents a native instance of the abstract GutterRenderer class.static classstatic interfaceFunctional interface declaration of theQueryActivatableCallbackcallback.static interfaceFunctional interface declaration of theQueryDataCallbackcallback.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.Widget$Impl, Widget.WidgetClassNested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Accessible
Accessible.Accessible$Impl, Accessible.AccessibleInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface org.gnome.gtk.ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterface -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new GutterRenderer.GutterRenderer(MemorySegment address) Create a GutterRenderer proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionvoidactivate(TextIter iter, Rectangle area, int button, Set<ModifierType> state, int nPresses) Emits theGutterRenderer::activatesignal of the renderer.voidactivate(TextIter iter, Rectangle area, int button, ModifierType state, int nPresses) Emits theGutterRenderer::activatesignal of the renderer.voidLocates where to render content that iswidthxheightbased on the renderers alignment and padding.protected GutterRendererasParent()Returns this instance as if it were its parent type.protected voidbegin(GutterLines lines) protected voidchangeBuffer(@Nullable Buffer oldBuffer) This is called when the text buffer changes forrenderer.protected voidchangeView(@Nullable View oldView) This is called when the text view changes forrenderer.voidemitActivate(@Nullable TextIter iter, @Nullable Rectangle area, int button, Set<ModifierType> state, int nPresses) Emits the "activate" signal.booleanemitQueryActivatable(@Nullable TextIter iter, @Nullable Rectangle area) Emits the "query-activatable" signal.voidemitQueryData(@Nullable GObject object, int p0) protected voidend()Get the alignment mode.@Nullable BufferGets theBufferfor which the gutter renderer is drawing.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the GutterRenderer classgetView()Get the view associated to the gutter rendererfloatGets thexalignproperty.intgetXpad()Gets thexpadproperty.floatGets theyalignproperty.intgetYpad()Gets theypadproperty.The signal is emitted when the renderer is activated.The signal is emitted when the renderer can possibly be activated.booleanqueryActivatable(TextIter iter, Rectangle area) Get whether the renderer is activatable at the location provided.protected voidqueryData(GutterLines lines, int line) voidSet the alignment mode.voidsetXalign(float xalign) Adjusts thexalignproperty.voidsetXpad(int xpad) Adjusts thexpadproperty.voidsetYalign(float yalign) Adjusts theyalignproperty.voidsetYpad(int ypad) Adjusts theypadproperty.protected voidsnapshotLine(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, getLimitEvents, 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, setLimitEvents, 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, unsetStateFlagsMethods inherited from class org.gnome.gobject.InitiallyUnowned
builderMethods 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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible
announce, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateStateMethods 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
-
GutterRenderer
public GutterRenderer()Creates a new GutterRenderer.
-
-
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 Javasuperkeyword, 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::activatesignal of the renderer. This is called fromGutterand should never have to be called manually.- Parameters:
iter- aGtkTextIterat the start of the line where the renderer is activatedarea- aGdkRectangleof the cell area where the renderer is activatedbutton- the button that was pressedstate- aGdkModifierTypenPresses- the number of button presses
-
activate
Emits theGutterRenderer::activatesignal of the renderer. This is called fromGutterand should never have to be called manually.- Parameters:
iter- aGtkTextIterat the start of the line where the renderer is activatedarea- aGdkRectangleof the cell area where the renderer is activatedbutton- the button that was pressedstate- aGdkModifierTypenPresses- the number of button presses
-
alignCell
Locates where to render content that iswidthxheightbased on the renderers alignment and padding.The location will be placed into
xandyand 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:xalignandGutterRenderer:yalign).- Returns:
- a
GtkSourceGutterRendererAlignmentMode
-
getBuffer
-
getView
-
getXalign
public float getXalign()Gets thexalignproperty.This may be used to adjust where within the cell rectangle the renderer will draw.
-
getXpad
public int getXpad()Gets thexpadproperty.This may be used to adjust the cell rectangle that the renderer will use to draw.
-
getYalign
public float getYalign()Gets theyalignproperty.This may be used to adjust where within the cell rectangle the renderer will draw.
-
getYpad
public int getYpad()Gets theypadproperty.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 fromGutterto determine whether a renderer is activatable using the mouse pointer.- Parameters:
iter- aGtkTextIterat the start of the line to be activatedarea- aGdkRectangleof the cell area to be activated- Returns:
trueif the renderer can be activated,falseotherwise
-
setAlignmentMode
Set the alignment mode. The alignment mode describes the manner in which the renderer is aligned (seeGutterRenderer:xalignandGutterRenderer:yalign).- Parameters:
mode- aGtkSourceGutterRendererAlignmentMode
-
setXalign
public void setXalign(float xalign) Adjusts thexalignproperty.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 thexpadproperty.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 theyalignproperty.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 theypadproperty.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 forrenderer.- Parameters:
oldBuffer- the oldGtkTextBuffer.
-
changeView
This is called when the text view changes forrenderer.- 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(@Nullable TextIter iter, @Nullable 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
-