ObjectiveC.jl
ObjectiveC.jl copied to clipboard
Add Cocoa wrappers
This commented out line is breaking the Cocoa functionality of the package.
Was it because nsrect
isn't working? I had to definition to this to get it to work:
nsrect(x, y, w, h) =
ccall((:nsmakerect, "cocoa"), Ptr{Void}, (Cfloat, Cfloat, Cfloat, Cfloat),
x, y, w, h)
Honestly, I can't remember – it's been a while since I worked on this.
If you want to patch up these issues through a PR you'd be very welcome – otherwise I probably won't get round to it for a while.
Ok. I'll see what I can do. Same with the other issue.
fwiw, julia v0.4 can call NSMakeRect
directly by mirroring the struct layout into julia types, and thus no longer requires the .m
shim:
immutable NSPoint
x::Cfloat
y::Cfloat
end
immutable NSSize
width::Cfloat
height::Cfloat
end
immutable NSRect
origin::NSPoint
size::NSSize
end
ccall((:NSMakeRect, "Foundation"), NSRect, (Cfloat, Cfloat, Cfloat, Cfloat), x, y, w, h)
Awesome, this will help us get rid of the last bits of Objective-C code – thanks for providing the example.
One tricky part is that currently method signatures are loaded dynamically. Presumably we'll have to either generate the corresponding types dynamically too, or force type hints for structs. (Perhaps tuples will work in place of immutable
types?)
As part of #11 I removed the Cocoa wrappers entirely, so if anybody is interested in bringing them back: have a look at the state of the package at commit https://github.com/JuliaInterop/ObjectiveC.jl/tree/22118319da1fb7601d2a3ecefb671ffbb5e57012.