summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--action.go9
-rw-r--r--common.go2
-rw-r--r--watchdog.go30
-rw-r--r--window.go5
4 files changed, 43 insertions, 3 deletions
diff --git a/action.go b/action.go
index cc5a975..0eecda1 100644
--- a/action.go
+++ b/action.go
@@ -60,6 +60,13 @@ func sendAction(n *Node, atype widget.ActionType) {
defer n.mu.Unlock()
// log.Log(PLUG, "SENDING ACTION STRINGS n.Strings", n.strings, n.id, n.WidgetType, n.GetProgName())
+ if n.changed {
+ n.changed = false
+ } else {
+ // probably shouldn't even send this to the toolkits
+ // TODO: can't implement this yet
+ }
+
// this checks to see if the window is show in the toolkit. If it is not,
// then don't send any events. Unless it is a window widget, then send events
if n.WidgetType != widget.Window {
@@ -103,6 +110,8 @@ func sendAction(n *Node, atype widget.ActionType) {
a.State.Checked = n.checked
a.State.Visable = n.visable
+ // TODO: if visable == false here, return
+ a.State.Hidden = n.hidden
a.State.Pad = n.pad
a.State.Expand = n.expand
a.State.Borderless = n.borderless
diff --git a/common.go b/common.go
index 855c11c..500e64d 100644
--- a/common.go
+++ b/common.go
@@ -48,11 +48,11 @@ func (n *Node) Hide() *Node {
log.Log(CHANGE, "Hide() this needs to do TestDestroy() ?")
n.Destroy()
n.hidden = true
+ // n.visable = false
n.changed = true
return nil
}
- n.visable = false
n.hidden = true
n.changed = true
diff --git a/watchdog.go b/watchdog.go
index 02e7a2f..07a1dee 100644
--- a/watchdog.go
+++ b/watchdog.go
@@ -17,9 +17,37 @@ This goroutine can be used like a watchdog timer
*/
func Watchdog() {
var i = 1
+ /*
for {
log.Verbose("gui.Watchdog() is alive. give me something to do.", i)
- i += 1
time.Sleep(watchtime * time.Second / 10)
}
+ */
+ // check the four known things to see if they are all WORKING
+ myTicker(3*time.Second, "WATCHDOG", func() {
+ i += 1
+ log.Log(INFO, "myTicker() ticked", i)
+ })
+}
+
+func myTicker(t time.Duration, name string, f func()) {
+ ticker := time.NewTicker(t)
+ defer ticker.Stop()
+ done := make(chan bool)
+ /*
+ go func() {
+ time.Sleep(10 * time.Second)
+ done <- true
+ }()
+ */
+ for {
+ select {
+ case <-done:
+ log.Warn("gui.Watchdog() Done!")
+ return
+ case t := <-ticker.C:
+ log.Log(INFO, name, "Current time: ", t)
+ f()
+ }
+ }
}
diff --git a/window.go b/window.go
index f158206..d1ff8b7 100644
--- a/window.go
+++ b/window.go
@@ -77,14 +77,17 @@ func (n *Node) PixelSize(w, h int) *Node {
}
*/
+// when a window is redrawn, every widget in the window
+// needs to be sent to the toolkit
func (n *Node) TestDraw() {
if n == nil {
return
}
// enable and
- n.hidden = false
+ // n.hidden = false
n.changed = true
+ n.visable = true
log.Verbose("TestDraw() sending widget.Add", n.id, n.WidgetType, n.progname)
sendAction(n, widget.Add)