Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Login

Gtk::Adjustment

class Gtk::Adjustment

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 Ruby/GTK 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 Gtk::Adjustment#value_changed and Gtk::Adjustment#changed functions after changing the value and its bounds. This results in the emission of the "value_changed" or "changed" signal respectively.

Class Methods

Gtk::Adjustment.new(value, lower, upper, step_inc, page_inc, page_size)
Creates a new Gtk::Adjustment. All argument types are Float.
  • value: the initial value.
  • lower: the minimum value.
  • upper: the maximum value.
  • step_increment: the increment to use to make minor changes to the value. In a Gtk::Scrollbar this increment is used when the mouse is clicked on the arrows at the top and bottom of the scrollbar, to scroll by a small amount.
  • page_increment: the increment to use to make major changes to the value. In a Gtk::Scrollbar this increment is used when the mouse is clicked in the trough, to scroll by a large amount.
  • page_size: the page size. In a Gtk::Scrollbar this is the size of the area which is currently visible.

Instance Methods

value
Gets the current value of the adjustment. See Gtk::Adjustment#value=.
  • Returns: The current value of the adjustment
value=(value)
Sets the Gtk::Adjustment value.
  • value : the new value
  • Returns: value
set_value
Same as Gtk::Adjustment#value=.
  • value : the new value
  • Returns: self
step_increment(step_increment)
Gets the step_increment value. See Gtk::Adjustment#step_increment=.
  • Returns: step_increment
step_increment=(step_increment)
Sets the increment to use to make minor changes to the value.
  • step_increment : the new step_increment value.
  • Returns: step_increment
set_step_increment(step_increment)
Same as Gtk::Adjustment#step_increment=.
  • step_increment : the new step_increment value.
  • Returns: self
clamp_page
Updates the Gtk::Adjustment value to ensure that the range between lower and upper is in the current page (i.e. between value and value + page_size). If the 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.
  • lower: the lower value.
  • upper: the upper value.
  • Returns: self
lower
Gets the minimum value of the adjustment. See Gtk::Adjustment#clamp_page.
  • Returns: The minimum value of the adjustment
lower=(lower)
Sets the minimum value of the adjustment. Since 2.4
  • lower: The minimum value of the adjustment
  • Returns: lower
set_lower(lower)
Same as Gtk::Adjustment#lower=. Since 2.4
  • lower: The minimum value of the adjustment
  • Returns: self
upper
Gets the maximum value of the adjustment. See Gtk::Adjustment#clamp_page.
  • Returns: The maximum value of the adjustment
upper=(upper)
Sets the maximum value of the adjustment. Since 2.4
  • upper: The maximum value of the adjustment
  • Returns: upper
set_upper(upper)
Same as Gtk::Adjustment#upper=. Since 2.4
  • upper: The maximum value of the adjustment
  • Returns: self
page_increment
Gets the increment to use to make major changes to the value of the adjustment. See Gtk::Adjustment.new.
  • Returns: The increment to use to make major changes to the value of the adjustment
page_increment=(page_increment)
Sets the increment to use to make major changes to the value of the adjustment.
  • page_increment : the new page_increment value.
  • Returns: page_increment
set_page_increment(page_increment)
Same as Gtk::Adjustment#page_increment=.
  • page_increment : the new page_increment value.
  • Returns: self
page_size
Gets the page size value of the adjustment. See Gtk::Adjustment.new.
  • Returns: The page size value of the adjustment
page_size=(page_size)
Sets the page size value of the adjustment.
  • page_size : the new page_size value.
  • Returns: page_size
set_page_size(page_size)
Same as Gtk::Adjustment#page_size=.
  • page_size : the new page_size value.
  • Returns: self
changed
Emits a "changed" signal from the Gtk::Adjustment. This is typically called by the owner of the Gtk::Adjustment after it has changed any of the Gtk::Adjustment fields other than the value.
value_changed
Emits a "value_changed" signal from the Gtk::Adjustment. This is typically called by the owner of the Gtk::Adjustment after it has changed the Gtk::Adjustment value field.

Properties

lower: Float (Read/Write)
The minimum value of the adjustment. Since 2.4
  • Default value: 0
page-increment: Float (Read/Write)
The page increment of the adjustment. Since 2.4
  • Default value: 0
page-size: Float (Read/Write)
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. Since 2.4
  • Default value: 0
step-increment: Float (Read/Write)
The step increment of the adjustment. Since 2.4
  • Default value: 0
upper: Float (Read/Write)
The maximum value of the adjustment. Since 2.4
  • Default value: 0
value: Float (Read/Write)
The value of the adjustment. Since 2.4
  • Default value: 0

Signals

changed: self (Run first / No recursion)
Emitted when one or more of the GtkAdjustment fields have been changed, other than the value field.
value-changed: self (Run first / No recursion)
Emitted when the GtkAdjustment value field has been changed.

ChangeLog

  • 2006-01-31 Apply GTK+-2.4 methods - Masao
  • 2005-10-27 Fix typos - Masao
  • 2003-08-22 Added - Masao