blob: a4752f67356edb43e0c00ec6eec4a3116a5f86a2 (
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
|
# Tree
Unlike Table, Tree can only store a set of a single data type. (Blame Windows.)
```go
type TreeData struct {
Checked bool
Image ImageIndex
Text string
Children []TreeData // TODO does this need to be *[]TreeData?
}
```
(the facilities for Images has yet to be designed)
Tree itself will operate similarly to Table:
```go
type Tree struct {
Control
sync.Locker // with Unlock() refreshing the view
Data() *[]TreeData
SetHasCheckboxes(bool)
SetHasImages(bool)
}
```
By default, a Tree only shows the Text field.
A Tree path is just an `[]int` with each element set to the consecutive index in Children. For example:
```go
i := []int{3, 4, 5}
value := tree.Data()[i[0]].Children[i[1]].Children[i[2]].Text
```
|