More go fmt.

This commit is contained in:
Pietro Gagliardi 2014-06-10 11:38:52 -04:00
parent 37bc89fe52
commit a3222f248d
4 changed files with 40 additions and 45 deletions

View File

@ -70,7 +70,7 @@ func (l *Listbox) InsertBefore(what string, before int) {
if before < 0 || before >= len(l.initItems) {
goto badrange
}
m = make([]string, 0, len(l.initItems) + 1)
m = make([]string, 0, len(l.initItems)+1)
m = append(m, l.initItems[:before]...)
m = append(m, what)
l.initItems = append(m, l.initItems[before:]...)
@ -94,7 +94,7 @@ func (l *Listbox) Delete(index int) {
if index < 0 || index >= len(l.initItems) {
goto badrange
}
l.initItems = append(l.initItems[:index], l.initItems[index + 1:]...)
l.initItems = append(l.initItems[:index], l.initItems[index+1:]...)
return
badrange:
panic(fmt.Errorf("index %d out of range in Listbox.Delete()", index))

View File

@ -2,10 +2,6 @@
package ui
import (
// ...
)
/*
The Cocoa API was not designed to be used directly in code; you were intended to build your user interfaces with Interface Builder. There is no dedicated listbox class; we have to synthesize it with a NSTableView. And this is difficult in code.
@ -81,7 +77,6 @@ func listboxArrayItemAt(array C.id, index int) string {
return fromListboxItem(dict)
}
/*
Now we have to establish the binding. To do this, we need the following things:
- the object to bind (NSTableColumn)
@ -190,7 +185,7 @@ func listboxSelectedIndices(listbox C.id) (list []int) {
list = make([]int, count)
list[0] = int(C.listboxIndexesFirst(indices))
for i := 1; i < count; i++ {
list[i] = int(C.listboxIndexesNext(indices, C.uintptr_t(list[i - 1])))
list[i] = int(C.listboxIndexesNext(indices, C.uintptr_t(list[i-1])))
}
return list
}