• 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
Re: NSSegmentedControl drawing problems in unified toolbar
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSegmentedControl drawing problems in unified toolbar


  • Subject: Re: NSSegmentedControl drawing problems in unified toolbar
  • From: Keith Blount <email@hidden>
  • Date: Mon, 6 Feb 2006 14:04:33 -0800 (PST)

Thanks, Todd, that works perfectly for me. By altering
it to set NSSegmentedCellMetalStyle, everything works
fine - no more toolbar issues.

Thanks again,
Keith

-----

FROM : Todd Yandell
DATE : Mon Feb 06 21:03:30 2006

On Feb 6, 2006, at 12:46 PM, Keith Blount wrote:

> I guess I'll have to subclass and do the drawing
myself...
> Annoying. There must be a private method that checks
the window
> style before drawing - it's a shame there's no way
of just
> overriding this.


Here's a custom subclass of NSSegmentedControl I made
to get around
that bug. It uses a private method, but it still works
nicely. Feel
free to do whatever you want with this code:

#define NSSegmentedCellAquaStyle 1    // Like the tabs
in an NSTabView.
#define NSSegmentedCellMetalStyle 2    // Like the
Safari and Finder
buttons.

@interface NSSegmentedCell ( Private )
- (void)_setSegmentedCellStyle:(int)style;
@end

@interface AOSegmentedControl : NSSegmentedControl
{
}
@end

@implementation AOSegmentedControl

- (void)awakeFromNib
{
   // 26 is the height of normal-sized segmented
control:
   [self setFrameSize:NSMakeSize([self
frame].size.width, 26)];
}

- (NSCell *)cell
{
   NSSegmentedCell *cell = [super cell];
   [cell
_setSegmentedCellStyle:NSSegmentedCellAquaStyle];
   return cell;
}

@end

Todd

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Double Fun
  • Next by Date: Re: NSSegmentedControl drawing problems in unified toolbar
  • Previous by thread: Re: NSSegmentedControl drawing problems in unified toolbar
  • Next by thread: Where is the text baseline in an NSTextField
  • Index(es):
    • Date
    • Thread