[Openmcl-devel] how to access non NS classes
R. Matthew Emerson
rme at clozure.com
Sat Oct 31 02:17:28 EDT 2009
On Oct 31, 2009, at 1:50 AM, Alexander Repenning wrote:
> There is a really handy class to get images from the build in camera
> called IKPictureTaker class
> I cannot access it.
> (eval-when (:compile-toplevel :load-toplevel :execute)
> (ccl:use-interface-dir :quartz)
> (open-shared-library "/System/Library/Frameworks/Quartz.framework/
Or just use (objc:load-framework "Quartz" :quartz)
> seems to find something
> ns::IK-Picture-Taker , i.e., the class, is not bound
> ImageKit is part of Quartz which is part of the x86 headers. Could
> this be a version problem? IKPictureTaker is available in Mac OS X
> v10.5 and later. Strangely, the methods of IKImagePicker are
> available, e.g., (#/
> popUpRecentsMenuForView:withDelegate:didEndSelector:contextInfo: ...)
> I am guessing I just doing something silly when trying to access the
> class but what?
The heuristics used by the Objective-C bridge to map from CamelCase
names to hyphen-separated names don't always do the right thing,
especially when Apple adds new prefixes like "IK".
The bridge can recognize special Objective-C "words" and not split
them up. See ccl:objc-bridge;name-translation.lisp.
Since the bridge doesn't recognize "IK" as a "special word", the
bridge translates the class name to ns:i-k-picture-taker. You could
also use (@class "IKPictureTaker").
(#/runModal (#/pictureTaker ns:i-k-picture-taker)) ought to work (on
x8664 anyway...some ports still use Tiger interfaces).
More information about the Openmcl-devel