summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-02-21 05:41:54 -0600
committerJeff Carr <[email protected]>2025-02-21 05:41:54 -0600
commit1cb395d4e29239a6d0c50ff37e16c143844dac75 (patch)
tree694038a2b1010e5b045855063e898c64bb71a725
parentf41728a81b2dec47cb826fab2acdaf2b9829f2f7 (diff)
start thinking about a raw grid widgetv0.22.29
-rw-r--r--Makefile2
-rw-r--r--table.go30
2 files changed, 23 insertions, 9 deletions
diff --git a/Makefile b/Makefile
index 83bbf8d..1728c7c 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ all:
@echo "It creates a binary tree of widgets (Windows, Buttons, etc)"
@echo "This is the interface to the GUI GO plugin (ncurses, GTK, etc)"
@echo
- @echo "todo: rewrite this using protobufs"
+ @echo "note: Feb 2025. this is experimental. being rewritten to use protobufs"
@echo
@make goimports vet
diff --git a/table.go b/table.go
index ee2eb94..df499b8 100644
--- a/table.go
+++ b/table.go
@@ -53,14 +53,27 @@ func RefreshTime(t *time.Duration) {
}
*/
-func NewTable(title string) *NodeTable {
+// shortcut. makes a window with just a grid in it
+func NewTableWindow(title string) *NodeTable {
t := new(NodeTable)
/*
t.pb = new(guipb.Table)
t.pb.Title = title
*/
- t.n = me.rootNode.newNode(title, widget.Table)
- t.n.label = title
+ t.tb = me.rootNode.newNode(title, widget.Table)
+ t.tb.label = title
+
+ return t
+}
+
+// makes a grid inside an existing Widget
+func (n *Node) NewTable(title string) *NodeTable {
+ t := new(NodeTable)
+
+ t.grid = n.RawGrid()
+
+ t.tb = t.grid.newNode(title, widget.Table)
+ t.tb.label = title
return t
}
@@ -71,8 +84,9 @@ type NodeColumn struct {
}
type NodeTable struct {
- n *Node
- // pb *guipb.Table
+ grid *Node
+ tb *Node
+ Custom func()
}
func ShowTable(pb *guipb.Table) {
@@ -130,7 +144,7 @@ func makeTableWidgets(pb *guipb.Table) {
pbwidget.Id = int64(label.id)
pbwidget.Name = v
r.Widgets = append(r.Widgets, pbwidget)
- log.Info("gui: added new string", pbwidget)
+ // log.Info("gui: added new string", pbwidget)
}
}
@@ -144,7 +158,7 @@ func makeTableWidgets(pb *guipb.Table) {
pbwidget.Id = int64(label.id)
pbwidget.Size = v
r.Widgets = append(r.Widgets, pbwidget)
- log.Info("gui: added new int", pbwidget)
+ // log.Info("gui: added new int", pbwidget)
}
}
@@ -163,7 +177,7 @@ func makeTableWidgets(pb *guipb.Table) {
}
pbwidget.Val = anyValue
r.Widgets = append(r.Widgets, pbwidget)
- log.Info("gui: added new val", pbwidget)
+ // log.Info("gui: added new val", pbwidget)
}
}
}