CtkScaleButton

CtkScaleButton — A button which pops up a scale

Functions

Properties

CtkAdjustment * adjustment Read / Write
GStrv icons Read / Write
CtkIconSize size Read / Write
double value Read / Write

Signals

void popdown Action
void popup Action
void value-changed Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── CtkWidget
            ╰── CtkContainer
                ╰── CtkBin
                    ╰── CtkButton
                        ╰── CtkScaleButton
                            ╰── CtkVolumeButton

Implemented Interfaces

CtkScaleButton implements AtkImplementorIface, CtkBuildable, CtkActionable, CtkActivatable and CtkOrientable.

Includes

#include <ctk/ctk.h>

Description

CtkScaleButton provides a button which pops up a scale widget. This kind of widget is commonly used for volume controls in multimedia applications, and CTK+ provides a CtkVolumeButton subclass that is tailored for this use case.

CSS nodes

CtkScaleButton has a single CSS node with name button. To differentiate it from a plain CtkButton, it gets the .scale style class.

The popup widget that contains the scale has a .scale-popup style class.

Functions

ctk_scale_button_new ()

CtkWidget *
ctk_scale_button_new (CtkIconSize size,
                      gdouble min,
                      gdouble max,
                      gdouble step,
                      const gchar **icons);

Creates a CtkScaleButton, with a range between min and max , with a stepping of step .

Parameters

size

a stock icon size (CtkIconSize).

[type int]

min

the minimum value of the scale (usually 0)

 

max

the maximum value of the scale (usually 100)

 

step

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

 

icons

a NULL-terminated array of icon names, or NULL if you want to set the list later with ctk_scale_button_set_icons().

[allow-none][array zero-terminated=1]

Returns

a new CtkScaleButton

Since: 2.12


ctk_scale_button_set_adjustment ()

void
ctk_scale_button_set_adjustment (CtkScaleButton *button,
                                 CtkAdjustment *adjustment);

Sets the CtkAdjustment to be used as a model for the CtkScaleButton’s scale. See ctk_range_set_adjustment() for details.

Parameters

button

a CtkScaleButton

 

adjustment

a CtkAdjustment

 

Since: 2.12


ctk_scale_button_set_icons ()

void
ctk_scale_button_set_icons (CtkScaleButton *button,
                            const gchar **icons);

Sets the icons to be used by the scale button. For details, see the “icons” property.

Parameters

button

a CtkScaleButton

 

icons

a NULL-terminated array of icon names.

[array zero-terminated=1]

Since: 2.12


ctk_scale_button_set_value ()

void
ctk_scale_button_set_value (CtkScaleButton *button,
                            gdouble 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 “value-changed” signal if the value changes.

Parameters

button

a CtkScaleButton

 

value

new value of the scale button

 

Since: 2.12


ctk_scale_button_get_adjustment ()

CtkAdjustment *
ctk_scale_button_get_adjustment (CtkScaleButton *button);

Gets the CtkAdjustment associated with the CtkScaleButton’s scale. See ctk_range_get_adjustment() for details.

Parameters

button

a CtkScaleButton

 

Returns

the adjustment associated with the scale.

[transfer none]

Since: 2.12


ctk_scale_button_get_value ()

gdouble
ctk_scale_button_get_value (CtkScaleButton *button);

Gets the current value of the scale button.

Parameters

button

a CtkScaleButton

 

Returns

current value of the scale button

Since: 2.12


ctk_scale_button_get_popup ()

CtkWidget *
ctk_scale_button_get_popup (CtkScaleButton *button);

Retrieves the popup of the CtkScaleButton.

Parameters

button

a CtkScaleButton

 

Returns

the popup of the CtkScaleButton.

[transfer none]

Since: 2.14


ctk_scale_button_get_plus_button ()

CtkWidget *
ctk_scale_button_get_plus_button (CtkScaleButton *button);

Retrieves the plus button of the CtkScaleButton.

Parameters

button

a CtkScaleButton

 

Returns

the plus button of the CtkScaleButton as a CtkButton.

[transfer none][type Ctk.Button]

Since: 2.14


ctk_scale_button_get_minus_button ()

CtkWidget *
ctk_scale_button_get_minus_button (CtkScaleButton *button);

Retrieves the minus button of the CtkScaleButton.

Parameters

button

a CtkScaleButton

 

Returns

the minus button of the CtkScaleButton as a CtkButton.

[transfer none][type Ctk.Button]

Since: 2.14

Types and Values

struct CtkScaleButton

struct CtkScaleButton;

Property Details

The “adjustment” property

  “adjustment”               CtkAdjustment *

The CtkAdjustment that contains the current value of this scale button object.

Owner: CtkScaleButton

Flags: Read / Write


The “icons” property

  “icons”                    GStrv

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 CtkScaleButton reflects the current value of the scale better for the users.

Owner: CtkScaleButton

Flags: Read / Write

Since: 2.12


The “size” property

  “size”                     CtkIconSize

The icon size.

Owner: CtkScaleButton

Flags: Read / Write

Default value: CTK_ICON_SIZE_SMALL_TOOLBAR


The “value” property

  “value”                    double

The value of the scale.

Owner: CtkScaleButton

Flags: Read / Write

Default value: 0

Signal Details

The “popdown” signal

void
user_function (CtkScaleButton *button,
               gpointer        user_data)

The ::popdown signal is a keybinding signal which gets emitted to popdown the scale widget.

The default binding for this signal is Escape.

Parameters

button

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

Since: 2.12


The “popup” signal

void
user_function (CtkScaleButton *button,
               gpointer        user_data)

The ::popup signal is a keybinding signal which gets emitted to popup the scale widget.

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

Parameters

button

the object which received the signal

 

user_data

user data set when the signal handler was connected.

 

Flags: Action

Since: 2.12


The “value-changed” signal

void
user_function (CtkScaleButton *button,
               double          value,
               gpointer        user_data)

The ::value-changed signal is emitted when the value field has changed.

Parameters

button

the object which received the signal

 

value

the new value

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since: 2.12