Re: Correctly Subclassing NSTableHeaderCell?
Re: Correctly Subclassing NSTableHeaderCell?
- Subject: Re: Correctly Subclassing NSTableHeaderCell?
- From: Daniel Kennett <email@hidden>
- Date: Thu, 3 Jan 2008 16:58:20 +0000
- Resent-date: Thu, 3 Jan 2008 16:58:48 +0000
- Resent-from: Daniel Kennett <email@hidden>
- Resent-message-id: <email@hidden>
- Resent-to: Apple Cocoa Developer Mailing List <email@hidden>
Well, it's probably what I *haven't* done - this is a listing of what
I've implemented in my NSTableHeaderCell subclass. The
drawSortIndicatorWithFrame method draws a red rectangle where the
indicator should go (and works when calling it from the end of my
drawWithFrame: method). However, when clicking on the headers nothing
changes visually at all. The table view does sort, however.
@implementation KNTableHeader
-(void)drawWithFrame:(NSRect)frame inView:(NSView *)view {
if ([self isHighlighted]) {
[[CTGradient unifiedDarkGradient] fillRect:frame angle:-90];
} else {
[[CTGradient unifiedNormalGradient] fillRect:frame angle:-90];
}
// Draw some stuff
}
-(void)highlight:(BOOL)flag withFrame:(NSRect)cellFrame inView:(NSView
*)controlView {
NSLog(@"Changed!");
}
-(void)drawSortIndicatorWithFrame:(NSRect)cellFrame inView:(NSView
*)controlView ascending:(BOOL)ascending priority:(int)priority {
[[NSColor redColor] set];
[NSBezierPath fillRect:[self sortIndicatorRectForBounds:cellFrame]];
}
@end
On 3 Jan 2008, at 16:37, I. Savant wrote:
I'm trying to subclass NSTableHeaderCell to get a darker look, a'la
iTunes and iCal. I've got it drawing perfectly well and I'm happy
with
the look, but I can't get it to highlight when clicked or is the
sorted column, and I can't get it to show the sort direction
indicator
either.
I predict the problem lies somewhere within your code ... ;-)
Perhaps you could share relevant bits so we can identify where that
might be?
--
I.S.
Thanks,
-- Daniel
_______________________
email@hidden
http://www.kennettnet.co.uk
Please include previous messages in any reply you send.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden