2022-10-19 13:23:22 -05:00
|
|
|
package toolkit
|
|
|
|
|
|
|
|
import "log"
|
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
|
|
|
// create a new box
|
|
|
|
func (t *Toolkit) GetBox() *ui.Box {
|
|
|
|
return t.uiBox
|
|
|
|
}
|
|
|
|
|
|
|
|
// create a new box
|
|
|
|
func (t *Toolkit) NewBox() *Toolkit {
|
2022-11-06 19:57:20 -06:00
|
|
|
if (DebugToolkit) {
|
|
|
|
log.Println("gui.Toolbox.NewBox() START create default")
|
|
|
|
}
|
2022-10-19 13:23:22 -05:00
|
|
|
t.Dump()
|
|
|
|
if (t.uiGroup != nil) {
|
2022-11-06 19:57:20 -06:00
|
|
|
if (DebugToolkit) {
|
|
|
|
log.Println("\tgui.Toolbox.NewBox() is a Group")
|
|
|
|
}
|
2022-10-19 13:23:22 -05:00
|
|
|
var newTK Toolkit
|
|
|
|
|
|
|
|
vbox := ui.NewVerticalBox()
|
2022-10-21 11:40:08 -05:00
|
|
|
vbox.SetPadded(padded)
|
2022-10-19 13:23:22 -05:00
|
|
|
t.uiGroup.SetChild(vbox)
|
|
|
|
newTK.uiBox = vbox
|
|
|
|
|
|
|
|
return &newTK
|
|
|
|
}
|
|
|
|
if (t.uiBox != nil) {
|
2022-11-06 19:57:20 -06:00
|
|
|
if (DebugToolkit) {
|
|
|
|
log.Println("\tgui.Toolbox.NewBox() is a Box")
|
|
|
|
}
|
2022-10-21 11:40:08 -05:00
|
|
|
var newTK Toolkit
|
|
|
|
|
|
|
|
vbox := ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(padded)
|
|
|
|
t.uiBox.Append(vbox, stretchy)
|
|
|
|
newTK.uiBox = vbox
|
|
|
|
newTK.Name = t.Name
|
|
|
|
|
|
|
|
return &newTK
|
2022-10-19 13:23:22 -05:00
|
|
|
}
|
2022-11-06 12:59:24 -06:00
|
|
|
if (t.uiWindow != nil) {
|
2022-11-06 19:57:20 -06:00
|
|
|
if (DebugToolkit) {
|
|
|
|
log.Println("\tgui.Toolbox.NewBox() is a Window")
|
|
|
|
}
|
2022-11-06 12:59:24 -06:00
|
|
|
var newT Toolkit
|
|
|
|
|
|
|
|
vbox := ui.NewVerticalBox()
|
|
|
|
vbox.SetPadded(padded)
|
|
|
|
t.uiWindow.SetChild(vbox)
|
|
|
|
newT.uiBox = vbox
|
|
|
|
newT.Name = t.Name
|
|
|
|
|
|
|
|
// panic("WTF")
|
|
|
|
return &newT
|
|
|
|
}
|
2022-11-06 19:57:20 -06:00
|
|
|
if (DebugToolkit) {
|
|
|
|
log.Println("\tgui.Toolbox.NewBox() FAILED. Couldn't figure out where to make a box")
|
|
|
|
}
|
2022-10-19 13:23:22 -05:00
|
|
|
t.Dump()
|
|
|
|
return nil
|
|
|
|
}
|