blob: 70a5d14ac17a6322ebace6d15352ac71b16821d8 (
plain)
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
|
package tree
import (
"go.wit.com/log"
"go.wit.com/widget"
)
func (n *Node) GetProgName() string {
return n.State.ProgName
}
/*
func (n *Node) GetValue() any {
return n.State.Value
}
*/
func (n *Node) Bool() bool {
return false // widget.GetBool(n.State.Value)
}
func (n *Node) CurrentS() string {
return n.State.CurrentS
}
func (n *Node) String() string {
switch n.WidgetType {
case widget.Button:
return n.State.Label
case widget.Window:
return n.State.Label
case widget.Checkbox:
return n.State.Label
case widget.Group:
return n.State.Label
case widget.Label:
return n.State.Label
case widget.Dropdown:
return n.State.CurrentS
case widget.Combobox:
return n.State.CurrentS
}
log.Log(TREE, "do not know how to do String() on widget type", n.WidgetType)
return ""
}
func (n *Node) ProgName() string {
return n.State.ProgName
}
func (n *Node) Hidden() bool {
return n.State.Hidden
}
/* avoid this function name as confusing
func (n *Node) GetText() string {
return widget.GetString(n.State.Value)
}
*/
/*
func (n *Node) SetValue(a any) {
n.State.Value = a
}
*/
func (n *Node) SetCurrentS(s string) {
n.State.CurrentS = s
}
func (n *Node) GetLabel() string {
return n.State.Label
}
|