Package com.avrix.ui.widgets
Class BoxLayoutWidget
java.lang.Object
com.avrix.ui.widgets.Widget
com.avrix.ui.widgets.BoxLayoutWidget
- Direct Known Subclasses:
HorizontalBoxWidget
,VerticalBoxWidget
A
Widget
that serves as a base class for layout containers like VerticalBoxWidget
and HorizontalBoxWidget
.
It provides common functionality for arranging child widgets with a specified margin between them.-
Field Summary
-
Constructor Summary
ConstructorDescriptionBoxLayoutWidget
(int x, int y, int width, int height, boolean autoresize) Constructs a newWidget
with the specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child widget to this widget's list of children.final int
Returns the margin between childWidget
s.final boolean
Returns whether theWidget
automatically resizes to fit its children.boolean
Checks if the layout is currently being updated.void
removeChild
(Widget widget) Removes a child widget from this widget's list of children.void
render()
Renders theWidget
final void
setAutoresize
(boolean autoresize) Sets whether theWidget
should automatically resize to fit its children.final void
setMargin
(int margin) Sets the margin between childWidget
s.void
setUpdatingLayout
(boolean updatingLayout) Sets the updating layout status.void
Updates the layout of theWidget
, positioning its children with the specified margin between them.Methods inherited from class com.avrix.ui.widgets.Widget
addToScreen, bringToTop, drawArc, drawArc, drawCircle, drawEllipse, drawImage, drawLine, drawRect, drawRectOutline, drawRoundedRect, drawRoundedRectOutline, drawText, getAbsoluteParent, getChildren, getHeight, getMaxScrollX, getMaxScrollY, getParent, getScrollSpeed, getScrollX, getScrollY, getWidth, getX, getXA, getY, getYA, intersectScissor, isAlwaysOnTop, isHovered, isPointOver, isScrollable, isScrollLock, isVisible, isVisibleWithinParent, isVisibleWithinWindow, onInitialize, onKeyPress, onKeyRelease, onKeyRepeat, onLeftMouseDown, onLeftMouseDownOutside, onLeftMouseUp, onLeftMouseUpOutside, onMouseEnter, onMouseExit, onMouseMove, onMouseMoveOutside, onMouseWheel, onRightMouseDown, onRightMouseDownOutside, onRightMouseUp, onRightMouseUpOutside, postRender, preRender, removeFromScreen, renderChildren, setAlwaysOnTop, setHeight, setMaxScrollX, setMaxScrollY, setScrollable, setScrollLock, setScrollSpeed, setScrollX, setScrollY, setVisible, setWidth, setX, setXA, setY, setYA, update
-
Constructor Details
-
BoxLayoutWidget
public BoxLayoutWidget(int x, int y, int width, int height, boolean autoresize) Constructs a newWidget
with the specified position and size.
-
-
Method Details
-
addChild
Adds a child widget to this widget's list of children. -
removeChild
Removes a child widget from this widget's list of children.- Overrides:
removeChild
in classWidget
- Parameters:
widget
- the widget to remove from the list of children
-
updateLayout
public void updateLayout()Updates the layout of theWidget
, positioning its children with the specified margin between them. Adjusts the size of the widget if autoresize is enabled. -
isUpdatingLayout
public boolean isUpdatingLayout()Checks if the layout is currently being updated.- Returns:
- true if the layout is being updated, false otherwise
-
setUpdatingLayout
public void setUpdatingLayout(boolean updatingLayout) Sets the updating layout status.- Parameters:
updatingLayout
- true if the layout is being updated, false otherwise
-
getMargin
public final int getMargin()Returns the margin between childWidget
s.- Returns:
- the margin between child
Widget
s
-
setMargin
public final void setMargin(int margin) Sets the margin between childWidget
s.- Parameters:
margin
- the margin between childWidget
s
-
isAutoresize
public final boolean isAutoresize()Returns whether theWidget
automatically resizes to fit its children.- Returns:
- true if the
Widget
automatically resizes to fit its children, false otherwise
-
setAutoresize
public final void setAutoresize(boolean autoresize) Sets whether theWidget
should automatically resize to fit its children.- Parameters:
autoresize
- true if theWidget
should automatically resize to fit its children, false otherwise
-
render
public void render()Renders theWidget
-