summaryrefslogtreecommitdiff
path: root/andlabs/add.go
blob: c09ddf116b944b400dd9880fd12fc6de005410b6 (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
61
62
63
64
65
66
67
68
69
70
package main

import (
	"go.wit.com/log"
	"go.wit.com/gui/widget"
)

func actionDump(b bool, a *widget.Action) {
	log.Log(NOW, "actionDump() Widget.Type =", a.ActionType)
	log.Log(NOW, "actionDump() Widget.S =", a.S)
	log.Log(NOW, "actionDump() Widget.I =", a.I)
	log.Log(NOW, "actionDump() WidgetId =", a.WidgetId)
	log.Log(NOW, "actionDump() ParentId =", a.ParentId)
}

func add(a *widget.Action) {
	if (a.WidgetType == widget.Root) {
		me.rootNode = addNode(a)
		return
	}
	n := addNode(a)

	p := n.parent
	switch n.WidgetType {
	case widget.Window:
		newWindow(n)
		return
	case widget.Tab:
		p.newTab(n)
		return
	case widget.Label:
		p.newLabel(n)
		return
	case widget.Button:
		p.newButton(n)
		return
	case widget.Grid:
		p.newGrid(n)
		return
	case widget.Checkbox:
		p.newCheckbox(n)
		return
	case widget.Spinner:
		p.newSpinner(n)
		return
	case widget.Slider:
		p.newSlider(n)
		return
	case widget.Dropdown:
		p.newDropdown(n)
		return
	case widget.Combobox:
		p.newCombobox(n)
		return
	case widget.Textbox:
		p.newTextbox(n)
		return
	case widget.Group:
		p.newGroup(n)
		return
	case widget.Box:
		p.newBox(n)
		return
	case widget.Image:
		p.newImage(n)
		return
	default:
		log.Log(ERROR, "add() error TODO: ", n.WidgetType, n.Name)
	}
}