Removed objc_alloc(). This should be all of them. Now to redo how classes are handled...
This commit is contained in:
parent
5a5b486b6a
commit
e35457b968
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue