summaryrefslogtreecommitdiff
path: root/click.go
diff options
context:
space:
mode:
Diffstat (limited to 'click.go')
-rw-r--r--click.go74
1 files changed, 20 insertions, 54 deletions
diff --git a/click.go b/click.go
index abb1ac9..431d27d 100644
--- a/click.go
+++ b/click.go
@@ -20,46 +20,42 @@ func (w *guiWidget) doWidgetClick() {
log.Log(NOW, "doWidgetClick() if this is the dropdown menu, handle it here?")
case widget.Window:
log.Log(NOW, "doWidgetClick() START on window", w.String())
- if me.currentWindow == w.node {
+ // if the user clicked on the current window, do nothing
+ /* Ignore this for now and redraw the window anyway
+ if me.currentWindow == w {
if !w.active {
return
}
}
+ */
+
+ // if there is a current window, hide it
if me.currentWindow != nil {
- var curw *guiWidget
- curw = me.currentWindow.TK.(*guiWidget)
- // curw.unsetCurrent()
- curw.setColor(&colorWindow)
- curw.hideWidgets()
+ me.currentWindow.setColor(&colorWindow)
+ me.currentWindow.hideWidgets()
+ me.currentWindow.isCurrent = false
}
- me.currentWindow = w.node
+ // now set this window as the current window
+ me.currentWindow = w
+ w.isCurrent = true
+
+ // draw the current window
log.Log(NOW, "doWidgetClick() set currentWindow to", w.String())
w.setColor(&colorActiveW)
-
+ w.DrawAt(3, 2)
+ w.placeWidgets(3, 2) // compute the sizes & places for each widget
w.active = false
- // w.dumpTree("before")
- w.placeWidgets(3, 2)
w.showWidgets()
-
- hideFake()
- showDebug = true
-
- // w.dumpTree("after")
+ /*
+ hideFake()
+ showDebug = true
+ */
case widget.Group:
- // n.placeWidgets(p.tk.startH, newH)
- // w.dumpTree("click start")
if w.active {
w.active = false
w.placeWidgets(w.startW, w.startH)
w.showWidgets()
- /*
- for _, child := range w.children {
- log.Log(INFO, "START W,H", startW, startH)
- child.placeWidgets(startW, startH)
- child.showWidgets()
- }
- */
} else {
w.active = true
for _, child := range w.children {
@@ -111,36 +107,6 @@ func (w *guiWidget) doWidgetClick() {
}
}
-var toggle bool = true
-
-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)
- }
-}
-
func click(g *gocui.Gui, v *gocui.View) error {
mouseW, mouseH := me.baseGui.MousePosition()