1.165 <GtkScaleButton>

Class: <GtkScaleButton>

It derives from <GtkWidget>.

Provides a button which pops up a scale widget.

This kind of widget is commonly used for volume controls in multimedia applications, and GTK provides a <GtkVolumeButton> subclass that is tailored for this use case.

Shortcuts and Gestures

The following signals have default keybindings:

CSS nodes

scalebutton.scale
╰── button.toggle
    ╰── <icon>

<GtkScaleButton> has a single CSS node with name scalebutton and .scale style class, and contains a button node with a .toggle style class.

Fields

parent-instance

Properties

Property: scale-button:active self

If the scale button should be pressed in.

Its value is a boolean.

It is read only.

Property: scale-button:adjustment self

The <GtkAdjustment> that is used as the model.

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

Set it with (set! (scale-button:adjustment self) value).

Property: scale-button:has-frame self

If the scale button has a frame.

Its value is a boolean.

Set it with (set! (scale-button:has-frame self) value).

Property: scale-button:icons self

The names of the icons to be used by the scale button.

The first item in the array will be used in the button when the current value is the lowest value, the second item for the highest value. All the subsequent icons will be used for all the other values, spread evenly over the range of values.

If there’s only one icon name in the icons array, it will be used for all the values. If only two icon names are in the icons array, the first one will be used for the bottom 50% of the scale, and the second one for the top 50%.

It is recommended to use at least 3 icons so that the <GtkScaleButton> reflects the current value of the scale better for the users.

Its value is a vector, each a string (or, to set it, a list), or #f.

Set it with (set! (scale-button:icons self) value).

Property: scale-button:value self

The value of the scale.

Its value is a real number.

Set it with (set! (scale-button:value self) value).

Procedures

Method: scale-button:get-active? self ⇒ %return
Method: get-active? self ⇒ %return

Queries a <GtkScaleButton> and returns its current state.

Returns #t if the scale button is pressed in and #f if it is raised.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

%return

Returned: a boolean.

whether the button is pressed

Method: scale-button:get-adjustment self ⇒ %return
Method: get-adjustment self ⇒ %return

Gets the <GtkAdjustment> associated with the <GtkScaleButton>’s scale.

See range:get-adjustment for details.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

%return

Returned: a <GtkAdjustment>.

the adjustment associated with the scale

Method: scale-button:get-has-frame? self ⇒ %return
Method: get-has-frame? self ⇒ %return

Returns whether the button has a frame.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

%return

Returned: a boolean.

#t if the button has a frame

Method: scale-button:get-minus-button self ⇒ %return
Method: get-minus-button self ⇒ %return

Retrieves the minus button of the <GtkScaleButton>.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

%return

Returned: a <GtkButton>.

the minus button of the <GtkScaleButton>

Method: scale-button:get-plus-button self ⇒ %return
Method: get-plus-button self ⇒ %return

Retrieves the plus button of the GtkScaleButton.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

%return

Returned: a <GtkButton>.

the plus button of the <GtkScaleButton>

Method: scale-button:get-popup self ⇒ %return
Method: get-popup self ⇒ %return

Retrieves the popup of the <GtkScaleButton>.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

%return

Returned: a <GtkWidget>.

the popup of the <GtkScaleButton>

Method: scale-button:get-value self ⇒ %return
Method: get-value self ⇒ %return

Gets the current value of the scale button.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

%return

Returned: a real number.

current value of the scale button

Procedure: scale-button:new min max step [icons] ⇒ %return

Creates a <GtkScaleButton>.

The new scale button has a range between min and max, with a stepping of step.

min

Passed: a real number.

the minimum value of the scale (usually 0)

max

Passed: a real number.

the maximum value of the scale (usually 100)

step

Passed: a real number.

the stepping of value when a scroll-wheel event, or up/down arrow event occurs (usually 2)

icons

Passed, or left out: a list or vector, each a string, or #f.

a #f-terminated array of icon names, or #f if you want to set the list later with scale-button:set-icons

%return

Returned: a <GtkWidget>.

a new <GtkScaleButton>

Method: scale-button:set-adjustment self adjustment
Method: set-adjustment self adjustment

Sets the <GtkAdjustment> to be used as a model for the <GtkScaleButton>’s scale.

See range:set-adjustment for details.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

adjustment

Passed: a <GtkAdjustment>.

a <GtkAdjustment>

Method: scale-button:set-has-frame self has-frame
Method: set-has-frame self has-frame

Sets the style of the button.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

has-frame

Passed: a boolean.

whether the button should have a visible frame

Method: scale-button:set-icons self icons
Method: set-icons self icons

Sets the icons to be used by the scale button.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

icons

Passed: a list or vector, each a string.

a #f-terminated array of icon names

Method: scale-button:set-value self value
Method: set-value self value

Sets the current value of the scale.

If the value is outside the minimum or maximum range values, it will be clamped to fit inside them.

The scale button emits the scale-button:value-changed signal if the value changes.

self

Passed: a <GtkScaleButton>.

a <GtkScaleButton>

value

Passed: a real number.

new value of the scale button

Signals

Signal: scale-button:popdown

Connect a handler with (connect object scale-button:popdown handler). It is called as (handler self).

Emitted to dismiss the popup.

This is a keybinding signal.

The default binding for this signal is Escape.

self

Passed: a <GtkScaleButton>.

Signal: scale-button:popup

Connect a handler with (connect object scale-button:popup handler). It is called as (handler self).

Emitted to popup the scale widget.

This is a keybinding signal.

The default bindings for this signal are Space, Enter and Return.

self

Passed: a <GtkScaleButton>.

Signal: scale-button:value-changed

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

Emitted when the value field has changed.

self

Passed: a <GtkScaleButton>.

value

Passed: a real number.

the new value

Virtual methods

Virtual method: scale-button:do-value-changed implementor self value

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

implementor

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

self

Passed: a <GtkScaleButton>.

value

Passed: a real number.