Class Adjustment
- All Implemented Interfaces:
Proxy
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
SpinButton
, Viewport
, Scrollbar
and 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 class
static class
Adjustment.Builder<B extends Adjustment.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theChangedCallback
callback.static interface
Functional interface declaration of theValueChangedCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClass
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionAdjustment
(double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize) Creates a newGtkAdjustment
.Adjustment
(MemorySegment address) Create a Adjustment proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected Adjustment
asParent()
Returns this instance as if it were its parent type.static Adjustment.Builder
<? extends Adjustment.Builder> builder()
AAdjustment.Builder
object constructs aAdjustment
with the specified properties.protected void
changed()
void
clampPage
(double lower, double upper) Updates the value property to ensure that the range betweenlower
andupper
is in the current page.void
configure
(double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize) Sets all properties of the adjustment at once.void
Emits the "changed" signal.void
Emits the "value-changed" signal.double
getLower()
Retrieves the minimum value of the adjustment.static MemoryLayout
The memory layout of the native struct.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.double
Retrieves the step increment of the adjustment.static Type
getType()
Get the GType of the Adjustment classdouble
getUpper()
Retrieves the maximum value of the adjustment.double
getValue()
Gets the current value of the adjustment.onChanged
(Adjustment.ChangedCallback handler) Emitted when one or more of theGtkAdjustment
properties have been changed.Emitted when the value has been changed.void
setLower
(double lower) Sets the minimum value of the adjustment.void
setPageIncrement
(double pageIncrement) Sets the page increment of the adjustment.void
setPageSize
(double pageSize) Sets the page size of the adjustment.void
setStepIncrement
(double stepIncrement) Sets the step increment of the adjustment.void
setUpper
(double upper) Sets the maximum value of the adjustment.void
setValue
(double value) Sets theGtkAdjustment
value.protected void
Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newInstance, newInstance, newv, notify_, notify_, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
Adjustment
Create a Adjustment proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
Adjustment
public Adjustment(double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize) Creates a newGtkAdjustment
.- Parameters:
value
- the initial valuelower
- the minimum valueupper
- the maximum valuestepIncrement
- the step incrementpageIncrement
- the page incrementpageSize
- the page size
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()
doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName()
. This will call the native function pointer of this virtual method in the typeclass of the parent type.- Overrides:
asParent
in classInitiallyUnowned
-
clampPage
public void clampPage(double lower, double upper) Updates the value property to ensure that the range betweenlower
andupper
is in the current page.The current page goes from
value
tovalue
+page-size
. If the range is larger than the page size, then only the start of it will be in the current page.A
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 stepIncrement, double pageIncrement, double pageSize) Sets all properties of the adjustment at once.Use this function to avoid multiple emissions of the
Gtk.Adjustment::changed
signal. SeesetLower(double)
for an alternative way of compressing multiple emissions ofGtk.Adjustment::changed
into one.- Parameters:
value
- the new valuelower
- the new minimum valueupper
- the new maximum valuestepIncrement
- the new step incrementpageIncrement
- the new page incrementpageSize
- 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 this 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
Gtk.Adjustment::changed
signals will be emitted. However, since the emission of theGtk.Adjustment::changed
signal is tied to the emission of the ::notify signals of the changed properties, it’s possible to compress theGtk.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
configure(double, double, double, double, double, double)
has the same effect.- Parameters:
lower
- the new minimum value
-
setPageIncrement
public void setPageIncrement(double pageIncrement) Sets the page increment of the adjustment.See
setLower(double)
about how to compress multiple emissions of theGtk.Adjustment::changed
signal when setting multiple adjustment properties.- Parameters:
pageIncrement
- the new page increment
-
setPageSize
public void setPageSize(double pageSize) Sets the page size of the adjustment.See
setLower(double)
about how to compress multiple emissions of theGtk.Adjustment::changed
signal when setting multiple adjustment properties.- Parameters:
pageSize
- the new page size
-
setStepIncrement
public void setStepIncrement(double stepIncrement) Sets the step increment of the adjustment.See
setLower(double)
about how to compress multiple emissions of theGtk.Adjustment::changed
signal when setting multiple adjustment properties.- Parameters:
stepIncrement
- 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
setLower(double)
about how to compress multiple emissions of theGtk.Adjustment::changed
signal when setting multiple adjustment properties.- Parameters:
upper
- the new maximum value
-
setValue
public void setValue(double value) Sets theGtkAdjustment
value.The value is clamped to lie between
Gtk.Adjustment:lower
andGtk.Adjustment:upper
.Note that for adjustments which are used in a
GtkScrollbar
, the effective range of allowed values goes fromGtk.Adjustment:lower
toGtk.Adjustment:upper
-Gtk.Adjustment:page-size
.- Parameters:
value
- the new value
-
changed
protected void changed() -
valueChanged
protected void valueChanged() -
onChanged
Emitted when one or more of theGtkAdjustment
properties have been changed.Note that the
Gtk.Adjustment:value
property is covered by theGtk.Adjustment::value-changed
signal.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitChanged
public void emitChanged()Emits the "changed" signal. SeeonChanged(org.gnome.gtk.Adjustment.ChangedCallback)
. -
onValueChanged
public SignalConnection<Adjustment.ValueChangedCallback> onValueChanged(Adjustment.ValueChangedCallback handler) Emitted when the value has been changed.- Parameters:
handler
- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitValueChanged
public void emitValueChanged()Emits the "value-changed" signal. SeeonValueChanged(org.gnome.gtk.Adjustment.ValueChangedCallback)
. -
builder
AAdjustment.Builder
object constructs aAdjustment
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withAdjustment.Builder.build()
.
-