[Mono-list] Cocoa-Sharp and Growl
Sandy Dunlop
sandy.dunlop at gmail.com
Tue Jul 17 17:55:28 EDT 2007
On 17 Jul 2007, at 22:47, Alan McGovern wrote:
>> The class I'm looking at currently is MutableDictionary. The Java
>> API for Growl calls:
>>
>> noteDict.setObjectForKey(new Integer(1), GROWL_NOTIFICATION_STICKY);
>>
>> where noteDict is an NSMutableDictionary. The Java Cocoa bindings
>> take Java Objects instead of Cocoa Objects, and with Integer
>> inheriting Object, this works just fine. In cocoa-sharp, I have
>> created a MutableDictionary.Set(Cocoa.Object,Cocoa.Object) method.
>>
>> With cocoa-sharp, I would have to either:
>> 1) Have multiple definitions of Set which take Cocoa.Object and
>> System.Int32 as keys
>> 2) Create a Cocoa.Integer class, which doesn't seem right,
>> although it might fit in with the Java API better
>> 3) Have everything take System.Object instead of Cocoa.Object and
>> pass in a System.Int32 object when needed.
> What exactly is the key? Is it *always* an integer? Is it *always*
> a Cocoa.Object? Or can it be either? Can it be something other than
> an integer or cocoa.object? If the key is always an integer, you
> could make your mutable dictionary use a Dictionary<int,
> Cocoa.Object>.
Sorry, I got a bit confused there looking at the Java API. The key
appears to always be an object. The value is sometimes an integer and
sometimes an object. I still have the same problem of how to treat
a .Net integer as a Cocoa.Object.
Sandy.
More information about the Mono-list
mailing list