A class representing an adjustable bounded value. More...
Inherits Gtk::Object.
Public Member Functions | |
virtual | ~Adjustment () |
GtkAdjustment* | gobj () |
Provides access to the underlying C GtkObject. | |
const GtkAdjustment* | gobj () const |
Provides access to the underlying C GtkObject. | |
Adjustment (double value, double lower, double upper, double step_increment=1, double page_increment=10, double page_size=0) | |
Constructor to create an Adjustment object. | |
void | changed () |
Emits a "changed" signal from the Adjustment. | |
void | value_changed () |
Emits a "value_changed" signal from the Adjustment. | |
void | clamp_page (double lower, double upper) |
Updates the Adjustment value to ensure that the range between the parameters lower and upper is in the current page (i.e. between value and value + page_size). | |
void | set_value (double value) |
Sets the current value of the Adjustment. | |
double | get_value () const |
Gets the current value of the adjustment. | |
void | set_lower (double lower) |
Sets the minimum value of the adjustment. | |
double | get_lower () const |
Retrieves the minimum value of the adjustment. | |
void | set_upper (double upper) |
Sets the maximum value of the adjustment. | |
double | get_upper () const |
Retrieves the maximum value of the adjustment. | |
void | set_step_increment (double step_increment) |
Sets the step increment of the adjustment. | |
double | get_step_increment () const |
Retrieves the step increment of the adjustment. | |
void | set_page_increment (double page_increment) |
Sets the page increment of the adjustment. | |
double | get_page_increment () const |
Retrieves the page increment of the adjustment. | |
void | set_page_size (double page_size) |
Sets the page size of the adjustment. | |
double | get_page_size () const |
Retrieves the page size of the adjustment. | |
void | configure (double value, double lower, double upper, double step_increment, double page_increment, double page_size) |
Sets all properties of the adjustment at once. | |
Glib::SignalProxy0< void > | signal_changed () |
Glib::SignalProxy0< void > | signal_value_changed () |
Protected Member Functions | |
virtual void | on_changed () |
virtual void | on_value_changed () |
Related Functions | |
(Note that these are not member functions.) | |
Gtk::Adjustment* | wrap (GtkAdjustment* object, bool take_copy=false) |
A Glib::wrap() method for this object. |
A class representing an adjustable bounded value.
The Gtk::Adjustment object represents a value which has an associated lower and upper bound, together with step and page increments, and a page size. It is used within several gtkmm widgets, including Gtk::SpinButton, Gtk::Viewport, and Gtk::Range (which is a base class for Gtk::HScrollbar, Gtk::VScrollbar, Gtk::HScale, and Gtk::VScale).
The Gtk::Adjustment object does not update the value itself. Instead it is left up to the owner of the Gtk::Adjustment to control the value.
The owner of the Gtk::Adjustment typically calls the value_changed() and changed() functions after changing the value and its bounds. This results in the emission of the "value_changed" or "changed" signal respectively.
virtual Gtk::Adjustment::~Adjustment | ( | ) | [virtual] |
Gtk::Adjustment::Adjustment | ( | double | value, | |
double | lower, | |||
double | upper, | |||
double | step_increment = 1 , |
|||
double | page_increment = 10 , |
|||
double | page_size = 0 | |||
) |
Constructor to create an Adjustment object.
value | The initial value | |
lower | The minimum value | |
upper | The maximum value | |
step_increment | The step increment | |
page_increment | The page increment | |
page_size | The page size |
void Gtk::Adjustment::changed | ( | ) |
Emits a "changed" signal from the Adjustment.
This is typically called by the owner of the Adjustment after it has changed any of the Adjustment fields other than the value.
void Gtk::Adjustment::clamp_page | ( | double | lower, | |
double | upper | |||
) |
Updates the Adjustment value to ensure that the range between the parameters lower and upper is in the current page (i.e. between value and value + page_size).
If this range is larger than the page size, then only the start of it will be in the current page. A "changed" signal will be emitted if the value is changed.
upper | The upper value. | |
lower | The lower value. |
void Gtk::Adjustment::configure | ( | double | value, | |
double | lower, | |||
double | upper, | |||
double | step_increment, | |||
double | page_increment, | |||
double | page_size | |||
) |
Sets all properties of the adjustment at once.
Use this function to avoid multiple emissions of the "changed" signal. See set_lower() for an alternative way of compressing multiple emissions of "changed" into one.
value | The new value. | |
lower | The new minimum value. | |
upper | The new maximum value. | |
step_increment | The new step increment. | |
page_increment | The new page increment. | |
page_size | The new page size. |
double Gtk::Adjustment::get_lower | ( | ) | const |
Retrieves the minimum value of the adjustment.
double Gtk::Adjustment::get_page_increment | ( | ) | const |
Retrieves the page increment of the adjustment.
double Gtk::Adjustment::get_page_size | ( | ) | const |
Retrieves the page size of the adjustment.
double Gtk::Adjustment::get_step_increment | ( | ) | const |
Retrieves the step increment of the adjustment.
double Gtk::Adjustment::get_upper | ( | ) | const |
Retrieves the maximum value of the adjustment.
double Gtk::Adjustment::get_value | ( | ) | const |
Gets the current value of the adjustment.
See set_value().
const GtkAdjustment* Gtk::Adjustment::gobj | ( | ) | const [inline] |
Provides access to the underlying C GtkObject.
Reimplemented from Gtk::Object.
GtkAdjustment* Gtk::Adjustment::gobj | ( | ) | [inline] |
Provides access to the underlying C GtkObject.
Reimplemented from Gtk::Object.
virtual void Gtk::Adjustment::on_changed | ( | ) | [protected, virtual] |
virtual void Gtk::Adjustment::on_value_changed | ( | ) | [protected, virtual] |
void Gtk::Adjustment::set_lower | ( | double | lower | ) |
Sets the minimum value of the adjustment.
When setting multiple adjustment properties via their individual setters, multiple "changed" signals will be emitted. However, since the emission of the "changed" signal is tied to the emission of the "GObject::notify" signals of the changed properties, it's possible to compress the "changed" signals into one by calling Glib::object_freeze_notify() and Glib::object_thaw_notify() around the calls to the individual setters.
Alternatively, using a single Glib::object_set() for all the properties to change, or using configure() has the same effect of compressing "changed" emissions.
lower | The new minimum value. |
void Gtk::Adjustment::set_page_increment | ( | double | page_increment | ) |
Sets the page increment of the adjustment.
See set_lower() about how to compress multiple emissions of the "changed" signal when setting multiple adjustment properties.
page_increment | The new page increment. |
void Gtk::Adjustment::set_page_size | ( | double | page_size | ) |
Sets the page size of the adjustment.
See set_lower() about how to compress multiple emissions of the "changed" signal when setting multiple adjustment properties.
page_size | The new page size. |
void Gtk::Adjustment::set_step_increment | ( | double | step_increment | ) |
Sets the step increment of the adjustment.
See set_lower() about how to compress multiple emissions of the "changed" signal when setting multiple adjustment properties.
step_increment | The new step increment. |
void Gtk::Adjustment::set_upper | ( | double | upper | ) |
Sets the maximum value of the adjustment.
Note that values will be restricted by <literal>upper - page-size</literal> if the page-size property is nonzero.
See set_lower() about how to compress multiple emissions of the "changed" signal when setting multiple adjustment properties.
upper | The new maximum value. |
void Gtk::Adjustment::set_value | ( | double | value | ) |
Sets the current value of the Adjustment.
value | The new value of the Adjustment. |
Glib::SignalProxy0< void > Gtk::Adjustment::signal_changed | ( | ) |
void on_my_changed()
Glib::SignalProxy0< void > Gtk::Adjustment::signal_value_changed | ( | ) |
void on_my_value_changed()
void Gtk::Adjustment::value_changed | ( | ) |
Emits a "value_changed" signal from the Adjustment.
This is typically called by the owner of the Adjustment after it has changed the Adjustment value field.
Gtk::Adjustment* wrap | ( | GtkAdjustment * | object, | |
bool | take_copy = false | |||
) | [related] |
A Glib::wrap() method for this object.
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. |