diff options
| author | Jeff Carr <[email protected]> | 2021-10-08 07:36:53 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2021-10-08 07:36:53 -0500 |
| commit | 44cd73f8e70beb436862aa0134a7c044f8e2ec7b (patch) | |
| tree | c1ae8e11430875a747b138928f3ca7806669fe41 /structs.go | |
| parent | 0c9547a066386f82f8e724c0f61c4d31dc5351e2 (diff) | |
NODE: going down a rabbit hole
Diffstat (limited to 'structs.go')
| -rw-r--r-- | structs.go | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -27,6 +27,7 @@ type GuiConfig struct { Exit func(*GuiWindow) depth int + counter int // used to make unique ID's } type GuiData struct { @@ -97,6 +98,13 @@ type GuiWindow struct { UiTab *ui.Tab // if this != nil, the window is 'tabbed' } +func (gw *GuiWindow) Dump() { + log.Println("gui.GuiWindow.Dump() Name = ", gw.Name) + log.Println("gui.GuiWindow.Dump() node = ", gw.node) + log.Println("gui.GuiWindow.Dump() Width = ", gw.Width) + log.Println("gui.GuiWindow.Dump() Height = ", gw.Height) +} + // GuiBox is any type of ui.Hbox or ui.Vbox // There can be lots of these for each GuiWindow type GuiBox struct { @@ -130,19 +138,32 @@ func (s GuiBox) SetTitle(title string) { return } +func (w *GuiWindow) SetNode(n *Node) { + if (w.node != nil) { + w.Dump() + panic("gui.SetNode() Error not nil") + } + w.node = n + if (w.node == nil) { + w.Dump() + panic("gui.SetNode() node == nil") + } +} + func (b *GuiBox) SetNode(n *Node) { if (b.node != nil) { b.Dump() - log.Println("gui.SetNode() Error not nil") - os.Exit(-1) + panic("gui.SetNode() Error not nil") } b.node = n if (b.node == nil) { b.Dump() - log.Println("gui.SetNode() node == nil") - os.Exit(-1) + panic("gui.SetNode() node == nil") } - b.Dump() +} + +func (w *GuiWindow) FindNode() *Node { + return w.node } func (b *GuiBox) FindNode() *Node { |
