summaryrefslogtreecommitdiff
path: root/draw.go
diff options
context:
space:
mode:
Diffstat (limited to 'draw.go')
-rw-r--r--draw.go38
1 files changed, 38 insertions, 0 deletions
diff --git a/draw.go b/draw.go
new file mode 100644
index 0000000..db22fe2
--- /dev/null
+++ b/draw.go
@@ -0,0 +1,38 @@
+package main
+
+var toggle bool = true
+
+func (w *guiWidget) DrawAt(offsetW, offsetH int) {
+ w.setColor(&colorActiveW)
+ w.placeWidgets(offsetW, offsetH) // compute the sizes & places for each widget
+ w.active = false
+ w.showWidgets()
+}
+
+func (w *guiWidget) toggleTree() {
+ if toggle {
+ w.drawTree(toggle)
+ toggle = false
+ } else {
+ w.hideWidgets()
+ toggle = true
+ }
+}
+
+// display the widgets in the binary tree
+func (w *guiWidget) drawTree(draw bool) {
+ if w == nil {
+ return
+ }
+ w.showWidgetPlacement("drawTree()")
+ if draw {
+ // w.textResize()
+ w.showView()
+ } else {
+ w.deleteView()
+ }
+
+ for _, child := range w.children {
+ child.drawTree(draw)
+ }
+}