Class Adjustment

All Implemented Interfaces:
PointerInterface

public class Adjustment extends InitiallyUnowned
`GtkAdjustment` is a model for a numeric value.

The `GtkAdjustment has an associated lower and upper bound.
It also contains step and page increments, and a page size.

Adjustments are used within several GTK widgets, including
[class@Gtk.SpinButton], [class@Gtk.Viewport], [class@Gtk.Scrollbar]
and [class@Gtk.Scale].

The `GtkAdjustment` object does not update the value itself. Instead
it is left up to the owner of the `GtkAdjustment` to control the value.

https://docs.gtk.org/gtk4/class.Adjustment.html

  • Field Details

  • Constructor Details

    • Adjustment

      public Adjustment(PointerContainer pointer)
    • Adjustment

      public Adjustment(double value, double lower, double upper, double step_increment, double page_increment, double page_size)
      Creates a new `GtkAdjustment`.
      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
  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • clampPage

      public void clampPage(double lower, double upper)
      Updates the value property to ensure that the range
      between @lower and @upper is in the current page.

      The current page goes from `value` to `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 [signal@Gtk.Adjustment::value-changed] signal will be emitted
      if the value is changed.
      Parameters:
      lower - the lower value
      upper - the upper value
    • configure

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

      Use this function to avoid multiple emissions of the
      [signal@Gtk.Adjustment::changed] signal. See
      [method@Gtk.Adjustment.set_lower] for an alternative
      way of compressing multiple emissions of
      [signal@Gtk.Adjustment::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
    • getLower

      public double getLower()
      Retrieves the minimum value of the adjustment.
      Returns:
      The current minimum value of the adjustment
    • getMinimumIncrement

      public double getMinimumIncrement()
      Gets the smaller of step increment and page increment.
      Returns:
      the minimum increment of @adjustment
    • getPageIncrement

      public double getPageIncrement()
      Retrieves the page increment of the adjustment.
      Returns:
      The current page increment of the adjustment
    • getPageSize

      public double getPageSize()
      Retrieves the page size of the adjustment.
      Returns:
      The current page size of the adjustment
    • getStepIncrement

      public double getStepIncrement()
      Retrieves the step increment of the adjustment.
      Returns:
      The current step increment of the adjustment.
    • getUpper

      public double getUpper()
      Retrieves the maximum value of the adjustment.
      Returns:
      The current maximum value of the adjustment
    • getValue

      public double getValue()
      Gets the current value of the adjustment.
      Returns:
      The current value of the adjustment
    • setLower

      public void setLower(double lower)
      Sets the minimum value of the adjustment.

      When setting multiple adjustment properties via their individual
      setters, multiple [signal@Gtk.Adjustment::changed] signals will
      be emitted. However, since the emission of the
      [signal@Gtk.Adjustment::changed] signal is tied to the emission
      of the ::notify signals of the changed properties, it’s possible
      to compress the [signal@Gtk.Adjustment::changed] signals into one
      by calling g_object_freeze_notify() and g_object_thaw_notify()
      around the calls to the individual setters.

      Alternatively, using a single g_object_set() for all the properties
      to change, or using [method@Gtk.Adjustment.configure] has the same effect.
      Parameters:
      lower - the new minimum value
    • setPageIncrement

      public void setPageIncrement(double page_increment)
      Sets the page increment of the adjustment.

      See [method@Gtk.Adjustment.set_lower] about how to compress
      multiple emissions of the [signal@Gtk.Adjustment::changed]
      signal when setting multiple adjustment properties.
      Parameters:
      page_increment - the new page increment
    • setPageSize

      public void setPageSize(double page_size)
      Sets the page size of the adjustment.

      See [method@Gtk.Adjustment.set_lower] about how to compress
      multiple emissions of the [signal@Gtk.Adjustment::changed]
      signal when setting multiple adjustment properties.
      Parameters:
      page_size - the new page size
    • setStepIncrement

      public void setStepIncrement(double step_increment)
      Sets the step increment of the adjustment.

      See [method@Gtk.Adjustment.set_lower] about how to compress
      multiple emissions of the [signal@Gtk.Adjustment::changed]
      signal when setting multiple adjustment properties.
      Parameters:
      step_increment - the new step increment
    • setUpper

      public void setUpper(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 [method@Gtk.Adjustment.set_lower] about how to compress
      multiple emissions of the [signal@Gtk.Adjustment::changed]
      signal when setting multiple adjustment properties.
      Parameters:
      upper - the new maximum value
    • setValue

      public void setValue(double value)
      Sets the `GtkAdjustment` value.

      The value is clamped to lie between [property@Gtk.Adjustment:lower]
      and [property@Gtk.Adjustment:upper].

      Note that for adjustments which are used in a `GtkScrollbar`,
      the effective range of allowed values goes from
      [property@Gtk.Adjustment:lower] to
      [property@Gtk.Adjustment:upper] - [property@Gtk.Adjustment:page-size].
      Parameters:
      value - the new value
    • onChanged

      public SignalHandler onChanged(Adjustment.OnChanged signal)
      Connect to signal "changed".
      See Adjustment.OnChanged.onChanged() for signal description.
      Field SIGNAL_ON_CHANGED contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • onValueChanged

      public SignalHandler onValueChanged(Adjustment.OnValueChanged signal)
      Connect to signal "value-changed".
      See Adjustment.OnValueChanged.onValueChanged() for signal description.
      Field SIGNAL_ON_VALUE_CHANGED contains original signal name and can be used as resource reference.
      Parameters:
      signal - callback function (lambda).
      Returns:
      SignalHandler. Can be used to disconnect signal and to release callback function.
    • getTypeID

      public static long getTypeID()
    • getParentTypeID

      public static long getParentTypeID()
    • getTypeSize

      public static TypeSystem.TypeSize getTypeSize()
    • getParentTypeSize

      public static TypeSystem.TypeSize getParentTypeSize()
    • getInstanceSize

      public static int getInstanceSize()