Class WSlider
java.lang.Object
io.github.cottonmc.cotton.gui.widget.WWidget
io.github.cottonmc.cotton.gui.widget.WAbstractSlider
io.github.cottonmc.cotton.gui.widget.WSlider
A simple slider widget that can be used to select int values.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.github.cottonmc.cotton.gui.widget.WAbstractSlider
WAbstractSlider.Direction -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Identifierstatic final Identifierstatic final intstatic final intFields inherited from class io.github.cottonmc.cotton.gui.widget.WAbstractSlider
axis, coordToValueRatio, direction, dragging, max, min, value, valueToCoordRatio -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected intReturns the thumb size along the slider axis.protected booleanisMouseInsideBounds(int x, int y) Checks if the mouse cursor is close enough to the slider that the user can start dragging.voidpaint(DrawContext context, int x, int y, int mouseX, int mouseY) Paints this widget.voidsetBackgroundPainter(@Nullable BackgroundPainter backgroundPainter) Methods inherited from class io.github.cottonmc.cotton.gui.widget.WAbstractSlider
addNarrations, canFocus, canResize, getAxis, getDirection, getDraggingFinishedListener, getMaxValue, getMinValue, getValue, getValueChangeListener, isDecreasingKey, isDragging, isIncreasingKey, onClick, onKeyPressed, onKeyReleased, onMouseDown, onMouseDrag, onMouseScroll, onMouseUp, onValueChanged, setDirection, setDraggingFinishedListener, setMaxValue, setMinValue, setSize, setValue, setValue, setValueChangeListener, tick, updateValueCoordRatiosMethods inherited from class io.github.cottonmc.cotton.gui.widget.WWidget
addPainters, addTooltip, canHover, getAbsoluteX, getAbsoluteY, getFocusModel, getHeight, getHost, getParent, getWidth, getX, getY, hit, hoveredProperty, isActivationKey, isFocused, isHovered, isNarratable, isWithinBounds, onCharTyped, onFocusGained, onFocusLost, onHidden, onMouseMove, onShown, releaseFocus, renderTooltip, requestFocus, setHost, setHovered, setLocation, setParent, shouldRenderInDarkMode, validate
-
Field Details
-
TRACK_WIDTH
public static final int TRACK_WIDTH- See Also:
-
THUMB_SIZE
public static final int THUMB_SIZE- See Also:
-
LIGHT_TEXTURE
-
DARK_TEXTURE
-
-
Constructor Details
-
WSlider
-
-
Method Details
-
getThumbWidth
protected int getThumbWidth()Description copied from class:WAbstractSliderReturns the thumb size along the slider axis.- Specified by:
getThumbWidthin classWAbstractSlider- Returns:
- the thumb size along the slider axis
-
isMouseInsideBounds
protected boolean isMouseInsideBounds(int x, int y) Description copied from class:WAbstractSliderChecks if the mouse cursor is close enough to the slider that the user can start dragging.- Specified by:
isMouseInsideBoundsin classWAbstractSlider- Parameters:
x- the mouse x positiony- the mouse y position- Returns:
- if the cursor is inside dragging bounds
-
paint
Description copied from class:WWidgetPaints this widget. -
getBackgroundPainter
-
setBackgroundPainter
@Environment(CLIENT) public void setBackgroundPainter(@Nullable @Nullable BackgroundPainter backgroundPainter)
-