|
10 | 10 | import com.lukflug.panelstudio.component.IFixedComponent; |
11 | 11 | import com.lukflug.panelstudio.container.IContainer; |
12 | 12 | import com.lukflug.panelstudio.container.VerticalContainer; |
| 13 | +import com.lukflug.panelstudio.layout.ChildUtil.ChildMode; |
13 | 14 | import com.lukflug.panelstudio.setting.ILabeled; |
| 15 | +import com.lukflug.panelstudio.setting.Labeled; |
14 | 16 | import com.lukflug.panelstudio.theme.ITheme; |
15 | 17 | import com.lukflug.panelstudio.widget.Button; |
16 | 18 | import com.lukflug.panelstudio.widget.ClosableComponent; |
17 | 19 |
|
18 | 20 | public class StackedPanelAdder implements IComponentAdder { |
19 | 21 | protected final IContainer<? super IFixedComponent> container; |
20 | | - protected VerticalContainer content; |
| 22 | + protected final ChildMode mode; |
| 23 | + protected final VerticalContainer content; |
21 | 24 | protected final ChildUtil util; |
22 | 25 |
|
23 | | - public StackedPanelAdder (IContainer<? super IFixedComponent> container, ILabeled label, ITheme theme, Point position, int width, Supplier<Animation> animation, IPopupPositioner popupPos) { |
| 26 | + public StackedPanelAdder (IContainer<? super IFixedComponent> container, ILabeled label, ITheme theme, Point position, int width, Supplier<Animation> animation, ChildMode mode, IPopupPositioner popupPos) { |
24 | 27 | this.container=container; |
| 28 | + this.mode=mode; |
25 | 29 | content=new VerticalContainer(label,theme.getContainerRenderer(-1,-1,true)); |
26 | 30 | container.addComponent(ClosableComponent.createDraggableComponent(new Button(label,theme.getButtonRenderer(Void.class,-1,-1,true)),content,()->null,new SimpleToggleable(true),animation.get(),theme.getPanelRenderer(Void.class,-1,-1),theme.getScrollBarRenderer(Void.class,-1,-1),theme.getEmptySpaceRenderer(Void.class,-1,-1),this::getScrollHeight,this::getComponentWidth,position,width,false)); |
27 | 31 | util=new ChildUtil(width,animation,popupPos,this::getScrollHeight); |
28 | 32 | } |
29 | 33 |
|
30 | 34 | @Override |
31 | 35 | public <S extends IComponent,T extends IComponent> void addComponent(S title, T content, ITheme theme, int logicalLevel, int graphicalLevel, Point position, int width, Supplier<Animation> animation) { |
32 | | - this.content.addComponent(new ClosableComponent<S,T>(title,content,()->null,new SimpleToggleable(false),animation.get(),theme.getPanelRenderer(Void.class,logicalLevel,graphicalLevel))); |
33 | | - //util.addContainer(title, title, null, null, null, null, null, theme, logicalLevel, graphicalLevel, null); |
| 36 | + util.addContainer(new Labeled(content.getTitle(),null,()->content.isVisible()),title,content,()->null,Void.class,this.content,this,theme,logicalLevel,graphicalLevel,mode); |
34 | 37 | } |
35 | 38 |
|
36 | 39 | @Override |
|
0 commit comments