Main Page Widgets Namespaces Book

# Gtk::Scale Class Reference
[Widgets]

Inheritance diagram for Gtk::Scale:

[legend]
List of all members.

## Detailed Description

Abstract base clase for Gtk::HScale and Gtk::VScale.

A Gtk::Scale is a slider control used to select a numeric value. To use it, you'll probably want to investigate the methods on its base class, Gtk::Range, in addition to the methods for Gtk::Scale itself. To set the value of a scale, you would normally use set_value(). To detect changes to the value, you would normally use signal_value_changed().

The Gtk::Scale widget is an abstract class, used only for deriving the subclasses Gtk::HScale and Gtk::VScale, so you should instantiate them instead.

## Public Member Functions

virtual | ~Scale ()
GtkScale* | gobj ()
| Provides access to the underlying C GtkObject.
const GtkScale* | gobj () const
| Provides access to the underlying C GtkObject.
void | set_digits (int digits)
| Set the number of decimal digits.
int | get_digits () const
| Get the number of decimal digits.
void | set_draw_value (bool draw_value=true)
| Set whether the current value is displayed as a string next to the slider.
bool | get_draw_value () const
| Get whether the current value is displayed as a string next to the slider.
void | set_value_pos (PositionType pos)
| Set the position in which the value is displayed.
PositionType | get_value_pos () const
| Get the position in which the value is displayed.
Glib::RefPtr<Pango::Layout> | get_layout ()
| Gets the Pango::Layout used to display the scale.
Glib::RefPtr<const Pango::Layout> | get_layout () const
| Gets the Pango::Layout used to display the scale.
void | get_layout_offsets (int& x, int& y) const
| Obtains the coordinates where the scale will draw the Pango::Layout representing the text in the scale.
Glib::SignalProxy1< Glib::ustring, double > | signal_format_value ()
| Determines how the value is formatted.
Glib::PropertyProxy<int> | property_digits ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< int > | property_digits () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> | property_draw_value ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< bool > | property_draw_value () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<PositionType> | property_value_pos ()
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly< PositionType > | property_value_pos () const
| You rarely need to use properties because there are get_ and set_ methods for almost all of them.

## Protected Member Functions

virtual Glib::ustring | on_format_value (double value)
| Scale ()
virtual void | draw_value_vfunc ()
virtual int | calc_digits_ (double step) const

## Related Functions

(Note that these are not member functions.)
Gtk::Scale* | wrap (GtkScale* object, bool take_copy=false)

## Constructor & Destructor Documentation

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

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

## Member Function Documentation

virtual int Gtk::Scale::calc_digits_ | ( | double | step | ) | const`[protected, virtual]`

virtual void Gtk::Scale::draw_value_vfunc | ( |  | ) | `[protected, virtual]`

int Gtk::Scale::get_digits | ( |  | ) | const

| Get the number of decimal digits.

bool Gtk::Scale::get_draw_value | ( |  | ) | const

| Get whether the current value is displayed as a string next to the slider.

Glib::RefPtr<const Pango::Layout> Gtk::Scale::get_layout | ( |  | ) | const

Gets the Pango::Layout used to display the scale.

The returned object is owned by the scale so does not need to be freed by the caller.

Returns:
  The Pango::Layout for this scale, or `0` if the draw_value property is `false`.

Since: 2.4.

Glib::RefPtr<Pango::Layout> Gtk::Scale::get_layout | ( |  | ) |

Gets the Pango::Layout used to display the scale.

The returned object is owned by the scale so does not need to be freed by the caller.

Returns:
  The Pango::Layout for this scale, or `0` if the draw_value property is `false`.

Since: 2.4.

void Gtk::Scale::get_layout_offsets | ( | int& | x,
|  | int& | y
| ) | const

Obtains the coordinates where the scale will draw the Pango::Layout representing the text in the scale.

Remember when using the Pango::Layout function you need to convert to and from pixels using PANGO_PIXELS() or Pango::SCALE.

If the draw_value property is `false`, the return values are undefined.

Since: 2.4

Parameters:

  | x | Location to store X offset of layout, or `0`.
  | y | Location to store Y offset of layout, or `0`.

PositionType Gtk::Scale::get_value_pos | ( |  | ) | const

| Get the position in which the value is displayed.

const GtkScale* Gtk::Scale::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C GtkObject. Reimplemented from Gtk::Range. Reimplemented in Gtk::VScale, and Gtk::HScale.

GtkScale* Gtk::Scale::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C GtkObject. Reimplemented from Gtk::Range. Reimplemented in Gtk::VScale, and Gtk::HScale.

virtual Glib::ustring Gtk::Scale::on_format_value | ( | double | value | ) | `[protected, virtual]`

Glib::PropertyProxy_ReadOnly<int> Gtk::Scale::property_digits | ( |  | ) | const

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::Scale::property_digits | ( |  | ) |

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::Scale::property_draw_value | ( |  | ) | const

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::Scale::property_draw_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<PositionType> Gtk::Scale::property_value_pos | ( |  | ) | const

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<PositionType> Gtk::Scale::property_value_pos | ( |  | ) |

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::Scale::set_digits | ( | int | digits | ) |

| Set the number of decimal digits. This also causes the adjustment to be rounded off so the retrieved value matches the value the user sees. Setting digits to 1 gives for example 1.0, 2 gives 1.00, etc.

void Gtk::Scale::set_draw_value | ( | bool | draw_value = `true` | ) |

| Set whether the current value is displayed as a string next to the slider.

void Gtk::Scale::set_value_pos | ( | PositionType | pos | ) |

| Set the position in which the value is displayed.

Glib::SignalProxy1<Glib::ustring,double> Gtk::Scale::signal_format_value | ( |  | ) |

| Determines how the value is formatted. This can be used to connect a custom function for determining how the value is formatted. The function (or function object) is given a the value as a double and should return the representation of it as a Glib::ustring.

## Friends And Related Function Documentation

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

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:

- scale.h