diff options
Diffstat (limited to 'node.go')
| -rw-r--r-- | node.go | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -1,17 +1,17 @@ package gui import ( + "go.wit.com/lib/widget" "go.wit.com/log" - "go.wit.com/gui/widget" ) /* - generic function to create a new node on the binary tree +generic function to create a new node on the binary tree - this is called each time you want a new widget - and it initializes basic default values +this is called each time you want a new widget +and it initializes basic default values - there isn't much to see here. +there isn't much to see here. */ func (n *Node) newNode(title string, t widget.WidgetType) *Node { var newN *Node @@ -42,7 +42,7 @@ func (n *Node) newNode(title string, t widget.WidgetType) *Node { } /* - raw create function for a new node struct and increments the counter +raw create function for a new node struct and increments the counter */ func addNode() *Node { n := new(Node) @@ -54,16 +54,20 @@ func addNode() *Node { } func (n *Node) Parent() *Node { - if ! n.Ready() { return n } + if !n.Ready() { + return n + } return n.parent } func (n *Node) Delete(d *Node) { - if ! n.Ready() { return } + if !n.Ready() { + return + } for i, child := range n.children { log.Log(NODE, "\t", i, child.id, child.progname) - if (child.id == d.id) { + if child.id == d.id { log.Log(NODE, "\t\t Deleting this") n.children = append(n.children[:i], n.children[i+1:]...) return |
