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) {
|
2023-03-29 23:03:04 -05:00
|
|
|
log(debugToolkit, "newBox()", a.Name)
|
2023-03-23 12:35:12 -05:00
|
|
|
|
2023-03-29 23:03:04 -05:00
|
|
|
t := andlabs[a.ParentId]
|
2023-03-23 12:35:12 -05:00
|
|
|
if (t == nil) {
|
2023-03-29 23:03:04 -05:00
|
|
|
log(debugToolkit, "newBox() toolkit struct == nil. name=", a.Name)
|
2023-03-23 12:35:12 -05:00
|
|
|
listMap(debugToolkit)
|
|
|
|
}
|
2023-03-29 23:03:04 -05:00
|
|
|
newt := t.rawBox(a.Text, a.B)
|
2023-03-23 12:35:12 -05:00
|
|
|
newt.boxC = 0
|
|
|
|
place(a, t, newt)
|
2023-03-29 23:03:04 -05:00
|
|
|
andlabs[a.WidgetId] = 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
|
|
|
}
|