summaryrefslogtreecommitdiff
path: root/new-structs.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2022-10-19 13:23:22 -0500
committerJeff Carr <[email protected]>2022-10-19 13:23:22 -0500
commitf3af1f5b7ff78b3f73d7510622fc9633dec36d35 (patch)
treee4868584d5e19942938aaa122b2e1cab377db000 /new-structs.go
parentf7b1036e544238d65b0e3ad46d08075aa4177032 (diff)
Refactor to 'gui/toolkit/'
* add a example cmds/consolemouse uses a console button to launch the andlabs/ui * fix wrong return value in toolkit/NewLabel() * redirect STDIN output to a file * wonderful fix of Window() exit * finally remove the ancient stupid variables x & y * phase out struct 'box' and use 'node' instead * better names for things: use NewFoo() and NewBar()
Diffstat (limited to 'new-structs.go')
-rw-r--r--new-structs.go75
1 files changed, 0 insertions, 75 deletions
diff --git a/new-structs.go b/new-structs.go
index fee1473..c05bf23 100644
--- a/new-structs.go
+++ b/new-structs.go
@@ -2,8 +2,6 @@ package gui
import (
"log"
- "fmt"
-// "reflect"
// "github.com/davecgh/go-spew/spew"
@@ -241,76 +239,3 @@ func (n *Node) ListChildren(dump bool) {
}
return
}
-
-// 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 (n *Node) AddTabNode(title string, b *GuiBox) *Node {
- var newNode *Node
- parent := n
-
- newNode = parent.makeNode(title, 444, 400 + Config.counter)
- newNode.uiTab = parent.uiTab
- newNode.box = b
-
- if (Config.DebugNode) {
- fmt.Println("")
- log.Println("parent:")
- parent.Dump()
-
- fmt.Println("")
- log.Println("newNode:")
- newNode.Dump()
- }
-
- if (newNode.uiTab == nil) {
- log.Println("wit/gui/ AddTabNode() Something went wrong tab == nil")
- // TODO: try to find the tab or window and make them if need be
- return newNode
- }
- newNode.uiTab.Append(title, b.UiBox)
-
- return newNode
-}
-
-func (n *Node) AddTab(title string, uiC *ui.Box) *Node {
- parent := n
- log.Println("gui.Node.AddTab() START name =", title)
- if parent.uiWindow == nil {
- parent.Dump()
- log.Println("gui.Node.AddTab() ERROR ui.Window == nil")
- return nil
- }
- if parent.box == nil {
- parent.Dump()
- panic("gui.AddTab() ERROR box == nil")
- }
- if parent.uiTab == nil {
- inittab := ui.NewTab() // no, not that 'inittab'
- parent.uiWindow.SetChild(inittab)
- parent.uiWindow.SetMargined(true)
- parent.uiTab = inittab
-
- // parent.Dump()
- // panic("gui.AddTab() ERROR uiTab == nil")
- }
-
- tab := parent.uiTab
- parent.uiWindow.SetMargined(true)
-
- if (uiC == nil) {
- hbox := ui.NewHorizontalBox()
- hbox.SetPadded(true)
- uiC = hbox
- }
- tab.Append(title, uiC)
-
- newNode := parent.makeNode(title, 555, 600 + Config.counter)
- newNode.uiTab = tab
- newNode.uiBox = uiC
- // panic("gui.AddTab() after makeNode()")
- tabSetMargined(newNode.uiTab)
- return newNode
-}