[Openmcl-devel] Core Animation ?

R. Matthew Emerson rme at clozure.com
Thu Apr 10 14:31:57 PDT 2008


On Apr 10, 2008, at 3:29 PM, Didier Verna wrote:
>
>       Hello,
>
> is it possible to use Core Animation in CCL, and if so how ? For
> instance, objc-to-lisp-classname tells me that CALayer would be named
> c-a-layer, which doesn't look right, and there doesn't seem to be such
> class anyway.

Not all Cocoa frameworks are loaded by default.  You load additional  
ones with OBJC:LOAD-FRAMEWORK.

There's a link to an example that shows how to use the Address Book  
framework on the Trac wiki:

http://trac.clozure.com/openmcl/wiki/Cocoa

In the Core Animation case, you'd say:

Welcome to Clozure Common Lisp Version 1.2-r8908MS  (DarwinX8664)!
? (objc:load-framework "QuartzCore" :quartzcore)
NIL
? ns:c-a-layer
#<OBJC:OBJC-CLASS NS:C-A-LAYER (#x7FFF703A7440)>
?

The c-a-layer ugliness can be corrected if we tell the bridge that  
"CA" is a "special word" in Cocoa names.  In ccl:objc-bridge;name- 
translation.lisp, we add the form:

(define-special-objc-word "CA")

I went ahead and committed that addition to the trunk, if you happen  
to be running it.  With that change:

? ns:ca-layer
#<OBJC:OBJC-CLASS NS:CA-LAYER (#x7FFF703A7440)>





More information about the Openmcl-devel mailing list