summaryrefslogtreecommitdiff
path: root/checkbox.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-17 14:09:09 -0400
committerPietro Gagliardi <[email protected]>2014-03-17 14:09:09 -0400
commit0e8680c04f3b364352a57e686bc93d018c6140e3 (patch)
treefbbab88400e8a6060cb59180aa63f2d958b2af52 /checkbox.go
parentbdb26046b6e91b1cf1a3d752fc36edd059ee5a58 (diff)
Dumped the mutex locks from the other controls and elaborated/asked for help in the README.
Diffstat (limited to 'checkbox.go')
-rw-r--r--checkbox.go21
1 files changed, 6 insertions, 15 deletions
diff --git a/checkbox.go b/checkbox.go
index db488f9..65e25c4 100644
--- a/checkbox.go
+++ b/checkbox.go
@@ -27,35 +27,32 @@ func NewCheckbox(text string) (c *Checkbox) {
// SetText sets the checkbox's text.
func (c *Checkbox) SetText(text string) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
if c.created {
c.sysData.setText(text)
return
}
+ c.lock.Lock()
+ defer c.lock.Unlock()
c.initText = text
}
// 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()
}
+ c.lock.Lock()
+ defer c.lock.Unlock()
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()
-
if c.created {
return c.sysData.isChecked()
}
+ c.lock.Lock()
+ defer c.lock.Unlock()
return false
}
@@ -72,15 +69,9 @@ func (c *Checkbox) make(window *sysData) error {
}
func (c *Checkbox) setRect(x int, y int, width int, height int, winheight int) error {
- c.lock.Lock()
- defer c.lock.Unlock()
-
return c.sysData.setRect(x, y, width, height, winheight)
}
func (c *Checkbox) preferredSize() (width int, height int) {
- c.lock.Lock()
- defer c.lock.Unlock()
-
return c.sysData.preferredSize()
}