manpagez: man pages & more
html files: gtk2
Home | html | info | man

GtkRange

GtkRange — Base class for widgets which visualize an adjustment

Properties

Types and Values

Object Hierarchy

    GObject
    ╰── GInitiallyUnowned
        ╰── GtkObject
            ╰── GtkWidget
                ╰── GtkRange
                    ├── GtkScale
                    ╰── GtkScrollbar

Implemented Interfaces

GtkRange implements AtkImplementorIface, GtkBuildable and GtkOrientable.

Includes

#include <gtk/gtk.h>

Description

GtkRange is the common base class for widgets which visualize an adjustment, e.g scales or scrollbars.

Apart from signals for monitoring the parameters of the adjustment, GtkRange provides properties and methods for influencing the sensitivity of the "steppers". It also provides properties and methods for setting a "fill level" on range widgets. See gtk_range_set_fill_level().

Functions

gtk_range_get_fill_level ()

gdouble
gtk_range_get_fill_level (GtkRange *range);

Gets the current position of the fill level indicator.

Parameters

range

A GtkRange

 

Returns

The current fill level

Since 2.12


gtk_range_get_restrict_to_fill_level ()

gboolean
gtk_range_get_restrict_to_fill_level (GtkRange *range);

Gets whether the range is restricted to the fill level.

Parameters

range

A GtkRange

 

Returns

TRUE if range is restricted to the fill level.

Since 2.12


gtk_range_get_show_fill_level ()

gboolean
gtk_range_get_show_fill_level (GtkRange *range);

Gets whether the range displays the fill level graphically.

Parameters

range

A GtkRange

 

Returns

TRUE if range shows the fill level.

Since 2.12


gtk_range_set_fill_level ()

void
gtk_range_set_fill_level (GtkRange *range,
                          gdouble 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 gtk_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 controller by gtk_range_set_restrict_to_fill_level() and is by default enabled.

Parameters

range

a GtkRange

 

fill_level

the new position of the fill level indicator

 

Since 2.12


gtk_range_set_restrict_to_fill_level ()

void
gtk_range_set_restrict_to_fill_level (GtkRange *range,
                                      gboolean restrict_to_fill_level);

Sets whether the slider is restricted to the fill level. See gtk_range_set_fill_level() for a general description of the fill level concept.

Parameters

range

A GtkRange

 

restrict_to_fill_level

Whether the fill level restricts slider movement.

 

Since 2.12


gtk_range_set_show_fill_level ()

void
gtk_range_set_show_fill_level (GtkRange *range,
                               gboolean show_fill_level);

Sets whether a graphical fill level is show on the trough. See gtk_range_set_fill_level() for a general description of the fill level concept.

Parameters

range

A GtkRange

 

show_fill_level

Whether a fill level indicator graphics is shown.

 

Since 2.12


gtk_range_get_adjustment ()

GtkAdjustment *
gtk_range_get_adjustment (GtkRange *range);

Get the GtkAdjustment which is the "model" object for GtkRange. See gtk_range_set_adjustment() for details. The return value does not have a reference added, so should not be unreferenced.

Parameters

range

a GtkRange

 

Returns

a GtkAdjustment.

[transfer none]


gtk_range_set_update_policy ()

void
gtk_range_set_update_policy (GtkRange *range,
                             GtkUpdateType policy);

gtk_range_set_update_policy has been deprecated since version 2.24 and should not be used in newly-written code.

There is no replacement. If you require delayed updates, you need to code it yourself.

Sets the update policy for the range. GTK_UPDATE_CONTINUOUS means that anytime the range slider is moved, the range value will change and the value_changed signal will be emitted. GTK_UPDATE_DELAYED means that the value will be updated after a brief timeout where no slider motion occurs, so updates are spaced by a short time rather than continuous. GTK_UPDATE_DISCONTINUOUS means that the value will only be updated when the user releases the button and ends the slider drag operation.

Parameters

range

a GtkRange

 

policy

update policy

 

gtk_range_set_adjustment ()

void
gtk_range_set_adjustment (GtkRange *range,
                          GtkAdjustment *adjustment);

gtk_range_set_adjustment is deprecated and should not be used in newly-written code.

Sets the adjustment to be used as the "model" object for this range widget. 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.

Parameters

range

a GtkRange

 

adjustment

a GtkAdjustment

 

gtk_range_get_inverted ()

gboolean
gtk_range_get_inverted (GtkRange *range);

Gets the value set by gtk_range_set_inverted().

Parameters

range

a GtkRange

 

Returns

TRUE if the range is inverted


gtk_range_set_inverted ()

void
gtk_range_set_inverted (GtkRange *range,
                        gboolean setting);

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.

Parameters

range

a GtkRange

 

setting

TRUE to invert the range

 

gtk_range_get_update_policy ()

GtkUpdateType
gtk_range_get_update_policy (GtkRange *range);

gtk_range_get_update_policy has been deprecated since version 2.24 and should not be used in newly-written code.

There is no replacement. If you require delayed updates, you need to code it yourself.

Gets the update policy of range . See gtk_range_set_update_policy().

Parameters

range

a GtkRange

 

Returns

the current update policy


gtk_range_set_increments ()

void
gtk_range_set_increments (GtkRange *range,
                          gdouble step,
                          gdouble page);

Sets the step and page sizes for the range. The step size is used when the user clicks the GtkScrollbar arrows or moves GtkScale via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.

Parameters

range

a GtkRange

 

step

step size

 

page

page size

 

gtk_range_set_range ()

void
gtk_range_set_range (GtkRange *range,
                     gdouble min,
                     gdouble max);

Sets the allowable values in the GtkRange, and clamps the range value to be between min and max . (If the range has a non-zero page size, it is clamped between min and max - page-size.)

Parameters

range

a GtkRange

 

min

minimum range value

 

max

maximum range value

 

gtk_range_get_value ()

gdouble
gtk_range_get_value (GtkRange *range);

Gets the current value of the range.

Parameters

range

a GtkRange

 

Returns

current value of the range.


gtk_range_set_value ()

void
gtk_range_set_value (GtkRange *range,
                     gdouble 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.

Parameters

range

a GtkRange

 

value

new value of the range

 

gtk_range_get_round_digits ()

gint
gtk_range_get_round_digits (GtkRange *range);

Gets the number of digits to round the value to when it changes. See “change-value”.

Parameters

range

a GtkRange

 

Returns

the number of digits to round to

Since 2.24


gtk_range_set_round_digits ()

void
gtk_range_set_round_digits (GtkRange *range,
                            gint round_digits);

Sets the number of digits to round the value to when it changes. See “change-value”.

Parameters

range

a GtkRange

 

round_digits

the precision in digits, or -1

 

Since 2.24


gtk_range_set_lower_stepper_sensitivity ()

void
gtk_range_set_lower_stepper_sensitivity
                               (GtkRange *range,
                                GtkSensitivityType sensitivity);

Sets the sensitivity policy for the stepper that points to the 'lower' end of the GtkRange's adjustment.

Parameters

range

a GtkRange

 

sensitivity

the lower stepper's sensitivity policy.

 

Since 2.10


gtk_range_get_lower_stepper_sensitivity ()

GtkSensitivityType
gtk_range_get_lower_stepper_sensitivity
                               (GtkRange *range);

Gets the sensitivity policy for the stepper that points to the 'lower' end of the GtkRange's adjustment.

Parameters

range

a GtkRange

 

Returns

The lower stepper's sensitivity policy.

Since 2.10


gtk_range_set_upper_stepper_sensitivity ()

void
gtk_range_set_upper_stepper_sensitivity
                               (GtkRange *range,
                                GtkSensitivityType sensitivity);

Sets the sensitivity policy for the stepper that points to the 'upper' end of the GtkRange's adjustment.

Parameters

range

a GtkRange

 

sensitivity

the upper stepper's sensitivity policy.

 

Since 2.10


gtk_range_get_upper_stepper_sensitivity ()

GtkSensitivityType
gtk_range_get_upper_stepper_sensitivity
                               (GtkRange *range);

Gets the sensitivity policy for the stepper that points to the 'upper' end of the GtkRange's adjustment.

Parameters

range

a GtkRange

 

Returns

The upper stepper's sensitivity policy.

Since 2.10


gtk_range_get_flippable ()

gboolean
gtk_range_get_flippable (GtkRange *range);

Gets the value set by gtk_range_set_flippable().

Parameters

range

a GtkRange

 

Returns

TRUE if the range is flippable

Since 2.18


gtk_range_set_flippable ()

void
gtk_range_set_flippable (GtkRange *range,
                         gboolean flippable);

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

See gtk_widget_get_direction().

Parameters

range

a GtkRange

 

flippable

TRUE to make the range flippable

 

Since 2.18


gtk_range_get_min_slider_size ()

gint
gtk_range_get_min_slider_size (GtkRange *range);

This function is useful mainly for GtkRange subclasses.

See gtk_range_set_min_slider_size().

Parameters

range

a GtkRange

 

Returns

The minimum size of the range's slider.

Since 2.20


gtk_range_get_range_rect ()

void
gtk_range_get_range_rect (GtkRange *range,
                          GdkRectangle *range_rect);

This function returns the area that contains the range's trough and its steppers, in widget->window coordinates.

This function is useful mainly for GtkRange subclasses.

Parameters

range

a GtkRange

 

range_rect

return location for the range rectangle.

[out]

Since 2.20


gtk_range_get_slider_range ()

void
gtk_range_get_slider_range (GtkRange *range,
                            gint *slider_start,
                            gint *slider_end);

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

This function is useful mainly for GtkRange subclasses.

Parameters

range

a GtkRange

 

slider_start

return location for the slider's start, or NULL.

[out][allow-none]

slider_end

return location for the slider's end, or NULL.

[out][allow-none]

Since 2.20


gtk_range_get_slider_size_fixed ()

gboolean
gtk_range_get_slider_size_fixed (GtkRange *range);

This function is useful mainly for GtkRange subclasses.

See gtk_range_set_slider_size_fixed().

Parameters

range

a GtkRange

 

Returns

whether the range's slider has a fixed size.

Since 2.20


gtk_range_set_min_slider_size ()

void
gtk_range_set_min_slider_size (GtkRange *range,
                               gboolean min_size);

Sets the minimum size of the range's slider.

This function is useful mainly for GtkRange subclasses.

Parameters

range

a GtkRange

 

min_size

The slider's minimum size

 

Since 2.20


gtk_range_set_slider_size_fixed ()

void
gtk_range_set_slider_size_fixed (GtkRange *range,
                                 gboolean size_fixed);

Sets whether the range's slider has a fixed size, or a size that depends on it's adjustment's page size.

This function is useful mainly for GtkRange subclasses.

Parameters

range

a GtkRange

 

size_fixed

TRUE to make the slider size constant

 

Since 2.20

Types and Values

struct GtkRange

struct GtkRange;


enum GtkSensitivityType

Determines how GTK+ handles the sensitivity of stepper arrows at the end of range widgets.

Members

GTK_SENSITIVITY_AUTO

The arrow is made insensitive if the thumb is at the end

 

GTK_SENSITIVITY_ON

The arrow is always sensitive

 

GTK_SENSITIVITY_OFF

The arrow is always insensitive

 

Property Details

The “adjustment” property

  “adjustment”               GtkAdjustment *

The GtkAdjustment that contains the current value of this range object.

Flags: Read / Write / Construct


The “fill-level” property

  “fill-level”               gdouble

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

Flags: Read / Write

Default value: 1.79769e+308

Since 2.12


The “inverted” property

  “inverted”                 gboolean

Invert direction slider moves to increase range value.

Flags: Read / Write

Default value: FALSE


The “lower-stepper-sensitivity” property

  “lower-stepper-sensitivity” GtkSensitivityType

The sensitivity policy for the stepper that points to the adjustment's lower side.

Flags: Read / Write

Default value: GTK_SENSITIVITY_AUTO


The “restrict-to-fill-level” property

  “restrict-to-fill-level”   gboolean

The restrict-to-fill-level property controls whether slider movement is restricted to an upper boundary set by the fill level. See gtk_range_set_restrict_to_fill_level().

Flags: Read / Write

Default value: TRUE

Since 2.12


The “round-digits” property

  “round-digits”             gint

The number of digits to round the value to when it changes, or -1. See “change-value”.

Flags: Read / Write

Allowed values: >= -1

Default value: -1

Since 2.24


The “show-fill-level” property

  “show-fill-level”          gboolean

The show-fill-level property controls whether fill level indicator graphics are displayed on the trough. See gtk_range_set_show_fill_level().

Flags: Read / Write

Default value: FALSE

Since 2.12


The “update-policy” property

  “update-policy”            GtkUpdateType

How the range should be updated on the screen.

Flags: Read / Write

Default value: GTK_UPDATE_CONTINUOUS


The “upper-stepper-sensitivity” property

  “upper-stepper-sensitivity” GtkSensitivityType

The sensitivity policy for the stepper that points to the adjustment's upper side.

Flags: Read / Write

Default value: GTK_SENSITIVITY_AUTO

Style Property Details

The “activate-slider” style property

  “activate-slider”          gboolean

When TRUE, sliders will be drawn active and with shadow in while they are dragged.

GtkRange:activate-slider has been deprecated since version 2.22 and should not be used in newly-written code.

This style property will be removed in GTK+ 3

Flags: Read

Default value: FALSE


The “arrow-displacement-x” style property

  “arrow-displacement-x”     gint

How far in the x direction to move the arrow when the button is depressed.

Flags: Read

Default value: 0


The “arrow-displacement-y” style property

  “arrow-displacement-y”     gint

How far in the y direction to move the arrow when the button is depressed.

Flags: Read

Default value: 0


The “arrow-scaling” style property

  “arrow-scaling”            gfloat

The arrow size proportion relative to the scroll button size.

Flags: Read

Allowed values: [0,1]

Default value: 0.5

Since 2.14


The “slider-width” style property

  “slider-width”             gint

Width of scrollbar or scale thumb.

Flags: Read

Allowed values: >= 0

Default value: 14


The “stepper-position-details” style property

  “stepper-position-details” gboolean

When TRUE, the detail string for rendering the steppers will be suffixed with information about the stepper position.

GtkRange:stepper-position-details has been deprecated since version 2.22 and should not be used in newly-written code.

This style property will be removed in GTK+ 3

Flags: Read

Default value: FALSE

Since 2.22


The “stepper-size” style property

  “stepper-size”             gint

Length of step buttons at ends.

Flags: Read

Allowed values: >= 0

Default value: 14


The “stepper-spacing” style property

  “stepper-spacing”          gint

The spacing between the stepper buttons and thumb. Note that setting this value to anything > 0 will automatically set the trough-under-steppers style property to TRUE as well. Also, stepper-spacing won't have any effect if there are no steppers.

Flags: Read

Allowed values: >= 0

Default value: 0


The “trough-border” style property

  “trough-border”            gint

Spacing between thumb/steppers and outer trough bevel.

Flags: Read

Allowed values: >= 0

Default value: 1


The “trough-side-details” style property

  “trough-side-details”      gboolean

When TRUE, the parts of the trough on the two sides of the slider are drawn with different details.

GtkRange:trough-side-details has been deprecated since version 2.22 and should not be used in newly-written code.

This style property will be removed in GTK+ 3

Flags: Read

Default value: FALSE

Since 2.10


The “trough-under-steppers” style property

  “trough-under-steppers”    gboolean

Whether to draw the trough across the full length of the range or to exclude the steppers and their spacing. Note that setting the “stepper-spacing” style property to any value > 0 will automatically enable trough-under-steppers too.

Flags: Read

Default value: TRUE

Since 2.10

Signal Details

The “adjust-bounds” signal

void
user_function (GtkRange *range,
               gdouble   arg1,
               gpointer  user_data)

Parameters

range

the object which received the signal.

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “change-value” signal

gboolean
user_function (GtkRange     *range,
               GtkScrollType scroll,
               gdouble       value,
               gpointer      user_data)

The ::change-value signal is 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”.

It is not possible to use delayed update policies in an overridden ::change-value handler.

Parameters

range

the range that received the signal

 

scroll

the type of scroll action that was performed

 

value

the new value resulting from the scroll action

 

returns

TRUE to prevent other handlers from being invoked for the signal, FALSE to propagate the signal further

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

Since 2.6


The “move-slider” signal

void
user_function (GtkRange     *range,
               GtkScrollType step,
               gpointer      user_data)

Virtual function that moves the slider. Used for keybindings.

Parameters

range

the GtkRange

 

step

how to move the slider

 

user_data

user data set when the signal handler was connected.

 

Flags: Action


The “value-changed” signal

void
user_function (GtkRange *range,
               gpointer  user_data)

Emitted when the range value changes.

Parameters

range

the GtkRange

 

user_data

user data set when the signal handler was connected.

 

Flags: Run Last

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.