GtkRange

GtkRange — Base class for widgets which visualize an adjustment

Synopsis


#include <gtk/gtk.h>


            GtkRange;
GtkAdjustment* gtk_range_get_adjustment     (GtkRange *range);
void        gtk_range_set_update_policy     (GtkRange *range,
                                             GtkUpdateType policy);
void        gtk_range_set_adjustment        (GtkRange *range,
                                             GtkAdjustment *adjustment);
gboolean    gtk_range_get_inverted          (GtkRange *range);
void        gtk_range_set_inverted          (GtkRange *range,
                                             gboolean setting);
GtkUpdateType gtk_range_get_update_policy   (GtkRange *range);
gdouble     gtk_range_get_value             (GtkRange *range);
void        gtk_range_set_increments        (GtkRange *range,
                                             gdouble step,
                                             gdouble page);
void        gtk_range_set_range             (GtkRange *range,
                                             gdouble min,
                                             gdouble max);
void        gtk_range_set_value             (GtkRange *range,
                                             gdouble value);


Object Hierarchy


  GObject
   +----GtkObject
         +----GtkWidget
               +----GtkRange
                     +----GtkScale
                     +----GtkScrollbar

Implemented Interfaces

GtkRange implements AtkImplementorIface.

Properties


  "adjustment"           GtkAdjustment         : Read / Write / Construct
  "inverted"             gboolean              : Read / Write
  "update-policy"        GtkUpdateType         : Read / Write

Style Properties


  "arrow-displacement-x" gint                  : Read
  "arrow-displacement-y" gint                  : Read
  "slider-width"         gint                  : Read
  "stepper-size"         gint                  : Read
  "stepper-spacing"      gint                  : Read
  "trough-border"        gint                  : Read

Signal Prototypes


"adjust-bounds"
            void        user_function      (GtkRange *range,
                                            gdouble arg1,
                                            gpointer user_data);
"change-value"
            gboolean    user_function      (GtkRange *range,
                                            GtkScrollType scroll,
                                            gdouble value,
                                            gpointer user_data);
"move-slider"
            void        user_function      (GtkRange *range,
                                            GtkScrollType arg1,
                                            gpointer user_data);
"value-changed"
            void        user_function      (GtkRange *range,
                                            gpointer user_data);

Description

Details

GtkRange

typedef struct _GtkRange GtkRange;


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.

range : a GtkRange
Returns : a GtkAdjustment

gtk_range_set_update_policy ()

void        gtk_range_set_update_policy     (GtkRange *range,
                                             GtkUpdateType policy);

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.

range : a GtkRange
policy : update policy

gtk_range_set_adjustment ()

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

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.

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

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.

range : a GtkRange
setting : TRUE to invert the range

gtk_range_get_update_policy ()

GtkUpdateType gtk_range_get_update_policy   (GtkRange *range);

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

range : a GtkRange
Returns : the current update policy

gtk_range_get_value ()

gdouble     gtk_range_get_value             (GtkRange *range);

Gets the current value of the range.

range : a GtkRange
Returns : current value of the range.

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.

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

range : a GtkRange
min : minimum range value
max : maximum range value

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.

range : a GtkRange
value : new value of the range

Properties

The "adjustment" property

  "adjustment"           GtkAdjustment         : Read / Write / Construct

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


The "inverted" property

  "inverted"             gboolean              : Read / Write

Invert direction slider moves to increase range value.

Default value: FALSE


The "update-policy" property

  "update-policy"        GtkUpdateType         : Read / Write

How the range should be updated on the screen.

Default value: GTK_UPDATE_CONTINUOUS

Style Properties

The "arrow-displacement-x" style property

  "arrow-displacement-x" gint                  : Read

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

Default value: 0


The "arrow-displacement-y" style property

  "arrow-displacement-y" gint                  : Read

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

Default value: 0


The "slider-width" style property

  "slider-width"         gint                  : Read

Width of scrollbar or scale thumb.

Allowed values: >= 0

Default value: 14


The "stepper-size" style property

  "stepper-size"         gint                  : Read

Length of step buttons at ends.

Allowed values: >= 0

Default value: 14


The "stepper-spacing" style property

  "stepper-spacing"      gint                  : Read

Spacing between step buttons and thumb.

Allowed values: >= 0

Default value: 0


The "trough-border" style property

  "trough-border"        gint                  : Read

Spacing between thumb/steppers and outer trough bevel.

Allowed values: >= 0

Default value: 1

Signals

The "adjust-bounds" signal

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

range :the object which received the signal.
arg1 :
user_data :user data set when the signal handler was connected.

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 range->round_digits.

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

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.

Since 2.6


The "move-slider" signal

void        user_function                  (GtkRange *range,
                                            GtkScrollType arg1,
                                            gpointer user_data);

Virtual function that moves the slider. Used for keybindings.

range :the GtkRange
arg1 :
user_data :user data set when the signal handler was connected.

The "value-changed" signal

void        user_function                  (GtkRange *range,
                                            gpointer user_data);

Emitted when the range value changes.

range :the GtkRange
user_data :user data set when the signal handler was connected.