gtkmm 4.7.1

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::Adjustment Class Reference

A class representing an adjustable bounded value. More...

`#include <gtkmm/adjustment.h>`

Inheritance diagram for Gtk::Adjustment:
[legend]

## Public Member Functions
| Adjustment (Adjustment && src) noexcept
Adjustment & | operator= (Adjustment && src) noexcept
| ~Adjustment () noexcept override
GtkAdjustment * | gobj ()
| Provides access to the underlying C GObject. More...
const GtkAdjustment * | gobj () const
| Provides access to the underlying C GObject. More...
GtkAdjustment * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
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). More...
void | set_value (double value)
| Sets the current value of the Adjustment. More...
double | get_value () const
| Gets the current value of the adjustment. More...
void | set_lower (double lower)
| Sets the minimum value of the adjustment. More...
double | get_lower () const
| Retrieves the minimum value of the adjustment. More...
void | set_upper (double upper)
| Sets the maximum value of the adjustment. More...
double | get_upper () const
| Retrieves the maximum value of the adjustment. More...
void | set_step_increment (double step_increment)
| Sets the step increment of the adjustment. More...
double | get_step_increment () const
| Retrieves the step increment of the adjustment. More...
void | set_page_increment (double page_increment)
| Sets the page increment of the adjustment. More...
double | get_page_increment () const
| Retrieves the page increment of the adjustment. More...
void | set_page_size (double page_size)
| Sets the page size of the adjustment. More...
double | get_page_size () const
| Retrieves the page size of the adjustment. More...
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. More...
double | get_minimum_increment () const
| Gets the smaller of step increment and page increment. More...
Glib::SignalProxy< void()> | signal_changed ()
Glib::SignalProxy< void()> | signal_value_changed ()
Glib::PropertyProxy< double > | property_value ()
| The value of the adjustment. More...
Glib::PropertyProxy_ReadOnly< double > | property_value () const
| The value of the adjustment. More...
Glib::PropertyProxy< double > | property_lower ()
| The minimum value of the adjustment. More...
Glib::PropertyProxy_ReadOnly< double > | property_lower () const
| The minimum value of the adjustment. More...
Glib::PropertyProxy< double > | property_upper ()
| The maximum value of the adjustment. More...
Glib::PropertyProxy_ReadOnly< double > | property_upper () const
| The maximum value of the adjustment. More...
Glib::PropertyProxy< double > | property_step_increment ()
| The step increment of the adjustment. More...
Glib::PropertyProxy_ReadOnly< double > | property_step_increment () const
| The step increment of the adjustment. More...
Glib::PropertyProxy< double > | property_page_increment ()
| The page increment of the adjustment. More...
Glib::PropertyProxy_ReadOnly< double > | property_page_increment () const
| The page increment of the adjustment. More...
Glib::PropertyProxy< double > | property_page_size ()
| The page size of the adjustment. More...
Glib::PropertyProxy_ReadOnly< double > | property_page_size () const
| The page size of the adjustment. More...
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system. More...
static Glib::RefPtr< Adjustment > | create (double value, double lower, double upper, double step_increment=1, double page_increment=10, double page_size=0)

## Protected Member Functions
| 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. More...
virtual void | on_changed ()
| This is a default handler for the signal signal_changed(). More...
virtual void | on_value_changed ()
| This is a default handler for the signal signal_value_changed(). More...
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::Adjustment > | wrap (GtkAdjustment * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## Detailed Description

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::Scrollbar and Gtk::Scale).

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.

## Constructor & Destructor Documentation

## ◆ Adjustment() [1/2]

Gtk::Adjustment::Adjustment | ( | Adjustment && | src | ) |
| noexcept

## ◆ ~Adjustment()

Gtk::Adjustment::~Adjustment | ( |  | ) |
| override noexcept

## ◆ Adjustment() [2/2]

Gtk::Adjustment::Adjustment | ( | double | value,
|  | double | lower,
|  | double | upper,
|  | double | step_increment = `1`,
|  | double | page_increment = `10`,
|  | double | page_size = `0`
| ) |  |
| protected

Constructor to create an Adjustment object.

Parameters

  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

## Member Function Documentation

## ◆ clamp_page()

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.

Parameters

  lower | The lower value.
  upper | The upper value.

## ◆ configure()

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 signal_changed() signal. See set_lower() for an alternative way of compressing multiple emissions of signal_changed() into one.

Parameters

  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.

## ◆ create()

static Glib::RefPtr<Adjustment> Gtk::Adjustment::create | ( | double | value,
|  | double | lower,
|  | double | upper,
|  | double | step_increment = `1`,
|  | double | page_increment = `10`,
|  | double | page_size = `0`
| ) |  |
| static

## ◆ get_lower()

double Gtk::Adjustment::get_lower | ( |  | ) | const

Retrieves the minimum value of the adjustment.

Returns
  The current minimum value of the adjustment.

## ◆ get_minimum_increment()

double Gtk::Adjustment::get_minimum_increment | ( |  | ) | const

Gets the smaller of step increment and page increment.

Returns
  The minimum increment of adjustment.

## ◆ get_page_increment()

double Gtk::Adjustment::get_page_increment | ( |  | ) | const

Retrieves the page increment of the adjustment.

Returns
  The current page increment of the adjustment.

## ◆ get_page_size()

double Gtk::Adjustment::get_page_size | ( |  | ) | const

Retrieves the page size of the adjustment.

Returns
  The current page size of the adjustment.

## ◆ get_step_increment()

double Gtk::Adjustment::get_step_increment | ( |  | ) | const

Retrieves the step increment of the adjustment.

Returns
  The current step increment of the adjustment.

## ◆ get_type()

static GType Gtk::Adjustment::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ get_upper()

double Gtk::Adjustment::get_upper | ( |  | ) | const

Retrieves the maximum value of the adjustment.

Returns
  The current maximum value of the adjustment.

## ◆ get_value()

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

Gets the current value of the adjustment.

Returns
  The current value of the adjustment.

## ◆ gobj() [1/2]

GtkAdjustment* Gtk::Adjustment::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkAdjustment* Gtk::Adjustment::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkAdjustment* Gtk::Adjustment::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ on_changed()

virtual void Gtk::Adjustment::on_changed | ( |  | ) |
| protected virtual

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

## ◆ on_value_changed()

virtual void Gtk::Adjustment::on_value_changed | ( |  | ) |
| protected virtual

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

## ◆ operator=()

Adjustment& Gtk::Adjustment::operator= | ( | Adjustment && | src | ) |
| noexcept

## ◆ property_lower() [1/2]

Glib::PropertyProxy< double > Gtk::Adjustment::property_lower | ( |  | ) |

The minimum value of the adjustment.

Default value: 0

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

## ◆ property_lower() [2/2]

Glib::PropertyProxy_ReadOnly< double > Gtk::Adjustment::property_lower | ( |  | ) | const

The minimum value of the adjustment.

Default value: 0

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

## ◆ property_page_increment() [1/2]

Glib::PropertyProxy< double > Gtk::Adjustment::property_page_increment | ( |  | ) |

The page increment of the adjustment.

Default value: 0

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

## ◆ property_page_increment() [2/2]

Glib::PropertyProxy_ReadOnly< double > Gtk::Adjustment::property_page_increment | ( |  | ) | const

The page increment of the adjustment.

Default value: 0

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

## ◆ property_page_size() [1/2]

Glib::PropertyProxy< double > Gtk::Adjustment::property_page_size | ( |  | ) |

The page size of the adjustment.

Note that the page-size is irrelevant and should be set to zero if the adjustment is used for a simple scalar value, e.g. in a `Gtk::SpinButton`.

Default value: 0

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

## ◆ property_page_size() [2/2]

Glib::PropertyProxy_ReadOnly< double > Gtk::Adjustment::property_page_size | ( |  | ) | const

The page size of the adjustment.

Note that the page-size is irrelevant and should be set to zero if the adjustment is used for a simple scalar value, e.g. in a `Gtk::SpinButton`.

Default value: 0

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

## ◆ property_step_increment() [1/2]

Glib::PropertyProxy< double > Gtk::Adjustment::property_step_increment | ( |  | ) |

The step increment of the adjustment.

Default value: 0

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

## ◆ property_step_increment() [2/2]

Glib::PropertyProxy_ReadOnly< double > Gtk::Adjustment::property_step_increment | ( |  | ) | const

The step increment of the adjustment.

Default value: 0

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

## ◆ property_upper() [1/2]

Glib::PropertyProxy< double > Gtk::Adjustment::property_upper | ( |  | ) |

The maximum value of the adjustment.

Note that values will be restricted by `upper - page-size` if the page-size property is nonzero.

Default value: 0

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

## ◆ property_upper() [2/2]

Glib::PropertyProxy_ReadOnly< double > Gtk::Adjustment::property_upper | ( |  | ) | const

The maximum value of the adjustment.

Note that values will be restricted by `upper - page-size` if the page-size property is nonzero.

Default value: 0

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

## ◆ property_value() [1/2]

Glib::PropertyProxy< double > Gtk::Adjustment::property_value | ( |  | ) |

The value of the adjustment.

Default value: 0

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

## ◆ property_value() [2/2]

Glib::PropertyProxy_ReadOnly< double > Gtk::Adjustment::property_value | ( |  | ) | const

The value of the adjustment.

Default value: 0

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

## ◆ set_lower()

void Gtk::Adjustment::set_lower | ( | double | lower | ) |

Sets the minimum value of the adjustment.

When setting multiple adjustment properties via their individual setters, multiple signal_changed() signals will be emitted. However, since the emission of the signal_changed() signal is tied to the emission of the signal_notify() signals of the changed properties, it’s possible to compress the signal_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.

Parameters

  lower | The new minimum value.

## ◆ set_page_increment()

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 signal_changed() signal when setting multiple adjustment properties.

Parameters

  page_increment | The new page increment.

## ◆ set_page_size()

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 signal_changed() signal when setting multiple adjustment properties.

Parameters

  page_size | The new page size.

## ◆ set_step_increment()

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 signal_changed() signal when setting multiple adjustment properties.

Parameters

  step_increment | The new step increment.

## ◆ set_upper()

void Gtk::Adjustment::set_upper | ( | double | upper | ) |

Sets the maximum value of the adjustment.

Note that values will be restricted by `upper - page-size` if the page-size property is nonzero.

See set_lower() about how to compress multiple emissions of the signal_changed() signal when setting multiple adjustment properties.

Parameters

  upper | The new maximum value.

## ◆ set_value()

void Gtk::Adjustment::set_value | ( | double | value | ) |

Sets the current value of the Adjustment.

Parameters

  value | The new value of the Adjustment.

## ◆ signal_changed()

Glib::SignalProxy<void()> Gtk::Adjustment::signal_changed | ( |  | ) |

Slot Prototype:
  `void on_my_changed()`

Flags: Run First, No Recurse

Emitted when one or more of the `Gtk::Adjustment` properties have been changed.

Note that the property_value() property is covered by the signal_value_changed() signal.

## ◆ signal_value_changed()

Glib::SignalProxy<void()> Gtk::Adjustment::signal_value_changed | ( |  | ) |

Slot Prototype:
  `void on_my_value_changed()`

Flags: Run First, No Recurse

Emitted when the value has been changed.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::Adjustment > wrap | ( | GtkAdjustment * | 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.