summaryrefslogtreecommitdiff
path: root/eventMouseClick.go
diff options
context:
space:
mode:
Diffstat (limited to 'eventMouseClick.go')
-rw-r--r--eventMouseClick.go81
1 files changed, 0 insertions, 81 deletions
diff --git a/eventMouseClick.go b/eventMouseClick.go
index 919ed87..787f00f 100644
--- a/eventMouseClick.go
+++ b/eventMouseClick.go
@@ -160,84 +160,3 @@ func click(g *gocui.Gui, v *gocui.View) error {
log.Log(GOCUI, "click() END gocui name:", v.Name())
return nil
}
-
-func findUnderMouse() *guiWidget {
- var widgets []*guiWidget
- var f func(w *guiWidget)
- w, h := me.baseGui.MousePosition()
-
- // find buttons that are below where the mouse button click
- f = func(widget *guiWidget) {
- // ignore widgets that are not visible
- if widget.Visible() {
- if (widget.gocuiSize.w0 <= w) && (w <= widget.gocuiSize.w1) &&
- (widget.gocuiSize.h0 <= h) && (h <= widget.gocuiSize.h1) {
- widgets = append(widgets, widget)
- }
- }
-
- for _, child := range widget.children {
- f(child)
- }
- }
- rootW := me.treeRoot.TK.(*guiWidget)
- f(rootW)
-
- // search through all the widgets that were below the mouse click
- var found *guiWidget
- for _, w := range widgets {
- // prioritize window buttons. This means if some code covers
- // up the window widgets, then it will ignore everything else
- // and allow the user (hopefully) to redraw or switch windows
- // TODO: display the window widgets on top
- if w.WidgetType == widget.Window {
- return w
- }
- }
-
- // return anything else that is interactive
- for _, w := range widgets {
- if w.WidgetType == widget.Button {
- return w
- }
- if w.WidgetType == widget.Combobox {
- return w
- }
- if w.WidgetType == widget.Checkbox {
- return w
- }
- w.showWidgetPlacement("findUnderMouse() found something unknown")
- found = w
- }
- // maybe something else was found
- return found
-}
-
-// find the widget under the mouse click
-func ctrlDown(g *gocui.Gui, v *gocui.View) error {
- var found *guiWidget
- // var widgets []*node
- // var f func (n *node)
- found = findUnderMouse()
- if me.ctrlDown == nil {
- setupCtrlDownWidget()
-
- var tk *guiWidget
- tk = me.ctrlDown.TK.(*guiWidget)
- tk.labelN = found.String()
- tk.cuiName = "ctrlDown"
- // me.ctrlDown.parent = me.rootNode
- }
- var tk *guiWidget
- tk = me.ctrlDown.TK.(*guiWidget)
- if found == nil {
- found = me.treeRoot.TK.(*guiWidget)
- }
- tk.labelN = found.String()
- newR := found.realGocuiSize()
- tk.gocuiSize.w0 = newR.w0
- tk.gocuiSize.h0 = newR.h0
- tk.gocuiSize.w1 = newR.w1
- tk.gocuiSize.h1 = newR.h1
- return nil
-}