2022-11-14 14:30:28 -06:00
|
|
|
package main
|
2022-10-17 22:39:03 -05:00
|
|
|
|
2022-11-14 14:30:28 -06:00
|
|
|
import (
|
|
|
|
"log"
|
2022-10-17 22:39:03 -05:00
|
|
|
|
2022-11-14 14:30:28 -06:00
|
|
|
"git.wit.org/wit/gui/toolkit"
|
|
|
|
|
|
|
|
"github.com/andlabs/ui"
|
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
|
|
|
)
|
|
|
|
|
|
|
|
func NewGroup(parentW *toolkit.Widget, w *toolkit.Widget) {
|
|
|
|
log.Println("gui.andlabs.NewGroup()", w.Name)
|
|
|
|
|
|
|
|
t := mapToolkits[parentW]
|
|
|
|
if (t == nil) {
|
|
|
|
log.Println("go.andlabs.NewGroup() toolkit struct == nil. name=", parentW.Name, w.Name)
|
|
|
|
listMap()
|
|
|
|
}
|
|
|
|
newt := t.NewGroup(w.Name)
|
|
|
|
mapWidgetsToolkits(w, newt)
|
|
|
|
}
|
2022-10-17 22:39:03 -05:00
|
|
|
|
|
|
|
// make new Group here
|
2022-11-14 14:30:28 -06:00
|
|
|
func (t andlabsT) NewGroup(title string) *andlabsT {
|
|
|
|
var newt andlabsT
|
2022-10-19 13:23:22 -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)
|
2022-11-06 12:59:24 -06:00
|
|
|
|
|
|
|
if (t.uiBox != nil) {
|
|
|
|
t.uiBox.Append(g, stretchy)
|
|
|
|
} else if (t.uiWindow != nil) {
|
|
|
|
t.uiWindow.SetChild(g)
|
|
|
|
} else {
|
|
|
|
log.Println("gui.ToolboxNode.NewGroup() node.UiBox == nil. I can't add a range UI element without a place to put it")
|
2022-11-14 14:30:28 -06:00
|
|
|
log.Fatalln("probably could just make a box here?")
|
2022-11-06 12:59:24 -06:00
|
|
|
}
|
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
|
2022-11-06 12:59:24 -06:00
|
|
|
newt.uiWindow = t.uiWindow
|
2022-10-19 13:23:22 -05:00
|
|
|
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
|
|
|
}
|