Class ScaleButton
- All Implemented Interfaces:
Accessible, AccessibleRange, Buildable, ConstraintTarget, Orientable, Proxy
- Direct Known Subclasses:
VolumeButton
Provides a button which pops up a scale widget.
This kind of widget is commonly used for volume controls in multimedia
applications, and GTK provides a VolumeButton subclass that
is tailored for this use case.
Shortcuts and Gestures
The following signals have default keybindings:
Gtk.ScaleButton::popup
CSS nodes
scalebutton.scale
╰── button.toggle
╰── <icon>
GtkScaleButton has a single CSS node with name scalebutton and .scale
style class, and contains a button node with a .toggle style class.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classScaleButton.Builder<B extends ScaleButton.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of thePopdownCallbackcallback.static interfaceFunctional interface declaration of thePopupCallbackcallback.static classstatic interfaceFunctional interface declaration of theValueChangedCallbackcallback.Nested classes/interfaces inherited from class Widget
Widget.DestroyCallback, Widget.DirectionChangedCallback, Widget.HideCallback, Widget.KeynavFailedCallback, Widget.MapCallback, Widget.MnemonicActivateCallback, Widget.MoveFocusCallback, Widget.QueryTooltipCallback, Widget.RealizeCallback, Widget.ShowCallback, Widget.StateFlagsChangedCallback, Widget.UnmapCallback, Widget.UnrealizeCallback, Widget.Widget$Impl, Widget.WidgetClassNested classes/interfaces inherited from class InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface Accessible
Accessible.Accessible$Impl, Accessible.AccessibleInterfaceNested classes/interfaces inherited from interface AccessibleRange
AccessibleRange.AccessibleRange$Impl, AccessibleRange.AccessibleRangeInterfaceNested classes/interfaces inherited from interface Buildable
Buildable.Buildable$Impl, Buildable.BuildableIfaceNested classes/interfaces inherited from interface ConstraintTarget
ConstraintTarget.ConstraintTarget$Impl, ConstraintTarget.ConstraintTargetInterfaceNested classes/interfaces inherited from interface Orientable
Orientable.Orientable$Impl, Orientable.OrientableIface -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new ScaleButton.ScaleButton(double min, double max, double step, @Nullable String @Nullable [] icons) Creates aGtkScaleButton.ScaleButton(MemorySegment address) Create a ScaleButton instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected ScaleButtonasParent()Return this instance as if it were its parent type.static ScaleButton.Builder<? extends ScaleButton.Builder> builder()AScaleButton.Builderobject constructs aScaleButtonwith the specified properties.voidEmits the "popdown" signal.voidEmits the "popup" signal.voidemitValueChanged(double value) Emits the "value-changed" signal.booleanQueries aGtkScaleButtonand returns its current state.Gets theGtkAdjustmentassociated with theGtkScaleButton’s scale.booleanReturns whether the button has a frame.static MemoryLayoutThe memory layout of the native struct.Retrieves the minus button of theGtkScaleButton.Retrieves the plus button of theGtkScaleButton.getPopup()Retrieves the popup of theGtkScaleButton.static @Nullable TypegetType()Get the GType of the ScaleButton class.doublegetValue()Gets the current value of the scale button.onPopdown(ScaleButton.PopdownCallback handler) Emitted to dismiss the popup.onPopup(ScaleButton.PopupCallback handler) Emitted to popup the scale widget.Emitted when the value field has changed.voidsetAdjustment(Adjustment adjustment) Sets theGtkAdjustmentto be used as a model for theGtkScaleButton’s scale.voidsetHasFrame(boolean hasFrame) Sets the style of the button.voidSets the icons to be used by the scale button.voidsetValue(double value) Sets the current value of the scale.protected voidvalueChanged(double value) Methods inherited from class Widget
actionSetEnabled, activateActionIfExists, activateDefault, activateWidget, addController, addCssClass, addMnemonicLabel, addTickCallback, allocate, childFocus, computeBounds, computeExpand, computeExpand, computePoint, computeTransform, contains, createPangoContext, createPangoLayout, cssChanged, directionChanged, disposeTemplate, dragCheckThreshold, emitDestroy, emitDirectionChanged, emitHide, emitKeynavFailed, emitMap, emitMnemonicActivate, emitMoveFocus, emitQueryTooltip, emitRealize, emitShow, emitStateFlagsChanged, emitUnmap, emitUnrealize, errorBell, focus, getAllocatedBaseline, getAllocatedHeight, getAllocatedWidth, getAllocation, getAncestor, getBaseline, getCanFocus, getCanTarget, getChildVisible, getClipboard, getColor, getCssClasses, getCssName, getCursor, getDefaultDirection, getDirection, getDisplay, getFirstChild, getFocusable, getFocusChild, getFocusOnClick, getFontMap, getFontOptions, getFrameClock, getHalign, getHasTooltip, getHeight, getHexpand, getHexpandSet, getLastChild, getLayoutManager, getLimitEvents, getMapped, getMarginBottom, getMarginEnd, getMarginStart, getMarginTop, getName, getNative, getNextSibling, getOpacity, getOverflow, getPangoContext, getParent, getPreferredSize, getPrevSibling, getPrimaryClipboard, getRealized, getReceivesDefault, getRequestMode, getRoot, getScaleFactor, getSensitive, getSettings, getSize, getSizeRequest, getStateFlags, getStyleContext, getTemplateChild, getTooltipMarkup, getTooltipText, getValign, getVexpand, getVexpandSet, getVisible, getWidth, grabFocus, hasCssClass, hasDefault, hasFocus, hasVisibleFocus, hide, inDestruction, initTemplate, insertActionGroup, insertAfter, insertBefore, isAncestor, isDrawable, isFocus, isSensitive, isVisible, keynavFailed, listMnemonicLabels, map, measure, mnemonicActivate, moveFocus, observeChildren, observeControllers, onDestroy, onDirectionChanged, onHide, onKeynavFailed, onMap, onMnemonicActivate, onMoveFocus, onQueryTooltip, onRealize, onShow, onStateFlagsChanged, onUnmap, onUnrealize, pick, pick, queryTooltip, queueAllocate, queueDraw, queueResize, realize, removeController, removeCssClass, removeMnemonicLabel, removeTickCallback, root, setCanFocus, setCanTarget, setChildVisible, setCssClasses, setCursor, setCursorFromName, setDefaultDirection, setDirection, setFocusable, setFocusChild, setFocusOnClick, setFontMap, setFontOptions, setHalign, setHasTooltip, setHexpand, setHexpandSet, setLayoutManager, setLimitEvents, setMarginBottom, setMarginEnd, setMarginStart, setMarginTop, setName, setOpacity, setOverflow, setParent, setReceivesDefault, setSensitive, setSizeRequest, setStateFlags, setStateFlags, setTooltipMarkup, setTooltipText, setValign, setVexpand, setVexpandSet, setVisible, shouldLayout, show, sizeAllocate, sizeAllocate, snapshot, snapshotChild, stateFlagsChanged, systemSettingChanged, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unroot, unsetStateFlags, unsetStateFlagsMethods inherited from class 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 TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCodeMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Accessible
announce, getAccessibleId, getAccessibleParent, getAccessibleRole, getAtContext, getBounds, getFirstAccessibleChild, getNextAccessibleSibling, getPlatformState, resetProperty, resetRelation, resetState, setAccessibleParent, updateNextAccessibleSibling, updatePlatformState, updateProperty, updateRelation, updateStateMethods inherited from interface Buildable
getBuildableIdMethods inherited from interface Orientable
getOrientation, setOrientation
-
Constructor Details
-
ScaleButton
Create a ScaleButton instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
ScaleButton
Creates a
GtkScaleButton.The new scale button has a range between
minandmax,with a stepping ofstep.- Parameters:
min- the minimum value of the scale (usually 0)max- the maximum value of the scale (usually 100)step- the stepping of value when a scroll-wheel event, or up/down arrow event occurs (usually 2)icons- anull-terminated array of icon names, ornullif you want to set the list later with gtk_scale_button_set_icons()
-
ScaleButton
public ScaleButton()Create a new ScaleButton.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code. -
getActive
public boolean getActive()Queries a
GtkScaleButtonand returns its current state.Returns
trueif the scale button is pressed in andfalseif it is raised.- Returns:
- whether the button is pressed
- Since:
- 4.10
-
getAdjustment
Gets the
GtkAdjustmentassociated with theGtkScaleButton’s scale.See
Range.getAdjustment()for details.- Returns:
- the adjustment associated with the scale
-
getHasFrame
public boolean getHasFrame()Returns whether the button has a frame.- Returns:
trueif the button has a frame- Since:
- 4.14
-
getMinusButton
Retrieves the minus button of theGtkScaleButton.- Returns:
- the minus button
of the
GtkScaleButton
-
getPlusButton
Retrieves the plus button of theGtkScaleButton.- Returns:
- the plus button
of the
GtkScaleButton
-
getPopup
Retrieves the popup of theGtkScaleButton.- Returns:
- the popup of the
GtkScaleButton
-
getValue
public double getValue()Gets the current value of the scale button.- Returns:
- current value of the scale button
-
setAdjustment
Sets the
GtkAdjustmentto be used as a model for theGtkScaleButton’s scale.See
Range.setAdjustment(Adjustment)for details.- Parameters:
adjustment- aGtkAdjustment
-
setHasFrame
public void setHasFrame(boolean hasFrame) Sets the style of the button.- Parameters:
hasFrame- whether the button should have a visible frame- Since:
- 4.14
-
setIcons
Sets the icons to be used by the scale button.- Parameters:
icons- anull-terminated array of icon names
-
setValue
public void setValue(double value) Sets the current value of the scale.
If the value is outside the minimum or maximum range values, it will be clamped to fit inside them.
The scale button emits the
Gtk.ScaleButton::value-changedsignal if the value changes.- Parameters:
value- new value of the scale button
-
valueChanged
protected void valueChanged(double value) -
onPopdown
Emitted to dismiss the popup.
This is a keybinding signal.
The default binding for this signal is Escape.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitPopdown
public void emitPopdown()Emits the "popdown" signal. SeeonPopdown(ScaleButton.PopdownCallback). -
onPopup
Emitted to popup the scale widget.
This is a keybinding signal.
The default bindings for this signal are Space, Enter and Return.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitPopup
public void emitPopup()Emits the "popup" signal. SeeonPopup(ScaleButton.PopupCallback). -
onValueChanged
public SignalConnection<ScaleButton.ValueChangedCallback> onValueChanged(ScaleButton.ValueChangedCallback handler) Emitted when the value field has changed.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitValueChanged
public void emitValueChanged(double value) Emits the "value-changed" signal. SeeonValueChanged(ScaleButton.ValueChangedCallback). -
builder
AScaleButton.Builderobject constructs aScaleButtonwith the specified properties. Use the variousset...()methods to set properties, and finish construction withScaleButton.Builder.build().- Returns:
- the builder object
-