summaryrefslogtreecommitdiff
path: root/redraw.go
blob: 7196baf29ff8cbd15ca66b92e13032432215008c (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
package gui

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

// This recreates the whole GUI for a plugin

// func (n *Node) ListChildren(dump bool, dropdown *Node, mapNodes map[string]*Node) {
func (n *Node) redraw(p *aplug) {
	if (n == nil) {
		return
	}

	n.redo(p)
	for _, child := range n.children {
		child.redraw(p)
	}
	return
}

func (n *Node) redo(plug *aplug) {
	log.Info("redo()", plug.name, n.id, n.WidgetType, n.progname)

	var a *widget.Action
	a = new(widget.Action)
	a.ProgName = n.progname
	a.Value = n.value

	a.ActionType = widget.Add
	a.WidgetType = n.WidgetType
	a.WidgetId = n.id

	// used for anything that needs a range
	a.X = n.X
	a.Y = n.Y

	// grid stuff
	a.AtW = n.AtW
	a.AtH = n.AtH

	if (n.parent == nil) {
		a.ParentId = 0
	} else {
		a.ParentId = n.parent.id
	}

	plug.pluginChan <- *a
	// sleep(.5)
}