summaryrefslogtreecommitdiff
path: root/tab.go
diff options
context:
space:
mode:
Diffstat (limited to 'tab.go')
-rw-r--r--tab.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/tab.go b/tab.go
index 5cdc0ad..0669cf6 100644
--- a/tab.go
+++ b/tab.go
@@ -10,20 +10,23 @@ import (
func (n *Node) NewTab(text string) *Node {
// check to make sure n is actually a window
+
if (n.WidgetType != toolkit.Window) {
// figure out what the actual window is
log(logError, "NewTab() is being requested on something that isn't a Window. node =", n)
- log(logError, "NewTab() parent", n.parent)
- return n.parent.NewTab(text)
- /*
- if (n.parent.WidgetType == toolkit.Window) {
- } else {
- if (n.parent.WidgetType == toolkit.Window) {
- return n.parent.NewTab(text)
+ if (n.parent == nil) {
// TODO: find a window. any window. never give up. never die.
+ log(logError, "NewTab() TODO: make a window here", n)
panic("NewTab did not get passed a window")
}
- */
+ log(logError, "NewTab() parent =", n.parent)
+ if (n.parent.WidgetType == toolkit.Root) {
+ // also broken
+ log(logError, "NewTab() TODO: make a window here", n)
+ panic("NewTab did not get passed a window")
+ }
+ // go up the binary tree until we find a window widget to add a tab too
+ return n.parent.NewTab(text)
}
newNode := n.newNode(text, toolkit.Tab, nil)