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
120
121
|
package main
import (
"go.wit.com/log"
// "go.wit.com/gui/widget"
)
var defaultBehavior bool = true
var bookshelf bool // do you want things arranged in the box like a bookshelf or a stack?
var canvas bool // if set to true, the windows are a raw canvas
var menubar bool // for windows
var stretchy bool // expand things like buttons to the maximum size
var padded bool // add space between things like buttons
var margin bool // add space around the frames of windows
var debugToolkit bool = false
var debugChange bool = false
var debugPlugin bool = false
var debugAction bool = false
var debugFlags bool = false
var debugGrid bool = false
var debugNow bool = true
var debugError bool = true
// This is important. This sets the defaults for the gui. Without this, there isn't correct padding, etc
func setDefaultBehavior(s bool) {
defaultBehavior = s
if (defaultBehavior) {
log.Log(NOW, "Setting this toolkit to use the default behavior.")
log.Log(NOW, "This is the 'guessing' part as defined by the wit/gui 'Principles'. Refer to the docs.")
stretchy = false
padded = true
menubar = true
margin = true
canvas = false
bookshelf = true // 99% of the time, things make a vertical stack of objects
} else {
log.Log(NOW, "This toolkit is set to ignore the default behavior.")
}
}
func (t *guiWidget) Dump(b bool) {
if ! b {
return
}
log.Log(NOW, "Name = ", t.Width, t.Height)
if (t.uiBox != nil) {
log.Log(NOW, "uiBox =", t.uiBox)
}
if (t.uiButton != nil) {
log.Log(NOW, "uiButton =", t.uiButton)
}
if (t.uiCombobox != nil) {
log.Log(NOW, "uiCombobox =", t.uiCombobox)
}
if (t.uiWindow != nil) {
log.Log(NOW, "uiWindow =", t.uiWindow)
}
if (t.uiTab != nil) {
log.Log(NOW, "uiTab =", t.uiTab)
}
if (t.uiGroup != nil) {
log.Log(NOW, "uiGroup =", t.uiGroup)
}
if (t.uiEntry != nil) {
log.Log(NOW, "uiEntry =", t.uiEntry)
}
if (t.uiMultilineEntry != nil) {
log.Log(NOW, "uiMultilineEntry =", t.uiMultilineEntry)
}
if (t.uiSlider != nil) {
log.Log(NOW, "uiSlider =", t.uiSlider)
}
if (t.uiCheckbox != nil) {
log.Log(NOW, "uiCheckbox =", t.uiCheckbox)
}
}
/*
func GetDebugToolkit () bool {
return debugToolkit
}
*/
func (n *node) dumpWidget(b bool) {
var info, d string
if (n == nil) {
log.Log(ERROR, "dumpWidget() node == nil")
return
}
info = n.WidgetType.String()
d = string(n.WidgetId) + " " + info + " " + n.progname
var tabs string
for i := 0; i < listChildrenDepth; i++ {
tabs = tabs + defaultPadding
}
log.Log(NOW, tabs + d)
}
var defaultPadding string = " "
var listChildrenDepth int = 0
func (n *node) listChildren(dump bool) {
if (n == nil) {
return
}
n.dumpWidget(dump)
if len(n.children) == 0 {
return
}
for _, child := range n.children {
listChildrenDepth += 1
child.listChildren(dump)
listChildrenDepth -= 1
}
}
|