@@ -62,6 +62,10 @@ public class CSGOLayout implements ILayout,IScrollSize {
6262 * Whether settings are in a separate column.
6363 */
6464 protected boolean moduleColumn ;
65+ /**
66+ * The width of the category column.
67+ */
68+ protected int columnWidth ;
6569 /**
6670 * The weight of the settings column.
6771 */
@@ -90,13 +94,33 @@ public class CSGOLayout implements ILayout,IScrollSize {
9094 * @param popupType child util instance
9195 */
9296 public CSGOLayout (ILabeled label , Point position , int width , int popupWidth , Supplier <Animation > animation , String enabledButton , boolean horizontal , boolean moduleColumn , int weight , ChildMode colorType , PopupTuple popupType ) {
97+ this (label ,position ,width ,popupWidth ,animation ,enabledButton ,horizontal ,moduleColumn ,-1 ,weight ,colorType ,popupType );
98+ }
99+
100+ /**
101+ * Constructor.
102+ * @param label panel label
103+ * @param position panel position
104+ * @param width panel width
105+ * @param popupWidth pop-up width
106+ * @param animation animation supplier
107+ * @param enabledButton title for module toggles
108+ * @param horizontal whether tab list is horizontal
109+ * @param moduleColumn whether settings are in a separate column
110+ * @param columnWidth the width of the category column
111+ * @param weight weight of the module column
112+ * @param colorType child mode to use for setting components that are containers (e.g. color components)
113+ * @param popupType child util instance
114+ */
115+ public CSGOLayout (ILabeled label , Point position , int width , int popupWidth , Supplier <Animation > animation , String enabledButton , boolean horizontal , boolean moduleColumn , int columnWidth , int weight , ChildMode colorType , PopupTuple popupType ) {
93116 this .label =label ;
94117 this .position =position ;
95118 this .width =width ;
96119 this .animation =animation ;
97120 this .enabledButton =enabledButton ;
98121 this .horizontal =horizontal ;
99122 this .moduleColumn =moduleColumn ;
123+ this .columnWidth =columnWidth ;
100124 this .weight =weight ;
101125 this .colorType =colorType ;
102126 util =new ChildUtil (popupWidth ,animation ,popupType );
@@ -113,15 +137,15 @@ public void populateGUI (IComponentAdder gui, IComponentGenerator components, IC
113137 container .addComponent (window );
114138 gui .addComponent (title ,container ,new ThemeTuple (theme ,0 ,0 ),position ,width ,animation );
115139 } else {
116- catSelect =addContainer (label ,client .getCategories ().map (cat ->cat ),window ,new ThemeTuple (theme ,0 ,1 ),false ,button ->wrapColumn (button ,new ThemeTuple (theme ,0 ,1 ),1 ),()->true );
140+ catSelect =addContainer (label ,client .getCategories ().map (cat ->cat ),window ,new ThemeTuple (theme ,0 ,1 ),false ,button ->wrapColumn (button ,new ThemeTuple (theme ,0 ,1 ),columnWidth > 0 ? columnWidth : 0 , columnWidth > 0 ? 0 : 1 ),()->true );
117141 gui .addComponent (title ,window ,new ThemeTuple (theme ,0 ,0 ),position ,width ,animation );
118142 }
119143 client .getCategories ().forEach (category ->{
120144 if (moduleColumn ) {
121- IEnumSetting modSelect =addContainer (category ,category .getModules ().map (mod ->mod ),window ,new ThemeTuple (theme ,1 ,1 ),false ,button ->wrapColumn (button ,new ThemeTuple (theme ,0 ,1 ),1 ),()->catSelect .getValueName ()==category .getDisplayName ());
145+ IEnumSetting modSelect =addContainer (category ,category .getModules ().map (mod ->mod ),window ,new ThemeTuple (theme ,1 ,1 ),false ,button ->wrapColumn (button ,new ThemeTuple (theme ,0 ,1 ),0 , 1 ),()->catSelect .getValueName ()==category .getDisplayName ());
122146 category .getModules ().forEach (module ->{
123147 VerticalContainer container =new VerticalContainer (module ,theme .getContainerRenderer (1 ,1 ,false ));
124- window .addComponent (wrapColumn (container ,new ThemeTuple (theme ,1 ,1 ),weight ),()->catSelect .getValueName ()==category .getDisplayName ()&&modSelect .getValueName ()==module .getDisplayName ());
148+ window .addComponent (wrapColumn (container ,new ThemeTuple (theme ,1 ,1 ),0 , weight ),()->catSelect .getValueName ()==category .getDisplayName ()&&modSelect .getValueName ()==module .getDisplayName ());
125149 if (module .isEnabled ()!=null ) container .addComponent (components .getComponent (new IBooleanSetting () {
126150 @ Override
127151 public String getDisplayName () {
@@ -142,7 +166,7 @@ public boolean isOn() {
142166 });
143167 } else {
144168 VerticalContainer categoryContent =new VerticalContainer (category ,theme .getContainerRenderer (0 ,1 ,false ));
145- window .addComponent (wrapColumn (categoryContent ,new ThemeTuple (theme ,0 ,1 ),1 ),()->catSelect .getValueName ()==category .getDisplayName ());
169+ window .addComponent (wrapColumn (categoryContent ,new ThemeTuple (theme ,0 ,1 ),0 , weight ),()->catSelect .getValueName ()==category .getDisplayName ());
146170 category .getModules ().forEach (module ->{
147171 int graphicalLevel =1 ;
148172 FocusableComponent moduleTitle ;
@@ -268,10 +292,11 @@ protected boolean isDownKey (int key) {
268292 * Wrap content in a scrollable horizontal component to be added as a column.
269293 * @param button the content container
270294 * @param theme the theme to be used
295+ * @param width the horizontal width
271296 * @param weight the horizontal weight
272297 * @return a horizontal component
273298 */
274- protected HorizontalComponent <ScrollBarComponent <Void ,IComponent >> wrapColumn (IComponent button , ThemeTuple theme , int weight ) {
299+ protected HorizontalComponent <ScrollBarComponent <Void ,IComponent >> wrapColumn (IComponent button , ThemeTuple theme , int width , int weight ) {
275300 return new HorizontalComponent <ScrollBarComponent <Void ,IComponent >>(new ScrollBarComponent <Void ,IComponent >(button ,theme .getScrollBarRenderer (Void .class ),theme .getEmptySpaceRenderer (Void .class ,false ),theme .getEmptySpaceRenderer (Void .class ,true )) {
276301 @ Override
277302 public int getScrollHeight (Context context , int componentHeight ) {
@@ -282,7 +307,7 @@ public int getScrollHeight (Context context, int componentHeight) {
282307 protected Void getState () {
283308 return null ;
284309 }
285- },0 ,weight );
310+ },width ,weight );
286311 }
287312
288313 /**
0 commit comments