Class TPanelElement
java.lang.Object
com.thecsdev.common.scene.Node<TElement>
com.thecsdev.commonmc.api.client.gui.TElement
com.thecsdev.commonmc.api.client.gui.panel.TPanelElement
- All Implemented Interfaces:
INode<TElement>, INodeBounded<TElement,Bounds2i>, INodeRenderable<TElement, TGuiGraphics>, Iterable<TElement>, Collection<TElement>
- Direct Known Subclasses:
TPanelElement.Paintable, TPanelElement.Transparent
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTPanelElementimplementation that allows you to customize its background and outline colors.static classTPanelElementimplementation that does not render any of its own visual, as in, has no background color or outlines. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intFields inherited from class TElement
eInitialized -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddAllVertically(@NotNull Iterable<TElement> elements, int gap) Adds all specified elements vertically with the given gap between each element.final @NotNull Bounds2icomputeNextXBounds(int width, int gap) Computes the bounds for the next element to be added horizontally, given the specified width and gap.final @NotNull Bounds2icomputeNextYBounds(int height, int gap) Computes the bounds for the next element to be added vertically, given the specified height and gap.booleaninputCallback(@NotNull TInputContext.InputDiscoveryPhase phase, @NotNull TInputContext context) A callback method that is invoked when the user makes an input.voidpostRenderCallback(@NotNull TGuiGraphics pencil) Callback method that is invoked after thisNodeand all of their children have been rendered.voidrenderCallback(@NotNull TGuiGraphics pencil) Callback method that is invoked when thisNodeis being rendered.final voidscroll(int deltaX, int deltaY) Scrolls thisTPanelElementby moving the children viaTElement.moveChildren(int, int).TheNotNullPropertyrepresenting the two-dimensional scroll amount value, with each axis ranging0 to 1.final IntegerPropertyTheIntegerPropertyholding the "padding" of thisTPanelElement.final IntegerPropertyTheIntegerPropertyfor thisTPanelElement's sensitivity of scrolling done by keyboard and mouse input.Methods inherited from class TElement
addRel, boundsProperty, clearAndInit, clipsDescendantsProperty, contextMenuProperty, dragEndCallback, dragStartCallback, findElementAt, focusableProperty, focusGainedCallback, focusLostCallback, forEachVisible, getBaseType, getBounds, getClient, getContentBounds, getCursor, getSelf, getTooltip, hoverableProperty, hoverGainedCallback, hoverLostCallback, initCallback, invalidateTooltipCache, isFocusable, isFocused, isHoverable, isHovered, isHoveredOrFocused, isVisible, move, moveChildren, moveTo, removeRel, screenProperty, setBounds, setBounds, setBounds, showContextMenu, tickCallback, tooltipProperty, toString, visiblePropertyMethods inherited from class Node
add, addAll, childAddedCallback, childRemovedCallback, clear, contains, containsAll, equals, findChild, findParent, findSibling, forEach, get, getFirst, getLast, getParent, hashCode, indexOf, isEmpty, iterator, parentProperty, remove, remove, remove, removeAll, retainAll, rootProperty, size, toArray, toArray
-
Field Details
-
COLOR_BACKGROUND
public static final int COLOR_BACKGROUND- See Also:
-
COLOR_OUTLINE
public static final int COLOR_OUTLINE- See Also:
-
COLOR_OUTLINE_FOCUSED
public static final int COLOR_OUTLINE_FOCUSED- See Also:
-
-
Constructor Details
-
TPanelElement
public TPanelElement()
-
-
Method Details
-
scrollAmountProperty
TheNotNullPropertyrepresenting the two-dimensional scroll amount value, with each axis ranging0 to 1. -
scrollPaddingProperty
TheIntegerPropertyholding the "padding" of thisTPanelElement. -
scrollSensitivityProperty
TheIntegerPropertyfor thisTPanelElement's sensitivity of scrolling done by keyboard and mouse input. -
renderCallback
Description copied from interface:INodeRenderableCallback method that is invoked when thisNodeis being rendered.- Specified by:
renderCallbackin interfaceINodeRenderable<TElement, TGuiGraphics>- Overrides:
renderCallbackin classTElement- Parameters:
pencil- The rendering context.
-
postRenderCallback
Description copied from interface:INodeRenderableCallback method that is invoked after thisNodeand all of their children have been rendered.- Specified by:
postRenderCallbackin interfaceINodeRenderable<TElement, TGuiGraphics>- Overrides:
postRenderCallbackin classTElement- Parameters:
pencil- The rendering context.
-
inputCallback
@Virtual public boolean inputCallback(@NotNull TInputContext.InputDiscoveryPhase phase, @NotNull @NotNull TInputContext context) Description copied from class:TElementA callback method that is invoked when the user makes an input.- Overrides:
inputCallbackin classTElement- Parameters:
phase- The input discovery phase.context- Information about the user's input.- Returns:
trueif thisTElementhandled the input.
-
scroll
public final void scroll(int deltaX, int deltaY) Scrolls thisTPanelElementby moving the children viaTElement.moveChildren(int, int).- Parameters:
deltaX- The X scroll amount, in in-game on-screen units.deltaY- The Y scroll amount, in in-game on-screen units.- API Note:
- Note that this method differs from
TElement.moveChildren(int, int)in that it also affects the value ofscrollAmountProperty().
-
computeNextYBounds
Computes the bounds for the next element to be added vertically, given the specified height and gap.- Parameters:
height- The height of the next element.gap- The vertical gap between the last element and the next one.- Returns:
- A
Bounds2irepresenting the position and size of the next element.
-
computeNextXBounds
Computes the bounds for the next element to be added horizontally, given the specified width and gap.- Parameters:
width- The width of the next element.gap- The horizontal gap between the last element and the next one.- Returns:
- A
Bounds2irepresenting the position and size of the next element.
-
addAllVertically
public final void addAllVertically(@NotNull @NotNull Iterable<TElement> elements, int gap) throws NullPointerException Adds all specified elements vertically with the given gap between each element. Each added element is resized horizontally to fit theTPanelElement's viewport width.- Parameters:
elements- The elements to add.gap- The vertical gap between each element.- Throws:
NullPointerException- The argument isnull.
-