2022-11-14 14:30:28 -06:00
|
|
|
package main
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2023-02-25 14:05:25 -06:00
|
|
|
import (
|
|
|
|
"github.com/andlabs/ui"
|
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2023-02-25 14:05:25 -06:00
|
|
|
"git.wit.org/wit/gui/toolkit"
|
|
|
|
)
|
2022-11-14 14:30:28 -06:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
func newButton(a *toolkit.Action) {
|
2022-11-14 14:30:28 -06:00
|
|
|
var t, newt *andlabsT
|
2022-10-19 13:23:22 -05:00
|
|
|
var b *ui.Button
|
2023-03-23 12:35:12 -05:00
|
|
|
w := a.Widget
|
2023-03-12 08:47:16 -05:00
|
|
|
log(debugToolkit, "newButton()", w.Name)
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
t = mapToolkits[a.Where]
|
2022-11-14 14:30:28 -06:00
|
|
|
if (t == nil) {
|
2023-03-23 12:35:12 -05:00
|
|
|
log(debugToolkit, "newButton() toolkit struct == nil. name=", a.Where.Name, w.Name)
|
2022-11-14 14:30:28 -06:00
|
|
|
return
|
2022-10-19 13:23:22 -05:00
|
|
|
}
|
|
|
|
|
2022-11-14 14:30:28 -06:00
|
|
|
newt = new(andlabsT)
|
|
|
|
|
|
|
|
b = ui.NewButton(w.Name)
|
2022-10-19 13:23:22 -05:00
|
|
|
newt.uiButton = b
|
2023-03-23 12:35:12 -05:00
|
|
|
newt.uiControl = b
|
2023-03-01 11:35:36 -06:00
|
|
|
newt.tw = w
|
|
|
|
newt.parent = t
|
2022-10-19 13:23:22 -05:00
|
|
|
|
|
|
|
b.OnClicked(func(*ui.Button) {
|
2023-03-01 11:35:36 -06:00
|
|
|
newt.commonChange(newt.tw)
|
2022-10-19 13:23:22 -05:00
|
|
|
})
|
|
|
|
|
2023-03-23 12:35:12 -05:00
|
|
|
place(a, t, newt)
|
|
|
|
mapWidgetsToolkits(a, newt)
|
2023-03-01 11:35:36 -06:00
|
|
|
}
|