Xfce Foundation Classes
Main Page | Index | Namespace List | Alphabetical List | Class List | File List

# Xfc::Gtk::Scale Class Reference

A GtkScale C++ wrapper class. More...

`#include <xfc/gtk/scale.hh>`

Inheritance diagram for Xfc::Gtk::Scale:

List of all members.

## Signal Prototpyes

- const FormatValueSignalType format_value_signal
    Format value signal (see signal_format_value()).

## Public Member Functions

Accessors

- GtkScale * gtk_scale () const
    Get a pointer to the GtkScale structure.
- operator GtkScale * () const
    Conversion operator; safely converts a Scale to a GtkScale pointer.
- int get_digits () const
    Gets the number of decimal places that are displayed in the value.
- bool get_draw_value () const
    Returns whether the current value is displayed as a string next to the slider.
- PositionType get_value_pos () const
    Gets the position in which the current value is displayed.
- 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.

Methods

- void set_digits (int digits)
    Sets the number of decimal places that are displayed in the value.
- void set_draw_value (bool draw_value)
    Specifies whether the current value is displayed as a string next to the slider.
- void set_value_pos (PositionType pos)
    Sets the position in which the current value is displayed.

Signal Proxies

- const FormatValueSignalProxy signal_format_value ()
    Connect to the format_value_signal; emitted to format the scale value before it gets displayed.

## Protected Member Functions

Constructors

- Scale ()
    Construct a new Scale.
- Scale (GtkScale *scale, bool owns_reference=false)
    Construct a new Scale from an existing GtkScale.
- virtual ~Scale ()=0
    Destructor.

## Detailed Description

A GtkScale C++ wrapper class.

The Scale widget is an abstract class, used only for deriving the subclasses HScale and VScale.

A 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, Range, in addition to the methods for Scale itself. To set the value of a scale, you would normally use Gtk::Range::set_value(). To detect changes to the value, you would normally connect to the value_changed signal.

See also: the Range Widget HOWTO and example.

## Constructor & Destructor Documentation

Xfc::Gtk::Scale::Scale | ( | GtkScale * | scale,
|  | bool | owns_reference = `false`
| ) | `[explicit, protected]`

Construct a new Scale from an existing GtkScale.

Parameters:

  | scale | A pointer to a GtkScale.
  | owns_reference | Set false if the initial reference count is floating, set true if it's not.

The scale can be a newly created GtkScale or an existing GtkScale (see G::Object::Object).

## Member Function Documentation

Pango::Layout* Xfc::Gtk::Scale::get_layout | ( |  | ) | const

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

Returns:
  The Pango::Layout for this scale, or null if set_draw_value() is set to false.

void Xfc::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.

Parameters:

  | x | The location to store X offset of layout, or null.
  | y | The location to store Y offset of layout, or null.

Remember when using Pango::Layout you need to convert to and from pixels using PANGO_PIXELS() or PANGO_SCALE. If set_draw_value() is set to false, the return values are undefined.

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

Gets the position in which the current value is displayed.

Returns:
  The position in which the current value is displayed.

void Xfc::Gtk::Scale::set_digits | ( | int | digits | ) |

Sets the number of decimal places that are displayed in the value.

Parameters:

  | digits | The number of decimal places to display, e.g. use 1 to display 1.0, 2 to display 1.00 etc.

Also causes the value of the adjustment to be rounded off to this number of digits, so the retrieved value matches the value the user saw.

void Xfc::Gtk::Scale::set_draw_value | ( | bool | draw_value | ) |

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

Parameters:

  | draw_value | Set true to display the current value.

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

Sets the position in which the current value is displayed.

Parameters:

  | pos | The position in which the current value is displayed.

## Member Data Documentation

const FormatValueSignalType Xfc::Gtk::Scale::format_value_signal `[static, protected]`

Format value signal (see signal_format_value()).

Calls a slot with the signature:

                 char* function(double value);
                 // value: The scale value to format.
                 // return: An allocated string representing value.

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

- scale.hh

Xfce Foundation Classes

Copyright © 2004-2005 The XFC Development Team | XFC 4.3