diff options
Diffstat (limited to 'toolkit/gocui/tab.go')
| -rw-r--r-- | toolkit/gocui/tab.go | 42 |
1 files changed, 41 insertions, 1 deletions
diff --git a/toolkit/gocui/tab.go b/toolkit/gocui/tab.go index cc00b6c..80447aa 100644 --- a/toolkit/gocui/tab.go +++ b/toolkit/gocui/tab.go @@ -72,8 +72,48 @@ func (w *cuiWidget) setTabWH() { w.showWidgetPlacement(logNow, "setTabWH:") } +func (w *cuiWidget) setLabel() { + // set the start and size of the tab gocui button + t := len(w.text) + w.gocuiSize.width = t + me.buttonPadding + w.gocuiSize.height = 2 + w.gocuiSize.w0 = me.rootNode.nextW + w.gocuiSize.h0 = me.rootNode.nextH + + // move the rootNode width over for the next window or tab + me.rootNode.nextW += w.gocuiSize.width + me.padW + + w.startW = me.rawW + w.startH = me.rawH + w.nextW = me.rawW + w.nextH = me.rawH + + w.setWH() + w.showWidgetPlacement(logNow, "setLabel:") +} + func (w *cuiWidget) redoTabs(draw bool) { - if ((w.widgetType == toolkit.Window) || (w.widgetType == toolkit.Tab)) { + if (w.widgetType == toolkit.Window) { + var tabs bool = false + // figure out if the window is just a bunch of tabs + for _, child := range w.children { + if (child.widgetType == toolkit.Tab) { + tabs = true + } + } + if (tabs) { + // window is tabs. Don't show it as a standard button + w.frame = false + w.setLabel() + } else { + w.frame = true + w.setTabWH() + } + + w.deleteView() + w.drawView() + } + if (w.widgetType == toolkit.Tab) { w.deleteView() w.drawView() } |
