Re: defining NSColor constants

2009-08-10 Thread Uli Kusterer
On Aug 6, 2009, at 8:58 AM, Arie Pieter Cammeraat wrote: NSColor * const kNiceBlueColor = [NSColor colorWithRed: 20 green: 20 blue: 240 alpha:1]; Don't assign autoreleased objects to global variables/global constants, please. The object will get autoreleased and the constant will point to

Re: defining NSColor constants

2009-08-07 Thread Graham Cox
On 08/08/2009, at 2:44 AM, Arie Pieter Cammeraat wrote: I almost don't dare to compare, but it's a lot more difficult than in REALBasic to declare a global color. But on the other side... who cares? I doubt that REALBasic's colours are objects. The advantage of a colour object is that i

Re: defining NSColor constants

2009-08-07 Thread Arie Pieter Cammeraat
Thanks everyone, I'll try your tips. I almost don't dare to compare, but it's a lot more difficult than in REALBasic to declare a global color. But on the other side... who cares? Op 6-aug-2009, om 17:27 heeft Sean McBride het volgende geschreven: On 8/6/09 8:38 PM, Graham Cox said: T

Re: defining NSColor constants

2009-08-06 Thread Sean McBride
On 8/6/09 8:38 PM, Graham Cox said: >Then add a class method to NSColor in a category: > >+ (NSColor*) calibratedRGBColorWithValues:(const float*) values; Nitpick: use CGFloat instead of float to match NSColor. Especially since you're passing an array of float/doubles. --

Re: defining NSColor constants

2009-08-06 Thread Graham Cox
Maybe the issue is avoiding a lot of typing for a longish list of colours? Back in the day when struct RGBColor was the mechanism, it was fairly easy to set up long lists of const values and refer to an item by name. Doing this with NSColor is not so straightforward, and making each colour

Re: defining NSColor constants

2009-08-06 Thread Alastair Houghton
On 6 Aug 2009, at 07:58, Arie Pieter Cammeraat wrote: I would like a more obj-c style, like globals.h: extern NSColor * const kNiceBlueColor globals.m: #import globals.h NSColor * const kNiceBlueColor = [NSColor colorWithRed: 20 green: 20 blue: 240 al