About all my projects
Gnome::Gtk4::Adjustment

Gnome::Gtk4::Adjustment

Description

Gnome::Gtk4::Adjustment is a model for a numeric value.

The Gnome::Gtk4::Adjustment has an associated lower and upper bound. It also contains step and page increments, and a page size.

Adjustments are used within several GTK widgets, including Gnome::Gtk4::SpinButton, Gnome::Gtk4::Viewport, Gnome::Gtk4::Scrollbar and Gnome::Gtk4::Scale.

The Gnome::Gtk4::Adjustment object does not update the value itself. Instead it is left up to the owner of the Gnome::Gtk4::Adjustment to control the value.

Class initialization

new

:native-object

Create an object using a native object from elsewhere. See also Gnome::N::TopLevelSupportClass.

multi method new ( N-Object :$native-object! )

new-adjustment

Creates a new Gnome::Gtk4::Adjustment.

method new-adjustment ( Num() $value, Num() $lower, Num() $upper, Num() $step-increment, Num() $page-increment, Num() $page-size --> Gnome::Gtk4::Adjustment \)
  • $value; the initial value.

  • $lower; the minimum value.

  • $upper; the maximum value.

  • $step-increment; the step increment.

  • $page-increment; the page increment.

  • $page-size; the page size.

Methods

clamp-page

Updates the value property to ensure that the range between $lower and $upper is in the current page.

The current page goes from value to value + page-size`. If the range is larger than the page size, then only the start of it will be in the current page.

A value-changed signal will be emitted if the value is changed.

method clamp-page ( Num() $lower, Num() $upper )
  • $lower; the lower value.

  • $upper; the upper value.

configure

Sets all properties of the adjustment at once.

Use this function to avoid multiple emissions of the changed signal. See .set-lower() for an alternative way of compressing multiple emissions of changed into one.

method configure ( Num() $value, Num() $lower, Num() $upper, Num() $step-increment, Num() $page-increment, Num() $page-size )
  • $value; the new value.

  • $lower; the new minimum value.

  • $upper; the new maximum value.

  • $step-increment; the new step increment.

  • $page-increment; the new page increment.

  • $page-size; the new page size.

get-lower

Retrieves the minimum value of the adjustment.

method get-lower (--> Num )

Return value; The current minimum value of the adjustment.

get-minimum-increment

Gets the smaller of step increment and page increment.

method get-minimum-increment (--> Num )

Return value; the minimum increment of $adjustment.

get-page-increment

Retrieves the page increment of the adjustment.

method get-page-increment (--> Num )

Return value; The current page increment of the adjustment.

get-page-size

Retrieves the page size of the adjustment.

method get-page-size (--> Num )

Return value; The current page size of the adjustment.

get-step-increment

Retrieves the step increment of the adjustment.

method get-step-increment (--> Num )

Return value; The current step increment of the adjustment..

get-upper

Retrieves the maximum value of the adjustment.

method get-upper (--> Num )

Return value; The current maximum value of the adjustment.

get-value

Gets the current value of the adjustment.

method get-value (--> Num )

Return value; The current value of the adjustment.

set-lower

Sets the minimum value of the adjustment.

When setting multiple adjustment properties via their individual setters, multiple changed signals will be emitted. However, since the emission of the changed signal is tied to the emission of the notify signals of the changed properties, it’s possible to compress the changed signals into one by calling g_object_freeze_notify() and g_object_thaw_notify() around the calls to the individual setters.

Alternatively, using a single g_object_set() for all the properties to change, or using .configure() has the same effect.

method set-lower ( Num() $lower )
  • $lower; the new minimum value.

set-page-increment

Sets the page increment of the adjustment.

See .set-lower() about how to compress multiple emissions of the changed signal when setting multiple adjustment properties.

method set-page-increment ( Num() $page-increment )
  • $page-increment; the new page increment.

set-page-size

Sets the page size of the adjustment.

See .set-lower() about how to compress multiple emissions of the changed signal when setting multiple adjustment properties.

method set-page-size ( Num() $page-size )
  • $page-size; the new page size.

set-step-increment

Sets the step increment of the adjustment.

See .set-lower() about how to compress multiple emissions of the changed signal when setting multiple adjustment properties.

method set-step-increment ( Num() $step-increment )
  • $step-increment; the new step increment.

set-upper

Sets the maximum value of the adjustment.

Note that values will be restricted by upper - page-size` if the page-size property is nonzero.

See .set-lower() about how to compress multiple emissions of the changed signal when setting multiple adjustment properties.

method set-upper ( Num() $upper )
  • $upper; the new maximum value.

set-value

Sets the Gnome::Gtk4::Adjustment value.

The value is clamped to lie between lower and upper.

Note that for adjustments which are used in a Gnome::Gtk4::Scrollbar, the effective range of allowed values goes from lower to upper - page-size.

method set-value ( Num() $value )
  • $value; the new value.

Signals

changed

Emitted when one or more of the Gnome::Gtk4::Adjustment properties have been changed.

Note that the value property is covered by the value-changed signal.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::Adjustment :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::Adjustment object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.

value-changed

Emitted when the value has been changed.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::Adjustment :$_widget,
  *C<user>-options
)
  • $_handle_id; The registered event handler id.

  • $_native-object; The native object provided by the Raku object which registered this event. This a native Gnome::Gtk4::Adjustment object.

  • $_widget; The object which registered the signal. User code may have left the object going out of scope.

  • user-options; A list of named arguments provided at the .register-signal() method from Gnome::GObject::Object.