summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debug.go20
-rw-r--r--eventGocui.go4
-rw-r--r--eventMouseClick.go12
-rw-r--r--eventMouseDrag.go6
-rw-r--r--find.go10
5 files changed, 24 insertions, 28 deletions
diff --git a/debug.go b/debug.go
index dbcccc3..b782955 100644
--- a/debug.go
+++ b/debug.go
@@ -12,9 +12,9 @@ import (
)
func (w *guiWidget) dumpTree(s string) {
- // log.Log(ERROR, "dump w", w.node.WidgetId, w.WidgetType, w.String())
+ // log.Log(ERROR, "dump w", w.WidgetId(), w.WidgetType, w.String())
if w == nil {
- log.Log(ERROR, "dump w.TK == nil", w.node.WidgetId, w.node.WidgetType, w.String())
+ log.Log(ERROR, "dump w.TK == nil", w.WidgetId(), w.WidgetType(), w.String())
return
}
w.dumpWidget("dumpTree() " + s)
@@ -25,12 +25,12 @@ func (w *guiWidget) dumpTree(s string) {
}
func (w *guiWidget) dumpWindows(s string) {
- // log.Log(ERROR, "dump w", w.node.WidgetId, w.WidgetType, w.String())
+ // log.Log(ERROR, "dump w", w.WidgetId(), w.WidgetType, w.String())
if w == nil {
- log.Log(ERROR, "dump w.TK == nil", w.node.WidgetId, w.node.WidgetType, w.String())
+ log.Log(ERROR, "dump w.TK == nil", w.WidgetId(), w.WidgetType(), w.String())
return
}
- if w.node.WidgetType == widget.Window {
+ if w.WidgetType() == widget.Window {
s += fmt.Sprintf(" F(%d,%d)", w.force.w0, w.force.h0)
// can't set this here. doesn't work
// w.full.w0 = w.force.w0
@@ -50,12 +50,12 @@ func (tk *guiWidget) dumpWidget(s string) {
var pId int
// tk.verifyRect()
if tk.node.Parent == nil {
- log.Logf(WARN, "showWidgetPlacement() parent == nil wId=%d cuiName=%s", tk.node.WidgetId, tk.cuiName)
+ log.Logf(WARN, "showWidgetPlacement() parent == nil wId=%d cuiName=%s", tk.WidgetId(), tk.cuiName)
pId = 0
} else {
pId = tk.node.Parent.WidgetId
}
- s1 = fmt.Sprintf("(wId,pId)=(%4d,%4d) ", tk.node.WidgetId, pId)
+ s1 = fmt.Sprintf("(wId,pId)=(%4d,%4d) ", tk.WidgetId(), pId)
sizeW, sizeH := tk.Size()
hide := "S"
if tk.Hidden() {
@@ -81,10 +81,10 @@ func (tk *guiWidget) dumpWidget(s string) {
s1 += fmt.Sprintf(" %3s %3s ", "", "")
}
var end string
- if tk.node.WidgetType == widget.Box {
- end = fmt.Sprintf("%-8s %-8s %s %s", tk.node.WidgetType, tk.cuiName, tk.node.State.Direction.String(), tk.String())
+ if tk.WidgetType() == widget.Box {
+ end = fmt.Sprintf("%-8s %-8s %s %s", tk.WidgetType(), tk.cuiName, tk.node.State.Direction.String(), tk.String())
} else {
- end = fmt.Sprintf("%-8s %-8s %s", tk.node.WidgetType, tk.cuiName, tk.String())
+ end = fmt.Sprintf("%-8s %-8s %s", tk.WidgetType(), tk.cuiName, tk.String())
}
log.Log(GOCUI, s1, s, end)
}
diff --git a/eventGocui.go b/eventGocui.go
index 2708ca1..6527bba 100644
--- a/eventGocui.go
+++ b/eventGocui.go
@@ -1,10 +1,6 @@
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
// Use of this source code is governed by the GPL 3.0
-// Copyright 2014 The gocui Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
package main
import (
diff --git a/eventMouseClick.go b/eventMouseClick.go
index ed560a7..6cdffd4 100644
--- a/eventMouseClick.go
+++ b/eventMouseClick.go
@@ -9,7 +9,7 @@ import (
)
func (tk *guiWidget) doButtonClick() {
- if tk.node.IsEnabled() {
+ if tk.IsEnabled() {
tk.dumpWidget("click()") // enable this to debug widget clicks
me.myTree.SendFromUser(tk.node)
} else {
@@ -25,12 +25,12 @@ func doMouseClick(w int, h int) {
if me.dropdown.active || me.textbox.active {
// can't drag or do anything when dropdown or textbox are visible
for _, tk := range findByXY(w, h) {
- if tk.node.WidgetId == me.dropdown.wId {
+ if tk.WidgetId() == me.dropdown.wId {
log.Info("got dropdwon click", w, h, tk.cuiName)
tk.dropdownClicked(w, h)
return
}
- if tk.node.WidgetId == me.textbox.wId {
+ if tk.WidgetId() == me.textbox.wId {
log.Info("got textbox click", w, h, tk.cuiName)
textboxClosed()
return
@@ -58,7 +58,7 @@ func doMouseClick(w int, h int) {
// look in this window for widgets
// widgets have priority. send the click here first
for _, tk := range win.findByXYreal(w, h) {
- switch tk.node.WidgetType {
+ switch tk.WidgetType() {
case widget.Checkbox:
if tk.node.State.Checked {
log.Log(WARN, "checkbox is being set to false")
@@ -101,12 +101,12 @@ func doMouseDoubleClick(w int, h int) {
}
for _, tk := range findByXY(w, h) {
- if tk.node.WidgetType == widget.Window {
+ if tk.WidgetType() == widget.Window {
tk.makeWindowActive()
return
}
- if tk.node.WidgetType == widget.Stdout {
+ if tk.WidgetType() == widget.Stdout {
if me.stdout.outputOnTop {
me.stdout.outputOnTop = false
setThingsOnTop()
diff --git a/eventMouseDrag.go b/eventMouseDrag.go
index 4f4239a..5559fac 100644
--- a/eventMouseDrag.go
+++ b/eventMouseDrag.go
@@ -100,7 +100,7 @@ func (tk *guiWidget) setAsDragging() {
// this is how the window gets dragged around
func (tk *guiWidget) moveNew() {
w, h := me.baseGui.MousePosition()
- if tk.node.WidgetType == widget.Window {
+ if tk.WidgetType() == widget.Window {
tk.window.wasDragged = true
// compute the new location based off how far the mouse has moved
@@ -111,7 +111,7 @@ func (tk *guiWidget) moveNew() {
return
}
/*
- if tk.node.WidgetType == widget.Flag {
+ if tk.WidgetType() == widget.Flag {
me.baseGui.SetView(tk.cuiName, w-3, h-3, w+20, h+20, 0)
// tk.verifyRect()
s := fmt.Sprintf("move(%dx%d) %s ###", w, h, tk.cuiName)
@@ -119,7 +119,7 @@ func (tk *guiWidget) moveNew() {
return
}
*/
- if tk.node.WidgetType == widget.Stdout {
+ if tk.WidgetType() == widget.Stdout {
if me.mouse.resize {
newW := w - me.stdout.lastW
newH := h - me.stdout.lastH
diff --git a/find.go b/find.go
index 2fa7f89..8fb8318 100644
--- a/find.go
+++ b/find.go
@@ -61,7 +61,7 @@ func (tk *guiWidget) findByXYreal(w int, h int) []*guiWidget {
if tk.full.inRect(w, h) {
widgets = append(widgets, tk)
}
- // log.Log(GOCUI, "findByXY() found", widget.node.WidgetType, w, h)
+ // log.Log(GOCUI, "findByXY() found", widget.WidgetType(), w, h)
// }
// }
// tk.verifyRect()
@@ -84,7 +84,7 @@ func findWindows() []*guiWidget {
func (tk *guiWidget) findWindows() []*guiWidget {
var found []*guiWidget
- if tk.node.WidgetType == widget.Window {
+ if tk.WidgetType() == widget.Window {
found = append(found, tk)
}
@@ -98,8 +98,8 @@ func (tk *guiWidget) findWindows() []*guiWidget {
// This widget is always in the background and covers the whole screen.
// gocui seems to not return mouse events unless there is something there
func (tk *guiWidget) findBG() *guiWidget {
- if tk.node.WidgetType == widget.Stdout {
- if tk.node.WidgetId != me.stdout.wId {
+ if tk.WidgetType() == widget.Stdout {
+ if tk.WidgetId() != me.stdout.wId {
tk.isBG = true
return tk
}
@@ -202,7 +202,7 @@ func ctrlDown(g *gocui.Gui, v *gocui.View) error {
}
func (tk *guiWidget) findParentWindow() *guiWidget {
- if tk.node.WidgetType == widget.Window {
+ if tk.WidgetType() == widget.Window {
return tk
}
if tk.parent == nil {