2023-03-23 12:35:12 -05:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"git.wit.org/wit/gui/toolkit"
|
|
|
|
|
|
|
|
"github.com/andlabs/ui"
|
|
|
|
_ "github.com/andlabs/ui/winmanifest"
|
|
|
|
)
|
|
|
|
|
|
|
|
// make new Image here
|
|
|
|
func newImage(a *toolkit.Action) {
|
2023-04-03 10:26:47 -05:00
|
|
|
log(debugToolkit, "newImage()", 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-04-03 10:26:47 -05:00
|
|
|
log(debugToolkit, "newImage() toolkit struct == nil. name=", a.Name)
|
2023-03-23 12:35:12 -05:00
|
|
|
listMap(debugToolkit)
|
|
|
|
}
|
2023-04-03 10:26:47 -05:00
|
|
|
newt := t.rawImage(a.Name)
|
2023-03-23 12:35:12 -05:00
|
|
|
place(a, t, newt)
|
|
|
|
}
|
|
|
|
|
|
|
|
// make new Image using andlabs/ui
|
|
|
|
func (t *andlabsT) rawImage(title string) *andlabsT {
|
|
|
|
var newt andlabsT
|
|
|
|
var img *ui.Image
|
|
|
|
newt.Name = title
|
|
|
|
|
|
|
|
log(debugToolkit, "rawImage() create", newt.Name)
|
|
|
|
|
|
|
|
img = ui.NewImage(16, 16)
|
|
|
|
|
|
|
|
newt.uiImage = img
|
|
|
|
// newt.uiControl = img
|
|
|
|
|
|
|
|
return &newt
|
|
|
|
}
|
|
|
|
/*
|
2023-04-03 10:26:47 -05:00
|
|
|
if (a.Name == "image") {
|
2023-03-23 12:35:12 -05:00
|
|
|
log(true, "NewTextbox() trying to add a new image")
|
|
|
|
i := ui.NewImage(16, 16)
|
|
|
|
img, _, err := image.Decode(bytes.NewReader(rawImage))
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
nr, ok := img.(*image.RGBA)
|
|
|
|
if !ok {
|
|
|
|
i2 := image.NewRGBA(img.Bounds())
|
|
|
|
draw.Draw(i2, i2.Bounds(), img, img.Bounds().Min, draw.Src)
|
|
|
|
nr = i2
|
|
|
|
}
|
|
|
|
i.Append(nr)
|
|
|
|
t.uiBox.Append(i, true)
|
|
|
|
|
|
|
|
var img *ui.Image
|
|
|
|
var icon []byte
|
|
|
|
var imgA image.Image
|
|
|
|
|
|
|
|
icon, _ = res.ReadFile("resources/ping6.working.png")
|
|
|
|
// imgA, _, err := image.Decode(bytes.NewReader(b))
|
|
|
|
imgA, _, _ = image.Decode(icon)
|
|
|
|
img.Append(imgA)
|
|
|
|
img.Append(icon)
|
|
|
|
}
|
|
|
|
*/
|