summaryrefslogtreecommitdiff
path: root/redo/controls.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-21 09:51:05 -0400
committerPietro Gagliardi <[email protected]>2014-07-21 09:51:05 -0400
commitea5936855ff863cb4c30a36d6a9ab6628d0b5631 (patch)
treeb0104733d60aca38be4c070443941268c57130b4 /redo/controls.go
parent55db438d63b4ddf31b9c06541b20ef29c59044ac (diff)
Re-added Checkbox's interface specification (with th Request changes applied) and removed Combobox; I'm going to implement things in a different order now.
Diffstat (limited to 'redo/controls.go')
-rw-r--r--redo/controls.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/redo/controls.go b/redo/controls.go
index 7a002f0..e20c5eb 100644
--- a/redo/controls.go
+++ b/redo/controls.go
@@ -28,3 +28,26 @@ type Button interface {
func NewButton(text string) Button {
return newButton(text)
}
+
+// Checkbox is a clickable box that indicates some Boolean value.
+type Checkbox interface {
+ Control
+
+ // OnClicked sets the event handler for when the Checkbox is clicked (to change its toggle state).
+ // TODO change to OnCheckChanged or OnToggled?
+ OnClicked(func())
+
+ // Text and SetText are Requests that get and set the Checkbox's label text.
+ Text() string
+ SetText(text string)
+
+ // Checked and SetChecked get and set the Checkbox's check state.
+ Checked() bool
+ SetChecked(checked bool)
+}
+
+// NewCheckbox creates a new Checkbox with the given label text.
+// The Checkbox will be initially unchecked.
+func NewCheckbox(text string) Checkbox {
+ return newCheckbox(text)
+}