summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-27 10:04:49 -0500
committerJeff Carr <[email protected]>2023-04-27 10:04:49 -0500
commitd5d11d9ca9c69e01715d191eb63ead18d8d7ff05 (patch)
treea8e9ef723dcd085a3ef8cc7bf529e2e217e6730e
parent6e52d306bf6fe15d00108b305b497a9722f491ca (diff)
andlabs: grid and checkbox to binary tree
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--toolkit/andlabs/add.go4
-rw-r--r--toolkit/andlabs/checkbox.go23
-rw-r--r--toolkit/andlabs/grid.go11
3 files changed, 18 insertions, 20 deletions
diff --git a/toolkit/andlabs/add.go b/toolkit/andlabs/add.go
index bca7aa9..4b2bc30 100644
--- a/toolkit/andlabs/add.go
+++ b/toolkit/andlabs/add.go
@@ -42,10 +42,10 @@ func add(a toolkit.Action) {
p.newButton(n)
return
case toolkit.Grid:
- newGrid(&a)
+ p.newGrid(n)
return
case toolkit.Checkbox:
- newCheckbox(&a)
+ p.newCheckbox(n)
return
case toolkit.Spinner:
newSpinner(&a)
diff --git a/toolkit/andlabs/checkbox.go b/toolkit/andlabs/checkbox.go
index d60b515..49096a1 100644
--- a/toolkit/andlabs/checkbox.go
+++ b/toolkit/andlabs/checkbox.go
@@ -1,20 +1,19 @@
package main
import (
- "git.wit.org/wit/gui/toolkit"
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
)
-func (t *andlabsT) newCheckbox(a *toolkit.Action) *andlabsT {
- var newt andlabsT
- log(debugToolkit, "newCheckbox()", a.Name, a.WidgetType)
- newt.WidgetType = a.WidgetType
- newt.wId = a.WidgetId
- newt.Name = a.Name
- newt.Text = a.Text
+func (p *node) newCheckbox(n *node) {
+ newt := new(andlabsT)
+ log(debugToolkit, "newCheckbox()", n.Name, n.WidgetType)
+ newt.WidgetType = n.WidgetType
+ newt.wId = n.WidgetId
+ newt.Name = n.Name
+ newt.Text = n.Text
- newt.uiCheckbox = ui.NewCheckbox(a.Text)
+ newt.uiCheckbox = ui.NewCheckbox(n.Text)
newt.uiControl = newt.uiCheckbox
newt.uiCheckbox.OnToggled(func(spin *ui.Checkbox) {
@@ -23,13 +22,15 @@ func (t *andlabsT) newCheckbox(a *toolkit.Action) *andlabsT {
newt.doUserEvent()
})
- return &newt
+ n.tk = newt
+ p.place(n)
}
func (t *andlabsT) checked() bool {
return t.uiCheckbox.Checked()
}
+/*
func newCheckbox(a *toolkit.Action) {
log(debugToolkit, "newCheckbox()", a.Name)
@@ -39,5 +40,5 @@ func newCheckbox(a *toolkit.Action) {
return
}
newt := t.newCheckbox(a)
- place(a, t, newt)
}
+*/
diff --git a/toolkit/andlabs/grid.go b/toolkit/andlabs/grid.go
index 61dea17..60e2ebf 100644
--- a/toolkit/andlabs/grid.go
+++ b/toolkit/andlabs/grid.go
@@ -3,8 +3,6 @@ package main
import (
"github.com/andlabs/ui"
_ "github.com/andlabs/ui/winmanifest"
-
- "git.wit.org/wit/gui/toolkit"
)
// Grid numbering by (X,Y)
@@ -12,19 +10,18 @@ import (
// -- (1,1) -- (2,1) -- (3,1) --
// -- (1,2) -- (2,1) -- (3,1) --
// -----------------------------
-func newGrid(a *toolkit.Action) {
+func (p *node) newGrid(n *node) {
var newt *andlabsT
- log(debugToolkit, "newGrid()", a.WidgetId, "to", a.ParentId)
+ log(debugToolkit, "newGrid()", n.WidgetId, "to", n.ParentId)
newt = new(andlabsT)
c := ui.NewGrid()
newt.uiGrid = c
newt.uiControl = c
- newt.WidgetType = toolkit.Grid
newt.gridX = 0
newt.gridY = 0
- t := andlabs[a.ParentId]
- place(a, t, newt)
+ n.tk = newt
+ p.place(n)
}