From 117d80ff0e343eecf260fd363db896166d8061d7 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 28 Apr 2022 20:45:50 +0200 Subject: better mousepressed handling, some more option types and some other things I forgor --- .../oneconfig/config/annotations/Option.java | 28 +++++++++++++++++++++- .../polyfrost/oneconfig/config/data/InfoType.java | 8 +++++++ .../oneconfig/config/data/OptionType.java | 20 +++++++++++++++- .../oneconfig/config/interfaces/Config.java | 8 ++++++- 4 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 src/main/java/io/polyfrost/oneconfig/config/data/InfoType.java (limited to 'src/main/java/io/polyfrost/oneconfig/config') diff --git a/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java b/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java index 8abb303..4cda7d5 100644 --- a/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java +++ b/src/main/java/io/polyfrost/oneconfig/config/annotations/Option.java @@ -1,5 +1,6 @@ package io.polyfrost.oneconfig.config.annotations; +import io.polyfrost.oneconfig.config.data.InfoType; import io.polyfrost.oneconfig.config.data.OptionType; import java.lang.annotation.ElementType; @@ -11,7 +12,7 @@ import java.lang.annotation.Target; @Target(ElementType.FIELD) public @interface Option { /** - * The name of the page that will be displayed to the user + * The name of the option that will be displayed to the user */ String name(); @@ -39,4 +40,29 @@ public @interface Option { * The width of the option (1 = half width, 2 = full width) */ int size() default 1; + + /** + * The placeholder for the text box if there is no text inside + */ + String placeholder() default ""; + + /** + * If the text field is secure or not + */ + boolean secure() default false; + + /** + * If the text field is multi line or not + */ + boolean multiLine() default false; + + /** + * Steps of slider (0 for no steps) + */ + int step() default 0; + + /** + * Option for info option type + */ + InfoType infoType() default InfoType.INFO; } diff --git a/src/main/java/io/polyfrost/oneconfig/config/data/InfoType.java b/src/main/java/io/polyfrost/oneconfig/config/data/InfoType.java new file mode 100644 index 0000000..1b96161 --- /dev/null +++ b/src/main/java/io/polyfrost/oneconfig/config/data/InfoType.java @@ -0,0 +1,8 @@ +package io.polyfrost.oneconfig.config.data; + +public enum InfoType { + INFO, + WARNING, + ERROR, + SUCCESS +} diff --git a/src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java b/src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java index 22c92c0..61bb516 100644 --- a/src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java +++ b/src/main/java/io/polyfrost/oneconfig/config/data/OptionType.java @@ -1,6 +1,24 @@ package io.polyfrost.oneconfig.config.data; public enum OptionType { + /** + * Type: class + */ PAGE, - SWITCH + /** + * Type: boolean + */ + SWITCH, + /** + * Type: boolean + */ + CHECKBOX, + DUAL_OPTION, + ARROW_SELECTOR, + TEXT, + SLIDER, + COLOR, + DROPDOWN, + MULTI_DROPDOWN, + INFO } diff --git a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java index 06e3e4e..37114cf 100644 --- a/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java +++ b/src/main/java/io/polyfrost/oneconfig/config/interfaces/Config.java @@ -6,9 +6,10 @@ import io.polyfrost.oneconfig.config.core.ConfigCore; import io.polyfrost.oneconfig.config.data.Mod; import io.polyfrost.oneconfig.config.data.OptionPage; import io.polyfrost.oneconfig.config.profiles.Profiles; +import io.polyfrost.oneconfig.gui.elements.config.ConfigCheckbox; import io.polyfrost.oneconfig.gui.elements.config.ConfigPage; import io.polyfrost.oneconfig.gui.elements.config.ConfigSwitch; -import io.polyfrost.oneconfig.test.TestConfig; +import io.polyfrost.oneconfig.gui.elements.config.ConfigTextBox; import java.io.*; import java.lang.reflect.Field; @@ -93,6 +94,11 @@ public class Config { case SWITCH: options.add(new ConfigSwitch(field, option.name(), option.size())); break; + case CHECKBOX: + options.add(new ConfigCheckbox(field, option.name(), option.size())); + break; + case TEXT: + options.add(new ConfigTextBox(field, option.name(), option.size(), option.placeholder(), option.secure(), option.multiLine())); } } } -- cgit