Class SpinRow

All Implemented Interfaces:
Accessible, Actionable, Buildable, ConstraintTarget, Editable, Proxy

@Generated("org.javagi.JavaGI") public final class SpinRow extends ActionRow implements Accessible, Actionable, Buildable, ConstraintTarget, Editable

An ActionRow with an embedded spin button.

spin-row

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.AccessibleRole.spin-button role.

Since:
1.4
  • Constructor Details

    • SpinRow

      public SpinRow(MemorySegment address)
      Create a SpinRow instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • SpinRow

      public SpinRow(@Nullable Adjustment adjustment, double climbRate, int digits)
      Creates a new AdwSpinRow.
      Parameters:
      adjustment - the adjustment that this spin row should use
      climbRate - the rate the value changes when holding a button or key
      digits - the number of decimal places to display
      Since:
      1.4
    • SpinRow

      public SpinRow()
      Create a new SpinRow.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the SpinRow class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected SpinRow asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class ActionRow
      Returns:
      the instance as if it were its parent type
    • withRange

      public static SpinRow withRange(double min, double max, double step)

      Creates a new AdwSpinRow 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 of step.

      ::: 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 setDigits(int) to correct it.

      Parameters:
      min - minimum allowable value
      max - maximum allowable value
      step - increment added or subtracted by spinning the widget
      Returns:
      the new AdwSpinRow
      Since:
      1.4
    • configure

      public void configure(@Nullable Adjustment adjustment, double climbRate, int digits)

      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 use
      climbRate - the new climb rate
      digits - the number of decimal places to display
      Since:
      1.4
    • getAdjustment

      public Adjustment getAdjustment()
      Gets the adjustment that holds the value for the spin row.
      Returns:
      the adjustment that holds the spin row's value
      Since:
      1.4
    • 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
      Since:
      1.4
    • getDigits

      public int getDigits()
      Gets the number of decimal places to display.
      Returns:
      the number of decimal places to display
      Since:
      1.4
    • getNumeric

      public boolean getNumeric()
      Gets whether non-numeric characters should be ignored.
      Returns:
      whether non-numeric characters should be ignored.
      Since:
      1.4
    • 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
      Since:
      1.4
    • getUpdatePolicy

      public SpinButtonUpdatePolicy getUpdatePolicy()
      Gets the policy for updating the spin row.
      Returns:
      the policy for updating the spin row
      Since:
      1.4
    • getValue

      public double getValue()
      Gets the current value.
      Returns:
      the current value
      Since:
      1.4
    • 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
      Since:
      1.4
    • setAdjustment

      public void setAdjustment(@Nullable Adjustment adjustment)
      Sets the adjustment that holds the value for the spin row.
      Parameters:
      adjustment - an adjustment
      Since:
      1.4
    • 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
      Since:
      1.4
    • setDigits

      public void setDigits(int digits)
      Sets the number of decimal places to display.
      Parameters:
      digits - the number of decimal places to display
      Since:
      1.4
    • setNumeric

      public void setNumeric(boolean numeric)
      Sets whether non-numeric characters should be ignored.
      Parameters:
      numeric - whether non-numeric characters should be ignored
      Since:
      1.4
    • setRange

      public void setRange(double min, double max)

      Sets the minimum and maximum allowable values for self.

      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 value
      max - maximum allowable value
      Since:
      1.4
    • 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
      Since:
      1.4
    • setUpdatePolicy

      public void setUpdatePolicy(SpinButtonUpdatePolicy policy)

      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
      Since:
      1.4
    • setValue

      public void setValue(double value)
      Sets the current value.
      Parameters:
      value - a new value
      Since:
      1.4
    • 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
      Since:
      1.4
    • update

      public void update()
      Manually force an update of the spin row.
      Since:
      1.4
    • 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.

      See Gtk.SpinButton::input.

      Parameters:
      handler - the signal handler
      Returns:
      a signal handler ID to keep track of the signal connection
      Since:
      1.4
      See Also:
    • emitInput

      public int emitInput(Out<Double> newValue)
      Emits the "input" signal. See onInput(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
      Since:
      1.4
      See Also:
    • emitOutput

      public boolean emitOutput()
      Emits the "output" signal. See onOutput(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
      Since:
      1.4
      See Also:
    • emitWrapped

      public void emitWrapped()
      Emits the "wrapped" signal. See onWrapped(SpinRow.WrappedCallback).
    • builder

      public static SpinRow.Builder<? extends SpinRow.Builder> builder()
      A SpinRow.Builder object constructs a SpinRow with the specified properties. Use the various set...() methods to set properties, and finish construction with SpinRow.Builder.build().
      Returns:
      the builder object