gocui: close to fixing tab coords
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
ab6ff31599
commit
a881d87108
|
@ -59,6 +59,7 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) {
|
||||||
}
|
}
|
||||||
log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text)
|
log(b, s1, s, w.widgetType, ",", w.name) // , "text=", w.text)
|
||||||
|
|
||||||
|
/*
|
||||||
if (w.realWidth != (w.gocuiSize.w1 - w.gocuiSize.w0)) {
|
if (w.realWidth != (w.gocuiSize.w1 - w.gocuiSize.w0)) {
|
||||||
log(b, "dump()", s,
|
log(b, "dump()", s,
|
||||||
"badsize()=(", w.realWidth, ",", w.realHeight, ")",
|
"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, ")",
|
"badreal()=(", w.gocuiSize.w0, ",", w.gocuiSize.h0, ",", w.gocuiSize.w1, ",", w.gocuiSize.h1, ")",
|
||||||
w.widgetType, ",", w.name)
|
w.widgetType, ",", w.name)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,32 +17,31 @@ func (w *cuiWidget) setStartWH() {
|
||||||
switch w.widgetType {
|
switch w.widgetType {
|
||||||
case toolkit.Root:
|
case toolkit.Root:
|
||||||
log(logInfo, "setStartWH() rootNode w.id =", w.id, "w.name", w.name)
|
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.isFake = true
|
||||||
w.setFake()
|
w.setFake()
|
||||||
w.showWidgetPlacement(logNow, "StartWH:")
|
w.showWidgetPlacement(logNow, "StartWH:")
|
||||||
return
|
return
|
||||||
case toolkit.Flag:
|
case toolkit.Flag:
|
||||||
w.startW = 1
|
|
||||||
w.startH = 1
|
|
||||||
w.isFake = true
|
w.isFake = true
|
||||||
w.setFake()
|
w.setFake()
|
||||||
w.showWidgetPlacement(logNow, "StartWH:")
|
w.showWidgetPlacement(logNow, "StartWH:")
|
||||||
return
|
return
|
||||||
case toolkit.Window:
|
case toolkit.Window:
|
||||||
w.startW = 1
|
|
||||||
w.startH = 3
|
|
||||||
w.setTabWH()
|
w.setTabWH()
|
||||||
w.showWidgetPlacement(logNow, "StartWH:")
|
w.showWidgetPlacement(logNow, "StartWH:")
|
||||||
return
|
return
|
||||||
case toolkit.Tab:
|
case toolkit.Tab:
|
||||||
w.startW = 1
|
|
||||||
w.startH = 3
|
|
||||||
w.setTabWH()
|
w.setTabWH()
|
||||||
w.showWidgetPlacement(logNow, "StartWH:")
|
w.showWidgetPlacement(logNow, "StartWH:")
|
||||||
return
|
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
|
p := w.parent
|
||||||
switch p.widgetType {
|
switch p.widgetType {
|
||||||
|
|
|
@ -51,31 +51,27 @@ func (w *cuiWidget) showWidgets() {
|
||||||
func (w *cuiWidget) setTabWH() {
|
func (w *cuiWidget) setTabWH() {
|
||||||
t := len(w.text)
|
t := len(w.text)
|
||||||
|
|
||||||
w.realWidth = t + me.buttonPadding
|
w.gocuiSize.width = t + me.buttonPadding
|
||||||
w.realHeight = me.defaultHeight
|
w.gocuiSize.height = me.defaultHeight
|
||||||
|
|
||||||
startW := 1
|
w.gocuiSize.startW = me.rootNode.startW
|
||||||
startH := 1
|
w.gocuiSize.startH = me.rootNode.startH
|
||||||
|
|
||||||
for _, child := range me.rootNode.children {
|
for _, child := range me.rootNode.children {
|
||||||
if (child.isFake) {
|
if (child.isFake) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (w == child) {
|
if (w == child) {
|
||||||
w.startW = startW
|
|
||||||
w.startH = startH
|
|
||||||
w.gocuiSize.startW = startW
|
|
||||||
w.gocuiSize.startH = startH
|
|
||||||
w.setWH()
|
w.setWH()
|
||||||
w.showWidgetPlacement(logNow, "setTABWH:")
|
w.showWidgetPlacement(logNow, "setTABWH:")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
startW += child.realWidth
|
w.gocuiSize.startW += child.realWidth
|
||||||
}
|
}
|
||||||
w.startW = startW
|
|
||||||
w.startH = startH
|
w.startW = me.rootNode.startW
|
||||||
w.gocuiSize.startW = startW
|
w.startH = me.rootNode.startH + me.buttonPadding
|
||||||
w.gocuiSize.startH = startH
|
|
||||||
w.setWH()
|
w.setWH()
|
||||||
w.showWidgetPlacement(logNow, "setTabWH:")
|
w.showWidgetPlacement(logNow, "setTabWH:")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue