From 0e8680c04f3b364352a57e686bc93d018c6140e3 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 17 Mar 2014 14:09:09 -0400 Subject: Dumped the mutex locks from the other controls and elaborated/asked for help in the README. --- checkbox.go | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'checkbox.go') 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() } -- cgit v1.2.3