summaryrefslogtreecommitdiff
path: root/toolkit/andlabs/grid.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-03-03 14:41:38 -0600
committerJeff Carr <[email protected]>2023-03-03 14:41:38 -0600
commit49202eeafdad8e5780fefdad3d2f87fd4354725e (patch)
tree5d749b5d4835c7a0395bd1f87b5d2d1d91b14a08 /toolkit/andlabs/grid.go
parent80317ec89c94beadcbf3775f84c6010b5ceef302 (diff)
release as v0.6.5v0.6.5
good standard release really clean interaction to plugin really clean debug flags implementation common doAppend() idea, but it probably won't work re-implement combobox. this code base almost doesn't suck slider & spinner set values now tab set margin works convert dropdown to Send() lots of other changes to try to implement single line Entry() I guess use golang file names even though internalally the go developers use underscore chars in the actual go sources. Maybe there is a reason for that? go channel debug window does something make a debug window for channels. add sample icons Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'toolkit/andlabs/grid.go')
-rw-r--r--toolkit/andlabs/grid.go102
1 files changed, 102 insertions, 0 deletions
diff --git a/toolkit/andlabs/grid.go b/toolkit/andlabs/grid.go
new file mode 100644
index 0000000..8d09152
--- /dev/null
+++ b/toolkit/andlabs/grid.go
@@ -0,0 +1,102 @@
+package main
+
+import (
+ "github.com/andlabs/ui"
+ _ "github.com/andlabs/ui/winmanifest"
+
+ "git.wit.org/wit/gui/toolkit"
+)
+
+// Grid numbering by (X,Y)
+// -----------------------------
+// -- (1,1) -- (2,1) -- (3,1) --
+// -- (1,2) -- (2,1) -- (3,1) --
+// -----------------------------
+func newGrid(parentW *toolkit.Widget, w *toolkit.Widget) {
+ var newt *andlabsT
+ log(debugToolkit, "NewGrid()", w.Name)
+
+ t := mapToolkits[parentW]
+ if (t == nil) {
+ listMap(debugError)
+ log(debugError, "ERROR newGrid() listMap()")
+ log(debugError, "ERROR FFFFFFFFFFFF listMap()")
+ log(debugError, "ERROR FFFFFFFFFFFF listMap()")
+ return
+ }
+
+ log(debugToolkit, "NewGrid()", w.Name)
+ if t.broken() {
+ return
+ }
+
+ newt = new(andlabsT)
+
+ c := ui.NewGrid()
+ newt.uiGrid = c
+ newt.uiBox = t.uiBox
+ newt.tw = w
+ t.doAppend(newt, nil)
+ /*
+ if (defaultBehavior) {
+ t.uiBox.Append(c, stretchy)
+ }
+
+ button1 := ui.NewButton("a(0,0)")
+ c.Append(button1,
+ 0, 0, 1, 1,
+ false, ui.AlignFill, false, ui.AlignFill)
+
+ button2 := ui.NewButton("a(1,0)")
+ c.Append(button2,
+ 1, 0, 1, 1,
+ false, ui.AlignFill, false, ui.AlignFill)
+ */
+
+ // Append(child Control,
+ // left, top int,
+ // xspan, yspan int,
+ // hexpand bool, halign Align,
+ // vexpand bool, valign Align) {
+
+ mapWidgetsToolkits(w, newt)
+}
+
+func doGrid(p *toolkit.Widget, c *toolkit.Widget) {
+ if broken(c) {
+ return
+ }
+ if (c.Action == "New") {
+ newGrid(p, c)
+ return
+ }
+ ct := mapToolkits[c]
+ if (ct == nil) {
+ log(true, "Trying to do something on a widget that doesn't work or doesn't exist or something", c)
+ return
+ }
+ if ct.broken() {
+ log(true, "Grid() ct.broken", ct)
+ return
+ }
+ if (ct.uiGrid == nil) {
+
+ log(true, "Grid() uiGrid == nil", ct)
+ return
+ }
+ log(true, "Going to attempt:", c.Action)
+ switch c.Action {
+ case "Enable":
+ ct.uiGrid.Enable()
+ case "Disable":
+ ct.uiGrid.Disable()
+ case "Show":
+ ct.uiGrid.Show()
+ case "Hide":
+ ct.uiGrid.Hide()
+ case "Set":
+ log(true, "Can I use 'Set' to place a *Node in a Grid?")
+ default:
+ log(true, "Can't do", c.Action, "to a Grid")
+ }
+}