1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
package main
// implements widgets 'Window' and 'Tab'
import (
"git.wit.org/wit/gui/toolkit"
// "github.com/awesome-gocui/gocui"
)
func (w *cuiWidget) hideWidgets() {
switch w.widgetType {
case toolkit.Root:
case toolkit.Flag:
case toolkit.Window:
case toolkit.Tab:
case toolkit.Box:
case toolkit.Grid:
default:
w.deleteView()
}
for _, child := range w.children {
child.hideWidgets()
}
}
func (w *cuiWidget) hideFake() {
if (w.isFake) {
w.deleteView()
}
for _, child := range w.children {
child.hideFake()
}
}
func (w *cuiWidget) showFake() {
if (w.isFake) {
w.drawView()
}
for _, child := range w.children {
child.showFake()
}
}
func (w *cuiWidget) showWidgets() {
w.drawView()
for _, child := range w.children {
child.showWidgets()
}
}
func (w *cuiWidget) setTabWH() {
t := len(w.text)
w.gocuiSize.width = t + me.buttonPadding
w.gocuiSize.height = me.defaultHeight
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.setWH()
w.showWidgetPlacement(logNow, "setTABWH:")
return
}
w.gocuiSize.startW += child.realWidth
}
w.startW = me.rootNode.startW
w.startH = me.rootNode.startH + me.buttonPadding
w.setWH()
w.showWidgetPlacement(logNow, "setTabWH:")
}
func (w *cuiWidget) redoTabs(draw bool) {
if (w == nil) {
return
}
log(logVerbose, "redoTabs() START 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(logVerbose, "redoTabs() in Window and Tab", w.name)
w.realWidth = t + me.buttonPadding
w.realHeight = me.defaultHeight
w.gocuiSize.w0 = me.rootNode.logicalSize.w1
w.gocuiSize.w1 = w.gocuiSize.w0 + w.realWidth
w.gocuiSize.h0 = 0
w.gocuiSize.h1 = w.realHeight
// 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
// start all windows and in the top left corner
w.nextW = w.logicalSize.w0
w.nextH = w.logicalSize.h0
me.rootNode.logicalSize.w1 = w.gocuiSize.w1
me.rootNode.logicalSize.h1 = w.gocuiSize.h1
w.deleteView()
w.drawView()
w.showWidgetPlacement(logNow, "redoTabs()")
}
log(logVerbose, "redoTabs() about to for loop children", w.name)
for _, child := range w.children {
log(logVerbose, "redoTabs() got to child", child.name)
child.redoTabs(draw)
}
}
|