summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/andlabs/add.go6
-rw-r--r--toolkit/andlabs/grid.go2
-rw-r--r--toolkit/andlabs/process.go72
-rw-r--r--toolkit/andlabs/structs.go6
-rw-r--r--toolkit/nocui/common.go6
-rw-r--r--toolkit/nocui/structs.go6
6 files changed, 21 insertions, 77 deletions
diff --git a/toolkit/andlabs/add.go b/toolkit/andlabs/add.go
index 9d40b4f..c25603d 100644
--- a/toolkit/andlabs/add.go
+++ b/toolkit/andlabs/add.go
@@ -108,12 +108,12 @@ func (p *node) place(n *node) bool {
switch p.WidgetType {
case toolkit.Grid:
log(debugGrid, "place() Grid try at Parent X,Y =", n.X, n.Y)
- n.tk.gridX = n.X
- n.tk.gridY = n.Y
+ n.tk.gridX = n.AtW - 1
+ n.tk.gridY = n.AtH - 1
log(debugGrid, "place() Grid try at gridX,gridY", n.tk.gridX, n.tk.gridY)
// at the very end, subtract 1 from X & Y since andlabs/ui starts counting at zero
p.tk.uiGrid.Append(n.tk.uiControl,
- n.tk.gridY - 1, n.tk.gridX - 1, 1, 1,
+ n.tk.gridY, n.tk.gridX, 1, 1,
false, ui.AlignFill, false, ui.AlignFill)
return true
case toolkit.Group:
diff --git a/toolkit/andlabs/grid.go b/toolkit/andlabs/grid.go
index 60e2ebf..8764962 100644
--- a/toolkit/andlabs/grid.go
+++ b/toolkit/andlabs/grid.go
@@ -19,8 +19,6 @@ func (p *node) newGrid(n *node) {
c := ui.NewGrid()
newt.uiGrid = c
newt.uiControl = c
- newt.gridX = 0
- newt.gridY = 0
n.tk = newt
p.place(n)
diff --git a/toolkit/andlabs/process.go b/toolkit/andlabs/process.go
deleted file mode 100644
index d70877e..0000000
--- a/toolkit/andlabs/process.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// myplugin/myplugin.go
-package main
-
-/*
-from chatgpt:
-
-// put this in widget.go
-import (
- "fmt"
- // "toolkit"
-)
-
-type Plugin interface {
- Process(input chan string, output chan string)
-}
-
-// put this in wit/gui/toolkit/*
-type myPlugin struct{}
-
-var Plugin myPlugin
-
-func (p *myPlugin) Process(input chan string, output chan string) {
- go func() {
- for msg := range input {
- // Your processing logic goes here
- result := fmt.Sprintf("Processed: %s", msg)
- output <- result
- }
- }()
-}
-
-// main.go put this in wit/gui
-package main
-
-import (
- "fmt"
- "plugin"
- "pluginapi"
-)
-
-func main() {
- plug, err := plugin.Open("myplugin.so")
- if err != nil {
- panic(err)
- }
-
- symPlugin, err := plug.Lookup("Plugin")
- if err != nil {
- panic(err)
- }
-
- p, ok := symPlugin.(pluginapi.Plugin)
- if !ok {
- panic("Invalid plugin type")
- }
-
- input := make(chan string)
- output := make(chan string)
-
- p.Process(input, output)
-
- input <- "Hello, World!"
- close(input)
-
- for result := range output {
- fmt.Println(result)
- }
-}
-
-*/
-
-// func main() {}
diff --git a/toolkit/andlabs/structs.go b/toolkit/andlabs/structs.go
index ac35183..c71732d 100644
--- a/toolkit/andlabs/structs.go
+++ b/toolkit/andlabs/structs.go
@@ -32,6 +32,12 @@ type node struct {
X int
Y int
+ // This is for the grid size & widget position
+ W int
+ H int
+ AtW int
+ AtH int
+
// the internal plugin toolkit structure
tk *andlabsT
}
diff --git a/toolkit/nocui/common.go b/toolkit/nocui/common.go
index e68308d..a012138 100644
--- a/toolkit/nocui/common.go
+++ b/toolkit/nocui/common.go
@@ -35,9 +35,15 @@ func addWidget(a *toolkit.Action) *node {
n.I = a.I
n.S = a.S
n.B = a.B
+
n.X = a.X
n.Y = a.Y
+ n.W = a.W
+ n.H = a.H
+ n.AtW = a.AtW
+ n.AtH = a.AtH
+
// store the internal toolkit information
n.tk = new(nocuiT)
diff --git a/toolkit/nocui/structs.go b/toolkit/nocui/structs.go
index ed004de..c3ece3b 100644
--- a/toolkit/nocui/structs.go
+++ b/toolkit/nocui/structs.go
@@ -27,6 +27,12 @@ type node struct {
X int
Y int
+ // This is for the grid size & widget position
+ W int
+ H int
+ AtW int
+ AtH int
+
// the internal plugin toolkit structure
tk *nocuiT
}