aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java5
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java23
2 files changed, 26 insertions, 2 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java
index 9ba8562..bcfbf2b 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WListPanel.java
@@ -97,8 +97,9 @@ public class WListPanel<D, W extends WWidget> extends WClippedPanel {
child.setParent(this);
// Set up the widget's host
if (host != null) {
- child.validate(host);
- child.createPeers(host);
+ // setHost instead of validate since we cannot have independent validations
+ // TODO: System for independently validating widgets?
+ child.setHost(host);
}
return child;
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
index 8df8e14..824a5b2 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
@@ -368,6 +368,29 @@ public class WWidget {
}
/**
+ * Gets the host of this widget.
+ *
+ * @return the host
+ * @see #host
+ * @since 2.1.0
+ */
+ @Nullable
+ public final GuiDescription getHost() {
+ return host;
+ }
+
+ /**
+ * Sets the host of this widget without creating peers.
+ *
+ * @param host the new host
+ * @see #host
+ * @since 2.1.0
+ */
+ public void setHost(@Nullable GuiDescription host) {
+ this.host = host;
+ }
+
+ /**
* Adds lines to this widget's tooltip. If the lines remain empty after this call, no tooltip will be drawn.
* @param tooltip List containing all previous tooltip data.
*/