Class Range

All Implemented Interfaces:
PointerInterface
Direct Known Subclasses:
Scale

public class Range extends Widget
`GtkRange` is the common base class for widgets which visualize an
adjustment.

Widgets that are derived from `GtkRange` include
[class@Gtk.Scale] and [class@Gtk.Scrollbar].

Apart from signals for monitoring the parameters of the adjustment,
`GtkRange` provides properties and methods for setting a
“fill level” on range widgets. See [method@Gtk.Range.set_fill_level].

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

  • Field Details

  • Constructor Details

  • Method Details

    • getClassHandler

      public static ClassHandler getClassHandler()
    • getAdjustment

      public Adjustment getAdjustment()
      Get the adjustment which is the “model” object for `GtkRange`.
      Returns:
      a `GtkAdjustment`
    • getFillLevel

      public double getFillLevel()
      Gets the current position of the fill level indicator.
      Returns:
      The current fill level
    • getFlippable

      public boolean getFlippable()
      Gets whether the `GtkRange` respects text direction.

      See [method@Gtk.Range.set_flippable].
      Returns:
      %TRUE if the range is flippable
    • getInverted

      public boolean getInverted()
      Gets whether the range is inverted.

      See [method@Gtk.Range.set_inverted].
      Returns:
      %TRUE if the range is inverted
    • getRangeRect

      public void getRangeRect(@Nonnull Rectangle range_rect)
      This function returns the area that contains the range’s trough,
      in coordinates relative to @range's origin.

      This function is useful mainly for `GtkRange` subclasses.
      Parameters:
      range_rect - return location for the range rectangle
    • getRestrictToFillLevel

      public boolean getRestrictToFillLevel()
      Gets whether the range is restricted to the fill level.
      Returns:
      %TRUE if @range is restricted to the fill level.
    • getRoundDigits

      public int getRoundDigits()
      Gets the number of digits to round the value to when
      it changes.

      See [signal@Gtk.Range::change-value].
      Returns:
      the number of digits to round to
    • getShowFillLevel

      public boolean getShowFillLevel()
      Gets whether the range displays the fill level graphically.
      Returns:
      %TRUE if @range shows the fill level.
    • getSliderRange

      public void getSliderRange(@Nullable Int slider_start, @Nullable Int slider_end)
      This function returns sliders range along the long dimension,
      in widget->window coordinates.

      This function is useful mainly for `GtkRange` subclasses.
      Parameters:
      slider_start - return location for the slider's start
      slider_end - return location for the slider's end
    • getSliderSizeFixed

      public boolean getSliderSizeFixed()
      This function is useful mainly for `GtkRange` subclasses.

      See [method@Gtk.Range.set_slider_size_fixed].
      Returns:
      whether the range’s slider has a fixed size.
    • getValue

      public double getValue()
      Gets the current value of the range.
      Returns:
      current value of the range.
    • setAdjustment

      public void setAdjustment(@Nonnull Adjustment adjustment)
      Sets the adjustment to be used as the “model” object for the `GtkRange`

      The adjustment indicates the current range value, the minimum and
      maximum range values, the step/page increments used for keybindings
      and scrolling, and the page size.

      The page size is normally 0 for `GtkScale` and nonzero for `GtkScrollbar`,
      and indicates the size of the visible area of the widget being scrolled.
      The page size affects the size of the scrollbar slider.
      Parameters:
      adjustment - a `GtkAdjustment`
    • setFillLevel

      public void setFillLevel(double fill_level)
      Set the new position of the fill level indicator.

      The “fill level” is probably best described by its most prominent
      use case, which is an indicator for the amount of pre-buffering in
      a streaming media player. In that use case, the value of the range
      would indicate the current play position, and the fill level would
      be the position up to which the file/stream has been downloaded.

      This amount of prebuffering can be displayed on the range’s trough
      and is themeable separately from the trough. To enable fill level
      display, use [method@Gtk.Range.set_show_fill_level]. The range defaults
      to not showing the fill level.

      Additionally, it’s possible to restrict the range’s slider position
      to values which are smaller than the fill level. This is controlled
      by [method@Gtk.Range.set_restrict_to_fill_level] and is by default
      enabled.
      Parameters:
      fill_level - the new position of the fill level indicator
    • setFlippable

      public void setFlippable(boolean flippable)
      Sets whether the `GtkRange` respects text direction.

      If a range is flippable, it will switch its direction
      if it is horizontal and its direction is %GTK_TEXT_DIR_RTL.

      See [method@Gtk.Widget.get_direction].
      Parameters:
      flippable - %TRUE to make the range flippable
    • setIncrements

      public void setIncrements(double step, double page)
      Sets the step and page sizes for the range.

      The step size is used when the user clicks the `GtkScrollbar`
      arrows or moves a `GtkScale` via arrow keys. The page size
      is used for example when moving via Page Up or Page Down keys.
      Parameters:
      step - step size
      page - page size
    • setInverted

      public void setInverted(boolean setting)
      Sets whether to invert the range.

      Ranges normally move from lower to higher values as the
      slider moves from top to bottom or left to right. Inverted
      ranges have higher values at the top or on the right rather
      than on the bottom or left.
      Parameters:
      setting - %TRUE to invert the range
    • setRange

      public void setRange(double min, double max)
      Sets the allowable values in the `GtkRange`.

      The range value is clamped to be between @min and @max.
      (If the range has a non-zero page size, it is clamped
      between @min and @max - page-size.)
      Parameters:
      min - minimum range value
      max - maximum range value
    • setRestrictToFillLevel

      public void setRestrictToFillLevel(boolean restrict_to_fill_level)
      Sets whether the slider is restricted to the fill level.

      See [method@Gtk.Range.set_fill_level] for a general description
      of the fill level concept.
      Parameters:
      restrict_to_fill_level - Whether the fill level restricts slider movement.
    • setRoundDigits

      public void setRoundDigits(int round_digits)
      Sets the number of digits to round the value to when
      it changes.

      See [signal@Gtk.Range::change-value].
      Parameters:
      round_digits - the precision in digits, or -1
    • setShowFillLevel

      public void setShowFillLevel(boolean show_fill_level)
      Sets whether a graphical fill level is show on the trough.

      See [method@Gtk.Range.set_fill_level] for a general description
      of the fill level concept.
      Parameters:
      show_fill_level - Whether a fill level indicator graphics is shown.
    • setSliderSizeFixed

      public void setSliderSizeFixed(boolean size_fixed)
      Sets whether the range’s slider has a fixed size, or a size that
      depends on its adjustment’s page size.

      This function is useful mainly for `GtkRange` subclasses.
      Parameters:
      size_fixed - %TRUE to make the slider size constant
    • setValue

      public void setValue(double value)
      Sets the current value of the range.

      If the value is outside the minimum or maximum range values,
      it will be clamped to fit inside them. The range emits the
      [signal@Gtk.Range::value-changed] signal if the value changes.
      Parameters:
      value - new value of the range
    • onAdjustBounds

      public SignalHandler onAdjustBounds(Range.OnAdjustBounds signal)
      Connect to signal "adjust-bounds".
      See Range.OnAdjustBounds.onAdjustBounds(double) for signal description.
      Field SIGNAL_ON_ADJUST_BOUNDS 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.
    • onChangeValue

      public SignalHandler onChangeValue(Range.OnChangeValue signal)
      Connect to signal "change-value".
      See Range.OnChangeValue.onChangeValue(int, double) for signal description.
      Field SIGNAL_ON_CHANGE_VALUE 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.
    • onMoveSlider

      public SignalHandler onMoveSlider(Range.OnMoveSlider signal)
      Connect to signal "move-slider".
      See Range.OnMoveSlider.onMoveSlider(int) for signal description.
      Field SIGNAL_ON_MOVE_SLIDER 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(Range.OnValueChanged signal)
      Connect to signal "value-changed".
      See Range.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.
    • asAccessible

      public Accessible asAccessible()
      Implements interface Accessible. Call this to get access to interface functions.
      Overrides:
      asAccessible in class Widget
      Returns:
      Accessible
    • asBuildable

      public Buildable asBuildable()
      Implements interface Buildable. Call this to get access to interface functions.
      Overrides:
      asBuildable in class Widget
      Returns:
      Buildable
    • asConstraintTarget

      public ConstraintTarget asConstraintTarget()
      Implements interface ConstraintTarget. Call this to get access to interface functions.
      Overrides:
      asConstraintTarget in class Widget
      Returns:
      ConstraintTarget
    • asOrientable

      public Orientable asOrientable()
      Implements interface Orientable. Call this to get access to interface functions.
      Returns:
      Orientable
    • 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()