summaryrefslogtreecommitdiff
path: root/add.go
blob: c948b88da29be280f3be55bf37569aadfeb9c921 (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
71
72
package main

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

func add(a *widget.Action) {
	log.Warn("andlabs add()", a.WidgetId, a.State.ProgName)
	if a.WidgetType == widget.Root {
		if me.treeRoot == nil {
			me.treeRoot = me.myTree.AddNode(a)
		}
		return
	}
	// n := addNode(a)
	n := me.myTree.AddNode(a)

	p := n.Parent
	switch n.WidgetType {
	case widget.Window:
		log.Warn("SPEEDY Add window", n.WidgetId, n.GetProgName())
		newWindow(p, n)
		return
	case widget.Group:
		log.Warn("SPEEDY Add Group", n.WidgetId, n.GetProgName())
		newGroup(p, n)
		return
	case widget.Grid:
		newGrid(n)
		return
	case widget.Box:
		newBox(n)
		return
	/*
		case widget.Tab:
			newTab(n)
			return
	*/
	case widget.Label:
		newLabel(p, n)
		return
	case widget.Button:
		newButton(p, n)
		return
	case widget.Checkbox:
		newCheckbox(p, n)
		return
	case widget.Spinner:
		newSpinner(p, n)
		return
	case widget.Slider:
		newSlider(p, n)
		return
	case widget.Dropdown:
		newDropdown(p, n)
		return
	case widget.Combobox:
		newCombobox(p, n)
		return
	case widget.Textbox:
		newTextbox(p, n)
		return
	/*
		case widget.Image:
			newImage(p, n)
			return
	*/
	default:
		log.Log(ERROR, "add() error TODO: ", n.WidgetType, n.State.ProgName)
	}
}