2024-01-18 00:08:37 -06:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
|
2024-01-18 04:10:08 -06:00
|
|
|
"go.wit.com/widget"
|
2024-01-18 00:08:37 -06:00
|
|
|
)
|
|
|
|
|
2024-01-28 20:15:59 -06:00
|
|
|
/*
|
|
|
|
func (w *guiWidget) RealWidth() int {
|
2024-01-18 00:08:37 -06:00
|
|
|
if w.frame {
|
|
|
|
return w.gocuiSize.w1 - w.gocuiSize.w0
|
|
|
|
}
|
|
|
|
return w.gocuiSize.w1 - w.gocuiSize.w0 - 1
|
|
|
|
}
|
|
|
|
|
|
|
|
func (w *guiWidget) Height() int {
|
|
|
|
if w.frame {
|
|
|
|
return w.gocuiSize.h1 - w.gocuiSize.h0
|
|
|
|
}
|
|
|
|
return w.gocuiSize.h1 - w.gocuiSize.h0 - 1
|
|
|
|
}
|
2024-01-28 20:15:59 -06:00
|
|
|
*/
|
2024-01-18 00:08:37 -06:00
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
func (tk *guiWidget) gocuiSetWH(sizeW, sizeH int) {
|
|
|
|
w := len(widget.GetString(tk.value))
|
|
|
|
lines := strings.Split(widget.GetString(tk.value), "\n")
|
2024-01-18 00:08:37 -06:00
|
|
|
h := len(lines)
|
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
// tk := n.tk
|
2024-01-18 00:08:37 -06:00
|
|
|
if tk.isFake {
|
|
|
|
tk.gocuiSize.w0 = sizeW
|
|
|
|
tk.gocuiSize.h0 = sizeH
|
|
|
|
tk.gocuiSize.w1 = tk.gocuiSize.w0 + w + me.FramePadW
|
|
|
|
tk.gocuiSize.h1 = tk.gocuiSize.h0 + h + me.FramePadH
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if tk.frame {
|
|
|
|
tk.gocuiSize.w0 = sizeW
|
|
|
|
tk.gocuiSize.h0 = sizeH
|
|
|
|
tk.gocuiSize.w1 = tk.gocuiSize.w0 + w + me.FramePadW
|
|
|
|
tk.gocuiSize.h1 = tk.gocuiSize.h0 + h + me.FramePadH
|
|
|
|
} else {
|
|
|
|
tk.gocuiSize.w0 = sizeW - 1
|
|
|
|
tk.gocuiSize.h0 = sizeH - 1
|
|
|
|
tk.gocuiSize.w1 = tk.gocuiSize.w0 + w + 1
|
|
|
|
tk.gocuiSize.h1 = tk.gocuiSize.h0 + h + 1
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-29 23:01:39 -06:00
|
|
|
func (w *guiWidget) redoWindows(nextW int, nextH int) {
|
|
|
|
var startW int = nextW
|
|
|
|
var startH int = nextH
|
|
|
|
|
|
|
|
for _, child := range w.children {
|
|
|
|
if child.node.WidgetType != widget.Window {
|
2024-01-18 00:08:37 -06:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
2024-01-29 23:01:39 -06:00
|
|
|
child.frame = false
|
|
|
|
child.hasTabs = false
|
2024-01-18 00:08:37 -06:00
|
|
|
|
2024-01-29 23:01:39 -06:00
|
|
|
child.gocuiSetWH(nextW, nextH)
|
|
|
|
child.deleteView()
|
|
|
|
child.showView()
|
|
|
|
sizeW := child.gocuiSize.Width()
|
|
|
|
nextW += sizeW + 4
|
2024-01-30 03:17:15 -06:00
|
|
|
child.redoWindows(startW+3, startH+2)
|
2024-01-18 00:08:37 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-28 20:15:59 -06:00
|
|
|
/*
|
2024-01-28 02:20:31 -06:00
|
|
|
func (p *guiWidget) redoTabs(nextW int, nextH int) {
|
|
|
|
for _, w := range p.children {
|
|
|
|
if w.node.WidgetType != widget.Tab {
|
2024-01-18 00:08:37 -06:00
|
|
|
continue
|
|
|
|
}
|
|
|
|
w.frame = true
|
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
w.gocuiSetWH(nextW, nextH)
|
|
|
|
w.deleteView()
|
2024-01-18 00:08:37 -06:00
|
|
|
// setCurrentTab(n)
|
|
|
|
// if (len(w.cuiName) < 4) {
|
|
|
|
// w.cuiName = "abcd"
|
|
|
|
// }
|
|
|
|
|
2024-01-28 02:20:31 -06:00
|
|
|
w.showView()
|
2024-01-18 00:08:37 -06:00
|
|
|
|
|
|
|
sizeW := w.Width() + me.TabPadW
|
|
|
|
sizeH := w.Height()
|
2024-01-28 02:20:31 -06:00
|
|
|
log.Log(NOW, "redoTabs() start nextW,H =", nextW, nextH, "gocuiSize.W,H =", sizeW, sizeH, w.String())
|
2024-01-18 00:08:37 -06:00
|
|
|
nextW += sizeW
|
|
|
|
}
|
|
|
|
}
|
2024-01-28 20:15:59 -06:00
|
|
|
*/
|
2024-01-28 11:44:36 -06:00
|
|
|
|
2024-01-28 20:15:59 -06:00
|
|
|
/*
|
2024-01-28 11:44:36 -06:00
|
|
|
func (p *guiWidget) drawWindow(nextW int, nextH int) {
|
|
|
|
for _, w := range p.children {
|
|
|
|
w.frame = true
|
|
|
|
|
|
|
|
w.gocuiSetWH(nextW, nextH)
|
|
|
|
w.deleteView()
|
|
|
|
// setCurrentTab(n)
|
|
|
|
// if (len(w.cuiName) < 4) {
|
|
|
|
// w.cuiName = "abcd"
|
|
|
|
// }
|
|
|
|
|
|
|
|
w.showView()
|
|
|
|
|
2024-01-28 20:15:59 -06:00
|
|
|
sizeW := w.gocuiSize.Width() + me.TabPadW
|
|
|
|
sizeH := w.gocuiSize.Height()
|
2024-01-28 11:44:36 -06:00
|
|
|
log.Log(NOW, "redoTabs() start nextW,H =", nextW, nextH, "gocuiSize.W,H =", sizeW, sizeH, w.String())
|
|
|
|
nextW += sizeW
|
|
|
|
}
|
|
|
|
}
|
2024-01-28 20:15:59 -06:00
|
|
|
*/
|