subclassing NSTabViewItem
subclassing NSTabViewItem
- Subject: subclassing NSTabViewItem
- From: Jeffrey Drake <email@hidden>
- Date: Thu, 2 Jan 2003 01:02:02 -0500
I am trying to subclass NSTabViewItem to do a custom draw routine.
I am trying to make the text draw horizontally when the tab is on the
side.
To start off, I tried making a basic thing:
@implementation JDTabViewItem
- (void)drawLabel:(BOOL)shouldTruncateLabel inRect:(NSRect)tabRect
{
[[self label] drawInRect: tabRect
withAttributes:
[NSDictionary dictionaryWithObject: [NSFont labelFontOfSize: [NSFont
labelFontSize]]
forKey: NSFontAttributeName]];
}
- (NSSize)sizeOfLabel:(BOOL)shouldTruncateLabel
{
return [[self label] sizeWithAttributes:
[NSDictionary dictionaryWithObject: [NSFont labelFontOfSize: [NSFont
labelFontSize]]
forKey: NSFontAttributeName]];
}
With an associated @interface:
@interface JDTabViewItem : NSTabViewItem
- (void)drawLabel:(BOOL)shouldTruncateLabel inRect:(NSRect)tabRect;
- (NSSize)sizeOfLabel:(BOOL)shouldTruncateLabel;
@end
To set it all up:
+ (void)initialize
{
[JDTabViewItem poseAsClass: [NSTabViewItem class]];
}
According to all the information I have this should work. Debugging
indicates that initialize is being called fine, but the two functions
above are not.
Is there something I am missing?
Thank you for any help,
Regards,
Jeffrey Drake
_______________________________________________
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.