summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2023-04-25 22:43:47 -0500
committerJeff Carr <[email protected]>2023-04-25 22:43:47 -0500
commit435b75b6e841ae981f6a98d2a0aaaafaedc2e170 (patch)
tree160cec5673b1497af1ae03558c396bdd2cb18bf6
parent55ea779640098ce71a5f36785634f4e22f3cd601 (diff)
gocui: more work on tabs
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--toolkit/gocui/tab.go24
1 files changed, 5 insertions, 19 deletions
diff --git a/toolkit/gocui/tab.go b/toolkit/gocui/tab.go
index 18f6ec7..ecaf5fd 100644
--- a/toolkit/gocui/tab.go
+++ b/toolkit/gocui/tab.go
@@ -60,8 +60,10 @@ func (w *cuiWidget) setTabWH() {
w.gocuiSize.w0 = me.rootNode.nextW
w.gocuiSize.h0 = me.rootNode.nextH
- w.realWidth = w.gocuiSize.width + me.FramePadW
- w.realHeight = w.gocuiSize.height + me.FramePadH
+ if w.frame {
+ w.realWidth = w.gocuiSize.width + me.FramePadW
+ w.realHeight = w.gocuiSize.height + me.FramePadH
+ }
// move the rootNode width over for the next window or tab
me.rootNode.nextW += w.gocuiSize.width + me.TabPadW
@@ -70,21 +72,6 @@ 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
-
- w.setWH()
- w.showWidgetPlacement(logNow, "setLabel:")
-}
-
func (w *cuiWidget) redoTabs(draw bool) {
if (w.widgetType == toolkit.Window) {
var tabs bool = false
@@ -97,11 +84,10 @@ func (w *cuiWidget) redoTabs(draw bool) {
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.setTabWH()
w.deleteView()
w.drawView()