diff options
| author | Pietro Gagliardi <[email protected]> | 2015-12-11 20:37:59 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2015-12-11 20:37:59 -0500 |
| commit | f8e3f12ab02b528f2a05a4f713d7af7ea8e44b42 (patch) | |
| tree | 82dedf4d37f0f6d31e88ebb2ca1ce6499dead261 /prev/proposals/tree.md | |
| parent | e34c561ed5bedeb180437ec165882b98d70d38c1 (diff) | |
LET'S GET THIS FINAL REWRITE EVER STARTED
Diffstat (limited to 'prev/proposals/tree.md')
| -rw-r--r-- | prev/proposals/tree.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/prev/proposals/tree.md b/prev/proposals/tree.md new file mode 100644 index 0000000..a4752f6 --- /dev/null +++ b/prev/proposals/tree.md @@ -0,0 +1,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 +``` |
