Class Range
- All Implemented Interfaces:
Proxy
,Accessible
,AccessibleRange
,Buildable
,ConstraintTarget
,Orientable
- Direct Known Subclasses:
Scale
GtkRange
is the common base class for widgets which visualize an
adjustment.
Widgets that are derived from GtkRange
include
Scale
and Scrollbar
.
Apart from signals for monitoring the parameters of the adjustment,
GtkRange
provides properties and methods for setting a
“fill level” on range widgets. See setFillLevel(double)
.
Shortcuts and Gestures
The GtkRange
slider is draggable. Holding the Shift
key while
dragging, or initiating the drag with a long-press will enable the
fine-tuning mode.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theAdjustBoundsCallback
callback.static class
Range.Builder<B extends Range.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theChangeValueCallback
callback.static interface
Functional interface declaration of theMoveSliderCallback
callback.static class
static interface
Functional interface declaration of theValueChangedCallback
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.AccessibleRange
AccessibleRange.AccessibleRangeImpl, AccessibleRange.AccessibleRangeInterface
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
Nested classes/interfaces inherited from interface org.gnome.gtk.Orientable
Orientable.OrientableIface, Orientable.OrientableImpl
-
Constructor Summary
ConstructorDescriptionRange
(MemorySegment address) Create a Range proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
adjustBounds
(double newValue) protected Range
asParent()
Returns this instance as if it were its parent type.static Range.Builder
<? extends Range.Builder> builder()
ARange.Builder
object constructs aRange
with the specified properties.protected boolean
changeValue
(ScrollType scroll, double newValue) void
emitAdjustBounds
(double value) Emits the "adjust-bounds" signal.boolean
emitChangeValue
(ScrollType scroll, double value) Emits the "change-value" signal.void
emitMoveSlider
(ScrollType step) Emits the "move-slider" signal.void
Emits the "value-changed" signal.Get the adjustment which is the “model” object forGtkRange
.double
Gets the current position of the fill level indicator.boolean
Gets whether theGtkRange
respects text direction.boolean
Gets whether the range is inverted.static MemoryLayout
The memory layout of the native struct.protected void
getRangeBorder
(Border border) void
getRangeRect
(Rectangle rangeRect) This function returns the area that contains the range’s trough, in coordinates relative to this Range's origin.boolean
Gets whether the range is restricted to the fill level.int
Gets the number of digits to round the value to when it changes.boolean
Gets whether the range displays the fill level graphically.void
getSliderRange
(@Nullable Out<Integer> sliderStart, @Nullable Out<Integer> sliderEnd) This function returns sliders range along the long dimension, in widget->window coordinates.boolean
This function is useful mainly forGtkRange
subclasses.static Type
getType()
Get the GType of the Range classdouble
getValue()
Gets the current value of the range.protected void
moveSlider
(ScrollType scroll) onAdjustBounds
(Range.AdjustBoundsCallback handler) Emitted before clamping a value, to give the application a chance to adjust the bounds.onChangeValue
(Range.ChangeValueCallback handler) Emitted when a scroll action is performed on a range.onMoveSlider
(Range.MoveSliderCallback handler) Virtual function that moves the slider.onValueChanged
(Range.ValueChangedCallback handler) Emitted when the range value changes.void
setAdjustment
(Adjustment adjustment) Sets the adjustment to be used as the “model” object for theGtkRange
void
setFillLevel
(double fillLevel) Set the new position of the fill level indicator.void
setFlippable
(boolean flippable) Sets whether theGtkRange
respects text direction.void
setIncrements
(double step, double page) Sets the step and page sizes for the range.void
setInverted
(boolean setting) Sets whether to invert the range.void
setRange
(double min, double max) Sets the allowable values in theGtkRange
.void
setRestrictToFillLevel
(boolean restrictToFillLevel) Sets whether the slider is restricted to the fill level.void
setRoundDigits
(int roundDigits) Sets the number of digits to round the value to when it changes.void
setShowFillLevel
(boolean showFillLevel) Sets whether a graphical fill level is show on the trough.void
setSliderSizeFixed
(boolean sizeFixed) Sets whether the range’s slider has a fixed size, or a size that depends on its adjustment’s page size.void
setValue
(double value) Sets the current value of the range.protected void
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
Methods inherited from interface org.gnome.gtk.Orientable
getOrientation, setOrientation
-
Constructor Details
-
Range
Create a Range 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. -
getAdjustment
Get the adjustment which is the “model” object forGtkRange
.- Returns:
- a
GtkAdjustment
-
getFillLevel
public double getFillLevel()Gets the current position of the fill level indicator.- Returns:
- The current fill level
-
getFlippable
public boolean getFlippable()Gets whether theGtkRange
respects text direction.- Returns:
true
if the range is flippable
-
getInverted
public boolean getInverted()Gets whether the range is inverted.See
setInverted(boolean)
.- Returns:
true
if the range is inverted
-
getRangeRect
This function returns the area that contains the range’s trough, in coordinates relative to this Range's origin.This function is useful mainly for
GtkRange
subclasses.- Parameters:
rangeRect
- return location for the range rectangle
-
getRestrictToFillLevel
public boolean getRestrictToFillLevel()Gets whether the range is restricted to the fill level.- Returns:
true
if this Range is restricted to the fill level.
-
getRoundDigits
public int getRoundDigits()Gets the number of digits to round the value to when it changes.See
Gtk.Range::change-value
.- Returns:
- the number of digits to round to
-
getShowFillLevel
public boolean getShowFillLevel()Gets whether the range displays the fill level graphically.- Returns:
true
if this Range shows the fill level.
-
getSliderRange
public void getSliderRange(@Nullable @Nullable Out<Integer> sliderStart, @Nullable @Nullable Out<Integer> sliderEnd) This function returns sliders range along the long dimension, in widget->window coordinates.This function is useful mainly for
GtkRange
subclasses.- Parameters:
sliderStart
- return location for the slider's startsliderEnd
- return location for the slider's end
-
getSliderSizeFixed
public boolean getSliderSizeFixed()This function is useful mainly forGtkRange
subclasses.- Returns:
- whether the range’s slider has a fixed size.
-
getValue
public double getValue()Gets the current value of the range.- Returns:
- current value of the range.
-
setAdjustment
Sets the adjustment to be used as the “model” object for theGtkRange
The adjustment indicates the current range value, the minimum and maximum range values, the step/page increments used for keybindings and scrolling, and the page size.
The page size is normally 0 for
GtkScale
and nonzero forGtkScrollbar
, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider.- Parameters:
adjustment
- aGtkAdjustment
-
setFillLevel
public void setFillLevel(double fillLevel) Set the new position of the fill level indicator.The “fill level” is probably best described by its most prominent use case, which is an indicator for the amount of pre-buffering in a streaming media player. In that use case, the value of the range would indicate the current play position, and the fill level would be the position up to which the file/stream has been downloaded.
This amount of prebuffering can be displayed on the range’s trough and is themeable separately from the trough. To enable fill level display, use
setShowFillLevel(boolean)
. The range defaults to not showing the fill level.Additionally, it’s possible to restrict the range’s slider position to values which are smaller than the fill level. This is controlled by
setRestrictToFillLevel(boolean)
and is by default enabled.- Parameters:
fillLevel
- the new position of the fill level indicator
-
setFlippable
public void setFlippable(boolean flippable) Sets whether theGtkRange
respects text direction.If a range is flippable, it will switch its direction if it is horizontal and its direction is
TextDirection.RTL
.- Parameters:
flippable
-true
to make the range flippable
-
setIncrements
public void setIncrements(double step, double page) Sets the step and page sizes for the range.The step size is used when the user clicks the
GtkScrollbar
arrows or moves aGtkScale
via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.- Parameters:
step
- step sizepage
- page size
-
setInverted
public void setInverted(boolean setting) Sets whether to invert the range.Ranges normally move from lower to higher values as the slider moves from top to bottom or left to right. Inverted ranges have higher values at the top or on the right rather than on the bottom or left.
- Parameters:
setting
-true
to invert the range
-
setRange
public void setRange(double min, double max) Sets the allowable values in theGtkRange
.The range value is clamped to be between
min
andmax
. (If the range has a non-zero page size, it is clamped betweenmin
andmax
- page-size.)- Parameters:
min
- minimum range valuemax
- maximum range value
-
setRestrictToFillLevel
public void setRestrictToFillLevel(boolean restrictToFillLevel) Sets whether the slider is restricted to the fill level.See
setFillLevel(double)
for a general description of the fill level concept.- Parameters:
restrictToFillLevel
- Whether the fill level restricts slider movement.
-
setRoundDigits
public void setRoundDigits(int roundDigits) Sets the number of digits to round the value to when it changes.See
Gtk.Range::change-value
.- Parameters:
roundDigits
- the precision in digits, or -1
-
setShowFillLevel
public void setShowFillLevel(boolean showFillLevel) Sets whether a graphical fill level is show on the trough.See
setFillLevel(double)
for a general description of the fill level concept.- Parameters:
showFillLevel
- Whether a fill level indicator graphics is shown.
-
setSliderSizeFixed
public void setSliderSizeFixed(boolean sizeFixed) Sets whether the range’s slider has a fixed size, or a size that depends on its adjustment’s page size.This function is useful mainly for
GtkRange
subclasses.- Parameters:
sizeFixed
-true
to make the slider size constant
-
setValue
public void setValue(double value) Sets the current value of the range.If the value is outside the minimum or maximum range values, it will be clamped to fit inside them. The range emits the
Gtk.Range::value-changed
signal if the value changes.- Parameters:
value
- new value of the range
-
adjustBounds
protected void adjustBounds(double newValue) -
changeValue
-
getRangeBorder
-
moveSlider
-
valueChanged
protected void valueChanged() -
onAdjustBounds
public SignalConnection<Range.AdjustBoundsCallback> onAdjustBounds(Range.AdjustBoundsCallback handler) Emitted before clamping a value, to give the application a chance to adjust the bounds.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitAdjustBounds
public void emitAdjustBounds(double value) Emits the "adjust-bounds" signal. SeeonAdjustBounds(org.gnome.gtk.Range.AdjustBoundsCallback)
. -
onChangeValue
Emitted when a scroll action is performed on a range.It allows an application to determine the type of scroll event that occurred and the resultant new value. The application can handle the event itself and return
true
to prevent further processing. Or, by returningfalse
, it can pass the event to other handlers until the default GTK handler is reached.The value parameter is unrounded. An application that overrides the ::change-value signal is responsible for clamping the value to the desired number of decimal digits; the default GTK handler clamps the value based on
Gtk.Range:round-digits
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitChangeValue
Emits the "change-value" signal. SeeonChangeValue(org.gnome.gtk.Range.ChangeValueCallback)
. -
onMoveSlider
Virtual function that moves the slider.Used for keybindings.
- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitMoveSlider
Emits the "move-slider" signal. SeeonMoveSlider(org.gnome.gtk.Range.MoveSliderCallback)
. -
onValueChanged
public SignalConnection<Range.ValueChangedCallback> onValueChanged(Range.ValueChangedCallback handler) Emitted when the range value changes.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitValueChanged
public void emitValueChanged()Emits the "value-changed" signal. SeeonValueChanged(org.gnome.gtk.Range.ValueChangedCallback)
. -
builder
ARange.Builder
object constructs aRange
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withRange.Builder.build()
.
-