Class TSliderWidget
java.lang.Object
com.thecsdev.common.scene.Node<TElement>
com.thecsdev.commonmc.api.client.gui.TElement
com.thecsdev.commonmc.api.client.gui.widget.TClickableWidget
com.thecsdev.commonmc.api.client.gui.widget.TButtonWidget
com.thecsdev.commonmc.api.client.gui.widget.TSliderWidget
- All Implemented Interfaces:
INode<TElement>, INodeBounded<TElement,Bounds2i>, INodeRenderable<TElement, TGuiGraphics>, Iterable<TElement>, Collection<TElement>
- Direct Known Subclasses:
TScrollBarWidget, TSliderWidget.Flat
A GUI slider that lets a user select a value by moving a handle along a track.
It's often used when a precise numerical input isn't required and a visual
representation of the value range is helpful.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTSliderWidgetwhose visual appearance is more flat and does not use the vanilla button texture.Nested classes/interfaces inherited from class TButtonWidget
TButtonWidget.Paintable, TButtonWidget.Transparent -
Field Summary
Fields inherited from class TButtonWidget
LBL_PAD_X, LBL_PAD_YFields inherited from class TClickableWidget
eClicked, ONCLICK_SOUNDFields inherited from class TElement
eInitialized -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleaninputCallback(TInputContext.InputDiscoveryPhase phase, @NotNull TInputContext context) A callback method that is invoked when the user makes an input.final NotNullProperty<UDim2> TheNotNullPropertyholding the XY size of the know, in0 to 1number range.voidpostRenderCallback(@NotNull TGuiGraphics pencil) Callback method that is invoked after thisNodeand all of their children have been rendered.protected final voidvoidrenderBackground(@NotNull TGuiGraphics pencil) Renders the background of thisTSliderWidget.final voidrenderCallback(@NotNull TGuiGraphics pencil) Callback method that is invoked when thisNodeis being rendered.voidrenderKnob(@NotNull TGuiGraphics pencil, @NotNull Bounds2i kbb) Renders the knob of thisTSliderWidget.final NotNullProperty<Point2d> TheNotNullPropertyholding the value of thisTSliderWidget.Methods inherited from class TButtonWidget
getLabel, initCallbackMethods inherited from class TClickableWidget
click, clickCallback, dragEndCallback, dragStartCallback, enabledProperty, focusLostCallback, getCursor, hoverGainedCallback, isFocusable, pressedPropertyMethods inherited from class TElement
addRel, boundsProperty, clearAndInit, clipsDescendantsProperty, contextMenuProperty, findElementAt, focusableProperty, focusGainedCallback, forEachVisible, getBaseType, getBounds, getClient, getContentBounds, getSelf, getTooltip, hoverableProperty, hoverLostCallback, invalidateTooltipCache, isFocused, isHoverable, isHovered, isHoveredOrFocused, isVisible, move, moveChildren, moveTo, removeRel, screenProperty, setBounds, setBounds, setBounds, showContextMenu, tickCallback, tooltipProperty, toString, visiblePropertyMethods inherited from class Node
add, addAll, childAddedCallback, childRemovedCallback, clear, contains, containsAll, equals, findChild, findParent, findSibling, forEach, get, getFirst, getLast, getParent, hashCode, indexOf, isEmpty, iterator, parentProperty, remove, remove, remove, removeAll, retainAll, rootProperty, size, toArray, toArray
-
Constructor Details
-
TSliderWidget
-
TSliderWidget
public TSliderWidget()
-
-
Method Details
-
refreshKnobQuietly
@Internal protected final void refreshKnobQuietly()Recalculates theknobBoundsgiven the currentknobSizeProperty()andvalueProperty()values.Does not invoke change listeners for
knobBounds. This is because invoking change listeners would affect thevalue, and we do not wish to update thevaluewhile resizing the knob. -
valueProperty
TheNotNullPropertyholding the value of thisTSliderWidget. -
knobSizeProperty
TheNotNullPropertyholding the XY size of the know, in0 to 1number range. For example, a value of[0.5, 0,5]means the knob takes half the size of theTSliderWidgeton both axis.- API Note:
- Set an axis to
0to use the minimum size, of around 10 units.
-
renderCallback
Description copied from interface:INodeRenderableCallback method that is invoked when thisNodeis being rendered.- Specified by:
renderCallbackin interfaceINodeRenderable<TElement, TGuiGraphics>- Overrides:
renderCallbackin classTButtonWidget- Parameters:
pencil- The rendering context.
-
postRenderCallback
Description copied from interface:INodeRenderableCallback method that is invoked after thisNodeand all of their children have been rendered.- Specified by:
postRenderCallbackin interfaceINodeRenderable<TElement, TGuiGraphics>- Overrides:
postRenderCallbackin classTClickableWidget- Parameters:
pencil- The rendering context.
-
renderBackground
Renders the background of thisTSliderWidget. -
renderKnob
@Virtual public void renderKnob(@NotNull @NotNull TGuiGraphics pencil, @NotNull @NotNull Bounds2i kbb) Renders the knob of thisTSliderWidget. -
inputCallback
@NonExtendable public boolean inputCallback(@NotNull TInputContext.InputDiscoveryPhase phase, @NotNull @NotNull TInputContext context) A callback method that is invoked when the user makes an input.- Overrides:
inputCallbackin classTClickableWidget- Parameters:
phase- The input discovery phase.context- Information about the user's input.- Returns:
trueif thisTElementhandled the input.- API Note:
- Do not override, as this implementation uses internal variables.
-