[Mono-osx] MonoMac NSAttributedString.h

Miguel de Icaza miguel at novell.com
Wed Apr 21 12:15:02 EDT 2010


Hello Duane,

I could not find in the bindings for these:
>
> APPKIT_EXTERN NSString *NSFontAttributeName;                // NSFont,
> default Helvetica 12
> APPKIT_EXTERN NSString *NSParagraphStyleAttributeName;      //
> NSParagraphStyle, default defaultParagraphStyle
> APPKIT_EXTERN NSString *NSForegroundColorAttributeName;     // NSColor,
> default blackColor
> etc....
>
> How should these be exposed in the bindings?  My guess is it needs to
> follow the same pattern as in CTStringAttributeKey.cs with the call to
> Dlfcn.GetStringConstant.  Is that correct?
>

This is correct.   I struggle with this because I feel that we should add
support to the generator for this instead of writing this by hand every
time.

My concern is the following: for a class that has say 200 of those
APPKIT_EXTERN declarations, we have multiple options:

(a) initialize them all in the static constructor, slows down a class
startup for no reason.
(b) initialize them on demand doing an open/find/close per symbol every time
(expensive if you need all keys)

And it just occurred to me that what we could do is open the handle on the
static constructor for the library (to avoid the GetSlowStringConstant
slowness) and load the data on demand.

The remaining issue is: how do we teach the generator about these constants?

Perhaps a [Field] attribute applied to properties?

Miguel.

>
> Duane
>
> _______________________________________________
> Mono-osx mailing list
> Mono-osx at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-osx
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-osx/attachments/20100421/f1c1a0a8/attachment.html 


More information about the Mono-osx mailing list