diff options
Diffstat (limited to 'tab.go')
| -rw-r--r-- | tab.go | 65 |
1 files changed, 7 insertions, 58 deletions
@@ -2,76 +2,25 @@ package gui import ( "log" - "os" - - "github.com/andlabs/ui" - _ "github.com/andlabs/ui/winmanifest" ) -// import toolkit "git.wit.org/wit/gui/toolkit/andlabs" - // This function should make a new node with the parent and // the 'tab' as a child func (n *Node) NewTab(title string) *Node { - log.Println("gui.Node.AddTab() START name =", title) - - return n.AddTabNew(title) -} + log.Println("gui.Node.NewTab() START name =", title) -func (n *Node) AddTabNew(title string) *Node { - log.Println("gui.Node.AddTab() START name =", title) - - if (n.Toolkit == nil) { - log.Println("FUCK TOOLKIT nil uiWindow =", n.uiWindow) - log.Println("FUCK TOOLKIT nil uiTab =", n.uiTab) - log.Println("FUCK TOOLKIT nil Toolkit =", n.Toolkit) - // return n.AddTab(title) // need to make a toolkit here + // TODO: standardize these checks somewhere + if (n.toolkit == nil) { n.Dump() - os.Exit(0) + panic("NewTab() failed. toolkit == nil") } log.Println("Make new node") newN := n.New(title) - log.Println("Add tab to window") - t := n.Toolkit.AddTab(title) - newN.Toolkit = t + log.Println("New tab to window") + t := n.toolkit.AddTab(title) + newN.toolkit = t n.Append(newN) return newN } - -func (n *Node) AddTab(title string, uiC *ui.Box) *Node { - return n.AddTabNew(title) -} -/* -func (n *Node) AddTabBAD(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.uiTab == nil { - inittab := ui.NewTab() // no, not that 'inittab' - parent.uiWindow.SetChild(inittab) - parent.uiWindow.SetMargined(true) - parent.uiTab = inittab - } - tab := parent.uiTab - parent.uiWindow.SetMargined(true) - - if (uiC == nil) { - hbox := ui.NewHorizontalBox() - hbox.SetPadded(true) - uiC = hbox - } - tab.Append(title, uiC) - - newNode := n.New(title) - newNode.uiTab = tab - newNode.uiBox = uiC - // tabSetMargined(newNode.uiTab) - return newNode -} -*/ |
