summaryrefslogtreecommitdiff
path: root/tree/json.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-17 22:23:01 -0600
committerJeff Carr <[email protected]>2024-01-17 22:23:01 -0600
commitbee272651ad38453aef27f098513f7be652c39bf (patch)
tree530d8f15a3210fc0762ebb1349d5835e6d818da5 /tree/json.go
parent841e6252c95244f0ee7faf2c01d33f69a8ab483a (diff)
make json toolkit for the web?v0.12.5
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'tree/json.go')
-rw-r--r--tree/json.go60
1 files changed, 60 insertions, 0 deletions
diff --git a/tree/json.go b/tree/json.go
new file mode 100644
index 0000000..2863408
--- /dev/null
+++ b/tree/json.go
@@ -0,0 +1,60 @@
+package tree
+
+import (
+ "fmt"
+
+ "go.wit.com/log"
+ "go.wit.com/gui/widget"
+)
+
+// makes a JSON version to pass to the toolkits ?
+// probably this should be in gui/toolkits/tree
+/*
+{"widget": {
+ "debug": "on",
+ "window": {
+ "title": "Sample Konfabulator Widget",
+ "name": "main_window",
+ "width": 500,
+ "height": 500
+ },
+ "image": {
+ "src": "Images/Sun.png",
+ "name": "sun1",
+ "hOffset": 250,
+ "vOffset": 250,
+ "alignment": "center"
+ },
+ "text": {
+ "data": "Click Here",
+ "size": 36,
+ "style": "bold",
+ "name": "text1",
+ "hOffset": 250,
+ "vOffset": 100,
+ "alignment": "center",
+ "onMouseUp": "sun1.opacity = (sun1.opacity / 100) * 90;"
+ }
+}}
+*/
+
+func (n *Node) Json() []string {
+ var all []string
+ switch n.WidgetType {
+ case widget.Checkbox:
+ case widget.Button:
+ case widget.Combobox:
+ case widget.Dropdown:
+ case widget.Textbox:
+ case widget.Spinner:
+ case widget.Slider:
+ case widget.Window:
+ tmp := fmt.Sprint("{ WidgetType :", n.WidgetType, "}")
+ all = append(all, tmp)
+ log.Warn(tmp)
+ return all
+ default:
+ log.Info("doUserEvent() type =", n.WidgetType)
+ }
+ return all
+}