import { Panel } from "../ui/panel"
import { Group } from "../ui/view"
import { ClassType } from "../util/types"
export abstract class ModularPanel extends Panel {
private modules: Panel[]
constructor() {
super()
this.modules = this.setupModules().map(e => new e)
}
abstract setupModules(): ClassType<Panel>[]
abstract setupShelf(root: Group): Group
build(root: Group) {
const groupView = this.setupShelf(root)
this.modules.forEach(e => {
Reflect.set(e, "__root__", groupView)
e.build(groupView)
})
onCreate() {
super.onCreate()
e.context = this.context
e.onCreate()
onDestroy() {
super.onDestroy()
e.onDestroy()
onShow() {
super.onShow()
e.onShow()
onHidden() {
super.onHidden()
e.onHidden()
onRenderFinished() {
super.onRenderFinished()
e.onRenderFinished()