Class Adjustment
- All Implemented Interfaces:
Proxy
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
Nested ClassesModifier and TypeClassDescriptionstatic classstatic classAdjustment.Builder<B extends Adjustment.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theChangedCallbackcallback.static interfaceFunctional interface declaration of theValueChangedCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new Adjustment.Adjustment(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 AdjustmentasParent()Returns this instance as if it were its parent type.static Adjustment.Builder<? extends Adjustment.Builder> builder()AAdjustment.Builderobject constructs aAdjustmentwith the specified properties.protected voidchanged()voidclampPage(double lower, double upper) Updates the value of the adjustment to ensure that the given range is contained in the current page.voidconfigure(double value, double lower, double upper, double stepIncrement, double pageIncrement, double pageSize) Sets all properties of the adjustment at once.voidEmits the "changed" signal.voidEmits the "value-changed" signal.doublegetLower()Retrieves the minimum value of the adjustment.static MemoryLayoutThe memory layout of the native struct.doubleGets the smaller of step increment and page increment.doubleRetrieves the page increment of the adjustment.doubleRetrieves the page size of the adjustment.doubleRetrieves the step increment of the adjustment.static @Nullable TypegetType()Get the GType of the Adjustment classdoublegetUpper()Retrieves the maximum value of the adjustment.doublegetValue()Gets the current value of the adjustment.onChanged(Adjustment.ChangedCallback handler) Emitted when one or more of theGtkAdjustmentproperties have been changed.Emitted when the value has been changed.voidsetLower(double lower) Sets the minimum value of the adjustment.voidsetPageIncrement(double pageIncrement) Sets the page increment of the adjustment.voidsetPageSize(double pageSize) Sets the page size of the adjustment.voidsetStepIncrement(double stepIncrement) Sets the step increment of the adjustment.voidsetUpper(double upper) Sets the maximum value of the adjustment.voidsetValue(double value) Sets theGtkAdjustmentvalue.protected voidMethods 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, 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, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.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
-
Adjustment
public Adjustment()Creates a new Adjustment.
-
-
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 Javasuperkeyword, 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:
asParentin classInitiallyUnowned
-
clampPage
public void clampPage(double lower, double upper) Updates the value of the adjustment to ensure that the given range is contained in the current page.The current page goes from
valuetovalue+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-changedsignal 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::changedsignal. SeesetLower(double)for an alternative way of compressing multiple emissions ofGtk.Adjustment::changedinto 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 minimum value
-
getMinimumIncrement
public double getMinimumIncrement()Gets the smaller of step increment and page increment.- Returns:
- the minimum increment
-
getPageIncrement
public double getPageIncrement()Retrieves the page increment of the adjustment.- Returns:
- the page increment
-
getPageSize
public double getPageSize()Retrieves the page size of the adjustment.- Returns:
- the page size
-
getStepIncrement
public double getStepIncrement()Retrieves the step increment of the adjustment.- Returns:
- the step increment
-
getUpper
public double getUpper()Retrieves the maximum value of the adjustment.- Returns:
- the maximum value
-
getValue
public double getValue()Gets the current value of the adjustment.- Returns:
- the current value
-
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::changedsignals will be emitted. However, since the emission of theGtk.Adjustment::changedsignal is tied to the emission of the ::notify signals of the changed properties, it’s possible to compress theGtk.Adjustment::changedsignals 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::changedsignal 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::changedsignal 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::changedsignal 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-sizeif the page-size property is nonzero.See
setLower(double)about how to compress multiple emissions of theGtk.Adjustment::changedsignal when setting multiple adjustment properties.- Parameters:
upper- the new maximum value
-
setValue
public void setValue(double value) Sets theGtkAdjustmentvalue.The value is clamped to lie between
Gtk.Adjustment:lowerandGtk.Adjustment:upper.Note that for adjustments which are used in a
GtkScrollbar, the effective range of allowed values goes fromGtk.Adjustment:lowertoGtk.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 theGtkAdjustmentproperties have been changed.Note that the
Gtk.Adjustment:valueproperty is covered by theGtk.Adjustment::value-changedsignal.- 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.Builderobject constructs aAdjustmentwith the specified properties. Use the variousset...()methods to set properties, and finish construction withAdjustment.Builder.build().- Returns:
- the builder object
-