Package ch.bailu.gtk.gtk
Class Adjustment
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.gobject.InitiallyUnowned
ch.bailu.gtk.gtk.Adjustment
- All Implemented Interfaces:
PointerInterface
`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.
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
static interface
Nested classes/interfaces inherited from class ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Field Summary
Fields inherited from class ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Constructor Summary
ConstructorDescriptionAdjustment
(double value, double lower, double upper, double step_increment, double page_increment, double page_size) Creates a new `GtkAdjustment`.Adjustment
(PointerContainer pointer) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clampPage
(double lower, double upper) Updates the value property to ensure that the range
between @lower and @upper is in the current page.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.static ClassHandler
static int
double
getLower()
Retrieves the minimum value of the adjustment.double
Gets the smaller of step increment and page increment.double
Retrieves the page increment of the adjustment.double
Retrieves the page size of the adjustment.static long
static TypeSystem.TypeSize
double
Retrieves the step increment of the adjustment.static long
static TypeSystem.TypeSize
double
getUpper()
Retrieves the maximum value of the adjustment.double
getValue()
Gets the current value of the adjustment.onChanged
(Adjustment.OnChanged signal) Connect to signal "changed".Connect to signal "value-changed".void
setLower
(double lower) Sets the minimum value of the adjustment.void
setPageIncrement
(double page_increment) Sets the page increment of the adjustment.void
setPageSize
(double page_size) Sets the page size of the adjustment.void
setStepIncrement
(double step_increment) Sets the step increment of the adjustment.void
setUpper
(double upper) Sets the maximum value of the adjustment.void
setValue
(double value) Sets the `GtkAdjustment` value.Methods inherited from class ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Methods inherited from class ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Methods inherited from class ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Field Details
-
SIGNAL_ON_CHANGED
- See Also:
-
SIGNAL_ON_VALUE_CHANGED
- See Also:
-
-
Constructor Details
-
Adjustment
-
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 valuelower
- the minimum valueupper
- the maximum valuestep_increment
- the step incrementpage_increment
- the page incrementpage_size
- the page size
-
-
Method Details
-
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 valueupper
- 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 valuelower
- the new minimum valueupper
- the new maximum valuestep_increment
- the new step incrementpage_increment
- the new page incrementpage_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
Connect to signal "changed".
SeeAdjustment.OnChanged.onChanged()
for signal description.
FieldSIGNAL_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
Connect to signal "value-changed".
SeeAdjustment.OnValueChanged.onValueChanged()
for signal description.
FieldSIGNAL_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
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-