gocui: close to fixing tab coords

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2023-04-05 19:03:01 -05:00
parent ab6ff31599
commit a881d87108
3 changed files with 19 additions and 22 deletions

View File

@ -59,6 +59,7 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) {
}
log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text)
/*
if (w.realWidth != (w.gocuiSize.w1 - w.gocuiSize.w0)) {
log(b, "dump()", s,
"badsize()=(", w.realWidth, ",", w.realHeight, ")",
@ -71,4 +72,5 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) {
"badreal()=(", w.gocuiSize.w0, ",", w.gocuiSize.h0, ",", w.gocuiSize.w1, ",", w.gocuiSize.h1, ")",
w.widgetType, ",", w.name)
}
*/
}

View File

@ -17,32 +17,31 @@ func (w *cuiWidget) setStartWH() {
switch w.widgetType {
case toolkit.Root:
log(logInfo, "setStartWH() rootNode w.id =", w.id, "w.name", w.name)
w.startW = 1
w.startH = 1
w.id = 0
w.isFake = true
w.setFake()
w.showWidgetPlacement(logNow, "StartWH:")
return
case toolkit.Flag:
w.startW = 1
w.startH = 1
w.isFake = true
w.setFake()
w.showWidgetPlacement(logNow, "StartWH:")
return
case toolkit.Window:
w.startW = 1
w.startH = 3
w.setTabWH()
w.showWidgetPlacement(logNow, "StartWH:")
return
case toolkit.Tab:
w.startW = 1
w.startH = 3
w.setTabWH()
w.showWidgetPlacement(logNow, "StartWH:")
return
case toolkit.Box:
w.isFake = true
w.setFake()
w.showWidgetPlacement(logNow, "StartWH:")
case toolkit.Grid:
w.isFake = true
w.setFake()
w.showWidgetPlacement(logNow, "StartWH:")
}
p := w.parent
switch p.widgetType {

View File

@ -51,31 +51,27 @@ func (w *cuiWidget) showWidgets() {
func (w *cuiWidget) setTabWH() {
t := len(w.text)
w.realWidth = t + me.buttonPadding
w.realHeight = me.defaultHeight
w.gocuiSize.width = t + me.buttonPadding
w.gocuiSize.height = me.defaultHeight
startW := 1
startH := 1
w.gocuiSize.startW = me.rootNode.startW
w.gocuiSize.startH = me.rootNode.startH
for _, child := range me.rootNode.children {
if (child.isFake) {
continue
}
if (w == child) {
w.startW = startW
w.startH = startH
w.gocuiSize.startW = startW
w.gocuiSize.startH = startH
w.setWH()
w.showWidgetPlacement(logNow, "setTABWH:")
return
}
startW += child.realWidth
w.gocuiSize.startW += child.realWidth
}
w.startW = startW
w.startH = startH
w.gocuiSize.startW = startW
w.gocuiSize.startH = startH
w.startW = me.rootNode.startW
w.startH = me.rootNode.startH + me.buttonPadding
w.setWH()
w.showWidgetPlacement(logNow, "setTabWH:")
}