Class LightweightGuiDescription

java.lang.Object
io.github.cottonmc.cotton.gui.client.LightweightGuiDescription
All Implemented Interfaces:
GuiDescription

public class LightweightGuiDescription extends Object implements GuiDescription
A GuiDescription without any associated Minecraft classes
  • Field Details

    • rootPanel

      protected WPanel rootPanel
    • propertyDelegate

      protected PropertyDelegate propertyDelegate
    • focus

      protected WWidget focus
    • titleColor

      protected int titleColor
    • darkmodeTitleColor

      protected int darkmodeTitleColor
    • fullscreen

      protected boolean fullscreen
    • titleVisible

      protected boolean titleVisible
    • titleAlignment

      protected HorizontalAlignment titleAlignment
  • Constructor Details

    • LightweightGuiDescription

      public LightweightGuiDescription()
  • Method Details

    • getRootPanel

      public WPanel getRootPanel()
      Specified by:
      getRootPanel in interface GuiDescription
    • getTitleColor

      public int getTitleColor()
      Specified by:
      getTitleColor in interface GuiDescription
    • setRootPanel

      public GuiDescription setRootPanel(WPanel panel)
      Specified by:
      setRootPanel in interface GuiDescription
    • setTitleColor

      public GuiDescription setTitleColor(int color)
      Description copied from interface: GuiDescription
      Sets the title color of this GUI.

      The dark-mode title color will also be set by this method. If the specified color is WLabel.DEFAULT_TEXT_COLOR, the dark-mode color will be WLabel.DEFAULT_DARKMODE_TEXT_COLOR; otherwise it will be the specified color.

      Specified by:
      setTitleColor in interface GuiDescription
      Parameters:
      color - the new title color
      Returns:
      this GUI
    • setTitleColor

      public GuiDescription setTitleColor(int lightColor, int darkColor)
      Description copied from interface: GuiDescription
      Sets the light and dark title colors of this GUI.
      Specified by:
      setTitleColor in interface GuiDescription
      Parameters:
      lightColor - the light-mode color
      darkColor - the dark-mode color
      Returns:
      this GUI
    • addPainters

      public void addPainters()
      Description copied from interface: GuiDescription
      Guis should use this method to add clientside styles and BackgroundPainters to their controls
      Specified by:
      addPainters in interface GuiDescription
    • addSlotPeer

      public void addSlotPeer(ValidatedSlot slot)
      Description copied from interface: GuiDescription
      Typical users won't call this. This adds a Slot to Container/Controller-based guis, and does nothing on lightweight guis.
      Specified by:
      addSlotPeer in interface GuiDescription
    • getPropertyDelegate

      @Nullable public @Nullable PropertyDelegate getPropertyDelegate()
      Description copied from interface: GuiDescription
      Gets the object which manages the integer properties used by WBars and such.
      Specified by:
      getPropertyDelegate in interface GuiDescription
    • setPropertyDelegate

      public GuiDescription setPropertyDelegate(PropertyDelegate delegate)
      Description copied from interface: GuiDescription
      Sets the object which manages the integer properties used by WBars
      Specified by:
      setPropertyDelegate in interface GuiDescription
    • isFocused

      public boolean isFocused(WWidget widget)
      Description copied from interface: GuiDescription
      Tests whether the widget is the currently-focused one.
      Specified by:
      isFocused in interface GuiDescription
    • getFocus

      public WWidget getFocus()
      Description copied from interface: GuiDescription
      Gets the currently-focused WWidget. May be null.
      Specified by:
      getFocus in interface GuiDescription
    • requestFocus

      public void requestFocus(WWidget widget)
      Description copied from interface: GuiDescription
      Notifies this gui that the widget wants to acquire focus.
      Specified by:
      requestFocus in interface GuiDescription
    • releaseFocus

      public void releaseFocus(WWidget widget)
      Description copied from interface: GuiDescription
      Notifies this gui that the widget wants to give up its hold over focus.
      Specified by:
      releaseFocus in interface GuiDescription
    • isFullscreen

      public boolean isFullscreen()
      Description copied from interface: GuiDescription
      Gets whether this GUI is fullscreen.

      Fullscreen GUIs have no default background painter and have the root panel stretched to fit the entire screen on the client.

      Specified by:
      isFullscreen in interface GuiDescription
      Returns:
      true if this GUI is fullscreen, false otherwise
    • setFullscreen

      public void setFullscreen(boolean fullscreen)
      Description copied from interface: GuiDescription
      Sets whether this GUI is fullscreen.
      Specified by:
      setFullscreen in interface GuiDescription
      Parameters:
      fullscreen - true if this GUI is fullscreen, false otherwise
    • isTitleVisible

      public boolean isTitleVisible()
      Description copied from interface: GuiDescription
      Gets whether the title of this GUI should be rendered by the screen.

      Modders can disable this to render the title themselves with a widget.

      Specified by:
      isTitleVisible in interface GuiDescription
      Returns:
      true if the title is visible, false otherwise
    • setTitleVisible

      public void setTitleVisible(boolean titleVisible)
      Description copied from interface: GuiDescription
      Sets whether the title of this GUI should be rendered by the screen.
      Specified by:
      setTitleVisible in interface GuiDescription
      Parameters:
      titleVisible - true if the title is visible, false otherwise
    • getTitleAlignment

      public HorizontalAlignment getTitleAlignment()
      Description copied from interface: GuiDescription
      Gets the horizontal alignment of the GUI title.
      Specified by:
      getTitleAlignment in interface GuiDescription
      Returns:
      the alignment
    • setTitleAlignment

      public void setTitleAlignment(HorizontalAlignment titleAlignment)
      Description copied from interface: GuiDescription
      Sets the horizontal alignment of the GUI title.
      Specified by:
      setTitleAlignment in interface GuiDescription
      Parameters:
      titleAlignment - the new alignment
    • getTitlePos

      public Vec2i getTitlePos()
      Description copied from interface: GuiDescription
      Gets the position of the screen title.
      Specified by:
      getTitlePos in interface GuiDescription
      Returns:
      the title position
    • setTitlePos

      public void setTitlePos(Vec2i titlePos)
      Description copied from interface: GuiDescription
      Sets the position of the screen title.
      Specified by:
      setTitlePos in interface GuiDescription
      Parameters:
      titlePos - the new title position