public abstract class UIListContainer<T extends UIListContainer<T,S>,S> extends UIComponent<T> implements IScrollable, IClipable
| Modifier and Type | Class and Description |
|---|---|
static class |
UIListContainer.SelectEvent<T extends UIListContainer<T,S>,S>
Event fired when a
UIListContainer changes its selected element. |
ITransformable.Alpha, ITransformable.Brightness, ITransformable.Color, ITransformable.Position<T>, ITransformable.Rotate, ITransformable.Scale, ITransformable.Size<T>, ITransformable.Translate| Modifier and Type | Field and Description |
|---|---|
protected java.util.Collection<S> |
elements |
protected int |
elementSpacing |
protected int |
lastSize |
protected UIScrollBar |
scrollbar
Vertical Scrollbar.
|
protected S |
selected |
protected boolean |
unselect |
protected int |
yOffset
Y Offset for the contents of this
UIListContainer. |
| Constructor and Description |
|---|
UIListContainer(MalisisGui gui) |
UIListContainer(MalisisGui gui,
int width,
int height) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canUnselect() |
void |
draw(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Draws this
UIComponent Called by UIComponent.parent component. |
void |
drawBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called first when drawing this
UIComponent. |
abstract void |
drawElementBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick,
S element,
boolean isHovered) |
abstract void |
drawElementForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick,
S element,
boolean isHovered) |
void |
drawElements(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick) |
void |
drawEmpty(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick) |
void |
drawForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Called last when drawing this
UIComponent. |
ClipArea |
getClipArea()
Gets the
ClipArea. |
int |
getContentHeight()
Gets the height of the scrollable content.
|
int |
getContentWidth()
Gets the width of the scrollable content.
|
S |
getElementAt(int x,
int y) |
abstract int |
getElementHeight(S element) |
java.lang.Iterable<S> |
getElements() |
int |
getHorizontalPadding()
Gets the horizontal padding.
|
float |
getOffsetX()
Gets the offset from 0 to 1 of the scrollable content.
|
float |
getOffsetY()
Gets the offset from 0 to 1 of the scrollable content.
|
float |
getScrollStep()
Gets the amount of scrolling from 0 to 1, done by one step of the scroll wheel.
|
S |
getSelected() |
int |
getVerticalPadding()
Gets the vertical padding.
|
boolean |
isSelected(S element) |
boolean |
onClick(int x,
int y)
On click.
|
S |
select(S element) |
void |
setClipContent(boolean clipContent)
Sets whether this
UIContainer should clip its contents |
void |
setElements(java.util.Collection<S> elements) |
void |
setElementSpacing(int elementSpacing) |
void |
setOffsetX(float offsetX,
int delta)
Sets the offset from 0 to 1 of the scrollable content.
|
void |
setOffsetY(float offsetY,
int delta)
Sets the offset from 0 to 1 of the scrollable content.
|
void |
setSelected(S comp) |
T |
setSize(int width,
int height)
Sets the size of this
UIComponent. |
void |
setUnselect(boolean unselect) |
boolean |
shouldClipContent()
Checks whether this
UIContainer should clip its contents |
addControlComponent, attachData, componentX, componentY, fireEvent, getAlpha, getAnchor, getComponentAt, getData, getGui, getHeight, getIconProvider, getName, getParent, getPropertyString, getRawHeight, getRawWidth, getRenderer, getTooltip, getWidth, getX, getY, getZIndex, isDisabled, isFocused, isHovered, isInsideBounds, isRelativeHeight, isRelativeWidth, isVisible, onAddedToScreen, onButtonPress, onButtonRelease, onDoubleClick, onDrag, onKeyTyped, onMouseMove, onRightClick, onScrollWheel, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, self, setAlpha, setAnchor, setDisabled, setFocused, setHovered, setName, setParent, setPosition, setPosition, setTooltip, setTooltip, setVisible, setZIndex, toString, unregisterprotected int elementSpacing
protected boolean unselect
protected java.util.Collection<S> elements
protected S selected
protected int lastSize
protected UIScrollBar scrollbar
protected int yOffset
UIListContainer.public UIListContainer(MalisisGui gui)
public UIListContainer(MalisisGui gui, int width, int height)
public T setSize(int width, int height)
UIComponentUIComponent.setSize in interface ITransformable.Size<T extends UIListContainer<T,S>>setSize in class UIComponent<T extends UIListContainer<T,S>>width - the widthheight - the heightUIComponentpublic void setElements(java.util.Collection<S> elements)
public java.lang.Iterable<S> getElements()
public void setElementSpacing(int elementSpacing)
public boolean canUnselect()
public void setUnselect(boolean unselect)
public void setSelected(S comp)
public S getSelected()
public boolean isSelected(S element)
public ClipArea getClipArea()
ClipArea.getClipArea in interface IClipablepublic void setClipContent(boolean clipContent)
UIContainer should clip its contentssetClipContent in interface IClipableclipContent - if true, clip contentspublic boolean shouldClipContent()
UIContainer should clip its contentsshouldClipContent in interface IClipablepublic int getContentWidth()
IScrollablegetContentWidth in interface IScrollablepublic int getContentHeight()
IScrollablegetContentHeight in interface IScrollablepublic float getOffsetX()
IScrollableUIScrollBar.Type.HORIZONTAL scrollbars.getOffsetX in interface IScrollablepublic void setOffsetX(float offsetX,
int delta)
IScrollableUIScrollBar.Type.HORIZONTAL scrollbars.UIScrollBar.Type.VERTICAL scrollbar if available.setOffsetX in interface IScrollableoffsetX - the offset xdelta - the deltapublic float getOffsetY()
IScrollableUIScrollBar.Type.VERTICAL scrollbars.getOffsetY in interface IScrollablepublic void setOffsetY(float offsetY,
int delta)
IScrollableUIScrollBar.Type.VERTICAL scrollbars.UIScrollBar.Type.HORIZONTAL scrollbar if available.setOffsetY in interface IScrollableoffsetY - the offset ydelta - the deltapublic float getScrollStep()
IScrollablegetScrollStep in interface IScrollablepublic int getHorizontalPadding()
getHorizontalPadding in interface IScrollableUIContainer.public int getVerticalPadding()
getVerticalPadding in interface IScrollableUIContainer.public S getElementAt(int x, int y)
public boolean onClick(int x,
int y)
UIComponentonClick in class UIComponent<T extends UIListContainer<T,S>>x - the xy - the ypublic void draw(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent Called by UIComponent.parent component.UIComponent.shape according to the size of this UIComponentdraw in class UIComponent<T extends UIListContainer<T,S>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponentUIComponent.drawBackground in class UIComponent<T extends UIListContainer<T,S>>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<T extends UIListContainer<T,S>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void drawElements(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
public void drawEmpty(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
public abstract int getElementHeight(S element)
public abstract void drawElementBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick, S element, boolean isHovered)
public abstract void drawElementForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick, S element, boolean isHovered)