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
Modifier and TypeFieldDescriptionstatic final Identifier
static final Identifier
static final int
static final int
Fields inherited from class io.github.cottonmc.cotton.gui.widget.WAbstractSlider
axis, coordToValueRatio, direction, dragging, max, min, value, valueToCoordRatio
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected int
Returns the thumb size along the slider axis.protected boolean
isMouseInsideBounds
(int x, int y) Checks if the mouse cursor is close enough to the slider that the user can start dragging.void
paint
(DrawContext context, int x, int y, int mouseX, int mouseY) Paints this widget.void
setBackgroundPainter
(@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, updateValueCoordRatios
Methods 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:WAbstractSlider
Returns the thumb size along the slider axis.- Specified by:
getThumbWidth
in classWAbstractSlider
- Returns:
- the thumb size along the slider axis
-
isMouseInsideBounds
protected boolean isMouseInsideBounds(int x, int y) Description copied from class:WAbstractSlider
Checks if the mouse cursor is close enough to the slider that the user can start dragging.- Specified by:
isMouseInsideBounds
in classWAbstractSlider
- Parameters:
x
- the mouse x positiony
- the mouse y position- Returns:
- if the cursor is inside dragging bounds
-
paint
Description copied from class:WWidget
Paints this widget. -
getBackgroundPainter
-
setBackgroundPainter
@Environment(CLIENT) public void setBackgroundPainter(@Nullable @Nullable BackgroundPainter backgroundPainter)
-