Class Range
- All Implemented Interfaces:
Accessible,AccessibleRange,Buildable,ConstraintTarget,Orientable,Proxy
- Direct Known Subclasses:
Scale
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
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theAdjustBoundsCallbackcallback.static classRange.Builder<B extends Range.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theChangeValueCallbackcallback.static interfaceFunctional interface declaration of theMoveSliderCallbackcallback.static classstatic interfaceFunctional interface declaration of theValueChangedCallbackcallback.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.AccessibleRange
AccessibleRange.AccessibleRange$Impl, AccessibleRange.AccessibleRangeInterfaceNested 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.ConstraintTargetInterfaceNested classes/interfaces inherited from interface org.gnome.gtk.Orientable
Orientable.Orientable$Impl, Orientable.OrientableIface -
Constructor Summary
ConstructorsConstructorDescriptionRange()Creates a new Range.Range(MemorySegment address) Create a Range proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidadjustBounds(double newValue) protected RangeasParent()Returns this instance as if it were its parent type.static Range.Builder<? extends Range.Builder> builder()ARange.Builderobject constructs aRangewith the specified properties.protected booleanchangeValue(ScrollType scroll, double newValue) voidemitAdjustBounds(double value) Emits the "adjust-bounds" signal.booleanemitChangeValue(ScrollType scroll, double value) Emits the "change-value" signal.voidemitMoveSlider(ScrollType step) Emits the "move-slider" signal.voidEmits the "value-changed" signal.Get the adjustment which is the “model” object forGtkRange.doubleGets the current position of the fill level indicator.booleanGets whether theGtkRangerespects text direction.booleanGets whether the range is inverted.static MemoryLayoutThe memory layout of the native struct.protected voidgetRangeBorder(Border border) voidgetRangeRect(Rectangle rangeRect) This function returns the area that contains the range’s trough, in coordinates relative torange'sorigin.booleanGets whether the range is restricted to the fill level.intGets the number of digits to round the value to when it changes.booleanGets whether the range displays the fill level graphically.voidgetSliderRange(@Nullable Out<Integer> sliderStart, @Nullable Out<Integer> sliderEnd) This function returns sliders range along the long dimension, in widget->window coordinates.booleanThis function is useful mainly forGtkRangesubclasses.static @Nullable TypegetType()Get the GType of the Range classdoublegetValue()Gets the current value of the range.protected voidmoveSlider(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.voidsetAdjustment(Adjustment adjustment) Sets the adjustment to be used as the “model” object for theGtkRangevoidsetFillLevel(double fillLevel) Set the new position of the fill level indicator.voidsetFlippable(boolean flippable) Sets whether theGtkRangerespects text direction.voidsetIncrements(double step, double page) Sets the step and page sizes for the range.voidsetInverted(boolean setting) Sets whether to invert the range.voidsetRange(double min, double max) Sets the allowable values in theGtkRange.voidsetRestrictToFillLevel(boolean restrictToFillLevel) Sets whether the slider is restricted to the fill level.voidsetRoundDigits(int roundDigits) Sets the number of digits to round the value to when it changes.voidsetShowFillLevel(boolean showFillLevel) Sets whether a graphical fill level is show on the trough.voidsetSliderSizeFixed(boolean sizeFixed) Sets whether the range’s slider has a fixed size, or a size that depends on its adjustment’s page size.voidsetValue(double value) Sets the current value of the range.protected voidMethods 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.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
getBuildableIdMethods 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
-
Range
public Range()Creates a new Range.
-
-
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. -
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 theGtkRangerespects text direction.- Returns:
trueif the range is flippable
-
getInverted
public boolean getInverted()Gets whether the range is inverted.See
setInverted(boolean).- Returns:
trueif the range is inverted
-
getRangeRect
This function returns the area that contains the range’s trough, in coordinates relative torange'sorigin.This function is useful mainly for
GtkRangesubclasses.- Parameters:
rangeRect- return location for the range rectangle
-
getRestrictToFillLevel
public boolean getRestrictToFillLevel()Gets whether the range is restricted to the fill level.- Returns:
trueif 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:
trueif this Range shows the fill level.
-
getSliderRange
This function returns sliders range along the long dimension, in widget->window coordinates.This function is useful mainly for
GtkRangesubclasses.- 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 forGtkRangesubclasses.- 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 theGtkRangeThe 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
GtkScaleand 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 theGtkRangerespects text direction.If a range is flippable, it will switch its direction if it is horizontal and its direction is
TextDirection.RTL.- Parameters:
flippable-trueto 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
GtkScrollbararrows or moves aGtkScalevia 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-trueto 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
minandmax.(If the range has a non-zero page size, it is clamped betweenminandmax- 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
GtkRangesubclasses.- Parameters:
sizeFixed-trueto 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-changedsignal 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
trueto 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.Builderobject constructs aRangewith the specified properties. Use the variousset...()methods to set properties, and finish construction withRange.Builder.build().- Returns:
- the builder object
-