Class LightweightGuiDescription
java.lang.Object
io.github.cottonmc.cotton.gui.client.LightweightGuiDescription
- All Implemented Interfaces:
GuiDescription
A GuiDescription without any associated Minecraft classes
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
protected WWidget
protected boolean
protected PropertyDelegate
protected WPanel
protected HorizontalAlignment
protected int
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Guis should use this method to add clientside styles and BackgroundPainters to their controlsvoid
addSlotPeer
(ValidatedSlot slot) Typical users won't call this.getFocus()
Gets the currently-focused WWidget.Gets the object which manages the integer properties used by WBars and such.Gets the horizontal alignment of the GUI title.int
Gets the position of the screen title.boolean
Tests whether the widget is the currently-focused one.boolean
Gets whether this GUI is fullscreen.boolean
Gets whether the title of this GUI should be rendered by the screen.void
releaseFocus
(WWidget widget) Notifies this gui that the widget wants to give up its hold over focus.void
requestFocus
(WWidget widget) Notifies this gui that the widget wants to acquire focus.void
setFullscreen
(boolean fullscreen) Sets whether this GUI is fullscreen.setPropertyDelegate
(PropertyDelegate delegate) Sets the object which manages the integer properties used by WBarssetRootPanel
(WPanel panel) void
setTitleAlignment
(HorizontalAlignment titleAlignment) Sets the horizontal alignment of the GUI title.setTitleColor
(int color) Sets the title color of this GUI.setTitleColor
(int lightColor, int darkColor) Sets the light and dark title colors of this GUI.void
setTitlePos
(Vec2i titlePos) Sets the position of the screen title.void
setTitleVisible
(boolean titleVisible) Sets whether the title of this GUI should be rendered by the screen.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.cottonmc.cotton.gui.GuiDescription
isDarkMode
-
Field Details
-
rootPanel
-
propertyDelegate
-
focus
-
titleColor
protected int titleColor -
darkmodeTitleColor
protected int darkmodeTitleColor -
fullscreen
protected boolean fullscreen -
titleVisible
protected boolean titleVisible -
titleAlignment
-
-
Constructor Details
-
LightweightGuiDescription
public LightweightGuiDescription()
-
-
Method Details
-
getRootPanel
- Specified by:
getRootPanel
in interfaceGuiDescription
-
getTitleColor
public int getTitleColor()- Specified by:
getTitleColor
in interfaceGuiDescription
-
setRootPanel
- Specified by:
setRootPanel
in interfaceGuiDescription
-
setTitleColor
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 beWLabel.DEFAULT_DARKMODE_TEXT_COLOR
; otherwise it will be the specified color.- Specified by:
setTitleColor
in interfaceGuiDescription
- Parameters:
color
- the new title color- Returns:
- this GUI
-
setTitleColor
Description copied from interface:GuiDescription
Sets the light and dark title colors of this GUI.- Specified by:
setTitleColor
in interfaceGuiDescription
- Parameters:
lightColor
- the light-mode colordarkColor
- 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 interfaceGuiDescription
-
addSlotPeer
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 interfaceGuiDescription
-
getPropertyDelegate
Description copied from interface:GuiDescription
Gets the object which manages the integer properties used by WBars and such.- Specified by:
getPropertyDelegate
in interfaceGuiDescription
-
setPropertyDelegate
Description copied from interface:GuiDescription
Sets the object which manages the integer properties used by WBars- Specified by:
setPropertyDelegate
in interfaceGuiDescription
-
isFocused
Description copied from interface:GuiDescription
Tests whether the widget is the currently-focused one.- Specified by:
isFocused
in interfaceGuiDescription
-
getFocus
Description copied from interface:GuiDescription
Gets the currently-focused WWidget. May be null.- Specified by:
getFocus
in interfaceGuiDescription
-
requestFocus
Description copied from interface:GuiDescription
Notifies this gui that the widget wants to acquire focus.- Specified by:
requestFocus
in interfaceGuiDescription
-
releaseFocus
Description copied from interface:GuiDescription
Notifies this gui that the widget wants to give up its hold over focus.- Specified by:
releaseFocus
in interfaceGuiDescription
-
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 interfaceGuiDescription
- 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 interfaceGuiDescription
- 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 interfaceGuiDescription
- 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 interfaceGuiDescription
- Parameters:
titleVisible
- true if the title is visible, false otherwise
-
getTitleAlignment
Description copied from interface:GuiDescription
Gets the horizontal alignment of the GUI title.- Specified by:
getTitleAlignment
in interfaceGuiDescription
- Returns:
- the alignment
-
setTitleAlignment
Description copied from interface:GuiDescription
Sets the horizontal alignment of the GUI title.- Specified by:
setTitleAlignment
in interfaceGuiDescription
- Parameters:
titleAlignment
- the new alignment
-
getTitlePos
Description copied from interface:GuiDescription
Gets the position of the screen title.- Specified by:
getTitlePos
in interfaceGuiDescription
- Returns:
- the title position
-
setTitlePos
Description copied from interface:GuiDescription
Sets the position of the screen title.- Specified by:
setTitlePos
in interfaceGuiDescription
- Parameters:
titlePos
- the new title position
-