T - type of UIContainerpublic class UIContainer<T extends UIContainer<T>> extends UIComponent<T> implements IClipable, IScrollable, ICloseable
UIContainer are the base for components holding other components.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 boolean |
clipContent
Determines whether this
UIContainer should clip its contents to its drawn area. |
protected java.util.Set<UIComponent<?>> |
components
List of
UIComponent inside this UIContainer. |
protected int |
contentHeight
Height of the contents of this
UIContainer. |
protected int |
contentWidth
Width of the contents of this
UIContainer. |
protected int |
horizontalPadding
Horizontal padding to apply to this
UIContainer. |
protected UILabel |
titleLabel
Label for the title of this
UIContainer. |
protected int |
verticalPadding
Vertical padding to apply to this
UIContainer. |
protected int |
xOffset
X Offset for the contents of this
UIContainer from 0 to 1. |
protected int |
yOffset
Y Offset for the contents of this
UIContainer from 0 to 1. |
| Constructor and Description |
|---|
UIContainer(MalisisGui gui)
Default constructor, creates the components list.
|
UIContainer(MalisisGui gui,
int width,
int height)
Instantiates a new
UIContainer. |
UIContainer(MalisisGui gui,
java.lang.String title)
Instantiates a new
UIContainer. |
UIContainer(MalisisGui gui,
java.lang.String title,
int width,
int height)
Instantiates a new
UIContainer. |
| Modifier and Type | Method and Description |
|---|---|
void |
add(UIComponent<?>... components)
Adds components to this
UIContainer. |
void |
calculateContentSize()
Calculates content size.
|
int |
componentX(UIComponent<?> component)
Gets the relative position of the specified
UIComponent inside this UIContainer. |
int |
componentY(UIComponent<?> component)
Gets the relative position of the specified
UIComponent inside this UIContainer. |
void |
drawBackground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Draws the background.
|
void |
drawForeground(GuiRenderer renderer,
int mouseX,
int mouseY,
float partialTick)
Draws the foreground.
|
ClipArea |
getClipArea()
Gets the
ClipArea. |
UIComponent<?> |
getComponent(java.lang.String name)
Gets the
UIComponent matching the specified name. |
UIComponent<?> |
getComponent(java.lang.String name,
boolean recursive)
Gets the
UIComponent matching the specified name. |
UIComponent<?> |
getComponentAt(int x,
int y)
Gets the
UIComponent at the specified coordinates. |
int |
getContentHeight()
Gets the height of the scrollable content.
|
int |
getContentWidth()
Gets the width of the scrollable content.
|
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.
|
java.lang.String |
getTitle()
Gets the title.
|
int |
getVerticalPadding()
Gets the vertical padding.
|
void |
onAddedToScreen()
Called when this
UIComponent is added to screen. |
void |
onClose() |
void |
onComponentSpaceChange(SpaceChangeEvent<T> event)
Called when a child
UIComponent gets its size or position changed |
void |
onComponentStateChange(StateChangeEvent.VisibleStateChange<T> event)
Called when a child
UIComponent gets its visibility changed |
void |
onContentUpdate()
Called when this
UIComponent gets its content updated. |
void |
remove(UIComponent<?> component)
Removes the component from this
UIContainer. |
void |
removeAll()
Removes all the components from this
UIContainer. |
void |
setClipContent(boolean clipContent)
Sets whether this
UIContainer should clip its contents |
T |
setDisabled(boolean disabled)
Sets the disabled.
|
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 |
setPadding(int horizontal,
int vertical)
Set the padding for this
UIContainer. |
T |
setTitle(java.lang.String title)
Sets the title for
UIContainer. |
T |
setVisible(boolean visible)
Sets the visible.
|
boolean |
shouldClipContent()
Checks whether this
UIContainer should clip its contents |
addControlComponent, attachData, draw, fireEvent, getAlpha, getAnchor, getData, getGui, getHeight, getIconProvider, getName, getParent, getPropertyString, getRawHeight, getRawWidth, getRenderer, getTooltip, getWidth, getX, getY, getZIndex, isDisabled, isFocused, isHovered, isInsideBounds, isRelativeHeight, isRelativeWidth, isVisible, onButtonPress, onButtonRelease, onClick, onDoubleClick, onDrag, onKeyTyped, onMouseMove, onRightClick, onScrollWheel, parentX, parentY, register, relativeX, relativeY, removeAllControlComponents, removeControlComponent, screenX, screenY, self, setAlpha, setAnchor, setFocused, setHovered, setName, setParent, setPosition, setPosition, setSize, setTooltip, setTooltip, setZIndex, toString, unregisterprotected final java.util.Set<UIComponent<?>> components
UIComponent inside this UIContainer.protected int horizontalPadding
UIContainer.protected int verticalPadding
UIContainer.protected UILabel titleLabel
UIContainer.protected boolean clipContent
UIContainer should clip its contents to its drawn area.protected int contentWidth
UIContainer.protected int contentHeight
UIContainer.protected int xOffset
UIContainer from 0 to 1.protected int yOffset
UIContainer from 0 to 1.public UIContainer(MalisisGui gui)
gui - the guipublic UIContainer(MalisisGui gui, java.lang.String title)
UIContainer.gui - the guititle - the titlepublic UIContainer(MalisisGui gui, int width, int height)
UIContainer.gui - the guiwidth - the widthheight - the heightpublic UIContainer(MalisisGui gui, java.lang.String title, int width, int height)
UIContainer.gui - the guititle - the titlewidth - the widthheight - the heightpublic T setVisible(boolean visible)
setVisible in class UIComponent<T extends UIContainer<T>>visible - the visiblepublic T setDisabled(boolean disabled)
setDisabled in class UIComponent<T extends UIContainer<T>>disabled - the disabledpublic void setPadding(int horizontal,
int vertical)
UIContainer.horizontal - the horizontalvertical - the verticalpublic int getHorizontalPadding()
getHorizontalPadding in interface IScrollableUIContainer.public int getVerticalPadding()
getVerticalPadding in interface IScrollableUIContainer.public T setTitle(java.lang.String title)
title - the titlepublic java.lang.String getTitle()
UIContainer.public int componentX(UIComponent<?> component)
UIComponent inside this UIContainer.componentX in class UIComponent<T extends UIContainer<T>>component - the componentpublic int componentY(UIComponent<?> component)
UIComponent inside this UIContainer.componentY in class UIComponent<T extends UIContainer<T>>component - the componentpublic UIComponent<?> getComponent(java.lang.String name)
UIComponent matching the specified name.name - the namepublic UIComponent<?> getComponent(java.lang.String name, boolean recursive)
UIComponent matching the specified name. If recursive is true, looks for the UIComponent inside it child
UIContainer too.name - the namerecursive - if true, look inside child UIContainerpublic UIComponent<?> getComponentAt(int x, int y)
UIComponent at the specified coordinates.getComponentAt in class UIComponent<T extends UIContainer<T>>x - the xy - the yUIContainer, this UIContainer if none, or null if outside its bounds.public void onContentUpdate()
UIComponent gets its content updated.public void calculateContentSize()
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 void add(UIComponent<?>... components)
UIContainer.components - the componentspublic void remove(UIComponent<?> component)
UIContainer.component - the componentpublic void removeAll()
UIContainer. Does not remove control componentspublic void onAddedToScreen()
UIComponentUIComponent is added to screen.SpaceChangeEvent.SizeChangeEvent if this component size is relative.onAddedToScreen in class UIComponent<T extends UIContainer<T>>public void onClose()
onClose in interface ICloseablepublic void drawBackground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
drawBackground in class UIComponent<T extends UIContainer<T>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void drawForeground(GuiRenderer renderer, int mouseX, int mouseY, float partialTick)
drawForeground in class UIComponent<T extends UIContainer<T>>renderer - the renderermouseX - the mouse xmouseY - the mouse ypartialTick - the partial tickpublic void onComponentStateChange(StateChangeEvent.VisibleStateChange<T> event)
UIComponent gets its visibility changedevent - the eventpublic void onComponentSpaceChange(SpaceChangeEvent<T> event)
UIComponent gets its size or position changedevent - the event