diff options
| author | Jeff Carr <[email protected]> | 2021-10-27 16:31:54 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-27 16:31:54 -0500 |
| commit | 81c44bce5313d4415a0fa062ececc4547832d66d (patch) | |
| tree | 050d019f1f80587d9112a1a7d18e6994707fd7dc /window.go | |
| parent | 10e13423db08e282a1f41c2f38f348d630cfca96 (diff) | |
REFACTOR: moving around things in the rabbit hole
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'window.go')
| -rw-r--r-- | window.go | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -77,12 +77,12 @@ func (n *Node) Add(e Element) *Node { } */ +/* // // Create a new node // if parent == nil, that means it is a new window and needs to be put // in the window map (aka Data.NodeMap) // -/* func (parent *Node) addNode(title string) *Node { var node Node node.Name = title @@ -147,6 +147,21 @@ func (parent *Node) makeNode(title string, x int, y int) *Node { return &node } +func (parent *Node) AddNode(title string) *Node { + var node Node + node.Name = title + node.Width = parent.Width + node.Height = parent.Height + + id := Config.prefix + strconv.Itoa(Config.counter) + Config.counter += 1 + node.id = id + + parent.Append(&node) + node.parent = parent + return &node +} + func (n *Node) uiNewWindow(title string, x int, y int) { w := ui.NewWindow(title, x, y, false) w.SetBorderless(false) |
