About all my projects
Gnome::Gtk4::Range

Gnome::Gtk4::Range

Description

Gnome::Gtk4::Range is the common base class for widgets which visualize an adjustment.

Widgets that are derived from Gnome::Gtk4::Range include Gnome::Gtk4::Scale and Gnome::Gtk4::Scrollbar.

Apart from signals for monitoring the parameters of the adjustment, Gnome::Gtk4::Range provides properties and methods for setting a “fill level” on range widgets. See .set-fill-level().

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! )

Methods

get-adjustment

Get the adjustment which is the “model” object for Gnome::Gtk4::Range.

method get-adjustment (--> N-Object )

Return value; a Gnome::Gtk4::Adjustment.

get-fill-level

Gets the current position of the fill level indicator.

method get-fill-level (--> Num )

Return value; The current fill level.

get-flippable

Gets whether the Gnome::Gtk4::Range respects text direction.

See .set-flippable().

method get-flippable (--> Bool )

Return value; True if the range is flippable.

get-inverted

Gets whether the range is inverted.

See .set-inverted().

method get-inverted (--> Bool )

Return value; True if the range is inverted.

get-range-rect

This function returns the area that contains the range’s trough, in coordinates relative to $range's origin.

This function is useful mainly for Gnome::Gtk4::Range subclasses.

method get-range-rect ( N-Object $range-rect )
  • $range-rect; return location for the range rectangle

get-restrict-to-fill-level

Gets whether the range is restricted to the fill level.

method get-restrict-to-fill-level (--> Bool )

Return value; True if $range is restricted to the fill level..

get-round-digits

Gets the number of digits to round the value to when it changes.

See change-value.

method get-round-digits (--> Int )

Return value; the number of digits to round to.

get-show-fill-level

Gets whether the range displays the fill level graphically.

method get-show-fill-level (--> Bool )

Return value; True if $range shows the fill level..

get-slider-range

This function returns sliders range along the long dimension, in widget->window coordinates.

This function is useful mainly for Gnome::Gtk4::Range subclasses.

method get-slider-range ( Array[Int] $slider-start, Array[Int] $slider-end )
  • $slider-start; (transfer ownership: full) return location for the slider's start.

  • $slider-end; (transfer ownership: full) return location for the slider's end.

get-slider-size-fixed

This function is useful mainly for Gnome::Gtk4::Range subclasses.

See .set-slider-size-fixed().

method get-slider-size-fixed (--> Bool )

Return value; whether the range’s slider has a fixed size..

get-value

Gets the current value of the range.

method get-value (--> Num )

Return value; current value of the range..

set-adjustment

Sets the adjustment to be used as the “model” object for the Gnome::Gtk4::Range

The 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 Gnome::Gtk4::Scale and nonzero for Gnome::Gtk4::Scrollbar, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider.

method set-adjustment ( N-Object() $adjustment )
  • $adjustment; a Gnome::Gtk4::Adjustment.

set-fill-level

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 .set-show-fill-level(). 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 .set-restrict-to-fill-level() and is by default enabled.

method set-fill-level ( Num() $fill-level )
  • $fill-level; the new position of the fill level indicator.

set-flippable

Sets whether the Gnome::Gtk4::Range respects text direction.

If a range is flippable, it will switch its direction if it is horizontal and its direction is GTK_TEXT_DIR_RTL.

See .get-direction() in class Gnome::Gtk4::Widget.

method set-flippable ( Bool() $flippable )
  • $flippable; True to make the range flippable.

set-increments

Sets the step and page sizes for the range.

The step size is used when the user clicks the Gnome::Gtk4::Scrollbar arrows or moves a Gnome::Gtk4::Scale via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.

method set-increments ( Num() $step, Num() $page )
  • $step; step size.

  • $page; page size.

set-inverted

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.

method set-inverted ( Bool() $setting )
  • $setting; True to invert the range.

set-range

Sets the allowable values in the Gnome::Gtk4::Range.

The range value is clamped to be between $min and $max. (If the range has a non-zero page size, it is clamped between $min and $max - page-size.)

method set-range ( Num() $min, Num() $max )
  • $min; minimum range value.

  • $max; maximum range value.

set-restrict-to-fill-level

Sets whether the slider is restricted to the fill level.

See .set-fill-level() for a general description of the fill level concept.

method set-restrict-to-fill-level ( Bool() $restrict-to-fill-level )
  • $restrict-to-fill-level; Whether the fill level restricts slider movement..

set-round-digits

Sets the number of digits to round the value to when it changes.

See change-value.

method set-round-digits ( Int() $round-digits )
  • $round-digits; the precision in digits, or -1.

set-show-fill-level

Sets whether a graphical fill level is show on the trough.

See .set-fill-level() for a general description of the fill level concept.

method set-show-fill-level ( Bool() $show-fill-level )
  • $show-fill-level; Whether a fill level indicator graphics is shown..

set-slider-size-fixed

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 Gnome::Gtk4::Range subclasses.

method set-slider-size-fixed ( Bool() $size-fixed )
  • $size-fixed; True to make the slider size constant.

set-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 value-changed signal if the value changes.

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

Signals

adjust-bounds

Emitted before clamping a value, to give the application a chance to adjust the bounds.

method handler (
  gdouble $value,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::Range :$_widget,
  *C<user>-options
)
  • $value; the value before we clamp.

  • $_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::Range 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.

change-value

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 True to prevent further processing. Or, by returning False, 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 round-digits.

method handler (
   $scroll,
  gdouble $value,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::Range :$_widget,
  *C<user>-options
  --> gboolean
)
  • $scroll; the type of scroll action that was performed.

  • $value; the new value resulting from the scroll action.

  • $_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::Range 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.

Return value; True to prevent other handlers from being invoked for the signal, False to propagate the signal further

move-slider

Virtual function that moves the slider.

Used for keybindings.

method handler (
   $step,
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::Range :$_widget,
  *C<user>-options
)
  • $step; how to move the slider.

  • $_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::Range 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 range value changes.

method handler (
  Int :$_handle_id,
  N-GObject :$_native-object,
  Gnome::Gtk4::Range :$_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::Range 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.