Re: Classes vs. custom palettes
Re: Classes vs. custom palettes
- Subject: Re: Classes vs. custom palettes
- From: Marco Scheurer <email@hidden>
- Date: Fri, 23 Aug 2002 15:20:16 +0200
On Thursday, August 22, 2002, at 07:17 pm, Andrew Merenbach wrote:
In my periodic table program, I currently have a giant NSMatrix filling
the window, with certain buttons cells transparent and disabled (so
they won't be seen or interacted with), and the other cells forming the
table. The elements themselves are in subclasses of NSButtonCell--one
class for each of twelve different colors. I have taken a look at
Aaron Hillegass' book, "Cocoa Programming for Mac OS X," and I stumbled
upon an idea. Instead of using lots of classes for the different
buttons, why not give the buttons their own IB Palette? Then I could
even program them to have their colors set in IB, thus reducing the
number of button cell subclasses.
Independently of doing a palette with it or not, for the case you
describe you should have at most one subclass of NSButtonCell. Your
subclass can have a color attribute that can be inititialized in your
code. Wrapping your class in a palette is useful only if you want to set
the color in IB, but this is not necessary.
I don't plan on necessarily releasing this IB palette to the public,
and my question is: I haven't found anything on whether or not my
program would take a performance hit from using this palette idea.
No.
Is there any advantage to sticking with multiple button cell
subclasses?
No, quite the contrary.
Marco Scheurer
Sen:te, Lausanne, Switzerland
http://www.sente.ch
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.