Interface GuiDescription

All Known Implementing Classes:
ItemSyncedGuiDescription, LightweightGuiDescription, SyncedGuiDescription

public interface GuiDescription
A GUI description represents a GUI without depending on screens.

GUI descriptions contain the root panel and the property delegate of the GUI. They also manage the focused widget.

See Also:
  • Method Details

    • getRootPanel

      WPanel getRootPanel()
    • getTitleColor

      int getTitleColor()
    • setRootPanel

      GuiDescription setRootPanel(WPanel panel)
    • setTitleColor

      GuiDescription setTitleColor(int color)
      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.

      Parameters:
      color - the new title color
      Returns:
      this GUI
    • setTitleColor

      GuiDescription setTitleColor(int lightColor, int darkColor)
      Sets the light and dark title colors of this GUI.
      Parameters:
      lightColor - the light-mode color
      darkColor - the dark-mode color
      Returns:
      this GUI
      Since:
      2.1.0
    • setPropertyDelegate

      GuiDescription setPropertyDelegate(PropertyDelegate delegate)
      Sets the object which manages the integer properties used by WBars
    • addSlotPeer

      void addSlotPeer(ValidatedSlot slot)
      Typical users won't call this. This adds a Slot to Container/Controller-based guis, and does nothing on lightweight guis.
    • addPainters

      @Environment(CLIENT) void addPainters()
      Guis should use this method to add clientside styles and BackgroundPainters to their controls
    • getPropertyDelegate

      @Nullable @Nullable PropertyDelegate getPropertyDelegate()
      Gets the object which manages the integer properties used by WBars and such.
    • isFocused

      boolean isFocused(WWidget widget)
      Tests whether the widget is the currently-focused one.
    • getFocus

      Gets the currently-focused WWidget. May be null.
    • requestFocus

      void requestFocus(WWidget widget)
      Notifies this gui that the widget wants to acquire focus.
    • releaseFocus

      void releaseFocus(WWidget widget)
      Notifies this gui that the widget wants to give up its hold over focus.
    • isFullscreen

      boolean isFullscreen()
      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.

      Returns:
      true if this GUI is fullscreen, false otherwise
      Since:
      2.0.0
    • setFullscreen

      void setFullscreen(boolean fullscreen)
      Sets whether this GUI is fullscreen.
      Parameters:
      fullscreen - true if this GUI is fullscreen, false otherwise
      Since:
      2.0.0
    • isTitleVisible

      boolean isTitleVisible()
      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.

      Returns:
      true if the title is visible, false otherwise
      Since:
      2.0.0
    • setTitleVisible

      void setTitleVisible(boolean titleVisible)
      Sets whether the title of this GUI should be rendered by the screen.
      Parameters:
      titleVisible - true if the title is visible, false otherwise
      Since:
      2.0.0
    • getTitleAlignment

      HorizontalAlignment getTitleAlignment()
      Gets the horizontal alignment of the GUI title.
      Returns:
      the alignment
      Since:
      2.1.0
    • setTitleAlignment

      void setTitleAlignment(HorizontalAlignment alignment)
      Sets the horizontal alignment of the GUI title.
      Parameters:
      alignment - the new alignment
      Since:
      2.1.0
    • getTitlePos

      Vec2i getTitlePos()
      Gets the position of the screen title.
      Returns:
      the title position
      Since:
      4.0.0
    • setTitlePos

      void setTitlePos(Vec2i titlePos)
      Sets the position of the screen title.
      Parameters:
      titlePos - the new title position
      Since:
      4.0.0
    • isDarkMode

      default net.fabricmc.fabric.api.util.TriState isDarkMode()
      Checks whether dark mode is used for this GUI description.
      Returns:
      • TriState.TRUE to force dark mode
      • TriState.FALSE to force light mode
      • TriState.DEFAULT to use the global dark mode setting
      Since:
      7.1.0