parent
d6f87e2edf
commit
89ef92e200
2
tab.go
2
tab.go
|
@ -16,6 +16,6 @@ func (n *Node) NewTab(text string) *Node {
|
|||
a.Text = text
|
||||
newaction(&a, newNode, n)
|
||||
|
||||
newBox := newNode.NewBox(text, true)
|
||||
newBox := newNode.NewBox(text + "tab hbox", true)
|
||||
return newBox
|
||||
}
|
||||
|
|
|
@ -24,7 +24,9 @@ func (w *cuiWidget) doWidgetClick() {
|
|||
w.redoBox(true)
|
||||
w.toggleTree()
|
||||
case toolkit.Grid:
|
||||
w.setParentLogical()
|
||||
w.gridBounds()
|
||||
w.setParentLogical()
|
||||
for _, child := range w.children {
|
||||
child.showWidgetPlacement(logNow, "gridBounds:")
|
||||
if (child.v == nil) {
|
||||
|
|
|
@ -7,26 +7,9 @@ import (
|
|||
var adjusted bool = false
|
||||
|
||||
// expands the logical size of the parents
|
||||
func (w *cuiWidget) setParentLogical(p *cuiWidget) {
|
||||
if (w.visable) {
|
||||
// expand the parent logicalsize to include the widget realSize
|
||||
if (p.logicalSize.w0 > w.realSize.w0) {
|
||||
p.logicalSize.w0 = w.realSize.w0
|
||||
adjusted = true
|
||||
}
|
||||
if (p.logicalSize.h0 > w.realSize.h0) {
|
||||
p.logicalSize.h0 = w.realSize.h0
|
||||
adjusted = true
|
||||
}
|
||||
if (p.logicalSize.w1 < w.realSize.w1) {
|
||||
p.logicalSize.w1 = w.realSize.w1
|
||||
adjusted = true
|
||||
}
|
||||
if (p.logicalSize.h1 < w.realSize.h1) {
|
||||
p.logicalSize.h1 = w.realSize.h1
|
||||
adjusted = true
|
||||
}
|
||||
} else {
|
||||
func (w *cuiWidget) setParentLogical() {
|
||||
p := w.parent
|
||||
if (w.isFake) {
|
||||
// expand the parent logicalsize to include the widget logicalsize
|
||||
if (p.logicalSize.w0 > w.logicalSize.w0) {
|
||||
p.logicalSize.w0 = w.logicalSize.w0
|
||||
|
@ -44,8 +27,26 @@ func (w *cuiWidget) setParentLogical(p *cuiWidget) {
|
|||
p.logicalSize.h1 = w.logicalSize.h1
|
||||
adjusted = true
|
||||
}
|
||||
} else {
|
||||
// expand the parent logicalsize to include the widget realSize
|
||||
if (p.logicalSize.w0 > w.realSize.w0) {
|
||||
p.logicalSize.w0 = w.realSize.w0
|
||||
adjusted = true
|
||||
}
|
||||
if (w.visable) {
|
||||
if (p.logicalSize.h0 > w.realSize.h0) {
|
||||
p.logicalSize.h0 = w.realSize.h0
|
||||
adjusted = true
|
||||
}
|
||||
if (p.logicalSize.w1 < w.realSize.w1) {
|
||||
p.logicalSize.w1 = w.realSize.w1
|
||||
adjusted = true
|
||||
}
|
||||
if (p.logicalSize.h1 < w.realSize.h1) {
|
||||
p.logicalSize.h1 = w.realSize.h1
|
||||
adjusted = true
|
||||
}
|
||||
}
|
||||
if (! w.isFake) {
|
||||
// adjust the widget realSize to the top left corner of the logicalsize
|
||||
if (w.logicalSize.w0 > w.realSize.w0) {
|
||||
w.realSize.w0 = w.logicalSize.w0
|
||||
|
@ -67,6 +68,6 @@ func (w *cuiWidget) setParentLogical(p *cuiWidget) {
|
|||
// pass the logical resizing up
|
||||
pP := w.parent
|
||||
if (pP != nil) {
|
||||
p.setParentLogical(pP)
|
||||
pP.setParentLogical()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,6 +141,7 @@ func (w *cuiWidget) moveTo(leftW int, topH int) {
|
|||
|
||||
func (w *cuiWidget) updateLogicalSizes() {
|
||||
for _, child := range w.children {
|
||||
// if (w.isReal)
|
||||
child.updateLogicalSizes()
|
||||
if (w.logicalSize.w0 > child.logicalSize.w0) {
|
||||
w.logicalSize.w0 = child.logicalSize.w0
|
||||
|
|
|
@ -49,7 +49,7 @@ func (w *cuiWidget) showWidgets() {
|
|||
}
|
||||
|
||||
func (w *cuiWidget) redoTabs(draw bool) {
|
||||
log(logNow, "redoTabs() START", w.name)
|
||||
log(logVerbose, "redoTabs() START", w.name)
|
||||
if (w == nil) {
|
||||
return
|
||||
}
|
||||
|
@ -59,45 +59,44 @@ func (w *cuiWidget) redoTabs(draw bool) {
|
|||
w.logicalSize.w1 = 0
|
||||
w.logicalSize.h1 = 0
|
||||
|
||||
w.nextW = 2
|
||||
w.nextH = 2
|
||||
w.nextW = 1
|
||||
w.nextH = 1
|
||||
}
|
||||
|
||||
log(logNow, "redoTabs() about to check for window and tab ", w.name)
|
||||
log(logVerbose, "redoTabs() about to check for window and tab ", w.name)
|
||||
w.text = w.name
|
||||
t := len(w.text)
|
||||
if ((w.widgetType == toolkit.Window) || (w.widgetType == toolkit.Tab)) {
|
||||
log(logNow, "redoTabs() in Window and Tab", w.name)
|
||||
w.realWidth = t + 2
|
||||
log(logVerbose, "redoTabs() in Window and Tab", w.name)
|
||||
w.realWidth = t + me.buttonPadding
|
||||
w.realHeight = me.defaultHeight
|
||||
|
||||
w.realSize.w0 = me.rootNode.logicalSize.w1
|
||||
w.realSize.h0 = 0
|
||||
w.realSize.w1 = w.realSize.w0 + w.realWidth
|
||||
w.realSize.h0 = 0
|
||||
w.realSize.h1 = w.realHeight
|
||||
|
||||
w.logicalSize.w0 = 0
|
||||
w.logicalSize.h0 = 0
|
||||
w.logicalSize.w1 = 0
|
||||
// start logical sizes windows and in the top left corner
|
||||
w.logicalSize.w0 = 2
|
||||
w.logicalSize.w1 = 2
|
||||
w.logicalSize.h0 = w.realHeight
|
||||
w.logicalSize.h1 = w.realHeight
|
||||
|
||||
// spaces right 1 space to next tab widget
|
||||
// spaces down 1 line to the next widget
|
||||
w.nextW = 2
|
||||
w.nextH = w.realHeight + 1
|
||||
// start all windows and in the top left corner
|
||||
w.nextW = w.logicalSize.w0
|
||||
w.nextH = w.logicalSize.h0
|
||||
|
||||
me.rootNode.logicalSize.w1 = w.realSize.w1 + 1
|
||||
me.rootNode.logicalSize.h1 = 0
|
||||
me.rootNode.logicalSize.w1 = w.realSize.w1
|
||||
me.rootNode.logicalSize.h1 = w.realSize.h1
|
||||
|
||||
w.deleteView()
|
||||
w.v = nil
|
||||
w.drawView()
|
||||
w.showWidgetPlacement(logNow, "redoTabs()")
|
||||
}
|
||||
|
||||
log(logNow, "redoTabs() about to for loop children", w.name)
|
||||
log(logVerbose, "redoTabs() about to for loop children", w.name)
|
||||
for _, child := range w.children {
|
||||
log(logNow, "redoTabs() got to child", child.name)
|
||||
log(logVerbose, "redoTabs() got to child", child.name)
|
||||
child.redoTabs(draw)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue