11package fi .dy .masa .itemscroller .gui ;
22
3+ import java .util .ArrayList ;
34import java .util .Collections ;
45import java .util .List ;
56import com .google .common .collect .ImmutableList ;
67import org .jetbrains .annotations .NotNull ;
78
9+ import fi .dy .masa .malilib .MaLiLibConfigGui ;
810import fi .dy .masa .malilib .config .IConfigBase ;
911import fi .dy .masa .malilib .gui .GuiConfigsBase ;
1012import fi .dy .masa .malilib .gui .button .ButtonBase ;
1113import fi .dy .masa .malilib .gui .button .ButtonGeneric ;
1214import fi .dy .masa .malilib .gui .button .IButtonActionListener ;
15+ import fi .dy .masa .malilib .gui .interfaces .IConfigGuiAllTab ;
1316import fi .dy .masa .malilib .util .StringUtils ;
1417import fi .dy .masa .itemscroller .Reference ;
1518import fi .dy .masa .itemscroller .config .Configs ;
1619import fi .dy .masa .itemscroller .config .Hotkeys ;
1720
18- public class GuiConfigs extends GuiConfigsBase
21+ public class GuiConfigs extends GuiConfigsBase implements IConfigGuiAllTab
1922{
2023 private static ConfigGuiTab tab = ConfigGuiTab .GENERIC ;
2124
@@ -67,7 +70,11 @@ public List<ConfigOptionWrapper> getConfigs()
6770 List <? extends IConfigBase > configs ;
6871 ConfigGuiTab tab = GuiConfigs .tab ;
6972
70- if (tab == ConfigGuiTab .GENERIC )
73+ if (tab == ConfigGuiTab .ALL && this .useAllTab ())
74+ {
75+ return this .getAllConfigs ();
76+ }
77+ else if (tab == ConfigGuiTab .GENERIC )
7178 {
7279 configs = Configs .Generic .OPTIONS ;
7380 }
@@ -87,7 +94,31 @@ else if (tab == ConfigGuiTab.HOTKEYS)
8794 return ConfigOptionWrapper .createFor (configs );
8895 }
8996
90- private record ButtonListener (ConfigGuiTab tab , GuiConfigs parent ) implements IButtonActionListener
97+ @ Override
98+ public boolean useAllTab ()
99+ {
100+ return true ;
101+ }
102+
103+ @ Override
104+ protected boolean useKeybindSearch ()
105+ {
106+ return tab == ConfigGuiTab .ALL || tab == ConfigGuiTab .HOTKEYS ;
107+ }
108+
109+ @ Override
110+ public List <ConfigOptionWrapper > getAllConfigs ()
111+ {
112+ List <ConfigOptionWrapper > configs = new ArrayList <>();
113+
114+ configs .addAll (ConfigOptionWrapper .createFor (Configs .Generic .OPTIONS ));
115+ configs .addAll (ConfigOptionWrapper .createFor (Configs .Toggles .OPTIONS ));
116+ configs .addAll (ConfigOptionWrapper .createFor (Hotkeys .HOTKEY_LIST ));
117+
118+ return configs ;
119+ }
120+
121+ private record ButtonListener (ConfigGuiTab tab , GuiConfigs parent ) implements IButtonActionListener
91122 {
92123 @ Override
93124 public void actionPerformedWithButton (ButtonBase button , int mouseButton )
@@ -102,9 +133,10 @@ public void actionPerformedWithButton(ButtonBase button, int mouseButton)
102133
103134 public enum ConfigGuiTab
104135 {
105- GENERIC ("itemscroller.gui.button.config_gui.generic" ),
106- TOGGLES ("itemscroller.gui.button.config_gui.toggles" ),
107- HOTKEYS ("itemscroller.gui.button.config_gui.hotkeys" );
136+ ALL (IConfigGuiAllTab .getTranslationKey ()),
137+ GENERIC ("itemscroller.gui.button.config_gui.generic" ),
138+ TOGGLES ("itemscroller.gui.button.config_gui.toggles" ),
139+ HOTKEYS ("itemscroller.gui.button.config_gui.hotkeys" );
108140
109141 private final String translationKey ;
110142
0 commit comments