summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-02-15 15:51:06 -0500
committerPietro Gagliardi <[email protected]>2014-02-15 15:51:06 -0500
commit558c618fbf6e8a1db88ca929531d654cb49a2b60 (patch)
tree18efd030daae421308beac264c54720eb0b98f2f
parentc20e3a261195889029d71e9490674fe48104a170 (diff)
Gave all relevant controls matching SetText()/Text() pairs. Also added a TODO for Checkbox related to checked state.
-rw-r--r--button.go11
-rw-r--r--checkbox.go12
-rw-r--r--label.go23
-rw-r--r--lineedit.go12
4 files changed, 56 insertions, 2 deletions
diff --git a/button.go b/button.go
index aa1c0bd..d1b286c 100644
--- a/button.go
+++ b/button.go
@@ -37,6 +37,17 @@ func (b *Button) SetText(text string) (err error) {
return nil
}
+// Text returns the button's text.
+func (b *Button) Text() string {
+ b.lock.Lock()
+ defer b.lock.Unlock()
+
+ if b.created {
+ return b.sysData.text()
+ }
+ return b.initText
+}
+
func (b *Button) make(window *sysData) error {
b.lock.Lock()
defer b.lock.Unlock()
diff --git a/checkbox.go b/checkbox.go
index 9a83852..f28b84d 100644
--- a/checkbox.go
+++ b/checkbox.go
@@ -37,11 +37,23 @@ func (c *Checkbox) SetText(text string) (err error) {
return nil
}
+// Text returns the checkbox's text.
+func (c *Checkbox) Text() string {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
+ if c.created {
+ return c.sysData.text()
+ }
+ return c.initText
+}
+
// Checked() returns whether or not the checkbox has been checked.
func (c *Checkbox) Checked() bool {
c.lock.Lock()
defer c.lock.Unlock()
+ // TODO if not created
return c.sysData.isChecked()
}
diff --git a/label.go b/label.go
index cadeff0..6f2aba2 100644
--- a/label.go
+++ b/label.go
@@ -22,7 +22,28 @@ func NewLabel(text string) *Label {
}
}
-// TODO SetText()/Text()?
+// SetText sets the Label's text.
+func (l *Label) SetText(text string) (err error) {
+ l.lock.Lock()
+ defer l.lock.Unlock()
+
+ if l.created {
+ return l.sysData.setText(text)
+ }
+ l.initText = text
+ return nil
+}
+
+// Text returns the Label's text.
+func (l *Label) Text() string {
+ l.lock.Lock()
+ defer l.lock.Unlock()
+
+ if l.created {
+ return l.sysData.text()
+ }
+ return l.initText
+}
func (l *Label) make(window *sysData) error {
l.lock.Lock()
diff --git a/lineedit.go b/lineedit.go
index ac20030..3b08962 100644
--- a/lineedit.go
+++ b/lineedit.go
@@ -24,7 +24,17 @@ func NewLineEdit(text string) *LineEdit {
}
}
-// TODO SetText
+// SetText sets the LineEdit's text.
+func (l *LineEdit) SetText(text string) (err error) {
+ l.lock.Lock()
+ defer l.lock.Unlock()
+
+ if l.created {
+ return l.sysData.setText(text)
+ }
+ l.initText = text
+ return nil
+}
// Text returns the LineEdit's text.
func (l *LineEdit) Text() string {