Class SpinRow
- All Implemented Interfaces:
Proxy
,Accessible
,Actionable
,Buildable
,ConstraintTarget
,Editable
ActionRow
with an embedded spin button.
Example of an AdwSpinRow
UI definition:
<object class="AdwSpinRow">
<property name="title" translatable="yes">Spin Row</property>
<property name="adjustment">
<object class="GtkAdjustment">
<property name="lower">0</property>
<property name="upper">100</property>
<property name="value">50</property>
<property name="page-increment">10</property>
<property name="step-increment">1</property>
</object>
</property>
</object>
See SpinButton
for details.
CSS nodes
AdwSpinRow
has the same structure as ActionRow
, as well as the
.spin
style class on the main node.
Accessibility
AdwSpinRow
uses an internal GtkSpinButton
with the
GTK_ACCESSIBLE_ROLE_SPIN_BUTTON
role.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
SpinRow.Builder<B extends SpinRow.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theInputCallback
callback.static interface
Functional interface declaration of theOutputCallback
callback.static class
static interface
Functional interface declaration of theWrappedCallback
callback.Nested classes/interfaces inherited from class org.gnome.adw.ActionRow
ActionRow.ActionRowClass, ActionRow.ActivatedCallback
Nested classes/interfaces inherited from class org.gnome.adw.PreferencesRow
PreferencesRow.PreferencesRowClass
Nested classes/interfaces inherited from class org.gnome.gtk.ListBoxRow
ListBoxRow.ActivateCallback, ListBoxRow.ListBoxRowClass
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.Actionable
Actionable.ActionableImpl, Actionable.ActionableInterface
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.Editable
Editable.ChangedCallback, Editable.DeleteTextCallback, Editable.EditableImpl, Editable.EditableInterface, Editable.InsertTextCallback
-
Constructor Summary
ConstructorDescriptionSpinRow
(MemorySegment address) Create a SpinRow proxy instance for the provided memory address.SpinRow
(@Nullable Adjustment adjustment, double climbRate, int digits) Creates a newAdwSpinRow
. -
Method Summary
Modifier and TypeMethodDescriptionprotected SpinRow
asParent()
Returns this instance as if it were its parent type.static SpinRow.Builder
<? extends SpinRow.Builder> builder()
ASpinRow.Builder
object constructs aSpinRow
with the specified properties.void
configure
(@Nullable Adjustment adjustment, double climbRate, int digits) Changes the properties of an existing spin row.int
Emits the "input" signal.boolean
Emits the "output" signal.void
Emits the "wrapped" signal.Gets the adjustment that holds the value for the spin row.double
Gets the acceleration rate when you hold down a button or key.int
Gets the number of decimal places to display.boolean
Gets whether non-numeric characters should be ignored.boolean
Gets whether invalid values are snapped to nearest step increment.static Type
getType()
Get the GType of the SpinRow classGets the policy for updating the spin row.double
getValue()
Gets the current value.boolean
getWrap()
Gets whether the spin row should wrap upon reaching its limits.onInput
(SpinRow.InputCallback handler) Emitted to convert the user's input into a double value.onOutput
(SpinRow.OutputCallback handler) Emitted to tweak the formatting of the value for display.onWrapped
(SpinRow.WrappedCallback handler) Emitted right after the spinbutton wraps.void
setAdjustment
(@Nullable Adjustment adjustment) Sets the adjustment that holds the value for the spin row.void
setClimbRate
(double climbRate) Sets the acceleration rate when you hold down a button or key.void
setDigits
(int digits) Sets the number of decimal places to display.void
setNumeric
(boolean numeric) Sets whether non-numeric characters should be ignored.void
setRange
(double min, double max) Sets the minimum and maximum allowable values for this SpinRow.void
setSnapToTicks
(boolean snapToTicks) Sets whether invalid values are snapped to the nearest step increment.void
Sets the policy for updating the spin row.void
setValue
(double value) Sets the current value.void
setWrap
(boolean wrap) Sets whether the spin row should wrap upon reaching its limits.void
update()
Manually force an update of the spin row.static SpinRow
withRange
(double min, double max, double step) Creates a newAdwSpinRow
with the given properties.Methods inherited from class org.gnome.adw.ActionRow
activate, addPrefix, addSuffix, emitActivated, getActivatableWidget, getIconName, getMemoryLayout, getSubtitle, getSubtitleLines, getSubtitleSelectable, getTitleLines, onActivated, remove, setActivatableWidget, setIconName, setSubtitle, setSubtitleLines, setSubtitleSelectable, setTitleLines
Methods inherited from class org.gnome.adw.PreferencesRow
getTitle, getTitleSelectable, getUseMarkup, getUseUnderline, setTitle, setTitleSelectable, setUseMarkup, setUseUnderline
Methods inherited from class org.gnome.gtk.ListBoxRow
changed, emitActivate, getActivatable, getChild, getHeader, getIndex, getSelectable, isSelected, onActivate, setActivatable, setChild, setHeader, setSelectable
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.Actionable
getActionName, getActionTargetValue, setActionName, setActionTarget, setActionTargetValue, setDetailedActionName
Methods inherited from interface org.gnome.gtk.Buildable
getBuildableId
Methods inherited from interface org.gnome.gtk.Editable
delegateGetAccessiblePlatformState, deleteSelection, deleteText, emitChanged, emitDeleteText, emitInsertText, finishDelegate, getAlignment, getChars, getDelegate, getEditable, getEnableUndo, getMaxWidthChars, getPosition, getSelectionBounds, getText, getWidthChars, initDelegate, insertText, onChanged, onDeleteText, onInsertText, selectRegion, setAlignment, setEditable, setEnableUndo, setMaxWidthChars, setPosition, setText, setWidthChars
-
Constructor Details
-
SpinRow
Create a SpinRow proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
SpinRow
Creates a newAdwSpinRow
.- Parameters:
adjustment
- the adjustment that this spin row should useclimbRate
- the rate the value changes when holding a button or keydigits
- the number of decimal places to display
-
-
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. -
withRange
Creates a newAdwSpinRow
with the given properties.This is a convenience constructor that allows creation of a numeric
AdwSpinRow
without manually creating an adjustment. The value is initially set to the minimum value and a page increment of 10 *step
is the default. The precision of the spin row is equivalent to the precisions ofstep
.Note The way in which the precision is derived works best if @step is a power of ten. If the resulting precision is not suitable for your needs, use [method@SpinRow.set_digits] to correct it.
- Parameters:
min
- minimum allowable valuemax
- maximum allowable valuestep
- increment added or subtracted by spinning the widget- Returns:
- the new
AdwSpinRow
-
configure
Changes the properties of an existing spin row.The adjustment, climb rate, and number of decimal places are updated accordingly.
- Parameters:
adjustment
- the adjustment that this spin row should useclimbRate
- the new climb ratedigits
- the number of decimal places to display
-
getAdjustment
Gets the adjustment that holds the value for the spin row.- Returns:
- the adjustment that holds the spin row's value
-
getClimbRate
public double getClimbRate()Gets the acceleration rate when you hold down a button or key.- Returns:
- the acceleration rate when you hold down a button or key
-
getDigits
public int getDigits()Gets the number of decimal places to display.- Returns:
- the number of decimal places to display
-
getNumeric
public boolean getNumeric()Gets whether non-numeric characters should be ignored.- Returns:
- whether non-numeric characters should be ignored.
-
getSnapToTicks
public boolean getSnapToTicks()Gets whether invalid values are snapped to nearest step increment.- Returns:
- whether invalid values are snapped to the nearest step increment
-
getUpdatePolicy
Gets the policy for updating the spin row.- Returns:
- the policy for updating the spin row
-
getValue
public double getValue()Gets the current value.- Returns:
- the current value
-
getWrap
public boolean getWrap()Gets whether the spin row should wrap upon reaching its limits.- Returns:
- whether the spin row should wrap upon reaching its limits
-
setAdjustment
Sets the adjustment that holds the value for the spin row.- Parameters:
adjustment
- an adjustment
-
setClimbRate
public void setClimbRate(double climbRate) Sets the acceleration rate when you hold down a button or key.- Parameters:
climbRate
- the acceleration rate when you hold down a button or key
-
setDigits
public void setDigits(int digits) Sets the number of decimal places to display.- Parameters:
digits
- the number of decimal places to display
-
setNumeric
public void setNumeric(boolean numeric) Sets whether non-numeric characters should be ignored.- Parameters:
numeric
- whether non-numeric characters should be ignored
-
setRange
public void setRange(double min, double max) Sets the minimum and maximum allowable values for this SpinRow.If the current value is outside this range, it will be adjusted to fit within the range, otherwise it will remain unchanged.
- Parameters:
min
- minimum allowable valuemax
- maximum allowable value
-
setSnapToTicks
public void setSnapToTicks(boolean snapToTicks) Sets whether invalid values are snapped to the nearest step increment.- Parameters:
snapToTicks
- whether invalid values are snapped to the nearest step increment
-
setUpdatePolicy
Sets the policy for updating the spin row.The options are always, or only when the value is invalid.
- Parameters:
policy
- the policy for updating the spin row
-
setValue
public void setValue(double value) Sets the current value.- Parameters:
value
- a new value
-
setWrap
public void setWrap(boolean wrap) Sets whether the spin row should wrap upon reaching its limits.- Parameters:
wrap
- whether the spin row should wrap upon reaching its limits
-
update
public void update()Manually force an update of the spin row. -
onInput
Emitted to convert the user's input into a double value.The signal handler is expected to use
Editable.getText()
to retrieve the text of the spinbutton and set new_value to the new value.The default conversion uses
GLib.strtod(java.lang.String, io.github.jwharm.javagi.base.Out<java.lang.String>)
.See
Gtk.SpinButton::input
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitInput
Emits the "input" signal. SeeonInput(org.gnome.adw.SpinRow.InputCallback)
. -
onOutput
Emitted to tweak the formatting of the value for display.See
Gtk.SpinButton::output
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitOutput
public boolean emitOutput()Emits the "output" signal. SeeonOutput(org.gnome.adw.SpinRow.OutputCallback)
. -
onWrapped
Emitted right after the spinbutton wraps.See
Gtk.SpinButton::wrapped
.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitWrapped
public void emitWrapped()Emits the "wrapped" signal. SeeonWrapped(org.gnome.adw.SpinRow.WrappedCallback)
. -
builder
ASpinRow.Builder
object constructs aSpinRow
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withSpinRow.Builder.build()
.
-