• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
subclassing NSTabViewItem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: NSColor (alpha enabling and setting color in color panel)
  • Next by Date: Re: NSColor (alpha enabling and setting color in color panel)
  • Previous by thread: Re: Equivalent to "ps aux" in Cocoa?
  • Next by thread: Re: subclassing NSTabViewItem
  • Index(es):
    • Date
    • Thread