From ffa1bbe0b91a8c812ddcea5c5d65e55f60d07f33 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Mon, 30 Jun 2014 22:48:12 -0400 Subject: Restored the previous new API. I'm going to change it so that events are callbacks rather than using a window handler, but other than that... yeah. --- combobox.go | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'combobox.go') diff --git a/combobox.go b/combobox.go index 83024ed..e1f49af 100644 --- a/combobox.go +++ b/combobox.go @@ -4,12 +4,10 @@ package ui import ( "fmt" - "sync" ) // A Combobox is a drop-down list of items, of which at most one can be selected at any given time. You may optionally make the combobox editable to allow custom items. Initially, no item will be selected (and no text entered in an editable Combobox's entry field). What happens to the text shown in a Combobox if its width is too small is implementation-defined. type Combobox struct { - lock sync.Mutex created bool sysData *sysData initItems []string @@ -37,9 +35,6 @@ func NewEditableCombobox(items ...string) *Combobox { // Append adds items to the end of the Combobox's list. // Append will panic if something goes wrong on platforms that do not abort themselves. func (c *Combobox) Append(what ...string) { - c.lock.Lock() - defer c.lock.Unlock() - if c.created { for _, s := range what { c.sysData.append(s) @@ -52,9 +47,6 @@ func (c *Combobox) Append(what ...string) { // InsertBefore inserts a new item in the Combobox before the item at the given position. It panics if the given index is out of bounds. // InsertBefore will also panic if something goes wrong on platforms that do not abort themselves. func (c *Combobox) InsertBefore(what string, before int) { - c.lock.Lock() - defer c.lock.Unlock() - var m []string if c.created { @@ -78,9 +70,6 @@ badrange: // Delete removes the given item from the Combobox. It panics if the given index is out of bounds. func (c *Combobox) Delete(index int) { - c.lock.Lock() - defer c.lock.Unlock() - if c.created { if index < 0 || index >= c.sysData.len() { goto badrange @@ -99,9 +88,6 @@ badrange: // Selection returns the current selection. func (c *Combobox) Selection() string { - c.lock.Lock() - defer c.lock.Unlock() - if c.created { return c.sysData.text() } @@ -110,9 +96,6 @@ func (c *Combobox) Selection() string { // SelectedIndex returns the index of the current selection in the Combobox. It returns -1 either if no selection was made or if text was manually entered in an editable Combobox. func (c *Combobox) SelectedIndex() int { - c.lock.Lock() - defer c.lock.Unlock() - if c.created { return c.sysData.selectedIndex() } @@ -123,9 +106,6 @@ func (c *Combobox) SelectedIndex() int { // // On platforms for which this function may return an error, it panics if one is returned. func (c *Combobox) Len() int { - c.lock.Lock() - defer c.lock.Unlock() - if c.created { return c.sysData.len() } @@ -133,9 +113,6 @@ func (c *Combobox) Len() int { } func (c *Combobox) make(window *sysData) (err error) { - c.lock.Lock() - defer c.lock.Unlock() - err = c.sysData.make(window) if err != nil { return err -- cgit v1.2.3