1.52 <AdwSpinRow>

Class: <AdwSpinRow>

It derives from <AdwActionRow>.

An 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 <GtkSpinButton> 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.

Properties

Property: spin-row:adjustment self

The adjustment that holds the value of the spin row.

Its value is a <GtkAdjustment>, or #f.

Set it with (set! (spin-row:adjustment self) value).

Property: spin-row:climb-rate self

The acceleration rate when you hold down a button or key.

Its value is a real number.

Set it with (set! (spin-row:climb-rate self) value).

Property: spin-row:digits self

The number of decimal places to display.

Its value is an unsigned 32-bit integer.

Set it with (set! (spin-row:digits self) value).

Property: spin-row:numeric self

Whether non-numeric characters should be ignored.

Its value is a boolean.

Set it with (set! (spin-row:numeric self) value).

Property: spin-row:snap-to-ticks self

Whether invalid values are snapped to the nearest step increment.

Its value is a boolean.

Set it with (set! (spin-row:snap-to-ticks self) value).

Property: spin-row:update-policy self

The policy for updating the spin row.

The options are always, or only when the value is invalid.

Its value is a <GtkSpinButtonUpdatePolicy> (or, to set it, one of its symbols).

Set it with (set! (spin-row:update-policy self) value).

Property: spin-row:value self

The current value.

Its value is a real number.

Set it with (set! (spin-row:value self) value).

Property: spin-row:wrap self

Whether the spin row should wrap upon reaching its limits.

Its value is a boolean.

Set it with (set! (spin-row:wrap self) value).

Procedures

Method: spin-row:configure self adjustment climb-rate digits
Method: configure self adjustment climb-rate digits

Changes the properties of an existing spin row.

The adjustment, climb rate, and number of decimal places are updated accordingly.

self

Passed: a <AdwSpinRow>.

a spin row

adjustment

Passed: a <GtkAdjustment>, or #f.

the adjustment that this spin row should use

climb-rate

Passed: a real number.

the new climb rate

digits

Passed: an unsigned 32-bit integer.

the number of decimal places to display

Method: spin-row:get-adjustment self ⇒ %return
Method: get-adjustment self ⇒ %return

Gets the adjustment that holds the value for the spin row.

self

Passed: a <AdwSpinRow>.

a spin row

%return

Returned: a <GtkAdjustment>.

the adjustment that holds the spin row’s value

Method: spin-row:get-climb-rate self ⇒ %return
Method: get-climb-rate self ⇒ %return

Gets the acceleration rate when you hold down a button or key.

self

Passed: a <AdwSpinRow>.

a spin row

%return

Returned: a real number.

the acceleration rate when you hold down a button or key

Method: spin-row:get-digits self ⇒ %return
Method: get-digits self ⇒ %return

Gets the number of decimal places to display.

self

Passed: a <AdwSpinRow>.

a spin row

%return

Returned: an unsigned 32-bit integer.

the number of decimal places to display

Method: spin-row:get-numeric? self ⇒ %return
Method: get-numeric? self ⇒ %return

Gets whether non-numeric characters should be ignored.

self

Passed: a <AdwSpinRow>.

a spin row

%return

Returned: a boolean.

whether non-numeric characters should be ignored.

Method: spin-row:get-snap-to-ticks? self ⇒ %return
Method: get-snap-to-ticks? self ⇒ %return

Gets whether invalid values are snapped to nearest step increment.

self

Passed: a <AdwSpinRow>.

a spin row

%return

Returned: a boolean.

whether invalid values are snapped to the nearest step increment

Method: spin-row:get-update-policy self ⇒ %return
Method: get-update-policy self ⇒ %return

Gets the policy for updating the spin row.

self

Passed: a <AdwSpinRow>.

a spin row

%return

Returned: a <GtkSpinButtonUpdatePolicy>.

the policy for updating the spin row

Method: spin-row:get-value self ⇒ %return
Method: get-value self ⇒ %return

Gets the current value.

self

Passed: a <AdwSpinRow>.

a spin row

%return

Returned: a real number.

the current value

Method: spin-row:get-wrap? self ⇒ %return
Method: get-wrap? self ⇒ %return

Gets whether the spin row should wrap upon reaching its limits.

self

Passed: a <AdwSpinRow>.

a spin row

%return

Returned: a boolean.

whether the spin row should wrap upon reaching its limits

Procedure: spin-row:new adjustment climb-rate digits ⇒ %return

Creates a new <AdwSpinRow>.

adjustment

Passed: a <GtkAdjustment>, or #f.

the adjustment that this spin row should use

climb-rate

Passed: a real number.

the rate the value changes when holding a button or key

digits

Passed: an unsigned 32-bit integer.

the number of decimal places to display

%return

Returned: a <GtkWidget>.

the newly created <AdwSpinRow>

Procedure: spin-row:new-with-range min max step ⇒ %return

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 SpinRow.set_digits to correct it.

min

Passed: a real number.

minimum allowable value

max

Passed: a real number.

maximum allowable value

step

Passed: a real number.

increment added or subtracted by spinning the widget

%return

Returned: a <GtkWidget>.

the new <AdwSpinRow>

Method: spin-row:set-adjustment self [adjustment]
Method: set-adjustment self [adjustment]

Sets the adjustment that holds the value for the spin row.

self

Passed: a <AdwSpinRow>.

a spin row

adjustment

Passed, or left out: a <GtkAdjustment>, or #f.

an adjustment

Method: spin-row:set-climb-rate self climb-rate
Method: set-climb-rate self climb-rate

Sets the acceleration rate when you hold down a button or key.

self

Passed: a <AdwSpinRow>.

a spin row

climb-rate

Passed: a real number.

the acceleration rate when you hold down a button or key

Method: spin-row:set-digits self digits
Method: set-digits self digits

Sets the number of decimal places to display.

self

Passed: a <AdwSpinRow>.

a spin row

digits

Passed: an unsigned 32-bit integer.

the number of decimal places to display

Method: spin-row:set-numeric self numeric
Method: set-numeric self numeric

Sets whether non-numeric characters should be ignored.

self

Passed: a <AdwSpinRow>.

a spin row

numeric

Passed: a boolean.

whether non-numeric characters should be ignored

Method: spin-row:set-range self min max
Method: set-range self min 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.

self

Passed: a <AdwSpinRow>.

a spin row

min

Passed: a real number.

minimum allowable value

max

Passed: a real number.

maximum allowable value

Method: spin-row:set-snap-to-ticks self snap-to-ticks
Method: set-snap-to-ticks self snap-to-ticks

Sets whether invalid values are snapped to the nearest step increment.

self

Passed: a <AdwSpinRow>.

a spin row

snap-to-ticks

Passed: a boolean.

whether invalid values are snapped to the nearest step increment

Method: spin-row:set-update-policy self policy
Method: set-update-policy self policy

Sets the policy for updating the spin row.

The options are always, or only when the value is invalid.

self

Passed: a <AdwSpinRow>.

a spin row

policy

Passed: a <GtkSpinButtonUpdatePolicy>, or one of its symbols.

the policy for updating the spin row

Method: spin-row:set-value self value
Method: set-value self value

Sets the current value.

self

Passed: a <AdwSpinRow>.

a spin row

value

Passed: a real number.

a new value

Method: spin-row:set-wrap self wrap
Method: set-wrap self wrap

Sets whether the spin row should wrap upon reaching its limits.

self

Passed: a <AdwSpinRow>.

a spin row

wrap

Passed: a boolean.

whether the spin row should wrap upon reaching its limits

Method: spin-row:update self
Method: update self

Manually force an update of the spin row.

self

Passed: a <AdwSpinRow>.

a spin row

Signals

Signal: spin-row:input

Connect a handler with (connect object spin-row:input handler). It is called as (handler self) ⇒ %return new-value.

Emitted to convert the user’s input into a double value.

The signal handler is expected to use editable:get-text to retrieve the text of the spinbutton and set new_value to the new value.

The default conversion uses strtod.

See spin-button:input.

self

Passed: a <AdwSpinRow>.

%return

Returned: a 32-bit integer.

TRUE for a successful conversion, FALSE if the input was not handled, and Gtk.INPUT_ERROR if the conversion failed.

new-value

Returned: a real number.

return location for the new value

Signal: spin-row:output

Connect a handler with (connect object spin-row:output handler). It is called as (handler self) ⇒ %return.

Emitted to tweak the formatting of the value for display.

See spin-button:output.

self

Passed: a <AdwSpinRow>.

%return

Returned: a boolean.

TRUE if the value has been displayed

Signal: spin-row:wrapped

Connect a handler with (connect object spin-row:wrapped handler). It is called as (handler self).

Emitted right after the spinbutton wraps.

See spin-button:wrapped.

self

Passed: a <AdwSpinRow>.