Package org.gnome.gtk
Class SpinButton.Builder<B extends SpinButton.Builder<B>>
java.lang.Object
org.javagi.gobject.Builder<B>
org.gnome.gobject.GObject.Builder<B>
org.gnome.gobject.InitiallyUnowned.Builder<B>
org.gnome.gtk.Widget.Builder<B>
org.gnome.gtk.SpinButton.Builder<B>
- Type Parameters:
B- the type of the Builder that is returned
- All Implemented Interfaces:
Accessible.Builder<B>,CellEditable.Builder<B>,Editable.Builder<B>,Orientable.Builder<B>,BuilderInterface
- Enclosing class:
SpinButton
public static class SpinButton.Builder<B extends SpinButton.Builder<B>>
extends Widget.Builder<B>
implements Accessible.Builder<B>, CellEditable.Builder<B>, Editable.Builder<B>, Orientable.Builder<B>
Inner class implementing a builder pattern to construct a GObject with
properties.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Finish building theSpinButtonobject.onActivate(SpinButton.ActivateCallback handler) Emitted when the spin button is activated.Emitted when the user initiates a value change.onInput(SpinButton.InputCallback handler) Emitted to convert the users input into a double value.onOutput(SpinButton.OutputCallback handler) Emitted to tweak the formatting of the value for display.Emitted when the value is changed.onWrapped(SpinButton.WrappedCallback handler) Emitted right after the spinbutton wraps from its maximum to its minimum value or vice-versa.setActivatesDefault(boolean activatesDefault) Whether to activate the default widget when the spin button is activated.setAdjustment(Adjustment adjustment) The adjustment that holds the value of the spin button.setClimbRate(double climbRate) The acceleration rate when you hold down a button or key.setDigits(int digits) The number of decimal places to display.setNumeric(boolean numeric) Whether non-numeric characters should be ignored.setSnapToTicks(boolean snapToTicks) Whether erroneous values are automatically changed to the spin buttons nearest step increment.setUpdatePolicy(SpinButtonUpdatePolicy updatePolicy) Whether the spin button should update always, or only when the value is acceptable.setValue(double value) The current value.setWrap(boolean wrap) Whether a spin button should wrap upon reaching its limits.Methods inherited from class org.gnome.gtk.Widget.Builder
onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, setCanFocus, setCanTarget, setCssClasses, setCssName, setCursor, setFocusable, setFocusOnClick, setHalign, setHasTooltip, setHeightRequest, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setReceivesDefault, setSensitive, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthRequestMethods inherited from class org.gnome.gobject.GObject.Builder
onNotifyMethods inherited from class org.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValuesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRoleMethods inherited from interface org.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArenaMethods inherited from interface org.gnome.gtk.CellEditable.Builder
setEditingCanceledMethods inherited from interface org.gnome.gtk.Editable.Builder
setEditable, setEnableUndo, setMaxWidthChars, setText, setWidthChars, setXalignMethods inherited from interface org.gnome.gtk.Orientable.Builder
setOrientation
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilderobject.
-
-
Method Details
-
build
Finish building theSpinButtonobject. This will callGObject.withProperties(org.gnome.glib.Type, java.lang.String[], org.gnome.gobject.Value[])to create a new GObject instance, which is then cast toSpinButton.- Overrides:
buildin classWidget.Builder<B extends SpinButton.Builder<B>>- Returns:
- a new instance of
SpinButtonwith the properties that were set in the Builder object.
-
setActivatesDefault
Whether to activate the default widget when the spin button is activated.See
Gtk.SpinButton::activatefor what counts as activation.- Parameters:
activatesDefault- the value for theactivates-defaultproperty- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 4.14
-
setAdjustment
The adjustment that holds the value of the spin button.- Parameters:
adjustment- the value for theadjustmentproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setClimbRate
The acceleration rate when you hold down a button or key.- Parameters:
climbRate- the value for theclimb-rateproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setDigits
The number of decimal places to display.- Parameters:
digits- the value for thedigitsproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setNumeric
Whether non-numeric characters should be ignored.- Parameters:
numeric- the value for thenumericproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setSnapToTicks
Whether erroneous values are automatically changed to the spin buttons nearest step increment.- Parameters:
snapToTicks- the value for thesnap-to-ticksproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setUpdatePolicy
Whether the spin button should update always, or only when the value is acceptable.- Parameters:
updatePolicy- the value for theupdate-policyproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setValue
The current value.- Parameters:
value- the value for thevalueproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
setWrap
Whether a spin button should wrap upon reaching its limits.- Parameters:
wrap- the value for thewrapproperty- Returns:
- the
Builderinstance is returned, to allow method chaining
-
onActivate
Emitted when the spin button is activated.The keybindings for this signal are all forms of the
Enterkey.If the
Enterkey results in the value being committed to the spin button, then activation does not occur untilEnteris pressed again.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - Since:
- 4.14
- See Also:
-
onChangeValue
Emitted when the user initiates a value change.This is a keybinding signal.
Applications should not connect to it, but may emit it with g_signal_emit_by_name() if they need to control the cursor programmatically.
The default bindings for this signal are Up/Down and PageUp/PageDown.
- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onInput
Emitted to convert the users input into a double value.The signal handler is expected to use
Editable.getText()to retrieve the text of the spinbutton and setnewValueto the new value.The default conversion uses g_strtod().
- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onOutput
Emitted to tweak the formatting of the value for display.// show leading zeros static gboolean on_output (GtkSpinButton *spin, gpointer data) { char *text; int value; value = gtk_spin_button_get_value_as_int (spin); text = g_strdup_printf ("%02d", value); gtk_editable_set_text (GTK_EDITABLE (spin), text): g_free (text); return TRUE; }- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onValueChanged
Emitted when the value is changed.Also see the
Gtk.SpinButton::outputsignal.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-
onWrapped
Emitted right after the spinbutton wraps from its maximum to its minimum value or vice-versa.- Parameters:
handler- the signal handler- Returns:
- the
Builderinstance is returned, to allow method chaining - See Also:
-