Class PaddedLayout
java.lang.Object
com.blackrook.gui.layout.PaddedLayout
- All Implemented Interfaces:
GUILayout
A layout for GUIObjects that resizes its children to its parent,
with padded space around its edges, defined in screen units. If
the units are a value less than one, it is treated as a percentage
of the associated axis's width (or height).
- Author:
- Matthew Tropiano
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatPadding on the bottom, in units.protected floatPadding on the left, in units.protected floatPadding on the right, in units.protected floatPadding on the top, in units. -
Constructor Summary
ConstructorsConstructorDescriptionPaddedLayout(float units) Creates a new PaddedLayout with every edge having the same padding.PaddedLayout(float vertical, float horizontal) Creates a new PaddedLayout with the opposing edges having the same padding.PaddedLayout(float top, float horizontal, float bottom) Creates a new PaddedLayout with the opposing horzontal edges having the same padding and the vertical edges different.PaddedLayout(float top, float right, float bottom, float left) Creates a new PaddedLayout with every edge having the same padding. -
Method Summary
Modifier and TypeMethodDescriptionvoidresizeChild(GUIObject object, int index, int childTotal) Called when a child object needs resizing.
-
Field Details
-
paddingTop
protected float paddingTopPadding on the top, in units. -
paddingRight
protected float paddingRightPadding on the right, in units. -
paddingBottom
protected float paddingBottomPadding on the bottom, in units. -
paddingLeft
protected float paddingLeftPadding on the left, in units.
-
-
Constructor Details
-
PaddedLayout
public PaddedLayout(float units) Creates a new PaddedLayout with every edge having the same padding.- Parameters:
units- the padding in units for all edges.
-
PaddedLayout
public PaddedLayout(float vertical, float horizontal) Creates a new PaddedLayout with the opposing edges having the same padding.- Parameters:
vertical- the padding in units for the top and bottom.horizontal- the padding in units for the left and right.
-
PaddedLayout
public PaddedLayout(float top, float horizontal, float bottom) Creates a new PaddedLayout with the opposing horzontal edges having the same padding and the vertical edges different.- Parameters:
top- the padding in units for the top.horizontal- the padding in units for the left and right.bottom- the padding in units for the bottom.
-
PaddedLayout
public PaddedLayout(float top, float right, float bottom, float left) Creates a new PaddedLayout with every edge having the same padding.- Parameters:
top- the padding in units for the top.right- the padding in units for the right.bottom- the padding in units for the bottom.left- the padding in units for the left.
-
-
Method Details
-
resizeChild
Description copied from interface:GUILayoutCalled when a child object needs resizing. DO NOT RESIZE THE PARENT OBJECT IN THIS METHOD, AS IT MAY CAUSE AN INFINITE LOOP TO OCCUR.- Specified by:
resizeChildin interfaceGUILayout- Parameters:
object- the object to resize.index- the child index while traversing through the list of children.childTotal- the total number of children.
-