2022-10-17 00:38:27 -05:00
|
|
|
package gui
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
2022-10-19 13:23:22 -05:00
|
|
|
// This function should make a new node with the parent and
|
|
|
|
// the 'tab' as a child
|
|
|
|
|
|
|
|
func (n *Node) NewTab(title string) *Node {
|
2022-10-20 06:55:42 -05:00
|
|
|
log.Println("gui.Node.NewTab() START name =", title)
|
2022-10-19 13:23:22 -05:00
|
|
|
|
2022-10-20 06:55:42 -05:00
|
|
|
// TODO: standardize these checks somewhere
|
|
|
|
if (n.toolkit == nil) {
|
2022-10-19 13:23:22 -05:00
|
|
|
n.Dump()
|
2022-10-20 06:55:42 -05:00
|
|
|
panic("NewTab() failed. toolkit == nil")
|
2022-10-19 13:23:22 -05:00
|
|
|
}
|
|
|
|
log.Println("Make new node")
|
|
|
|
newN := n.New(title)
|
2022-10-20 06:55:42 -05:00
|
|
|
log.Println("New tab to window")
|
|
|
|
t := n.toolkit.AddTab(title)
|
|
|
|
newN.toolkit = t
|
2022-10-19 13:23:22 -05:00
|
|
|
|
|
|
|
n.Append(newN)
|
|
|
|
return newN
|
|
|
|
}
|