I got you a present!
December 25, 2006 at 6:11 pm 4 comments
[Update: Looks like Dave Batton beat me to the punch. *cries*]
Merry Atheist Children Get Presents Day Christmas, everyone!
In celebration of this day, I am giving you a gift – yes, a gift – from me to you. Yes, you. It is my first piece of public code – well, actually, that’s a lie. I posted this some months ago – I consider it my cleverest Java hack EVER. I’m quite proud of it. No! Digression! Must…focus. Wait…my second was this.
Anyway, it’s my third piece of public code, and I hope you like it. In short, it’s called PVCGradientCell, and it’s a subclass of NSTextFieldCell that uses the CTGradient class to mimic the Source List found in iTunes 6. It’s notable for several reasons:
- Despite the name of the file (PVCGradientTable) , it is actually not a subclass of NSTableView – all the code is contained in the NSTextFieldCell subclass. This is unlike Matt Gemmell’s iTableView, which requires subclassing of NSTableView. (By the way, props to Matt – his iTableView helped me fix a lot of bugs.)
- It uses Chad Weider’s CTGradient code to render the gradient – the majority of implementations use either stretching images or bare CoreImage code.
- It allows you to enable centering the text vertically, a lá Daniel Jalkut’s RSVerticallyCenteredTextCell.
- It allows one to specify whether the text should be bold when clicked upon.
- It freshens your breath.
Here’s a screenshot, with the text bolded and vertically centered:
You can grab it here, or check it out from my Subversion repository (courtesy of Assembla – great job, guys!) here:
http://tools.assembla.com/svn/importantshock
Use the username and password ‘anonymous‘ (without quotes, of course) to access the repository.
Bug reports, accolades, fame, and large sacks of cash are welcome at:
ironswallow at gmail dot etc
By the way, PVC was the initial acronym for the Cocoa application I’m working on.
Anyway, I hope that y’all have a rockin’ Christmas. Oh, and check out Scott Stevenson’s really neat THCalendarInfo present to you; it kinda owns my present in terms of complexity. (It reminds me of the Ruby linguistics module in terms of slickness and usefulness.)
Bye!

1. Johannes Fortmann | December 26, 2006 at 12:13 am
Your repository link is, like, password-protected.
Happy holidays!
2. Patrick Thomson | December 26, 2006 at 12:32 am
Oh dear. So it is. Fixed!
3. Dave Batton | December 27, 2006 at 10:55 pm
Great minds think alike. 😉
4. Mike | April 6, 2007 at 12:19 pm
Call me stupid, but how do I set the custom class for the cells? You have that handy arrow in the upper right corner of the column. I cannot find that on mine?
Thanks for any help/tips you can give.:)