public interface IGuiElement extends ICroppable
The interface the most gui elements of forestry implement. You must place the element a containment hierarchy whose
root is a top-level IWindowElement.
| Modifier and Type | Method and Description |
|---|---|
default <E extends GuiElementEvent> |
addEventHandler(java.lang.Class<? super E> eventClass,
java.util.function.Consumer<E> eventHandler)
Adds an event handler that handles events that this element receives with
receiveEvent(GuiElementEvent). |
default <E extends GuiElementEvent> |
addEventHandler(java.lang.Class<? super E> eventClass,
GuiEventOrigin origin,
IGuiElement relative,
java.util.function.Consumer<E> eventHandler)
Adds an event handler that handles events that this element receives with
receiveEvent(GuiElementEvent). |
<E extends GuiElementEvent> |
addEventHandler(java.util.function.Consumer<E> eventHandler)
Adds an event handler that handles events that this element receives with
receiveEvent(GuiElementEvent). |
default <E extends GuiElementEvent> |
addSelfEventHandler(java.lang.Class<? super E> eventClass,
java.util.function.Consumer<E> eventHandler)
Adds an event handler that handles events that this element receives with
receiveEvent(GuiElementEvent). |
IGuiElement |
addTooltip(java.util.Collection<java.lang.String> lines)
Adds an additional tooltip to the current tooltip of the element.
|
IGuiElement |
addTooltip(ITooltipSupplier supplier) |
IGuiElement |
addTooltip(java.lang.String line)
Adds an additional tooltip to the current tooltip of the element.
|
default boolean |
canFocus() |
default boolean |
canMouseOver() |
void |
clearTooltip()
Clears the tooltips that were added with
addTooltip(String) and addTooltip(Collection). |
void |
draw(int mouseX,
int mouseY)
Draws the element and his children.
|
void |
drawElement(int mouseX,
int mouseY)
Draws the element itself at the current position.
|
int |
getAbsoluteX() |
int |
getAbsoluteY() |
GuiElementAlignment |
getAlign()
The alignment of the
IGuiElement defines the position of the element relative to the position of its
parent. |
int |
getHeight() |
IGuiElement |
getParent()
The position of this element is relative to the position of its parent.
|
java.util.List<java.lang.String> |
getTooltip() |
java.util.List<java.lang.String> |
getTooltip(int mouseX,
int mouseY)
Returns the tooltip that this element provides at the given mouse position.
|
int |
getWidth() |
IWindowElement |
getWindow()
The root of the containment hierarchy that this element is part of.
|
int |
getX() |
int |
getY() |
boolean |
hasTooltip() |
void |
hide()
Hides this element.
|
boolean |
isEnabled()
The most elements are enabled by default.
|
boolean |
isMouseOver() |
boolean |
isMouseOver(int mouseX,
int mouseY) |
boolean |
isVisible()
|
void |
onCreation()
Called at
IElementGroup.add(IGuiElement) after the element was added to the group and
setParent(IGuiElement) was called at the element. |
void |
onDeletion()
Called at
IElementGroup.remove(IGuiElement...) after the element was removed from the group. |
default void |
postEvent(GuiElementEvent event) |
default void |
postEvent(GuiElementEvent event,
GuiEventDestination destination)
Distributes the event to the elements that are defined by the
GuiEventDestination. |
void |
receiveEvent(GuiElementEvent event)
Receives an event and distributes them to the event handlers of this element.
|
IGuiElement |
setAlign(GuiElementAlignment align)
Sets the alignment of this element.
|
IGuiElement |
setBounds(int xPos,
int yPos,
int width,
int height)
Sets the dimensions and position of this element.
|
void |
setHeight(int height) |
IGuiElement |
setLocation(int xPos,
int yPos)
Sets the position of this element.
|
IGuiElement |
setOffset(int xOffset,
int yOffset) |
IGuiElement |
setParent(IGuiElement parent)
Sets the parent of this element.
|
IGuiElement |
setSize(int width,
int height)
Sets the dimensions of this element.
|
void |
setWidth(int width) |
void |
setXPosition(int xPos)
Sets the x position of this element relative to the position of its parent.
|
void |
setYPosition(int yPos)
Sets the y position of this element relative to the position of its parent.
|
void |
show()
Makes this element visible again.
|
void |
updateClient()
Updates the element.
|
getCropElement, getCropHeight, getCropWidth, getCropX, getCropY, isCropped, setCroppedZoneint getX()
int getY()
IGuiElement setAlign(GuiElementAlignment align)
GuiElementAlignment getAlign()
IGuiElement defines the position of the element relative to the position of its
parent.IWindowElement getWindow()
int getAbsoluteX()
int getAbsoluteY()
int getWidth()
void setWidth(int width)
int getHeight()
void setHeight(int height)
IGuiElement setSize(int width, int height)
width - the size of the element on the x-axis.height - the size of the element on the y-axis.IGuiElement setLocation(int xPos, int yPos)
xPos - the x position of this element relative to the position of its parent.yPos - the y position of this element relative to the position of its parent.IGuiElement setOffset(int xOffset, int yOffset)
IGuiElement setBounds(int xPos, int yPos, int width, int height)
xPos - the x position of this element relative to the position of its parent.yPos - the y position of this element relative to the position of its parent.width - the size of the element on the x-axis.height - the size of the element on the y-axis.void setXPosition(int xPos)
void setYPosition(int yPos)
@Nullable IGuiElement getParent()
IGuiElement setParent(@Nullable IGuiElement parent)
void onCreation()
IElementGroup.add(IGuiElement) after the element was added to the group and
setParent(IGuiElement) was called at the element.
Can be used to add other element to the element if the element is an IElementGroup.
void onDeletion()
IElementGroup.remove(IGuiElement...) after the element was removed from the group.void draw(int mouseX,
int mouseY)
mouseX - The x position of the mouse relative to the parent of the element.mouseY - The y position of the mouse relative to the parent of the element.void drawElement(int mouseX,
int mouseY)
mouseX - The x position of the mouse relative to the parent of the element.mouseY - The y position of the mouse relative to the parent of the element.boolean isMouseOver(int mouseX,
int mouseY)
mouseX - The x position of the mouse relative to the parent of the element.mouseY - The y position of the mouse relative to the parent of the element.boolean isMouseOver()
default boolean canMouseOver()
void updateClient()
GuiScreen.updateScreen().default boolean canFocus()
boolean isVisible()
void show()
void hide()
boolean isEnabled()
IGuiElement addTooltip(java.lang.String line)
IGuiElement addTooltip(java.util.Collection<java.lang.String> lines)
IGuiElement addTooltip(ITooltipSupplier supplier)
boolean hasTooltip()
void clearTooltip()
addTooltip(String) and addTooltip(Collection).
It does not remove default tooltips of an element like the fluid information of a tank or the item information
of an slot element.java.util.List<java.lang.String> getTooltip(int mouseX,
int mouseY)
mouseX - The x position of the mouse relative to the parent of the element.mouseY - The y position of the mouse relative to the parent of the element.java.util.List<java.lang.String> getTooltip()
addTooltip(String) and addTooltip(Collection).<E extends GuiElementEvent> void addEventHandler(java.util.function.Consumer<E> eventHandler)
receiveEvent(GuiElementEvent).default <E extends GuiElementEvent> void addEventHandler(java.lang.Class<? super E> eventClass, java.util.function.Consumer<E> eventHandler)
receiveEvent(GuiElementEvent).default <E extends GuiElementEvent> void addEventHandler(java.lang.Class<? super E> eventClass, GuiEventOrigin origin, IGuiElement relative, java.util.function.Consumer<E> eventHandler)
receiveEvent(GuiElementEvent).default <E extends GuiElementEvent> void addSelfEventHandler(java.lang.Class<? super E> eventClass, java.util.function.Consumer<E> eventHandler)
receiveEvent(GuiElementEvent).default void postEvent(GuiElementEvent event, GuiEventDestination destination)
GuiEventDestination.default void postEvent(GuiElementEvent event)
void receiveEvent(GuiElementEvent event)