Package com.avrix.ui
Class WidgetManager
java.lang.Object
com.avrix.ui.WidgetManager
Manages a collection of
Widget instances, handling rendering and updates.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a widget to the list ofWidgets to be managed and displayed.static voidbringWidgetToTop(Widget widget) static NanoContextGetting the NanoVG rendering contextGetting a list ofWidgets registered in the managerstatic voidinit()Initializing theWidgetManager(creating NanoVG contexts)static booleanReturns the current keyboard input blocking state.static booleanChecks if the mouse pointer is over a custom UI element.static voidonRender()Renders allWidgets and processes input events.static voidremoveWidget(Widget widget) static voidsetBlockInputKeyboard(boolean block) Sets the keyboard input blocking state.
-
Constructor Details
-
WidgetManager
public WidgetManager()
-
-
Method Details
-
init
public static void init()Initializing theWidgetManager(creating NanoVG contexts) -
onRender
public static void onRender() -
isBlockInputKeyboard
public static boolean isBlockInputKeyboard()Returns the current keyboard input blocking state.- Returns:
trueif keyboard input is disabled, otherwisefalse.
-
setBlockInputKeyboard
public static void setBlockInputKeyboard(boolean block) Sets the keyboard input blocking state.- Parameters:
block-trueto block keyboard input,falseto unlock.
-
getContext
Getting the NanoVG rendering context- Returns:
- NanoVG context, if it does not exist (not initialized) returns
null
-
getWidgetList
Getting a list ofWidgets registered in the manager- Returns:
- list of
Widgets
-
isOverCustomUI
public static boolean isOverCustomUI()Checks if the mouse pointer is over a custom UI element.- Returns:
- true if the mouse pointer is over a custom UI element, false otherwise.
-
bringWidgetToTop
Moves the specifiedWidgetto the front of the rendering order, ensuring it is drawn above otherWidgets.- Parameters:
widget- theWidgetto bring to the front
-
addWidget
Adds a widget to the list ofWidgets to be managed and displayed. TheWidgetis added only if it is not already present in the list.- Parameters:
widget- theWidgetto be added
-
removeWidget
- Parameters:
widget- theWidgetto be removed
-