summaryrefslogtreecommitdiff
path: root/json.go
blob: 68fe39823fb93466101c863f5e687311d994b32a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package tree

import (
	"fmt"

	"go.wit.com/log"
	"go.wit.com/lib/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
}