Package org.gnome.gtk
Class SpinButton.Builder<B extends SpinButton.Builder<B>>
java.lang.Object
io.github.jwharm.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:
BuilderInterface
,Accessible.Builder<B>
,CellEditable.Builder<B>
,Editable.Builder<B>
,Orientable.Builder<B>
- 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
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Finish building theSpinButton
object.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, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setReceivesDefault, setSensitive, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, setWidthRequest
Methods inherited from class org.gnome.gobject.GObject.Builder
onNotify
Methods inherited from class io.github.jwharm.javagi.gobject.Builder
addBuilderProperty, connect, connect, connectSignals, getArena, getNames, getValues
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.gnome.gtk.Accessible.Builder
setAccessibleRole
Methods inherited from interface io.github.jwharm.javagi.gobject.BuilderInterface
addBuilderProperty, connect, connect, getArena
Methods inherited from interface org.gnome.gtk.CellEditable.Builder
setEditingCanceled
Methods inherited from interface org.gnome.gtk.Editable.Builder
setEditable, setEnableUndo, setMaxWidthChars, setText, setWidthChars, setXalign
Methods inherited from interface org.gnome.gtk.Orientable.Builder
setOrientation
-
Constructor Details
-
Builder
protected Builder()Default constructor for aBuilder
object.
-
-
Method Details
-
build
Finish building theSpinButton
object. 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:
build
in classWidget.Builder<B extends SpinButton.Builder<B>>
- Returns:
- a new instance of
SpinButton
with 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::activate
for what counts as activation.- Parameters:
activatesDefault
- the value for theactivates-default
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setAdjustment
The adjustment that holds the value of the spin button.- Parameters:
adjustment
- the value for theadjustment
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setClimbRate
The acceleration rate when you hold down a button or key.- Parameters:
climbRate
- the value for theclimb-rate
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setDigits
The number of decimal places to display.- Parameters:
digits
- the value for thedigits
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setNumeric
Whether non-numeric characters should be ignored.- Parameters:
numeric
- the value for thenumeric
property- Returns:
- the
Builder
instance 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-ticks
property- Returns:
- the
Builder
instance 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-policy
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setValue
The current value.- Parameters:
value
- the value for thevalue
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
setWrap
Whether a spin button should wrap upon reaching its limits.- Parameters:
wrap
- the value for thewrap
property- Returns:
- the
Builder
instance is returned, to allow method chaining
-
onActivate
Emitted when the spin button is activated.The keybindings for this signal are all forms of the
Enter
key.If the
Enter
key results in the value being committed to the spin button, then activation does not occur untilEnter
is pressed again.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance is returned, to allow method chaining - 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
Builder
instance 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 setnewValue
to the new value.The default conversion uses g_strtod().
- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance 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
Builder
instance is returned, to allow method chaining - See Also:
-
onValueChanged
Emitted when the value is changed.Also see the
Gtk.SpinButton::output
signal.- Parameters:
handler
- the signal handler- Returns:
- the
Builder
instance 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
Builder
instance is returned, to allow method chaining - See Also:
-