andlabs: more things in the binary tree

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-27 10:24:52 -05:00
parent 46094b5a48
commit e370d22932
5 changed files with 25 additions and 84 deletions

View File

@ -36,7 +36,7 @@ func add(a toolkit.Action) {
p.newTab(n)
return
case toolkit.Label:
newLabel(&a)
p.newLabel(n)
return
case toolkit.Button:
p.newButton(n)
@ -48,10 +48,10 @@ func add(a toolkit.Action) {
p.newCheckbox(n)
return
case toolkit.Spinner:
newSpinner(&a)
p.newSpinner(n)
return
case toolkit.Slider:
newSlider(&a)
p.newSlider(n)
return
case toolkit.Dropdown:
newDropdown(&a)
@ -69,7 +69,7 @@ func add(a toolkit.Action) {
p.newBox(n)
return
case toolkit.Image:
newImage(&a)
p.newImage(n)
return
default:
log(debugError, "add() error TODO: ", n.WidgetType, n.Name)

View File

@ -1,30 +1,15 @@
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) {
log(debugToolkit, "newImage()", a.Name)
t := andlabs[a.ParentId]
if (t == nil) {
log(debugToolkit, "newImage() toolkit struct == nil. name=", a.Name)
listMap(debugToolkit)
}
newt := t.rawImage(a.Name)
place(a, t, newt)
}
// make new Image using andlabs/ui
func (t *andlabsT) rawImage(title string) *andlabsT {
var newt andlabsT
func (p *node) newImage(n *node) {
newt := new(andlabsT)
var img *ui.Image
newt.Name = title
newt.Name = n.Name
log(debugToolkit, "rawImage() create", newt.Name)
@ -33,7 +18,8 @@ func (t *andlabsT) rawImage(title string) *andlabsT {
newt.uiImage = img
// newt.uiControl = img
return &newt
n.tk = newt
p.place(n)
}
/*
if (a.Name == "image") {

View File

@ -3,30 +3,16 @@ package main
import (
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
"git.wit.org/wit/gui/toolkit"
)
func newLabel(a *toolkit.Action) {
var newt *andlabsT
log(debugToolkit, "NewLabel()", a.Name)
func (p *node) newLabel(n *node) {
log(logInfo, "NewLabel()", n.Name)
t := andlabs[a.ParentId]
if (t == nil) {
listMap(debugError)
log(debugError, "ERROR newLabel() listMap()")
log(debugError, "ERROR FFFFFFFFFFFF listMap()")
log(debugError, "ERROR FFFFFFFFFFFF listMap()")
return
}
log(debugToolkit, "NewLabel()", a.Name)
newt = new(andlabsT)
c := ui.NewLabel(a.Name)
newt := new(andlabsT)
c := ui.NewLabel(n.Name)
newt.uiLabel = c
newt.uiControl = c
place(a, t, newt)
n.tk = newt
p.place(n)
}

View File

@ -1,38 +1,22 @@
package main
import (
"git.wit.org/wit/gui/toolkit"
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
)
func (t *andlabsT) newSlider(a *toolkit.Action) *andlabsT {
var newt andlabsT
func (p *node) newSlider(n *node) {
newt := new(andlabsT)
s := ui.NewSlider(a.X, a.Y)
s := ui.NewSlider(n.X, n.Y)
newt.uiSlider = s
newt.uiControl = s
newt.WidgetType = toolkit.Slider
newt.wId = a.WidgetId
s.OnChanged(func(spin *ui.Slider) {
newt.i = newt.uiSlider.Value()
newt.doUserEvent()
})
return &newt
}
func newSlider(a *toolkit.Action) {
var newt *andlabsT
log(debugToolkit, "newSlider()", a.Name)
t := andlabs[a.ParentId]
if (t == nil) {
log(debugError, "newSlider() ERROR toolkit struct == nil. name=", a.Name)
return
}
newt = t.newSlider(a)
place(a, t, newt)
n.tk = newt
p.place(n)
}

View File

@ -1,37 +1,22 @@
package main
import (
"git.wit.org/wit/gui/toolkit"
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
)
func (t *andlabsT) newSpinner(a *toolkit.Action) *andlabsT {
var newt andlabsT
func (p *node) newSpinner(n *node) {
newt := new(andlabsT)
s := ui.NewSpinbox(a.X, a.Y)
s := ui.NewSpinbox(n.X, n.Y)
newt.uiSpinbox = s
newt.uiControl = s
newt.wId = a.WidgetId
newt.WidgetType = toolkit.Spinner
s.OnChanged(func(s *ui.Spinbox) {
newt.i = newt.uiSpinbox.Value()
newt.doUserEvent()
})
return &newt
}
func newSpinner(a *toolkit.Action) {
var newt *andlabsT
t := andlabs[a.ParentId]
if (t == nil) {
log(debugError, "NewSpinner() toolkit struct == nil. name=", a.Name)
return
}
newt = t.newSpinner(a)
place(a, t, newt)
n.tk = newt
p.place(n)
}