2022-11-14 14:30:28 -06:00
|
|
|
package main
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
import (
|
|
|
|
"git.wit.org/wit/gui/toolkit"
|
|
|
|
|
|
|
|
"github.com/andlabs/ui"
|
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
|
|
|
)
|
|
|
|
|
|
|
|
// make new Box here
|
|
|
|
func newBox(a *toolkit.Action) {
|
|
|
|
w := a.Widget
|
|
|
|
parentW := a.Where
|
|
|
|
log(debugToolkit, "newBox()", w.Name)
|
|
|
|
|
|
|
|
t := mapToolkits[parentW]
|
|
|
|
if (t == nil) {
|
|
|
|
log(debugToolkit, "newBox() toolkit struct == nil. name=", parentW.Name, w.Name)
|
|
|
|
listMap(debugToolkit)
|
|
|
|
}
|
|
|
|
newt := t.rawBox(w.Name, a.B)
|
|
|
|
newt.boxC = 0
|
|
|
|
place(a, t, newt)
|
|
|
|
mapWidgetsToolkits(a, newt)
|
2022-10-19 13:23:22 -05:00
|
|
|
}
|
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
// make new Box using andlabs/ui
|
|
|
|
func (t *andlabsT) rawBox(title string, b bool) *andlabsT {
|
|
|
|
var newt andlabsT
|
|
|
|
var box *ui.Box
|
|
|
|
newt.Name = title
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
log(debugToolkit, "rawBox() create", newt.Name)
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
if (b) {
|
|
|
|
box = ui.NewHorizontalBox()
|
|
|
|
} else {
|
|
|
|
box = ui.NewVerticalBox()
|
2022-10-19 13:23:22 -05:00
|
|
|
}
|
2023-03-23 12:35:12 -05:00
|
|
|
box.SetPadded(padded)
|
2022-10-21 11:40:08 -05:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
newt.uiBox = box
|
|
|
|
newt.uiControl = box
|
2022-10-21 11:40:08 -05:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
return &newt
|
2022-10-19 13:23:22 -05:00
|
|
|
}
|