Class UILayout
java.lang.Object
io.github.thecsdev.tcdcommons.api.client.gui.layout.UILayout
- Direct Known Subclasses:
UIAutomaticSize
,UIHorizontalGridLayout
,UIListLayout
,UITableLayout
An
Object
used to enforce certain
"children layout rules" within a TParentElement
.-
Field Summary
Modifier and TypeFieldDescriptionprotected int
Default "parent scroll padding" returned bygetElementScrollPadding(TParentElement)
when theTParentElement
is not aTPanelElement
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
apply
(TParentElement parent) Applies thisUILayout
to a givenTParentElement
.final int
SeedefaultPsp
for more info.protected int
If theTParentElement
is aTPanelElement
, returnsTPanelElement.getScrollPadding()
, anddefaultPsp
otherwise.static final void
initLines
(TPanelElement panel, int color, net.minecraft.text.Text... texts) Adds aMultilineText
to aTPanelElement
.static final void
initWrappedLines
(TPanelElement panel, net.minecraft.text.Text textToWrap, int color) Wraps aText
into lines, and then adds the lines to theTPanelElement
.static final int
nextChildBottomY
(TParentElement parent) Similar toTConfigPanelBuilder.nextPanelBottomY(TPanelElement)
, returns the next "free" global Y coordinate at which a child can be placed without any obstructions from other child elements.static final int
nextChildBottomY
(TParentElement parent, int defaultScrollPadding) Same asnextChildBottomY(TParentElement)
, except it also allows you to define a "padding" for the parent element.static final Rectangle
nextChildVerticalRect
(TParentElement parent) Similar toTConfigPanelBuilder.nextPanelVerticalRect(TPanelElement)
, returns the next "free / unoccupied" space on the global Y coordinate for the next childTParentElement
to be placed at.static final Rectangle
nextChildVerticalRect
(TParentElement parent, int defaultScrollPadding) Same asnextChildVerticalRect(TParentElement)
, except it also allows you to define a "padding" for the parent element.final void
setDefaultPSP
(int defaultPsp)
-
Field Details
-
defaultPsp
protected int defaultPspDefault "parent scroll padding" returned bygetElementScrollPadding(TParentElement)
when theTParentElement
is not aTPanelElement
.
-
-
Constructor Details
-
UILayout
public UILayout()
-
-
Method Details
-
getDefaultPSP
public final int getDefaultPSP()SeedefaultPsp
for more info. -
setDefaultPSP
public final void setDefaultPSP(int defaultPsp) -
getElementScrollPadding
If theTParentElement
is aTPanelElement
, returnsTPanelElement.getScrollPadding()
, anddefaultPsp
otherwise.- Parameters:
parent
- TheTParentElement
being checked.
-
apply
Applies thisUILayout
to a givenTParentElement
. -
nextChildBottomY
Similar toTConfigPanelBuilder.nextPanelBottomY(TPanelElement)
, returns the next "free" global Y coordinate at which a child can be placed without any obstructions from other child elements.- Parameters:
parent
- TheTParentElement
to check.- Throws:
NullPointerException
- If theTParentElement
isnull
.
-
nextChildBottomY
public static final int nextChildBottomY(TParentElement parent, int defaultScrollPadding) throws NullPointerException Same asnextChildBottomY(TParentElement)
, except it also allows you to define a "padding" for the parent element.- Parameters:
parent
- TheTParentElement
to check.defaultScrollPadding
- Behaves likeTPanelElement.getScrollPadding()
. Will get overridden byTPanelElement.getScrollPadding()
if present.- Throws:
NullPointerException
- If theTParentElement
isnull
.- See Also:
-
nextChildVerticalRect
public static final Rectangle nextChildVerticalRect(TParentElement parent) throws NullPointerException Similar toTConfigPanelBuilder.nextPanelVerticalRect(TPanelElement)
, returns the next "free / unoccupied" space on the global Y coordinate for the next childTParentElement
to be placed at.- Parameters:
parent
- TheTParentElement
to check.- Throws:
NullPointerException
- If theTParentElement
isnull
.
-
nextChildVerticalRect
public static final Rectangle nextChildVerticalRect(TParentElement parent, int defaultScrollPadding) throws NullPointerException Same asnextChildVerticalRect(TParentElement)
, except it also allows you to define a "padding" for the parent element.- Parameters:
parent
- TheTParentElement
to check.defaultScrollPadding
- Behaves likeTPanelElement.getScrollPadding()
. Will get overridden byTPanelElement.getScrollPadding()
if present.- Throws:
NullPointerException
- If theTParentElement
isnull
.- See Also:
-
initLines
@Experimental public static final void initLines(TPanelElement panel, int color, net.minecraft.text.Text... texts) Adds aMultilineText
to aTPanelElement
.- Parameters:
panel
- TheTPanelElement
onto which to add theMultilineText
to.color
- The text color.texts
- TheText
s to turn into aMultilineText
.
-
initWrappedLines
public static final void initWrappedLines(TPanelElement panel, net.minecraft.text.Text textToWrap, int color) Wraps aText
into lines, and then adds the lines to theTPanelElement
.- Parameters:
panel
- TheTPanelElement
onto which the wrapped text will be added.textToWrap
- TheText
to wrap into lines.color
- TheText
color.
-