Reference Manual

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

# Inti::Gtk::Scale Class Reference

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

`#include <inti/gtk/scale.h>`

Inheritance diagram for Inti::Gtk::Scale:

List of all members.

## Public Member Functions

Accessors

- GtkScale * gtk_scale () const
    Get a pointer to the GtkScale structure.
- GtkScaleClass * gtk_scale_class () const
    Get a pointer to the GtkScaleClass 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.

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.
- String format_value (double value)
    Emits the "format_value" signal to format the value.

Property Proxies

- const DigitsPropertyProxy prop_digits ()
    The number of decimal places that are displayed in the value (int : Read / Write).
- const DrawValuePropertyProxy prop_draw_value ()
    Whether the current value is displayed as a string next to the slider (bool : Read / Write).
- const ValuePosPropertyProxy prop_value_pos ()
    The position in which the current value is displayed (PositionType : Read / Write.

Signal Proxies

- const FormatValueSignalProxy sig_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 reference=false)
    Construct a new Scale from an existing GtkScale.
- virtual ~Scale ()=0
    Destructor.

Signal Handlers

- virtual char * on_format_value (double value)
    Called to format the scale value before it gets displayed.

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

## Constructor & Destructor Documentation

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

Construct a new Scale from an existing GtkScale.

Parameters:

  scale | A pointer to a GtkScale.
  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

String Inti::Gtk::Scale::format_value | ( | double | value | ) |

Emits the "format_value" signal to format the value.

Parameters:

  value | the current adjustment value.

If there are no user signal handlers, falls back to a default format.

PositionType Inti::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.

virtual char* Inti::Gtk::Scale::on_format_value | ( | double | value | ) | `[protected, virtual]`

Called to format the scale value before it gets displayed.

Parameters:

  value | The scale value to format.

Returns:
  An allocated string representing value.

This signal handler allows you to change how the scale value is displayed. The return value must be an allocated string representing value. That string will then be used to display the scale's value. Here's an example signal handler which displays a value 1.0 as with "-->1.0<--".

                 char*
                 MyScale::on_format_value(double value)
                 {
                    return g_strdup_printf("-->%0.*g<--", scale->get_digits(value));
                 }

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

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

- scale.h

Main Page - Footer