summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-04-04 20:34:35 -0400
committerPietro Gagliardi <[email protected]>2014-04-04 20:34:35 -0400
commite35457b9684f23657e12832266bff477eb55a2ad (patch)
tree2a16c213dd8d88ef4e0e14e481ceb4f2dcfdc80b
parent5a5b486b6abd568d80150d36ed85746b445bf2fb (diff)
Removed objc_alloc(). This should be all of them. Now to redo how classes are handled...
-rw-r--r--area_darwin.go4
-rw-r--r--listbox_darwin.go6
-rw-r--r--objc_darwin.go6
-rw-r--r--sysdata_darwin.go18
4 files changed, 14 insertions, 20 deletions
diff --git a/area_darwin.go b/area_darwin.go
index 36156e9..45675b9 100644
--- a/area_darwin.go
+++ b/area_darwin.go
@@ -277,7 +277,7 @@ func areaView_flagsChanged(self C.id, sel C.SEL, e C.id) {
// TODO combine these with the listbox functions?
func newAreaScrollView(area C.id) C.id {
- scrollview := objc_alloc(_NSScrollView)
+ scrollview := C.objc_msgSend_noargs(_NSScrollView, _alloc)
scrollview = initWithDummyFrame(scrollview)
C.objc_msgSend_bool(scrollview, _setHasHorizontalScroller, C.BOOL(C.YES))
C.objc_msgSend_bool(scrollview, _setHasVerticalScroller, C.BOOL(C.YES))
@@ -291,7 +291,7 @@ func areaInScrollView(scrollview C.id) C.id {
}
func makeArea(parentWindow C.id, alternate bool) C.id {
- area := objc_alloc(_goArea)
+ area := C.objc_msgSend_noargs(_goArea, _alloc)
area = initWithDummyFrame(area)
// TODO others?
area = newAreaScrollView(area)
diff --git a/listbox_darwin.go b/listbox_darwin.go
index 25a040d..da2a0af 100644
--- a/listbox_darwin.go
+++ b/listbox_darwin.go
@@ -165,7 +165,7 @@ var (
)
func newListboxTableColumn() C.id {
- column := objc_alloc(_NSTableColumn)
+ column := C.objc_msgSend_noargs(_NSTableColumn, _alloc)
column = C.objc_msgSend_id(column, _initWithIdentifier, listboxItemKey)
C.objc_msgSend_bool(column, _setEditable, C.BOOL(C.NO))
// TODO other properties?
@@ -192,7 +192,7 @@ var (
)
func newListboxScrollView(listbox C.id) C.id {
- scrollview := objc_alloc(_NSScrollView)
+ scrollview := C.objc_msgSend_noargs(_NSScrollView, _alloc)
scrollview = initWithDummyFrame(scrollview)
C.objc_msgSend_bool(scrollview, _setHasHorizontalScroller, C.BOOL(C.YES))
C.objc_msgSend_bool(scrollview, _setHasVerticalScroller, C.BOOL(C.YES))
@@ -232,7 +232,7 @@ var (
)
func makeListbox(parentWindow C.id, alternate bool) C.id {
- listbox := objc_alloc(_NSTableView)
+ listbox := C.objc_msgSend_noargs(_NSTableView, _alloc)
listbox = initWithDummyFrame(listbox)
C.objc_msgSend_id(listbox, _addTableColumn, newListboxTableColumn())
multi := C.BOOL(C.NO)
diff --git a/objc_darwin.go b/objc_darwin.go
index b4a6a5b..f8d7771 100644
--- a/objc_darwin.go
+++ b/objc_darwin.go
@@ -37,12 +37,6 @@ var (
_UTF8String = sel_getUid("UTF8String")
)
-// some helper functions
-
-func objc_alloc(class C.id) C.id {
- return C.objc_msgSend_noargs(class, _alloc)
-}
-
func toNSString(str string) C.id {
cstr := C.CString(str)
defer C.free(unsafe.Pointer(cstr))
diff --git a/sysdata_darwin.go b/sysdata_darwin.go
index e53fcd7..d54523b 100644
--- a/sysdata_darwin.go
+++ b/sysdata_darwin.go
@@ -116,7 +116,7 @@ var classTypes = [nctypes]*classData{
)
// we have to specify a content rect to start; it will be overridden soon though
- win := objc_alloc(_NSWindow)
+ win := C.objc_msgSend_noargs(_NSWindow, _alloc)
win = C.objc_msgSend_rect_uint_uint_bool(win,
_initWithContentRect,
C.int64_t(0), C.int64_t(0), C.int64_t(100), C.int64_t(100),
@@ -139,7 +139,7 @@ var classTypes = [nctypes]*classData{
},
c_button: &classData{
make: func(parentWindow C.id, alternate bool) C.id {
- button := objc_alloc(_NSButton)
+ button := C.objc_msgSend_noargs(_NSButton, _alloc)
button = initWithDummyFrame(button)
C.objc_msgSend_uint(button, _setBezelStyle, C.uintptr_t(1)) // NSRoundedBezelStyle
C.objc_msgSend_id(button, _setTarget, appDelegate)
@@ -157,7 +157,7 @@ var classTypes = [nctypes]*classData{
},
c_checkbox: &classData{
make: func(parentWindow C.id, alternate bool) C.id {
- checkbox := objc_alloc(_NSButton)
+ checkbox := C.objc_msgSend_noargs(_NSButton, _alloc)
checkbox = initWithDummyFrame(checkbox)
C.objc_msgSend_uint(checkbox, _setButtonType, C.uintptr_t(3)) // NSSwitchButton
addControl(parentWindow, checkbox)
@@ -173,11 +173,11 @@ var classTypes = [nctypes]*classData{
var combobox C.id
if alternate {
- combobox = objc_alloc(_NSComboBox)
+ combobox = C.objc_msgSend_noargs(_NSComboBox, _alloc)
combobox = initWithDummyFrame(combobox)
C.objc_msgSend_bool(combobox, _setUsesDataSource, C.BOOL(C.NO))
} else {
- combobox = objc_alloc(_NSPopUpButton)
+ combobox = C.objc_msgSend_noargs(_NSPopUpButton, _alloc)
combobox = C.objc_msgSend_rect_bool(combobox, _initWithFramePullsDown,
C.int64_t(0), C.int64_t(0), C.int64_t(100), C.int64_t(100),
C.BOOL(C.NO))
@@ -220,9 +220,9 @@ var classTypes = [nctypes]*classData{
var lineedit C.id
if alternate {
- lineedit = objc_alloc(_NSSecureTextField)
+ lineedit = C.objc_msgSend_noargs(_NSSecureTextField, _alloc)
} else {
- lineedit = objc_alloc(_NSTextField)
+ lineedit = C.objc_msgSend_noargs(_NSTextField, _alloc)
}
lineedit = initWithDummyFrame(lineedit)
addControl(parentWindow, lineedit)
@@ -236,7 +236,7 @@ var classTypes = [nctypes]*classData{
},
c_label: &classData{
make: func(parentWindow C.id, alternate bool) C.id {
- label := objc_alloc(_NSTextField)
+ label := C.objc_msgSend_noargs(_NSTextField, _alloc)
label = initWithDummyFrame(label)
C.objc_msgSend_bool(label, _setEditable, C.BOOL(C.NO))
C.objc_msgSend_bool(label, _setBordered, C.BOOL(C.NO))
@@ -263,7 +263,7 @@ var classTypes = [nctypes]*classData{
},
c_progressbar: &classData{
make: func(parentWindow C.id, alternate bool) C.id {
- pbar := objc_alloc(_NSProgressIndicator)
+ pbar := C.objc_msgSend_noargs(_NSProgressIndicator, _alloc)
pbar = initWithDummyFrame(pbar)
// TODO really int?
C.objc_msgSend_int(pbar, _setStyle, 0) // NSProgressIndicatorBarStyle