1.161 <GtkRange>

Class: <GtkRange>

It derives from <GtkWidget>.

Base class for widgets which visualize an adjustment.

Widgets that are derived from <GtkRange> include <GtkScale> and <GtkScrollbar>.

Apart from signals for monitoring the parameters of the adjustment, <GtkRange> provides properties and methods for setting a “fill level” on range widgets. See range:set-fill-level.

Shortcuts and Gestures

The <GtkRange> slider is draggable. Holding the Shift key while dragging, or initiating the drag with a long-press will enable the fine-tuning mode.

Fields

parent-instance

Properties

Property: range:adjustment self

The adjustment that is controlled by the range.

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

Set it with (set! (range:adjustment self) value).

Property: range:fill-level self

The fill level (e.g. prebuffering of a network stream).

Its value is a real number.

Set it with (set! (range:fill-level self) value).

Property: range:inverted self

If #t, the direction in which the slider moves is inverted.

Its value is a boolean.

Set it with (set! (range:inverted self) value).

Property: range:restrict-to-fill-level self

Controls whether slider movement is restricted to an upper boundary set by the fill level.

Its value is a boolean.

Set it with (set! (range:restrict-to-fill-level self) value).

Property: range:round-digits self

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

See range:change-value.

Its value is a 32-bit integer.

Set it with (set! (range:round-digits self) value).

Property: range:show-fill-level self

Controls whether fill level indicator graphics are displayed on the trough.

Its value is a boolean.

Set it with (set! (range:show-fill-level self) value).

Procedures

Method: range:get-adjustment self ⇒ %return
Method: get-adjustment self ⇒ %return

Get the adjustment which is the “model” object for <GtkRange>.

self

Passed: a <GtkRange>.

a <GtkRange>

%return

Returned: a <GtkAdjustment>.

a <GtkAdjustment>

Method: range:get-fill-level self ⇒ %return
Method: get-fill-level self ⇒ %return

Gets the current position of the fill level indicator.

self

Passed: a <GtkRange>.

A <GtkRange>

%return

Returned: a real number.

The current fill level

Method: range:get-flippable? self ⇒ %return
Method: get-flippable? self ⇒ %return

Gets whether the <GtkRange> respects text direction.

See range:set-flippable.

self

Passed: a <GtkRange>.

a <GtkRange>

%return

Returned: a boolean.

#t if the range is flippable

Method: range:get-inverted? self ⇒ %return
Method: get-inverted? self ⇒ %return

Gets whether the range is inverted.

See range:set-inverted.

self

Passed: a <GtkRange>.

a <GtkRange>

%return

Returned: a boolean.

#t if the range is inverted

Method: range:get-range-rect! self range-rect ⇒ range-rect
Method: get-range-rect! self range-rect ⇒ range-rect

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

This function is useful mainly for <GtkRange> subclasses.

self

Passed: a <GtkRange>.

a <GtkRange>

range-rect

Passed, filled in, and returned: a <GdkRectangle>.

return location for the range rectangle

Method: range:get-restrict-to-fill-level? self ⇒ %return
Method: get-restrict-to-fill-level? self ⇒ %return

Gets whether the range is restricted to the fill level.

self

Passed: a <GtkRange>.

A <GtkRange>

%return

Returned: a boolean.

#t if self is restricted to the fill level.

Method: range:get-round-digits self ⇒ %return
Method: get-round-digits self ⇒ %return

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

See range:change-value.

self

Passed: a <GtkRange>.

a <GtkRange>

%return

Returned: a 32-bit integer.

the number of digits to round to

Method: range:get-show-fill-level? self ⇒ %return
Method: get-show-fill-level? self ⇒ %return

Gets whether the range displays the fill level graphically.

self

Passed: a <GtkRange>.

A <GtkRange>

%return

Returned: a boolean.

#t if self shows the fill level.

Method: range:get-slider-range self ⇒ slider-start slider-end
Method: get-slider-range self ⇒ slider-start slider-end

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

This function is useful mainly for <GtkRange> subclasses.

self

Passed: a <GtkRange>.

a <GtkRange>

slider-start

Returned: a 32-bit integer.

return location for the slider’s start

slider-end

Returned: a 32-bit integer.

return location for the slider’s end

Method: range:get-slider-size-fixed? self ⇒ %return
Method: get-slider-size-fixed? self ⇒ %return

This function is useful mainly for <GtkRange> subclasses.

See range:set-slider-size-fixed.

self

Passed: a <GtkRange>.

a <GtkRange>

%return

Returned: a boolean.

whether the range’s slider has a fixed size.

Method: range:get-value self ⇒ %return
Method: get-value self ⇒ %return

Gets the current value of the range.

self

Passed: a <GtkRange>.

a <GtkRange>

%return

Returned: a real number.

current value of the range.

Method: range:set-adjustment self adjustment
Method: set-adjustment self adjustment

Sets the adjustment to be used as the “model” object for the <GtkRange>

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 <GtkScale> and nonzero for <GtkScrollbar>, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider.

self

Passed: a <GtkRange>.

a <GtkRange>

adjustment

Passed: a <GtkAdjustment>.

a <GtkAdjustment>

Method: range:set-fill-level self fill-level
Method: set-fill-level self 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 range: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 range:set-restrict-to-fill-level and is by default enabled.

self

Passed: a <GtkRange>.

a <GtkRange>

fill-level

Passed: a real number.

the new position of the fill level indicator

Method: range:set-flippable self flippable
Method: set-flippable self flippable

Sets whether the <GtkRange> respects text direction.

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

See widget:get-direction.

self

Passed: a <GtkRange>.

a <GtkRange>

flippable

Passed: a boolean.

#t to make the range flippable

Method: range:set-increments self step page
Method: set-increments self step page

Sets the step and page sizes for the range.

The step size is used when the user clicks the <GtkScrollbar> arrows or moves a <GtkScale> via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.

self

Passed: a <GtkRange>.

a <GtkRange>

step

Passed: a real number.

step size

page

Passed: a real number.

page size

Method: range:set-inverted self setting
Method: set-inverted self setting

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.

self

Passed: a <GtkRange>.

a <GtkRange>

setting

Passed: a boolean.

#t to invert the range

Method: range:set-range self min max
Method: set-range self min max

Sets the allowable values in the <GtkRange>.

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

self

Passed: a <GtkRange>.

a <GtkRange>

min

Passed: a real number.

minimum range value

max

Passed: a real number.

maximum range value

Method: range:set-restrict-to-fill-level self restrict-to-fill-level
Method: set-restrict-to-fill-level self restrict-to-fill-level

Sets whether the slider is restricted to the fill level.

See range:set-fill-level for a general description of the fill level concept.

self

Passed: a <GtkRange>.

A <GtkRange>

restrict-to-fill-level

Passed: a boolean.

Whether the fill level restricts slider movement.

Method: range:set-round-digits self round-digits
Method: set-round-digits self round-digits

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

See range:change-value.

self

Passed: a <GtkRange>.

a <GtkRange>

round-digits

Passed: a 32-bit integer.

the precision in digits, or -1

Method: range:set-show-fill-level self show-fill-level
Method: set-show-fill-level self show-fill-level

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

See range:set-fill-level for a general description of the fill level concept.

self

Passed: a <GtkRange>.

A <GtkRange>

show-fill-level

Passed: a boolean.

Whether a fill level indicator graphics is shown.

Method: range:set-slider-size-fixed self size-fixed
Method: set-slider-size-fixed self 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 <GtkRange> subclasses.

self

Passed: a <GtkRange>.

a <GtkRange>

size-fixed

Passed: a boolean.

#t to make the slider size constant

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

self

Passed: a <GtkRange>.

a <GtkRange>

value

Passed: a real number.

new value of the range

Signals

Signal: range:adjust-bounds

Connect a handler with (connect object range:adjust-bounds handler). It is called as (handler self value).

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

self

Passed: a <GtkRange>.

value

Passed: a real number.

the value before we clamp

Signal: range:change-value

Connect a handler with (connect object range:change-value handler). It is called as (handler self scroll value) ⇒ %return.

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 #t to prevent further processing. Or, by returning #f, 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 range:round-digits.

self

Passed: a <GtkRange>.

scroll

Passed: a <GtkScrollType>.

the type of scroll action that was performed

value

Passed: a real number.

the new value resulting from the scroll action

%return

Returned: a boolean.

#t to prevent other handlers from being invoked for the signal, #f to propagate the signal further

Signal: range:move-slider

Connect a handler with (connect object range:move-slider handler). It is called as (handler self step).

Virtual function that moves the slider.

Used for keybindings.

self

Passed: a <GtkRange>.

step

Passed: a <GtkScrollType>.

how to move the slider

Signal: range:value-changed

Connect a handler with (connect object range:value-changed handler). It is called as (handler self).

Emitted when the range value changes.

self

Passed: a <GtkRange>.

Virtual methods

Virtual method: range:do-adjust-bounds implementor self new-value

To override it in a new class, give register-type #:vfuncs `((adjust-bounds . ,procedure)). The procedure is called as (procedure self new-value).

implementor

Passed: the class whose implementation to call: <GtkRange>, or a class that derives from it, or its GType number.

self

Passed: a <GtkRange>.

new-value

Passed: a real number.

Virtual method: range:do-change-value implementor self scroll new-value ⇒ %return

To override it in a new class, give register-type #:vfuncs `((change-value . ,procedure)). The procedure is called as (procedure self scroll new-value) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GtkRange>, or a class that derives from it, or its GType number.

self

Passed: a <GtkRange>.

scroll

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

new-value

Passed: a real number.

%return

Returned: a boolean.

Virtual method: range:do-get-range-border implementor self border-

To override it in a new class, give register-type #:vfuncs `((get-range-border . ,procedure)). The procedure is called as (procedure self border-).

implementor

Passed: the class whose implementation to call: <GtkRange>, or a class that derives from it, or its GType number.

self

Passed: a <GtkRange>.

border-

Passed: a <GtkBorder>.

Virtual method: range:do-move-slider implementor self scroll

To override it in a new class, give register-type #:vfuncs `((move-slider . ,procedure)). The procedure is called as (procedure self scroll).

implementor

Passed: the class whose implementation to call: <GtkRange>, or a class that derives from it, or its GType number.

self

Passed: a <GtkRange>.

scroll

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

Virtual method: range:do-value-changed implementor self

To override it in a new class, give register-type #:vfuncs `((value-changed . ,procedure)). The procedure is called as (procedure self).

implementor

Passed: the class whose implementation to call: <GtkRange>, or a class that derives from it, or its GType number.

self

Passed: a <GtkRange>.