From 550fe32e612801daa99493aa0bade083f3330133 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Wed, 18 Mar 2020 00:35:36 +0800 Subject: 4.0.14: Better widgets system Signed-off-by: shedaniel --- .../java/me/shedaniel/rei/api/widgets/Label.java | 112 +++++++++++++++++++++ 1 file changed, 112 insertions(+) (limited to 'src/main/java/me/shedaniel/rei/api/widgets/Label.java') diff --git a/src/main/java/me/shedaniel/rei/api/widgets/Label.java b/src/main/java/me/shedaniel/rei/api/widgets/Label.java index 8d4d0247f..e51f504e9 100644 --- a/src/main/java/me/shedaniel/rei/api/widgets/Label.java +++ b/src/main/java/me/shedaniel/rei/api/widgets/Label.java @@ -37,76 +37,179 @@ public abstract class Label extends WidgetWithBounds { public static final int CENTER = 0; public static final int RIGHT_ALIGNED = 1; + /** + * @return whether the label is clickable, ignores if onClick is set. + */ public abstract boolean isClickable(); + /** + * Sets whether the label is clickable, ignores if onClick is set. + * + * @param clickable whether the label is clickable. + */ public abstract void setClickable(boolean clickable); + /** + * Sets the label as clickable, ignores if onClick is set. + * + * @return the label itself. + */ + @NotNull public final Label clickable() { return clickable(true); } + /** + * Sets whether the label is clickable, ignores if onClick is set. + * + * @param clickable whether the label is clickable. + * @return the label itself. + */ + @NotNull public final Label clickable(boolean clickable) { setClickable(clickable); return this; } + /** + * @return the consumer on click, only applicable if the label is clickable, null if not set. + */ @Nullable public abstract Consumer