Fixed various Mac OS X compilation errors.
This commit is contained in:
parent
a83dcb0282
commit
0770c2a697
|
@ -10,11 +10,7 @@ The main culprits are:
|
||||||
Go wrapper functions (bleh_darwin.go) call these directly and take care of stdint.h -> Go type conversions.
|
Go wrapper functions (bleh_darwin.go) call these directly and take care of stdint.h -> Go type conversions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <objc/message.h>
|
#include "objc_darwin.h"
|
||||||
#include <objc/objc.h>
|
|
||||||
#include <objc/runtime.h>
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include <Foundation/NSGeometry.h>
|
#include <Foundation/NSGeometry.h>
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
package ui
|
package ui
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,9 +17,9 @@ type sysData struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type classData struct {
|
type classData struct {
|
||||||
make: func(parentWindow C.id) C.id
|
make func(parentWindow C.id) C.id
|
||||||
show: func(what C.id)
|
show func(what C.id)
|
||||||
hide: func(what C.id)
|
hide func(what C.id)
|
||||||
settextsel C.SEL
|
settextsel C.SEL
|
||||||
textsel C.SEL
|
textsel C.SEL
|
||||||
}
|
}
|
||||||
|
@ -70,10 +71,10 @@ var classTypes = [nctypes]*classData{
|
||||||
C.BOOL(C.YES)) // defer creation of device until we show the window
|
C.BOOL(C.YES)) // defer creation of device until we show the window
|
||||||
},
|
},
|
||||||
show: func(what C.id) {
|
show: func(what C.id) {
|
||||||
C.objc_sendMsg_id(what, _makeKeyAndOrderFront, what)
|
C.objc_msgSend_id(what, _makeKeyAndOrderFront, what)
|
||||||
},
|
},
|
||||||
hide: func(what C.id) {
|
hide: func(what C.id) {
|
||||||
C.objc_sendMsg_id(what, _orderOut, what)
|
C.objc_msgSend_id(what, _orderOut, what)
|
||||||
},
|
},
|
||||||
settextsel: _setTitle,
|
settextsel: _setTitle,
|
||||||
textsel: _title,
|
textsel: _title,
|
||||||
|
@ -157,13 +158,12 @@ if classTypes[s.ctype].settextsel == zero { return nil }
|
||||||
|
|
||||||
func (s *sysData) setRect(x int, y int, width int, height int) error {
|
func (s *sysData) setRect(x int, y int, width int, height int) error {
|
||||||
if classTypes[s.ctype].make == nil { return nil }
|
if classTypes[s.ctype].make == nil { return nil }
|
||||||
C.objc_msgSend_rect(s.id, _setFrame,
|
objc_msgSend_rect(s.id, _setFrame, x, y, width, height)
|
||||||
C.int64_t(x), C.int64_t(y), C.int64_t(width), C.int64_t(height))
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) isChecked() bool {
|
func (s *sysData) isChecked() bool {
|
||||||
if classTypes[s.ctype].make == nil { return nil }
|
if classTypes[s.ctype].make == nil { return false }
|
||||||
const (
|
const (
|
||||||
NSOnState = 1
|
NSOnState = 1
|
||||||
)
|
)
|
||||||
|
@ -179,7 +179,7 @@ if classTypes[s.ctype].make == nil { return nil }
|
||||||
|
|
||||||
func (s *sysData) text() string {
|
func (s *sysData) text() string {
|
||||||
var zero C.SEL
|
var zero C.SEL
|
||||||
if classTypes[s.ctype].textsel == zero { return nil }
|
if classTypes[s.ctype].textsel == zero { return "" }
|
||||||
ret := make(chan string)
|
ret := make(chan string)
|
||||||
defer close(ret)
|
defer close(ret)
|
||||||
uitask <- func() {
|
uitask <- func() {
|
||||||
|
@ -201,7 +201,7 @@ func (s *sysData) insertBefore(what string, before int) error {
|
||||||
|
|
||||||
func (s *sysData) selectedIndex() int {
|
func (s *sysData) selectedIndex() int {
|
||||||
// TODO
|
// TODO
|
||||||
reteurn -1
|
return -1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) selectedIndices() []int {
|
func (s *sysData) selectedIndices() []int {
|
||||||
|
@ -214,12 +214,13 @@ func (s *sysData) selectedTexts() []string {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *sysData) setWindowSize(x int, y int, width int, height int) error {
|
func (s *sysData) setWindowSize(width int, height int) error {
|
||||||
ret := make(chan struct{})
|
ret := make(chan struct{})
|
||||||
defer close(ret)
|
defer close(ret)
|
||||||
uitask <- func() {
|
uitask <- func() {
|
||||||
|
// we need to get the top left point
|
||||||
objc_msgSend_rect_bool(s.id, _setFrameDisplay,
|
objc_msgSend_rect_bool(s.id, _setFrameDisplay,
|
||||||
x, y, w, h,
|
x, y, width, height,
|
||||||
C.BOOL(C.YES)) // TODO set to NO to prevent subviews from being redrawn before they are resized?
|
C.BOOL(C.YES)) // TODO set to NO to prevent subviews from being redrawn before they are resized?
|
||||||
ret <- struct{}{}
|
ret <- struct{}{}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue