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
ConstructorsConstructorDescriptionBoxLayoutWidget(int x, int y, int width, int height, boolean autoresize) Constructs a newWidgetwith the specified position and size. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a child widget to this widget's list of children.final intReturns the margin between childWidgets.final booleanReturns whether theWidgetautomatically resizes to fit its children.booleanChecks if the layout is currently being updated.voidremoveChild(Widget widget) Removes a child widget from this widget's list of children.voidrender()Renders theWidgetfinal voidsetAutoresize(boolean autoresize) Sets whether theWidgetshould automatically resize to fit its children.final voidsetMargin(int margin) Sets the margin between childWidgets.voidsetUpdatingLayout(boolean updatingLayout) Sets the updating layout status.voidUpdates 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 newWidgetwith 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:
removeChildin 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 childWidgets.- Returns:
- the margin between child
Widgets
-
setMargin
public final void setMargin(int margin) Sets the margin between childWidgets.- Parameters:
margin- the margin between childWidgets
-
isAutoresize
public final boolean isAutoresize()Returns whether theWidgetautomatically resizes to fit its children.- Returns:
- true if the
Widgetautomatically resizes to fit its children, false otherwise
-
setAutoresize
public final void setAutoresize(boolean autoresize) Sets whether theWidgetshould automatically resize to fit its children.- Parameters:
autoresize- true if theWidgetshould automatically resize to fit its children, false otherwise
-
render
public void render()Renders theWidget
-