Matt Gemmell

My new book CHANGER is out now!

An action-thriller novel — book 1 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="http://www.apple.com/ical/images/index_multiple09112003.jpg">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="http://mattgemmell.com/ftp/source/itableview.tgz">iTableView source code</a> 
to include the new functionality. Here's a <a href="http://mattgemmell.com/ftp/source/itableview_screenshot.jpg">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.



Enjoy!