gocui: store more in w.gocuiSize.
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
cd8ddbc767
commit
ab6ff31599
|
@ -47,9 +47,9 @@ func (w *cuiWidget) showWidgetPlacement(b bool, s string) {
|
||||||
}
|
}
|
||||||
s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.id, pId)
|
s1 = fmt.Sprintf("(wId,pId)=(%2d,%2d) ", w.id, pId)
|
||||||
s1 += fmt.Sprintf("W,H()=(%2d,%2d) ", w.startW, w.startH)
|
s1 += fmt.Sprintf("W,H()=(%2d,%2d) ", w.startW, w.startH)
|
||||||
s1 += fmt.Sprintf("size()=(%2d,%2d) ", w.realWidth, w.realHeight)
|
s1 += fmt.Sprintf("gocui()=(%2d,%2d,%2d,%2d,%2d,%2d) ",
|
||||||
s1 += fmt.Sprintf("gocui()=(%2d,%2d,%2d,%2d) ", w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
|
w.gocuiSize.startW, w.gocuiSize.startH,
|
||||||
|
w.gocuiSize.w0, w.gocuiSize.h0, w.gocuiSize.w1, w.gocuiSize.h1)
|
||||||
switch w.widgetType {
|
switch w.widgetType {
|
||||||
case toolkit.Grid:
|
case toolkit.Grid:
|
||||||
s1 += fmt.Sprintf("next()=(%2d,%2d)", w.nextW, w.nextH)
|
s1 += fmt.Sprintf("next()=(%2d,%2d)", w.nextW, w.nextH)
|
||||||
|
|
|
@ -15,8 +15,11 @@ func (w *cuiWidget) setFake() {
|
||||||
// setup fake labels for non-visable things off screen
|
// setup fake labels for non-visable things off screen
|
||||||
w.realWidth = t + 2
|
w.realWidth = t + 2
|
||||||
w.realHeight = me.defaultHeight
|
w.realHeight = me.defaultHeight
|
||||||
w.startW = fakeStartWidth
|
|
||||||
w.startH = fakeStartHeight
|
w.gocuiSize.width = t + 2
|
||||||
|
w.gocuiSize.height = me.defaultHeight
|
||||||
|
w.gocuiSize.startW = fakeStartWidth
|
||||||
|
w.gocuiSize.startH = fakeStartHeight
|
||||||
|
|
||||||
fakeStartHeight += 3
|
fakeStartHeight += 3
|
||||||
if (fakeStartHeight > 24) {
|
if (fakeStartHeight > 24) {
|
||||||
|
@ -194,10 +197,10 @@ func (w *cuiWidget) redoBox(draw bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *cuiWidget) setWH() {
|
func (w *cuiWidget) setWH() {
|
||||||
w.gocuiSize.w0 = w.startW
|
w.gocuiSize.w0 = w.gocuiSize.startW
|
||||||
w.gocuiSize.h0 = w.startH
|
w.gocuiSize.h0 = w.gocuiSize.startH
|
||||||
w.gocuiSize.w1 = w.gocuiSize.w0 + w.realWidth
|
w.gocuiSize.w1 = w.gocuiSize.w0 + w.gocuiSize.width
|
||||||
w.gocuiSize.h1 = w.gocuiSize.h0 + w.realHeight
|
w.gocuiSize.h1 = w.gocuiSize.h0 + w.gocuiSize.height
|
||||||
|
|
||||||
w.logicalSize.w0 = w.gocuiSize.w0
|
w.logicalSize.w0 = w.gocuiSize.w0
|
||||||
w.logicalSize.h0 = w.gocuiSize.h0
|
w.logicalSize.h0 = w.gocuiSize.h0
|
||||||
|
|
|
@ -65,6 +65,14 @@ var (
|
||||||
// the logical size of the widget
|
// the logical size of the widget
|
||||||
// corner starts at in the upper left corner
|
// corner starts at in the upper left corner
|
||||||
type rectType struct {
|
type rectType struct {
|
||||||
|
// where the widget should calculate it's existance from
|
||||||
|
startW int
|
||||||
|
startH int
|
||||||
|
|
||||||
|
// the actual size
|
||||||
|
width int
|
||||||
|
height int
|
||||||
|
|
||||||
// this is the gocui way
|
// this is the gocui way
|
||||||
w0, h0, w1, h1 int // left top right bottom
|
w0, h0, w1, h1 int // left top right bottom
|
||||||
}
|
}
|
||||||
|
@ -90,7 +98,7 @@ type cuiWidget struct {
|
||||||
// visable bool // track if it's currently supposed to be shown
|
// visable bool // track if it's currently supposed to be shown
|
||||||
isFake bool // widget types like 'box' are 'false'
|
isFake bool // widget types like 'box' are 'false'
|
||||||
|
|
||||||
// where the widget should calculate it's existance from
|
// where the widget should add children
|
||||||
startW int
|
startW int
|
||||||
startH int
|
startH int
|
||||||
|
|
||||||
|
|
|
@ -59,12 +59,13 @@ func (w *cuiWidget) setTabWH() {
|
||||||
|
|
||||||
for _, child := range me.rootNode.children {
|
for _, child := range me.rootNode.children {
|
||||||
if (child.isFake) {
|
if (child.isFake) {
|
||||||
w.showWidgetPlacement(logNow, "SETTABWH:")
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if (w == child) {
|
if (w == child) {
|
||||||
w.startW = startW
|
w.startW = startW
|
||||||
w.startH = startH
|
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
|
||||||
|
@ -73,6 +74,8 @@ func (w *cuiWidget) setTabWH() {
|
||||||
}
|
}
|
||||||
w.startW = startW
|
w.startW = startW
|
||||||
w.startH = startH
|
w.startH = startH
|
||||||
|
w.gocuiSize.startW = startW
|
||||||
|
w.gocuiSize.startH = startH
|
||||||
w.setWH()
|
w.setWH()
|
||||||
w.showWidgetPlacement(logNow, "setTabWH:")
|
w.showWidgetPlacement(logNow, "setTabWH:")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue