diff options
| author | Jeff Carr <[email protected]> | 2021-10-08 10:22:38 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-08 10:22:38 -0500 |
| commit | c59560da383f56bb1a86f02b7b4ecf7bca3bb588 (patch) | |
| tree | 888c34ff58ab27281b5e41f9afe5644c48fcf05f /box.go | |
| parent | 44cd73f8e70beb436862aa0134a7c044f8e2ec7b (diff) | |
NODE: going down a rabbit hole
Diffstat (limited to 'box.go')
| -rw-r--r-- | box.go | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -64,6 +64,38 @@ func add(box *GuiBox, newbox *GuiBox) { log.Println("gui.add() END") } +func (n *Node) NewBox(axis int, name string) *Node { + var newBox *GuiBox + var newNode *Node = n + + newBox = new(GuiBox) + // newBox.Window = newNode.uiWindow + newBox.Name = name + + if (n.box == nil) { + panic("node.newBox() box == nil") + } + if (n.box == nil) { + // add a box here + newBox.node = n + n.box = newBox + } else { + // make a new box & a new node + newNode = makeNode(n, name, 111, 112) + } + + var uiBox *ui.Box + if (axis == Xaxis) { + uiBox = ui.NewHorizontalBox() + } else { + uiBox = ui.NewVerticalBox() + } + uiBox.SetPadded(true) + newBox.UiBox = uiBox + add(n.box, newBox) + return newNode +} + func NewBox(box *GuiBox, axis int, name string) *GuiBox { log.Println("gui.NewBox() START") n := box.FindNode() |
