Package com.avrix.ui

Class WidgetManager

java.lang.Object
com.avrix.ui.WidgetManager

public class WidgetManager extends Object
Manages a collection of Widget instances, handling rendering and updates.
  • Constructor Details

    • WidgetManager

      public WidgetManager()
  • Method Details

    • init

      public static void init()
      Initializing the WidgetManager (creating NanoVG contexts)
    • onRender

      public static void onRender()
      Renders all Widgets and processes input events. Initializes the UI context if it is not already set. Updates mouse events and renders each visible Widget.
    • isBlockInputKeyboard

      public static boolean isBlockInputKeyboard()
      Returns the current keyboard input blocking state.
      Returns:
      true if keyboard input is disabled, otherwise false.
    • setBlockInputKeyboard

      public static void setBlockInputKeyboard(boolean block)
      Sets the keyboard input blocking state.
      Parameters:
      block - true to block keyboard input, false to unlock.
    • getContext

      public static NanoContext getContext()
      Getting the NanoVG rendering context
      Returns:
      NanoVG context, if it does not exist (not initialized) returns null
    • getWidgetList

      public static List<Widget> getWidgetList()
      Getting a list of Widgets 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

      public static void bringWidgetToTop(Widget widget)
      Moves the specified Widget to the front of the rendering order, ensuring it is drawn above other Widgets.
      Parameters:
      widget - the Widget to bring to the front
    • addWidget

      public static void addWidget(Widget widget)
      Adds a widget to the list of Widgets to be managed and displayed. The Widget is added only if it is not already present in the list.
      Parameters:
      widget - the Widget to be added
    • removeWidget

      public static void removeWidget(Widget widget)
      Removes a Widget from the list of Widgets to be managed and displayed.
      Parameters:
      widget - the Widget to be removed