public class UIScrollBar extends UIComponent<UIScrollBar> implements IControlComponent
| Modifier and Type | Class and Description |
|---|---|
static class |
UIScrollBar.Type |
ITransformable.Alpha, ITransformable.Brightness, ITransformable.Color, ITransformable.Position<T>, ITransformable.Rotate, ITransformable.Scale, ITransformable.Size<T>, ITransformable.Translate| Modifier and Type | Field and Description |
|---|---|
boolean |
autoHide |
protected int |
offsetX
The X offset for the scrollbar rendering.
|
protected int |
offsetY
The Y offset for the scrollbar rendering.
|
protected int |
scrollHeight
The scroll height (Height for vertical, width for horizontal).
|
protected GuiShape |
scrollShape |
protected int |
scrollThickness
The scroll thickness (Width for vertical, height for horizontal).
|
protected UIScrollBar.Type |
type
The type of scrollbar.
|
| Constructor and Description |
|---|
UIScrollBar(MalisisGui gui,
T parent,
UIScrollBar.Type type) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
createShape(MalisisGui gui)
Creates the shapes for this
UIScrollBar. |
void |
drawBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called first when drawing this
UIComponent. |
void |
drawForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called last when drawing this
UIComponent. |
int |
getHeight()
Gets the height of this
UIComponent. |
int |
getLength()
Gets the length of this
UIScrollBar (width if UIScrollBar.Type.HORIZONTAL, height if UIScrollBar.Type.VERTICAL. |
float |
getOffset()
Gets the offset of the parent component of this
UIScrollBar. |
java.lang.String |
getPropertyString()
Gets the property string.
|
protected IScrollable |
getScrollable()
Gets the parent as a
IScrollable. |
static UIScrollBar |
getScrollbar(UIComponent<?> component,
UIScrollBar.Type type)
Gets the
UIScrollBar for the UIComponent, if any. |
int |
getWidth()
Gets the width of this
UIComponent. |
int |
getZIndex()
Gets the zIndex of this
UIComponent. |
boolean |
hasVisibleOtherScrollbar()
Checks if the other type of scrollbar is present and visible.
|
boolean |
isHorizontal()
Checks if this
UIScrollBar is UIScrollBar.Type.HORIZONTAL. |
boolean |
onButtonPress(int x,
int y,
MouseButton button)
On button press.
|
boolean |
onClick(int x,
int y)
On click.
|
void |
onContentUpdate(ContentUpdateEvent<UIScrollBar> event) |
boolean |
onDrag(int lastX,
int lastY,
int x,
int y,
MouseButton button)
On drag.
|
boolean |
onKeyTyped(char keyChar,
int keyCode)
Called when a key is typed inside
MalisisGui. |
boolean |
onScrollWheel(int x,
int y,
int delta)
On scroll wheel.
|
void |
scrollBy(float amount)
Scroll this
UIScrollBar by the specified amount. |
void |
scrollTo(float offset)
Scroll this
UIScrollBar to the specified offset. |
UIScrollBar |
setAutoHide(boolean autoHide)
Sets whether this
UIScrollBar should automatically hide when scrolling is not possible (content size is inferior to component
size). |
UIScrollBar |
setOffset(int x,
int y)
Sets the position offset for this
UIScrollBar. |
protected void |
setPosition()
Sets the scrollbar position.
|
void |
setScrollSize(int thickness,
int height)
Sets the scroll size.
|
void |
updateScrollbar()
Update this
UIScrollBar, hiding and disabling it if necessary, based on content size. |
addControlComponent, attachData, componentX, componentY, draw, fireEvent, getAlpha, getAnchor, getComponentAt, getData, getGui, getIconProvider, getName, getParent, getRawHeight, getRawWidth, getRenderer, getTooltip, getX, getY, isDisabled, isFocused, isHovered, isInsideBounds, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, onButtonRelease, onDoubleClick, onMouseMove, onRightClick, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, self, setAlpha, setAnchor, setDisabled, setFocused, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdraw, getComponentAt, getParent, setParentprotected int scrollThickness
protected int scrollHeight
protected int offsetX
protected int offsetY
protected UIScrollBar.Type type
public boolean autoHide
protected GuiShape scrollShape
public UIScrollBar(MalisisGui gui, T parent, UIScrollBar.Type type)
public void setScrollSize(int thickness,
int height)
thickness - the thicknessheight - the heightprotected void setPosition()
protected void createShape(MalisisGui gui)
UIScrollBar.gui - the guiprotected IScrollable getScrollable()
IScrollable.public boolean hasVisibleOtherScrollbar()
public boolean isHorizontal()
UIScrollBar is UIScrollBar.Type.HORIZONTAL.public UIScrollBar setAutoHide(boolean autoHide)
UIScrollBar should automatically hide when scrolling is not possible (content size is inferior to component
size).autoHide - the auto hideUIScrollBarpublic int getZIndex()
UIComponentUIComponent.getZIndex in class UIComponent<UIScrollBar>public int getWidth()
UIComponentUIComponent.getWidth in class UIComponent<UIScrollBar>public int getHeight()
UIComponentUIComponent.getHeight in class UIComponent<UIScrollBar>public int getLength()
UIScrollBar (width if UIScrollBar.Type.HORIZONTAL, height if UIScrollBar.Type.VERTICAL.public float getOffset()
UIScrollBar.public UIScrollBar setOffset(int x, int y)
UIScrollBar.x - the xy - the ypublic void scrollTo(float offset)
UIScrollBar to the specified offset.offset - the offsetpublic void scrollBy(float amount)
UIScrollBar by the specified amount.amount - the amountpublic void updateScrollbar()
UIScrollBar, hiding and disabling it if necessary, based on content size.public void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawBackground in class UIComponent<UIScrollBar>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawForeground in class UIComponent<UIScrollBar>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void onContentUpdate(ContentUpdateEvent<UIScrollBar> event)
public boolean onButtonPress(int x,
int y,
MouseButton button)
UIComponentonButtonPress in class UIComponent<UIScrollBar>x - the xy - the ybutton - the buttonpublic boolean onClick(int x,
int y)
UIComponentonClick in class UIComponent<UIScrollBar>x - the xy - the ypublic boolean onDrag(int lastX,
int lastY,
int x,
int y,
MouseButton button)
UIComponentonDrag in class UIComponent<UIScrollBar>lastX - the last xlastY - the last yx - the xy - the ybutton - the buttonpublic boolean onScrollWheel(int x,
int y,
int delta)
UIComponentonScrollWheel in interface IControlComponentonScrollWheel in class UIComponent<UIScrollBar>x - the xy - the ydelta - the deltapublic boolean onKeyTyped(char keyChar,
int keyCode)
IKeyListenerMalisisGui.onKeyTyped in interface IControlComponentonKeyTyped in interface IKeyListeneronKeyTyped in class UIComponent<UIScrollBar>keyChar - the key charkeyCode - the key codepublic java.lang.String getPropertyString()
UIComponentgetPropertyString in class UIComponent<UIScrollBar>public static UIScrollBar getScrollbar(UIComponent<?> component, UIScrollBar.Type type)
UIScrollBar for the UIComponent, if any.component - the componenttype - the type