Re: NSSegmentedControl drawing problems in unified toolbar
Re: NSSegmentedControl drawing problems in unified toolbar
- Subject: Re: NSSegmentedControl drawing problems in unified toolbar
- From: Todd Yandell <email@hidden>
- Date: Mon, 6 Feb 2006 14:03:30 -0600
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 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