diff options
| author | Jeff Carr <[email protected]> | 2021-10-11 03:39:15 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-11 03:39:15 -0500 |
| commit | a915cecec02306363039c3ef32226670ec935b8d (patch) | |
| tree | 6e25b401bee16c110d90fd7905453c9480a3c5b1 | |
| parent | 38ad324ec0e715425be8fc58d73aec420e5acd95 (diff) | |
NODE: walking around in the rabbit hole
| -rw-r--r-- | new-structs.go | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/new-structs.go b/new-structs.go index d6741c4..397372c 100644 --- a/new-structs.go +++ b/new-structs.go @@ -2,6 +2,7 @@ package gui import ( "log" + "fmt" // "time" // "github.com/davecgh/go-spew/spew" @@ -212,16 +213,50 @@ func findByName(node *Node, name string) *Node { return nil } -func (parent *Node) AddTabNode(title string, n *Node) *Node { +// The parent Node needs to be the raw Window +// The 'stuff' Node needs to be the contents of the tab +// +// This function should make a new node with the parent and +// the 'stuff' Node as a child +func (parent *Node) AddTabNode(title string, b *GuiBox) *Node { // Ybox := gui.NewBox(box, gui.Yaxis, "Working Stuff") // var baseControl ui.Control // baseControl = Ybox.UiBox // return baseControl - parent.Dump() + var newNode *Node + // var newControl ui.Control - newNode := parent.makeNode(title, 444, 400 + Config.counter) + if (parent.box == nil) { + // TODO: fix this to use a blank box + uiC := parent.initBlankWindow() + newNode.uiControl = &uiC + panic("node.AddTabNode() can not add a tab if the box == nil") + } + if (parent.uiTab == nil) { + panic("node.AddTabNode() can not add a tab if parent.uiTab == nil") + } + + newNode = parent.makeNode(title, 444, 400 + Config.counter) newNode.uiTab = parent.uiTab + newNode.box = b + + /* + newControl = b.UiBox + newNode.uiTab.Append(title, newControl) + */ + newNode.uiTab.Append(title, b.UiBox) + + fmt.Println("") + log.Println("parent:") + parent.Dump() + + fmt.Println("") + log.Println("newNode:") + newNode.Dump() + + // panic("node.AddTabNode()") + return newNode } |
