java.lang.Object
technology.sola.engine.graphics.gui.style.theme.GuiTheme

@NullMarked public class GuiTheme extends Object
GuiTheme instances contain GuiElement to BaseStyles mappings that can be applied to a specific element or an element and all its children.
  • Constructor Details

    • GuiTheme

      public GuiTheme()
  • Method Details

    • applyToTree

      public <Style extends BaseStyles> void applyToTree(GuiElement<Style,?> guiElement)
      Applies this theme to a GuiElement and all its children. Theme styles are prepended to element's existing styles.
      Type Parameters:
      Style - the BaseStyles type the element uses
      Parameters:
      guiElement - the parent element of the tree to apply the theme to
    • applyToElement

      public <Style extends BaseStyles> void applyToElement(GuiElement<Style,?> guiElement)
      Applies this theme to a GuiElement. Theme styles are prepended to element's existing styles.
      Type Parameters:
      Style - the BaseStyles type the element uses
      Parameters:
      guiElement - the element to apply the theme to
    • getForElement

      public <Style extends BaseStyles> List<ConditionalStyle<Style>> getForElement(GuiElement<Style,?> guiElement)
      Gets a List of ConditionalStyle from the theme for the GuiElement.
      Type Parameters:
      Style - the BaseStyles type the element uses
      Parameters:
      guiElement - the element to get theme styles for
      Returns:
      the styles for the element
    • addStyle

      public <Style extends BaseStyles> GuiTheme addStyle(Class<? extends GuiElement<Style,?>> elementClass, List<ConditionalStyle<Style>> styles)
      Adds a List of ConditionalStyles for a GuiElement type to the theme.
      Type Parameters:
      Style - the BaseStyles type the element uses
      Parameters:
      elementClass - the class of the element to add style definitions for
      styles - the styles to add
      Returns:
      this