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 (
|
|
|
|
"git.wit.org/wit/gui/toolkit"
|
|
|
|
|
|
|
|
"github.com/andlabs/ui"
|
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
|
|
|
)
|
|
|
|
|
2023-03-01 11:35:36 -06:00
|
|
|
func newGroup(parentW *toolkit.Widget, w *toolkit.Widget) {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "gui.andlabs.NewGroup()", w.Name)
|
2022-11-14 14:30:28 -06:00
|
|
|
|
|
|
|
t := mapToolkits[parentW]
|
|
|
|
if (t == nil) {
|
2023-02-25 14:05:25 -06:00
|
|
|
log(debugToolkit, "go.andlabs.NewGroup() toolkit struct == nil. name=", parentW.Name, w.Name)
|
2023-03-01 11:35:36 -06:00
|
|
|
listMap(debugToolkit)
|
2022-11-14 14:30:28 -06:00
|
|
|
}
|
|
|
|
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
|
|
|
|
2023-03-01 11:35:36 -06:00
|
|
|
log(debugToolkit, "NewGroup() create", title)
|
2023-02-25 14:05:25 -06:00
|
|
|
|
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) {
|
2023-03-01 11:35:36 -06:00
|
|
|
// TODO: temporary hack to make the output textbox 'fullscreen'
|
|
|
|
if (title == "output") {
|
|
|
|
t.uiBox.Append(g, true)
|
|
|
|
} else {
|
|
|
|
t.uiBox.Append(g, stretchy)
|
|
|
|
}
|
2022-11-06 12:59:24 -06:00
|
|
|
} else if (t.uiWindow != nil) {
|
|
|
|
t.uiWindow.SetChild(g)
|
|
|
|
} else {
|
2023-03-01 11:35:36 -06:00
|
|
|
log(debugError, "NewGroup() node.UiBox == nil. I can't add a range UI element without a place to put it")
|
|
|
|
log(debugError, "probably could just make a box here?")
|
2023-02-25 14:05:25 -06:00
|
|
|
exit("internal wit/gui error")
|
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
|
|
|
return &newt
|
2022-10-17 22:39:03 -05:00
|
|
|
}
|