summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-07 16:51:17 -0400
committerPietro Gagliardi <[email protected]>2014-07-07 16:51:17 -0400
commit0c57837676eba65696a1e8175ff0b59ad1e00c37 (patch)
tree3e6f5ca235547450671180ee3bc339814282c5ee
parentc0c38ac8f5ded52f0db925ca7ca4bc6efedcb648 (diff)
Made event handler setters return a Request, implemented stubs on GTK+ so I can build a test, and made documentation consistent.
-rw-r--r--redo/controls.go8
-rw-r--r--redo/controls_unix.go5
-rw-r--r--redo/window.go4
-rw-r--r--redo/window_unix.go5
4 files changed, 14 insertions, 8 deletions
diff --git a/redo/controls.go b/redo/controls.go
index 3c750cb..bc4f823 100644
--- a/redo/controls.go
+++ b/redo/controls.go
@@ -15,15 +15,15 @@ type Control interface {
type Button interface {
Control
- // OnClicked sets the event handler for when the Button is clicked.
- OnClicked(func(d Doer))
+ // OnClicked creates a Request to set the event handler for when the Button is clicked.
+ OnClicked(func(d Doer)) *Request
- // Text and SetText are Requests that get and set the Button's label text.
+ // Text and SetText creates a Request that get and set the Button's label text.
Text() *Request
SetText(text string) *Request
}
-// NewButton returns a Request to create a new Button with the given label text.
+// NewButton creates a Request to create a new Button with the given label text.
func NewButton(text string) *Request {
return newButton(text)
}
diff --git a/redo/controls_unix.go b/redo/controls_unix.go
index 647e5ee..a091488 100644
--- a/redo/controls_unix.go
+++ b/redo/controls_unix.go
@@ -40,7 +40,10 @@ func newButton(text string) *Request {
}
}
-// TODO OnClicked
+func (b *Button) OnClicked(func e(c Doer)) *Request {
+ // TODO
+ return nil
+}
func (b *button) Text() *Request {
c := make(chan interface{})
diff --git a/redo/window.go b/redo/window.go
index 176239b..27160c2 100644
--- a/redo/window.go
+++ b/redo/window.go
@@ -22,11 +22,11 @@ type Window interface {
// Attempting to use a Window after it has been closed results in undefined behavior.
Close() *Request
- // OnClosing registers an event handler that is triggered when the user clicks the Window's close button.
+ // OnClosing creates a Request to register an event handler that is triggered when the user clicks the Window's close button.
// On systems where whole applications own windows, OnClosing is also triggered when the user asks to close the application.
// If this handler returns true, the Window is closed as defined by Close above.
// If this handler returns false, the Window is not closed.
- OnClosing(func(c Doer) bool)
+ OnClosing(func(c Doer) bool) *Request
// TODO SetSize (TODO remove?)
// TODO Center
diff --git a/redo/window_unix.go b/redo/window_unix.go
index f76c350..dddcad1 100644
--- a/redo/window_unix.go
+++ b/redo/window_unix.go
@@ -107,4 +107,7 @@ func (w *window) Close() *Request {
}
}
-// TODO OnClosing
+func (w *window) OnClosing(func e(c Doer) bool) *Request {
+ // TODO
+ return nil
+}