2022-10-19 13:23:22 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
/*
|
|
|
|
generic function to create a new node on the binary tree
|
|
|
|
*/
|
|
|
|
func (n *Node) New(title string) *Node {
|
|
|
|
var newN *Node
|
|
|
|
|
|
|
|
newN = addNode(title, n.Width, n.Height)
|
|
|
|
|
|
|
|
n.Append(newN)
|
|
|
|
newN.parent = n
|
|
|
|
return newN
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
raw create function for a new node struct
|
|
|
|
*/
|
|
|
|
func addNode(title string, w int, h int) *Node {
|
|
|
|
var n Node
|
|
|
|
n.Name = title
|
|
|
|
n.Width = w
|
|
|
|
n.Height = h
|
|
|
|
|
2022-11-06 12:59:24 -06:00
|
|
|
// no longer a string
|
|
|
|
// id := Config.prefix + strconv.Itoa(Config.counter)
|
|
|
|
// n.id = id
|
|
|
|
|
|
|
|
n.id = Config.counter
|
2022-10-19 13:23:22 -05:00
|
|
|
Config.counter += 1
|
|
|
|
|
|
|
|
return &n
|
|
|
|
}
|