public abstract class UIListContainer<T extends UIListContainer,S> extends UIComponent<T>
Modifier and Type | Class and Description |
---|---|
static class |
UIListContainer.SelectEvent<T>
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 S |
current |
protected java.util.Collection<S> |
elements |
protected int |
elementSpacing |
protected S |
hovered |
protected S |
selected |
protected boolean |
unselect |
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. |
abstract void |
drawEmtpy(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick) |
UIComponent |
getComponentAt(int x,
int y)
Gets the
UIComponent at the specified coordinates. |
abstract int |
getElementHeight(S element) |
java.lang.Iterable<S> |
getElements() |
S |
getSelected() |
boolean |
isSelected(S element) |
boolean |
onClick(int x,
int y) |
S |
select(S element) |
void |
setElements(java.util.Collection<S> elements) |
void |
setElementSpacing(int elementSpacing) |
void |
setSelected(S comp) |
void |
setUnselect(boolean unselect) |
addControlComponent, componentX, componentY, drawBackground, drawForeground, fireEvent, getAlpha, getAnchor, getGui, getHeight, getName, getParent, getPropertyString, getRawHeight, getRawWidth, 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, setAlpha, setAnchor, setDisabled, setFocused, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setVisible, setZIndex, toString, unregister
protected int elementSpacing
protected boolean unselect
protected java.util.Collection<S> elements
protected S hovered
protected S selected
protected S current
public UIListContainer(MalisisGui gui)
public UIListContainer(MalisisGui gui, int width, int height)
public 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 UIComponent getComponentAt(int x, int y)
UIComponent
UIComponent
at the specified coordinates.IControlComponent
if any. Checks if inside bounds, visible and not disabled.getComponentAt
in class UIComponent<T extends UIListContainer>
x
- the xy
- the yUIComponent
or null if outside its bounds.public boolean onClick(int x, int y)
onClick
in class UIComponent<T extends UIListContainer>
public void draw(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
UIComponent
UIComponent
Called by UIComponent.parent
component.UIComponent.shape
according to the size of this UIComponent
draw
in class UIComponent<T extends UIListContainer>
renderer
- the renderermouseX
- the mouse xmouseY
- the mouse ypartialTick
- the partial tickpublic abstract int getElementHeight(S element)
public abstract void drawEmtpy(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)