diff options
author | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-06-05 17:55:27 +0300 |
---|---|---|
committer | Juuxel <6596629+Juuxel@users.noreply.github.com> | 2020-06-05 17:55:27 +0300 |
commit | 2318d06b49ebacd29a7071f5c3ac5bc0b18a5646 (patch) | |
tree | ea39f6fe0770443bd8ff1e2c0d0b4ba026ebd5cd /src | |
parent | 1910cba88af8a95ad0ce4373b460220297aad86b (diff) | |
download | LibGui-2318d06b49ebacd29a7071f5c3ac5bc0b18a5646.tar.gz LibGui-2318d06b49ebacd29a7071f5c3ac5bc0b18a5646.tar.bz2 LibGui-2318d06b49ebacd29a7071f5c3ac5bc0b18a5646.zip |
Document WLabel and WText methods, add missing accessors to WText
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java | 67 | ||||
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java | 57 |
2 files changed, 123 insertions, 1 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java index edbc36b..518a4a6 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java @@ -101,6 +101,13 @@ public class WLabel extends WWidget { } } + /** + * Gets the text style at the specific widget-space coordinates. + * + * @param x the X coordinate in widget space + * @param y the Y coordinate in widget space + * @return the text style at the position, or null if not found + */ @Environment(EnvType.CLIENT) @Nullable public Style getTextStyleAt(int x, int y) { @@ -120,48 +127,106 @@ public class WLabel extends WWidget { super.setSize(x, Math.max(8, y)); } + /** + * Gets the dark mode color of this label. + * + * @return the color + * @since 2.0.0 + */ public int getDarkmodeColor() { return darkmodeColor; } + /** + * Sets the dark mode color of this label. + * + * @param color the new color + * @return this label + */ public WLabel setDarkmodeColor(int color) { darkmodeColor = color; return this; } - + + /** + * Disables separate dark mode coloring by copying the dark color to be the light color. + * + * @return this label + */ public WLabel disableDarkmode() { this.darkmodeColor = this.color; return this; } + /** + * Gets the light mode color of this label. + * + * @return the color + */ public int getColor() { return color; } + /** + * Sets the light mode color of this label. + * + * @param color the new color + * @return this label + */ public WLabel setColor(int color) { this.color = color; return this; } + /** + * Sets the light and dark mode colors of this label. + * + * @param color the new light color + * @param darkmodeColor the new dark color + * @return this label + */ public WLabel setColor(int color, int darkmodeColor) { this.color = color; this.darkmodeColor = darkmodeColor; return this; } + /** + * Gets the text of this label. + * + * @return the text + */ public class_5348 getText() { return text; } + /** + * Sets the text of this label. + * + * @param text the new text + * @return this label + */ public WLabel setText(class_5348 text) { this.text = text; return this; } + /** + * Gets the text alignment of this label. + * + * @return the alignment + * @since 2.0.0 + */ public Alignment getAlignment() { return alignment; } + /** + * Sets the text alignment of this label. + * + * @param align the new text alignment + * @return this label + */ public WLabel setAlignment(Alignment align) { this.alignment = align; return this; diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java index 4051a89..4cf268e 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java @@ -58,6 +58,13 @@ public class WText extends WWidget { wrappedLines = font.wrapLines(text, width); } + /** + * Gets the text style at the specific widget-space coordinates. + * + * @param x the X coordinate in widget space + * @param y the Y coordinate in widget space + * @return the text style at the position, or null if not found + */ @Environment(EnvType.CLIENT) @Nullable public Style getTextStyleAt(int x, int y) { @@ -108,10 +115,21 @@ public class WText extends WWidget { } } + /** + * Gets the text of this label. + * + * @return the text + */ public class_5348 getText() { return text; } + /** + * Sets the text of this label. + * + * @param text the new text + * @return this label + */ public WText setText(class_5348 text) { Objects.requireNonNull(text, "text is null"); this.text = text; @@ -120,26 +138,65 @@ public class WText extends WWidget { return this; } + /** + * Gets the light mode color of this label. + * + * @return the color + */ public int getColor() { return color; } + /** + * Sets the light mode color of this label. + * + * @param color the new color + * @return this text widget + */ public WText setColor(int color) { this.color = color; return this; } + /** + * Gets the dark mode color of this label. + * + * @return the color + * @since 2.0.0 + */ + public int getDarkmodeColor() { + return darkmodeColor; + } + + /** + * Sets the dark mode color of this label. + * + * @param darkmodeColor the new color + * @return this text widget + */ public WText setDarkmodeColor(int darkmodeColor) { this.darkmodeColor = darkmodeColor; return this; } + /** + * Sets the light and dark mode colors of this label. + * + * @param color the new light color + * @param darkmodeColor the new dark color + * @return this text widget + */ public WText setColor(int color, int darkmodeColor) { setColor(color); setDarkmodeColor(darkmodeColor); return this; } + /** + * Disables separate dark mode coloring by copying the dark color to be the light color. + * + * @return this text widget + */ public WText disableDarkmode() { this.darkmodeColor = this.color; return this; |