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. --- listbox.go | 23 ----------------------- 1 file changed, 23 deletions(-) (limited to 'listbox.go') diff --git a/listbox.go b/listbox.go index fc57142..774f553 100644 --- a/listbox.go +++ b/listbox.go @@ -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 -- cgit v1.2.3