Ok, so Im trying to subclass NSSegmentedcell but it's doing some odd stuff.
I can't seem to get it to work properly, There is no way to cover up the underlaying buttons properly, or get rid of them properly.
So far this is what I have:
Maybe I am taking the wrong approach? I have never done this before, still learning it i guess it all comes with practice it's pretty well ill documented.
Chris
I can't seem to get it to work properly, There is no way to cover up the underlaying buttons properly, or get rid of them properly.
So far this is what I have:
Code:
- (void)drawSegment:(NSInteger)segment inFrame:(NSRect)rect withView:(NSView *)controlView {
NSImage *backgroundImage = [NSImage imageNamed: @"statusbar_background"];
if ([self selectedSegment] != segment) {
[backgroundImage setFlipped: YES];
[backgroundImage setScalesWhenResized: YES];
[backgroundImage setSize: rect.size];
[backgroundImage drawInRect: rect fromRect:rect operation: NSCompositeSourceOver fraction: 1.0];
[[NSColor colorWithCalibratedWhite:202.0/255.0 alpha:1.0] drawPixelThickLineAtPosition:rect.size.width withInset:0.0 inRect:rect inView:controlView horizontal:NO flip:NO];
[[NSColor colorWithCalibratedWhite:202.0/255.0 alpha:1.0] drawPixelThickLineAtPosition:20.0 withInset:0.0 inRect:rect inView:controlView horizontal:YES flip:NO];
}
}
Maybe I am taking the wrong approach? I have never done this before, still learning it i guess it all comes with practice it's pretty well ill documented.
Chris