Matt Gemmell

TOLL is available now!

An action-thriller novel — book 2 in the KESTREL series.

★★★★★ — Amazon

iCal Colored Checkboxes

source 1 min read

Ever since iCal was released, Cocoa developers have wanted to duplicate its custom colored checkboxes 
(<a href="">these things</a>). Just a note 
that I've improved my iTableView source code to include the ability to create an iCal-style checkbox 
of any color.
Essentially, there's a method to which you pass an NSColor and a BOOL (whether or not the checkbox 
should be checked), and an appropriate NSImage is returned. It could easily be used to create an 
NSButtonCell subclass, for example. I've updated the <a href="">iTableView source code</a> 
to include the new functionality. Here's a <a href="">screenshot</a>.

Besides the colored checkboxes, iTableView includes NSTextFieldCell and NSImageCell subclasses to 
display the blue gradient highlight found in iCal, iTunes and the Panther Finder. The grey gradient 
will show if the relevant view isn't focused, as in iCal etc. Also, the NSImageCell subclass has been 
updated to behave better with flipped images.