diff options
| author | Pietro Gagliardi <[email protected]> | 2014-06-28 01:05:06 -0400 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-06-28 01:05:06 -0400 |
| commit | ea6200a432c2954ec2b38afc66d1795dd161e8d9 (patch) | |
| tree | 10665ae3e2ed42bb6a16027b7eb40adf7c8dee58 /listbox.go | |
| parent | 05ffc6511ab11fa365b2e8961bc67770bbf79777 (diff) | |
Began the migration to the new API. Removed locks from the public control APIs; they won't be needed anymore.
Diffstat (limited to 'listbox.go')
| -rw-r--r-- | listbox.go | 23 |
1 files changed, 0 insertions, 23 deletions
@@ -4,7 +4,6 @@ package ui import ( "fmt" - "sync" ) // A Listbox is a vertical list of items, of which either at most one or any number of items can be selected at any given time. @@ -12,7 +11,6 @@ import ( // For information on scrollbars, see "Scrollbars" in the Overview. // Due to implementation issues, the presence of horizontal scrollbars is currently implementation-defined. type Listbox struct { - lock sync.Mutex created bool sysData *sysData initItems []string @@ -40,9 +38,6 @@ func NewMultiSelListbox(items ...string) *Listbox { // Append adds items to the end of the Listbox's list. // Append will panic if something goes wrong on platforms that do not abort themselves. func (l *Listbox) Append(what ...string) { - l.lock.Lock() - defer l.lock.Unlock() - if l.created { for _, s := range what { l.sysData.append(s) @@ -55,9 +50,6 @@ func (l *Listbox) Append(what ...string) { // InsertBefore inserts a new item in the Listbox 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 (l *Listbox) InsertBefore(what string, before int) { - l.lock.Lock() - defer l.lock.Unlock() - var m []string if l.created { @@ -81,9 +73,6 @@ badrange: // Delete removes the given item from the Listbox. It panics if the given index is out of bounds. func (l *Listbox) Delete(index int) { - l.lock.Lock() - defer l.lock.Unlock() - if l.created { if index < 0 || index >= l.sysData.len() { goto badrange @@ -102,9 +91,6 @@ badrange: // Selection returns a list of strings currently selected in the Listbox, or an empty list if none have been selected. This list will have at most one item on a single-selection Listbox. func (l *Listbox) Selection() []string { - l.lock.Lock() - defer l.lock.Unlock() - if l.created { return l.sysData.selectedTexts() } @@ -113,9 +99,6 @@ func (l *Listbox) Selection() []string { // SelectedIndices returns a list of the currently selected indexes in the Listbox, or an empty list if none have been selected. This list will have at most one item on a single-selection Listbox. func (l *Listbox) SelectedIndices() []int { - l.lock.Lock() - defer l.lock.Unlock() - if l.created { return l.sysData.selectedIndices() } @@ -126,9 +109,6 @@ func (l *Listbox) SelectedIndices() []int { // // On platforms for which this function may return an error, it panics if one is returned. func (l *Listbox) Len() int { - l.lock.Lock() - defer l.lock.Unlock() - if l.created { return l.sysData.len() } @@ -136,9 +116,6 @@ func (l *Listbox) Len() int { } func (l *Listbox) make(window *sysData) (err error) { - l.lock.Lock() - defer l.lock.Unlock() - err = l.sysData.make(window) if err != nil { return err |
