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
FieldsModifier and TypeFieldDescriptionprotected intprotected WWidgetprotected booleanprotected PropertyDelegateprotected WPanelprotected HorizontalAlignmentprotected intprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidGuis should use this method to add clientside styles and BackgroundPainters to their controlsvoidaddSlotPeer(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.intGets the position of the screen title.booleanTests whether the root panel should get a vanilla background in the defaultGuiDescription.addPainters()implementations.booleanTests whether the widget is the currently-focused one.booleanGets whether this GUI is fullscreen.booleanGets whether the title of this GUI should be rendered by the screen.voidreleaseFocus(WWidget widget) Notifies this gui that the widget wants to give up its hold over focus.voidrequestFocus(WWidget widget) Notifies this gui that the widget wants to acquire focus.voidsetFullscreen(boolean fullscreen) Sets whether this GUI is fullscreen.setPropertyDelegate(PropertyDelegate delegate) Sets the object which manages the integer properties used by WBarssetRootPanel(WPanel panel) voidsetTitleAlignment(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.voidsetTitlePos(Vec2i titlePos) Sets the position of the screen title.voidsetTitleVisible(boolean titleVisible) Sets whether the title of this GUI should be rendered by the screen.voidsetUseDefaultRootBackground(boolean useDefaultRootBackground) Enables or disables the default vanilla background for root panels.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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:
getRootPanelin interfaceGuiDescription
-
getTitleColor
public int getTitleColor()- Specified by:
getTitleColorin interfaceGuiDescription
-
setRootPanel
- Specified by:
setRootPanelin interfaceGuiDescription
-
setTitleColor
Description copied from interface:GuiDescriptionSets 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:
setTitleColorin interfaceGuiDescription- Parameters:
color- the new title color- Returns:
- this GUI
-
setTitleColor
Description copied from interface:GuiDescriptionSets the light and dark title colors of this GUI.- Specified by:
setTitleColorin interfaceGuiDescription- Parameters:
lightColor- the light-mode colordarkColor- the dark-mode color- Returns:
- this GUI
-
addPainters
public void addPainters()Description copied from interface:GuiDescriptionGuis should use this method to add clientside styles and BackgroundPainters to their controls- Specified by:
addPaintersin interfaceGuiDescription
-
getUseDefaultRootBackground
public boolean getUseDefaultRootBackground()Description copied from interface:GuiDescriptionTests whether the root panel should get a vanilla background in the defaultGuiDescription.addPainters()implementations.- Specified by:
getUseDefaultRootBackgroundin interfaceGuiDescription- Returns:
trueif the default background painter is applied,falseotherwise
-
setUseDefaultRootBackground
public void setUseDefaultRootBackground(boolean useDefaultRootBackground) Description copied from interface:GuiDescriptionEnables or disables the default vanilla background for root panels.- Specified by:
setUseDefaultRootBackgroundin interfaceGuiDescription- Parameters:
useDefaultRootBackground-trueif the default background painter is applied,falseotherwise- See Also:
-
addSlotPeer
Description copied from interface:GuiDescriptionTypical users won't call this. This adds a Slot to Container/Controller-based guis, and does nothing on lightweight guis.- Specified by:
addSlotPeerin interfaceGuiDescription
-
getPropertyDelegate
Description copied from interface:GuiDescriptionGets the object which manages the integer properties used by WBars and such.- Specified by:
getPropertyDelegatein interfaceGuiDescription
-
setPropertyDelegate
Description copied from interface:GuiDescriptionSets the object which manages the integer properties used by WBars- Specified by:
setPropertyDelegatein interfaceGuiDescription
-
isFocused
Description copied from interface:GuiDescriptionTests whether the widget is the currently-focused one.- Specified by:
isFocusedin interfaceGuiDescription
-
getFocus
Description copied from interface:GuiDescriptionGets the currently-focused WWidget. May be null.- Specified by:
getFocusin interfaceGuiDescription
-
requestFocus
Description copied from interface:GuiDescriptionNotifies this gui that the widget wants to acquire focus.- Specified by:
requestFocusin interfaceGuiDescription
-
releaseFocus
Description copied from interface:GuiDescriptionNotifies this gui that the widget wants to give up its hold over focus.- Specified by:
releaseFocusin interfaceGuiDescription
-
isFullscreen
public boolean isFullscreen()Description copied from interface:GuiDescriptionGets 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:
isFullscreenin interfaceGuiDescription- Returns:
- true if this GUI is fullscreen, false otherwise
-
setFullscreen
public void setFullscreen(boolean fullscreen) Description copied from interface:GuiDescriptionSets whether this GUI is fullscreen.- Specified by:
setFullscreenin interfaceGuiDescription- Parameters:
fullscreen- true if this GUI is fullscreen, false otherwise
-
isTitleVisible
public boolean isTitleVisible()Description copied from interface:GuiDescriptionGets 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:
isTitleVisiblein interfaceGuiDescription- Returns:
- true if the title is visible, false otherwise
-
setTitleVisible
public void setTitleVisible(boolean titleVisible) Description copied from interface:GuiDescriptionSets whether the title of this GUI should be rendered by the screen.- Specified by:
setTitleVisiblein interfaceGuiDescription- Parameters:
titleVisible- true if the title is visible, false otherwise
-
getTitleAlignment
Description copied from interface:GuiDescriptionGets the horizontal alignment of the GUI title.- Specified by:
getTitleAlignmentin interfaceGuiDescription- Returns:
- the alignment
-
setTitleAlignment
Description copied from interface:GuiDescriptionSets the horizontal alignment of the GUI title.- Specified by:
setTitleAlignmentin interfaceGuiDescription- Parameters:
titleAlignment- the new alignment
-
getTitlePos
Description copied from interface:GuiDescriptionGets the position of the screen title.- Specified by:
getTitlePosin interfaceGuiDescription- Returns:
- the title position
-
setTitlePos
Description copied from interface:GuiDescriptionSets the position of the screen title.- Specified by:
setTitlePosin interfaceGuiDescription- Parameters:
titlePos- the new title position
-