gocui: more work on tabs

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-25 22:43:47 -05:00
parent 092ac51f5e
commit 97079e936b
1 changed files with 5 additions and 19 deletions

View File

@ -60,8 +60,10 @@ func (w *cuiWidget) setTabWH() {
w.gocuiSize.w0 = me.rootNode.nextW w.gocuiSize.w0 = me.rootNode.nextW
w.gocuiSize.h0 = me.rootNode.nextH w.gocuiSize.h0 = me.rootNode.nextH
w.realWidth = w.gocuiSize.width + me.FramePadW if w.frame {
w.realHeight = w.gocuiSize.height + me.FramePadH 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 // move the rootNode width over for the next window or tab
me.rootNode.nextW += w.gocuiSize.width + me.TabPadW me.rootNode.nextW += w.gocuiSize.width + me.TabPadW
@ -70,21 +72,6 @@ func (w *cuiWidget) setTabWH() {
w.showWidgetPlacement(logNow, "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) { func (w *cuiWidget) redoTabs(draw bool) {
if (w.widgetType == toolkit.Window) { if (w.widgetType == toolkit.Window) {
var tabs bool = false var tabs bool = false
@ -97,11 +84,10 @@ func (w *cuiWidget) redoTabs(draw bool) {
if (tabs) { if (tabs) {
// window is tabs. Don't show it as a standard button // window is tabs. Don't show it as a standard button
w.frame = false w.frame = false
w.setLabel()
} else { } else {
w.frame = true w.frame = true
w.setTabWH()
} }
w.setTabWH()
w.deleteView() w.deleteView()
w.drawView() w.drawView()