gtkmm: Gtk::Range Class Reference

gtkmm 3.4.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Related Functions
Gtk::Range Class Reference
Widgets

Base class for widgets which visualize an adjustment. More...

Inheritance diagram for Gtk::Range:
[legend]

List of all members.

## Public Member Functions
virtual | ~Range ()
GtkRange* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkRange* | gobj () const
| Provides access to the underlying C GtkObject.
void | set_adjustment (const Glib::RefPtr< Adjustment >& adjustment)
| Sets the adjustment to be used as the "model" object for this range widget.
void | unset_adjustment ()
Glib::RefPtr< Adjustment > | get_adjustment ()
| Get the Gtk::Adjustment which is the "model" object for Gtk::Range.
Glib::RefPtr< const Adjustment > | get_adjustment () const
| Get the Gtk::Adjustment which is the "model" object for Gtk::Range.
void | set_inverted (bool setting=true)
| Ranges normally move from lower to higher values as the slider moves from top to bottom or left to right.
bool | get_inverted () const
| Gets the value set by set_inverted().
void | set_flippable (bool flippable=true)
| If a range is flippable, it will switch its direction if it is horizontal and its direction is Gtk::TEXT_DIR_RTL.
bool | get_flippable () const
| Gets the value set by set_flippable().
void | set_slider_size_fixed (bool size_fixed=true)
| Sets whether the range's slider has a fixed size, or a size that depends on its adjustment's page size.
bool | get_slider_size_fixed () const
| This function is useful mainly for Gtk::Range subclasses.
void | set_min_slider_size (bool min_size=true)
| Sets the minimum size of the range's slider.
int | get_min_slider_size () const
| This function is useful mainly for Gtk::Range subclasses.
Gdk::Rectangle | get_range_rect () const
| This method returns the area that contains the range's trough and its steppers, in the widget's Gdk::Window coordinates.
void | get_slider_range (int& slider_start, int& slider_end) const
| This function returns sliders range along the long dimension, in widget->window coordinates.
void | set_lower_stepper_sensitivity (SensitivityType sensitivity)
| Sets the sensitivity policy for the stepper that points to the 'lower' end of the GtkRange's adjustment.
SensitivityType | get_lower_stepper_sensitivity () const
| Gets the sensitivity policy for the stepper that points to the 'lower' end of the GtkRange's adjustment.
void | set_upper_stepper_sensitivity (SensitivityType sensitivity)
| Sets the sensitivity policy for the stepper that points to the 'upper' end of the GtkRange's adjustment.
SensitivityType | get_upper_stepper_sensitivity () const
| Gets the sensitivity policy for the stepper that points to the 'upper' end of the GtkRange's adjustment.
void | set_increments (double step, double page)
| Sets the step and page sizes for the range.
void | set_range (double min, double max)
| Sets the allowable values in the Gtk::Range, and clamps the range value to be between min and max.
void | set_value (double 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.
double | get_value () const
| Gets the current value of the range.
void | set_show_fill_level (bool show_fill_level=true)
| Sets whether a graphical fill level is show on the trough.
bool | get_show_fill_level () const
| Gets whether the range displays the fill level graphically.
void | set_restrict_to_fill_level (bool restrict_to_fill_level=true)
| Sets whether the slider is restricted to the fill level.
bool | get_restrict_to_fill_level () const
| Gets whether the range is restricted to the fill level.
void | set_fill_level (double fill_level)
| Set the new position of the fill level indicator.
double | get_fill_level () const
| Gets the current position of the fill level indicator.
void | set_round_digits (int round_digits)
| Sets the number of digits to round the value to when it changes.
int | get_round_digits () const
| Gets the number of digits to round the value to when it changes.
Glib::SignalProxy0< void > | signal_value_changed ()
Glib::SignalProxy1< void, double > | signal_adjust_bounds ()
Glib::SignalProxy1< void, ScrollType > | signal_move_slider ()
Glib::SignalProxy2< bool, ScrollType, double > | signal_change_value ()
Glib::PropertyProxy< Adjustment* > | property_adjustment ()
| The GtkAdjustment that contains the current value of this range object.
Glib::PropertyProxy_ReadOnly < Adjustment* > | property_adjustment () const
| The GtkAdjustment that contains the current value of this range object.
Glib::PropertyProxy< bool > | property_inverted ()
| Invert direction slider moves to increase range value.
Glib::PropertyProxy_ReadOnly < bool > | property_inverted () const
| Invert direction slider moves to increase range value.
Glib::PropertyProxy < SensitivityType > | property_lower_stepper_sensitivity ()
| The sensitivity policy for the stepper that points to the adjustment's lower side.
Glib::PropertyProxy_ReadOnly < SensitivityType > | property_lower_stepper_sensitivity () const
| The sensitivity policy for the stepper that points to the adjustment's lower side.
Glib::PropertyProxy < SensitivityType > | property_upper_stepper_sensitivity ()
| The sensitivity policy for the stepper that points to the adjustment's upper side.
Glib::PropertyProxy_ReadOnly < SensitivityType > | property_upper_stepper_sensitivity () const
| The sensitivity policy for the stepper that points to the adjustment's upper side.
Glib::PropertyProxy< bool > | property_show_fill_level ()
| Whether to display a fill level indicator graphics on trough.
Glib::PropertyProxy_ReadOnly < bool > | property_show_fill_level () const
| Whether to display a fill level indicator graphics on trough.
Glib::PropertyProxy< bool > | property_restrict_to_fill_level ()
| Whether to restrict the upper boundary to the fill level.
Glib::PropertyProxy_ReadOnly < bool > | property_restrict_to_fill_level () const
| Whether to restrict the upper boundary to the fill level.
Glib::PropertyProxy< double > | property_fill_level ()
| The fill level.
Glib::PropertyProxy_ReadOnly < double > | property_fill_level () const
| The fill level.
Glib::PropertyProxy< int > | property_round_digits ()
| The number of digits to round the value to.
Glib::PropertyProxy_ReadOnly< int > | property_round_digits () const
| The number of digits to round the value to.
## Protected Member Functions
virtual void | on_value_changed ()
| This is a default handler for the signal signal_value_changed().
virtual void | on_adjust_bounds (double new_value)
| This is a default handler for the signal signal_adjust_bounds().
virtual void | on_move_slider (ScrollType scroll)
| This is a default handler for the signal signal_move_slider().
virtual bool | on_change_value (ScrollType scroll, double new_value)
| This is a default handler for the signal signal_change_value().
| Range ()
virtual void | get_range_border_vfunc (Gtk::Border& border) const
## Related Functions
(Note that these are not member functions.)
Gtk::Range* | wrap (GtkRange* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Base class for widgets which visualize an adjustment.

## Constructor & Destructor Documentation

virtual Gtk::Range::~Range | ( |  | ) | `[virtual]`

Gtk::Range::Range | ( |  | ) | `[protected]`

## Member Function Documentation

Glib::RefPtr<Adjustment> Gtk::Range::get_adjustment | ( |  | ) |

Get the Gtk::Adjustment which is the "model" object for Gtk::Range.

See set_adjustment() for details. The return value does not have a reference added, so should not be unreferenced.

Returns:
  A Gtk::Adjustment.

Glib::RefPtr<const Adjustment> Gtk::Range::get_adjustment | ( |  | ) | const

Get the Gtk::Adjustment which is the "model" object for Gtk::Range.

See set_adjustment() for details. The return value does not have a reference added, so should not be unreferenced.

Returns:
  A Gtk::Adjustment.

double Gtk::Range::get_fill_level | ( |  | ) | const

Gets the current position of the fill level indicator.

Since gtkmm 2.12:

Returns:
  The current fill level.

bool Gtk::Range::get_flippable | ( |  | ) | const

Gets the value set by set_flippable().

Since gtkmm 2.18:

Returns:
  `true` if the range is flippable.

bool Gtk::Range::get_inverted | ( |  | ) | const

Gets the value set by set_inverted().

Returns:
  `true` if the range is inverted.

SensitivityType Gtk::Range::get_lower_stepper_sensitivity | ( |  | ) | const

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

Since gtkmm 2.10:

Returns:
  The lower stepper's sensitivity policy.

int Gtk::Range::get_min_slider_size | ( |  | ) | const

This function is useful mainly for Gtk::Range subclasses.

See set_min_slider_size().

Since gtkmm 2.20:

Returns:
  The minimum size of the range's slider.

virtual void Gtk::Range::get_range_border_vfunc | ( | Gtk::Border& | border | ) | const`[protected, virtual]`

Gdk::Rectangle Gtk::Range::get_range_rect | ( |  | ) | const

This method returns the area that contains the range's trough and its steppers, in the widget's Gdk::Window coordinates.

This method is useful mainly for Range subclasses.

Returns:
  The range rectangle.

@newin{2,20}

bool Gtk::Range::get_restrict_to_fill_level | ( |  | ) | const

Gets whether the range is restricted to the fill level.

Since gtkmm 2.12:

Returns:
  `true` if range is restricted to the fill level.

int Gtk::Range::get_round_digits | ( |  | ) | const

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

See Gtk::Range::signal_change_value().

Since gtkmm 2.24:

Returns:
  The number of digits to round to.

bool Gtk::Range::get_show_fill_level | ( |  | ) | const

Gets whether the range displays the fill level graphically.

Since gtkmm 2.12:

Returns:
  `true` if range shows the fill level.

void Gtk::Range::get_slider_range | ( | int & | slider_start,
|  | int & | slider_end
| ) |  | const

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

This function is useful mainly for Gtk::Range subclasses.

Since gtkmm 2.20:

Parameters:

  slider_start | Return location for the slider's start, or `0`.
  slider_end | Return location for the slider's end, or `0`.

bool Gtk::Range::get_slider_size_fixed | ( |  | ) | const

This function is useful mainly for Gtk::Range subclasses.

See set_slider_size_fixed().

Since gtkmm 2.20:

Returns:
  Whether the range's slider has a fixed size.

SensitivityType Gtk::Range::get_upper_stepper_sensitivity | ( |  | ) | const

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

Since gtkmm 2.10:

Returns:
  The upper stepper's sensitivity policy.

double Gtk::Range::get_value | ( |  | ) | const

Gets the current value of the range.

Returns:
  Current value of the range.

GtkRange* Gtk::Range::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Widget.

Reimplemented in Gtk::HScale, Gtk::HScrollbar, Gtk::VScrollbar, Gtk::VScale, Gtk::Scrollbar, and Gtk::Scale.

const GtkRange* Gtk::Range::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GtkObject.

Reimplemented from Gtk::Widget.

Reimplemented in Gtk::HScale, Gtk::HScrollbar, Gtk::VScrollbar, Gtk::VScale, Gtk::Scrollbar, and Gtk::Scale.

virtual void Gtk::Range::on_adjust_bounds | ( | double | new_value | ) | `[protected, virtual]`

This is a default handler for the signal signal_adjust_bounds().

virtual bool Gtk::Range::on_change_value | ( | ScrollType | scroll,
|  | double | new_value
| ) |  | `[protected, virtual]`

This is a default handler for the signal signal_change_value().

virtual void Gtk::Range::on_move_slider | ( | ScrollType | scroll | ) | `[protected, virtual]`

This is a default handler for the signal signal_move_slider().

virtual void Gtk::Range::on_value_changed | ( |  | ) | `[protected, virtual]`

This is a default handler for the signal signal_value_changed().

Glib::PropertyProxy< Adjustment* > Gtk::Range::property_adjustment | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< Adjustment* > Gtk::Range::property_adjustment | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< double > Gtk::Range::property_fill_level | ( |  | ) |

The fill level.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< double > Gtk::Range::property_fill_level | ( |  | ) | const

The fill level.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::Range::property_inverted | ( |  | ) |

Invert direction slider moves to increase range value.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::Range::property_inverted | ( |  | ) | const

Invert direction slider moves to increase range value.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< SensitivityType > Gtk::Range::property_lower_stepper_sensitivity | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< SensitivityType > Gtk::Range::property_lower_stepper_sensitivity | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::Range::property_restrict_to_fill_level | ( |  | ) |

Whether to restrict the upper boundary to the fill level.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::Range::property_restrict_to_fill_level | ( |  | ) | const

Whether to restrict the upper boundary to the fill level.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< int > Gtk::Range::property_round_digits | ( |  | ) |

The number of digits to round the value to.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< int > Gtk::Range::property_round_digits | ( |  | ) | const

The number of digits to round the value to.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< bool > Gtk::Range::property_show_fill_level | ( |  | ) |

Whether to display a fill level indicator graphics on trough.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< bool > Gtk::Range::property_show_fill_level | ( |  | ) | const

Whether to display a fill level indicator graphics on trough.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy< SensitivityType > Gtk::Range::property_upper_stepper_sensitivity | ( |  | ) |

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly< SensitivityType > Gtk::Range::property_upper_stepper_sensitivity | ( |  | ) | const

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

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

void Gtk::Range::set_adjustment | ( | const Glib::RefPtr< Adjustment >& | 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 Gtk::Scale and nonzero for Gtk::Scrollbar, and indicates the size of the visible area of the widget being scrolled. The page size affects the size of the scrollbar slider.

Parameters:

  adjustment | A Gtk::Adjustment.

void Gtk::Range::set_fill_level | ( | double | 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 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 set_restrict_to_fill_level() and is by default enabled.

Since gtkmm 2.12:

Parameters:

  fill_level | The new position of the fill level indicator.

void Gtk::Range::set_flippable | ( | bool | flippable = `true` | ) |

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

Since gtkmm 2.18:

Parameters:

  flippable | `true` to make the range flippable.

void Gtk::Range::set_increments | ( | double | step,
|  | double | page
| ) |  |

Sets the step and page sizes for the range.

The step size is used when the user clicks the Gtk::Scrollbar arrows or moves Gtk::Scale via arrow keys. The page size is used for example when moving via Page Up or Page Down keys.

Parameters:

  step | Step size.
  page | Page size.

void Gtk::Range::set_inverted | ( | bool | setting = `true` | ) |

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:

  setting | `true` to invert the range.

void Gtk::Range::set_lower_stepper_sensitivity | ( | SensitivityType | sensitivity | ) |

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

Since gtkmm 2.10:

Parameters:

  sensitivity | The lower stepper's sensitivity policy.

void Gtk::Range::set_min_slider_size | ( | bool | min_size = `true` | ) |

Sets the minimum size of the range's slider.

This function is useful mainly for Gtk::Range subclasses.

Since gtkmm 2.20:

Parameters:

  min_size | The slider's minimum size.

void Gtk::Range::set_range | ( | double | min,
|  | double | max
| ) |  |

Sets the allowable values in the Gtk::Range, 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:

  min | Minimum range value.
  max | Maximum range value.

void Gtk::Range::set_restrict_to_fill_level | ( | bool | restrict_to_fill_level = `true` | ) |

Sets whether the slider is restricted to the fill level.

See set_fill_level() for a general description of the fill level concept.

Since gtkmm 2.12:

Parameters:

  restrict_to_fill_level | Whether the fill level restricts slider movement.

void Gtk::Range::set_round_digits | ( | int | round_digits | ) |

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

See Gtk::Range::signal_change_value().

Since gtkmm 2.24:

Parameters:

  round_digits | The precision in digits, or -1.

void Gtk::Range::set_show_fill_level | ( | bool | show_fill_level = `true` | ) |

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

See set_fill_level() for a general description of the fill level concept.

Since gtkmm 2.12:

Parameters:

  show_fill_level | Whether a fill level indicator graphics is shown.

void Gtk::Range::set_slider_size_fixed | ( | bool | size_fixed = `true` | ) |

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 Gtk::Range subclasses.

Since gtkmm 2.20:

Parameters:

  size_fixed | `true` to make the slider size constant.

void Gtk::Range::set_upper_stepper_sensitivity | ( | SensitivityType | sensitivity | ) |

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

Since gtkmm 2.10:

Parameters:

  sensitivity | The upper stepper's sensitivity policy.

void Gtk::Range::set_value | ( | double | 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 Gtk::Range::signal_value_changed() signal if the value changes.

Parameters:

  value | New value of the range.

Glib::SignalProxy1< void,double > Gtk::Range::signal_adjust_bounds | ( |  | ) |

Slot Prototype:
  `void on_my_adjust_bounds(double new_value)`

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

Parameters:

  value | The value before we clamp.

Glib::SignalProxy2< bool,ScrollType,double > Gtk::Range::signal_change_value | ( |  | ) |

Slot Prototype:
  `bool on_my_change_value(ScrollType scroll, double new_value)`

The Gtk::Range::signal_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 GtkRange::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 Gtk::Range::property_round_digits().

It is not possible to use delayed update policies in an overridden Gtk::Range::signal_change_value() handler.

Since gtkmm 2.6:

Parameters:

  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.

Glib::SignalProxy1< void,ScrollType > Gtk::Range::signal_move_slider | ( |  | ) |

Slot Prototype:
  `void on_my_move_slider(ScrollType scroll)`

Virtual function that moves the slider. Used for keybindings.

Parameters:

  step | How to move the slider.

Glib::SignalProxy0< void > Gtk::Range::signal_value_changed | ( |  | ) |

Slot Prototype:
  `void on_my_value_changed()`

Emitted when the range value changes.

void Gtk::Range::unset_adjustment | ( |  | ) |

## Friends And Related Function Documentation

Gtk::Range* wrap | ( | GtkRange * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.

The documentation for this class was generated from the following file:

- gtkmm/range.h