JuliaInterop / ObjectiveC.jl

Objective-C embedded in Julia
Other
39 stars 10 forks source link

Add Cocoa wrappers #4

Open JayKickliter opened 8 years ago

JayKickliter commented 8 years ago

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)
MikeInnes commented 8 years ago

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.

JayKickliter commented 8 years ago

Ok. I'll see what I can do. Same with the other issue.

vtjnash commented 8 years ago

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)
MikeInnes commented 8 years ago

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?)

maleadt commented 1 year ago

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.