summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--area_darwin.go2
-rw-r--r--listbox_darwin.go52
-rw-r--r--listbox_darwin.m2
-rw-r--r--objc_darwin.go2
-rw-r--r--objc_darwin.h2
-rw-r--r--sysdata_darwin.go12
6 files changed, 35 insertions, 37 deletions
diff --git a/area_darwin.go b/area_darwin.go
index 6fc3a9b..c7fe2d9 100644
--- a/area_darwin.go
+++ b/area_darwin.go
@@ -15,7 +15,7 @@ import "C"
func makeArea(parentWindow C.id, alternate bool, s *sysData) C.id {
area := C.makeArea()
- area = newScrollView(area)
+ area = makeScrollView(area)
addControl(parentWindow, area)
return area
}
diff --git a/listbox_darwin.go b/listbox_darwin.go
index 6183a2d..4236a51 100644
--- a/listbox_darwin.go
+++ b/listbox_darwin.go
@@ -14,8 +14,6 @@ Under normal circumstances we would have to build our own data source class, as
After switching from using the Objective-C runtime to using Objective-C directly, you will now need to look both here and in listbox_darwin.m to get what's going on.
PERSONAL TODO - make a post somewhere that does all this in Objective-C itself, for the benefit of the programming community.
-
-TODO - change the name of some of these functions? specifically the functions that get data about the NSTableView?
*/
// #cgo LDFLAGS: -lobjc -framework Foundation -framework AppKit
@@ -65,23 +63,23 @@ But what is arrangedObjects? Why care about arranging objects? We don't have to
Of course, Mac OS X 10.5 adds the ability to automatically arrange objects. So let's just turn that off to be safe.
*/
-func newListboxArray() C.id {
- return C.newListboxArray()
+func makeListboxArray() C.id {
+ return C.makeListboxArray()
}
-func appendListboxArray(array C.id, what string) {
+func listboxArrayAppend(array C.id, what string) {
C.listboxArrayAppend(array, toListboxItem(what))
}
-func insertListboxArrayBefore(array C.id, what string, before int) {
+func listboxArrayInsertBefore(array C.id, what string, before int) {
C.listboxArrayInsertBefore(array, toListboxItem(what), C.uintptr_t(before))
}
-func deleteListboxArray(array C.id, index int) {
+func listboxArrayDelete(array C.id, index int) {
C.listboxArrayDelete(array, C.uintptr_t(index))
}
-func indexListboxArray(array C.id, index int) string {
+func listboxArrayItemAt(array C.id, index int) string {
dict := C.listboxArrayItemAt(array, C.uintptr_t(index))
return fromListboxItem(dict)
}
@@ -114,7 +112,7 @@ func bindListboxArray(tableColumn C.id, array C.id) {
array, listboxItemKeyPath)
}
-func listboxArrayController(tableColumn C.id) C.id {
+func boundListboxArray(tableColumn C.id) C.id {
return C.boundListboxArray(tableColumn, tableColumnBinding)
}
@@ -126,9 +124,9 @@ Columns need string identifiers; we'll just reuse the item key.
Editability is also handled here, as opposed to in NSTableView itself.
*/
-func newListboxTableColumn() C.id {
+func makeListboxTableColumn() C.id {
column := C.makeListboxTableColumn(listboxItemKey)
- bindListboxArray(column, newListboxArray())
+ bindListboxArray(column, makeListboxArray())
return column
}
@@ -142,8 +140,8 @@ The NSTableViews don't draw their own scrollbars; we have to drop our NSTableVie
The actual creation code was moved to objc_darwin.go.
*/
-func newListboxScrollView(listbox C.id) C.id {
- scrollview := newScrollView(listbox)
+func makeListboxScrollView(listbox C.id) C.id {
+ scrollview := makeScrollView(listbox)
C.giveScrollViewBezelBorder(scrollview) // this is what Interface Builder gives the scroll view
return scrollview
}
@@ -157,7 +155,7 @@ And now, a helper function that takes a scroll view and gets out the array.
*/
func listboxArray(listbox C.id) C.id {
- return listboxArrayController(listboxTableColumn(listboxInScrollView(listbox)))
+ return boundListboxArray(listboxTableColumn(listboxInScrollView(listbox)))
}
/*
@@ -167,26 +165,26 @@ We'll handle selections from the NSTableView too. The only trickery is dealing w
*/
func makeListbox(parentWindow C.id, alternate bool, s *sysData) C.id {
- listbox := C.makeListbox(newListboxTableColumn(), toBOOL(alternate))
- listbox = newListboxScrollView(listbox)
+ listbox := C.makeListbox(makeListboxTableColumn(), toBOOL(alternate))
+ listbox = makeListboxScrollView(listbox)
addControl(parentWindow, listbox)
return listbox
}
-func appendListbox(listbox C.id, what string, alternate bool) {
+func listboxAppend(listbox C.id, what string, alternate bool) {
array := listboxArray(listbox)
- appendListboxArray(array, what)
+ listboxArrayAppend(array, what)
}
-func insertListboxBefore(listbox C.id, what string, before int, alternate bool) {
+func listboxInsertBefore(listbox C.id, what string, before int, alternate bool) {
array := listboxArray(listbox)
- insertListboxArrayBefore(array, what, before)
+ listboxArrayInsertBefore(array, what, before)
}
// technique from http://stackoverflow.com/questions/3773180/how-to-get-indexes-from-nsindexset-into-an-nsarray-in-cocoa
// we don't care that the indices were originally NSUInteger since by this point we have a problem anyway; Go programs generally use int indices anyway
// we also don't care about NSNotFound because we check the count first AND because NSIndexSet is always sorted (and NSNotFound can be a valid index if the list is large enough... since it's NSIntegerMax, not NSUIntegerMax)
-func selectedListboxIndices(listbox C.id) (list []int) {
+func listboxSelectedIndices(listbox C.id) (list []int) {
indices := C.listboxSelectedRowIndexes(listboxInScrollView(listbox))
count := int(C.listboxIndexesCount(indices))
if count == 0 {
@@ -200,29 +198,29 @@ func selectedListboxIndices(listbox C.id) (list []int) {
return list
}
-func selectedListboxTexts(listbox C.id) (texts []string) {
- indices := selectedListboxIndices(listbox)
+func listboxSelectedTexts(listbox C.id) (texts []string) {
+ indices := listboxSelectedIndices(listbox)
if len(indices) == 0 {
return nil
}
array := listboxArray(listbox)
texts = make([]string, len(indices))
for i := 0; i < len(texts); i++ {
- texts[i] = indexListboxArray(array, indices[i])
+ texts[i] = listboxArrayItemAt(array, indices[i])
}
return texts
}
-func deleteListbox(listbox C.id, index int) {
+func listboxDelete(listbox C.id, index int) {
array := listboxArray(listbox)
- deleteListboxArray(array, index)
+ listboxArrayDelete(array, index)
}
func listboxLen(listbox C.id) int {
return int(C.listboxLen(listboxInScrollView(listbox)))
}
-func selectListboxIndices(id C.id, indices []int) {
+func listboxSelectIndices(id C.id, indices []int) {
listbox := listboxInScrollView(id)
if len(indices) == 0 {
C.listboxDeselectAll(listbox)
diff --git a/listbox_darwin.m b/listbox_darwin.m
index ff427fd..cce97a0 100644
--- a/listbox_darwin.m
+++ b/listbox_darwin.m
@@ -31,7 +31,7 @@ id fromListboxItem(id item, id key)
return [toNSMutableDictionary(item) objectForKey:key];
}
-id newListboxArray(void)
+id makeListboxArray(void)
{
NSArrayController *ac;
diff --git a/objc_darwin.go b/objc_darwin.go
index 2d20076..37b8430 100644
--- a/objc_darwin.go
+++ b/objc_darwin.go
@@ -31,7 +31,7 @@ func toBOOL(what bool) C.BOOL {
// These consolidate the NSScrollView code (used by listbox_darwin.go and area_darwin.go) into a single place.
-func newScrollView(content C.id) C.id {
+func makeScrollView(content C.id) C.id {
return C.makeScrollView(content)
}
diff --git a/objc_darwin.h b/objc_darwin.h
index 34405c6..09106f2 100644
--- a/objc_darwin.h
+++ b/objc_darwin.h
@@ -64,7 +64,7 @@ extern void msgBoxError(id, id);
/* listbox_darwin.m */
extern id toListboxItem(id, id);
extern id fromListboxItem(id, id);
-extern id newListboxArray(void);
+extern id makeListboxArray(void);
extern void listboxArrayAppend(id, id);
extern void listboxArrayInsertBefore(id, id, uintptr_t);
extern void listboxArrayDelete(id, uintptr_t);
diff --git a/sysdata_darwin.go b/sysdata_darwin.go
index b240e70..8da134a 100644
--- a/sysdata_darwin.go
+++ b/sysdata_darwin.go
@@ -177,13 +177,13 @@ var classTypes = [nctypes]*classData{
make: makeListbox,
show: controlShow,
hide: controlHide,
- append: appendListbox,
- insertBefore: insertListboxBefore,
- selIndices: selectedListboxIndices,
- selTexts: selectedListboxTexts,
- delete: deleteListbox,
+ append: listboxAppend,
+ insertBefore: listboxInsertBefore,
+ selIndices: listboxSelectedIndices,
+ selTexts: listboxSelectedTexts,
+ delete: listboxDelete,
len: listboxLen,
- selectIndices: selectListboxIndices,
+ selectIndices: listboxSelectIndices,
},
c_progressbar: &classData{
make: func(parentWindow C.id, alternate bool, s *sysData) C.id {