2022-10-17 22:39:03 -05:00
|
|
|
package toolkit
|
|
|
|
|
|
|
|
import "log"
|
2022-10-19 13:23:22 -05:00
|
|
|
import "os"
|
2022-10-17 22:39:03 -05:00
|
|
|
|
|
|
|
import "github.com/andlabs/ui"
|
|
|
|
import _ "github.com/andlabs/ui/winmanifest"
|
|
|
|
|
|
|
|
// make new Group here
|
2022-10-19 13:23:22 -05:00
|
|
|
func (t Toolkit) NewGroup(title string) *Toolkit {
|
|
|
|
var newt Toolkit
|
|
|
|
|
|
|
|
if (t.uiBox == nil) {
|
|
|
|
log.Println("gui.ToolboxNode.NewGroup() node.UiBox == nil. I can't add a range UI element without a place to put it")
|
|
|
|
log.Println("probably could just make a box here?")
|
|
|
|
os.Exit(0)
|
|
|
|
return nil
|
2022-10-17 22:39:03 -05:00
|
|
|
}
|
|
|
|
|
2022-11-05 10:19:04 -05:00
|
|
|
if (DebugToolkit) {
|
|
|
|
log.Println("gui.Toolbox.NewGroup() create", title)
|
|
|
|
}
|
2022-10-17 22:39:03 -05:00
|
|
|
g := ui.NewGroup(title)
|
2022-10-21 11:40:08 -05:00
|
|
|
g.SetMargined(margin)
|
|
|
|
t.uiBox.Append(g, stretchy)
|
2022-10-17 22:39:03 -05:00
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
hbox := ui.NewVerticalBox()
|
2022-10-21 11:40:08 -05:00
|
|
|
hbox.SetPadded(padded)
|
2022-10-19 13:23:22 -05:00
|
|
|
g.SetChild(hbox)
|
2022-10-17 22:39:03 -05:00
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
newt.uiGroup = g
|
|
|
|
newt.uiBox = hbox
|
|
|
|
newt.Name = title
|
2022-10-17 22:39:03 -05:00
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
t.Dump()
|
|
|
|
newt.Dump()
|
|
|
|
// panic("toolkit.NewGroup")
|
|
|
|
return &newt
|
2022-10-17 22:39:03 -05:00
|
|
|
}
|