• 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
custom NSSliderCell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

custom NSSliderCell


  • Subject: custom NSSliderCell
  • From: Dominik Pich <email@hidden>
  • Date: Fri, 20 Oct 2006 10:52:23 +0200

Hi,
I have a custom NSSliderCell so the slider's bar is translucent. The issue is: The 'original' bar is still dran behind mine and shines through.


In awakeFromNib I do:
//cell is NSSliderCell from IB - it is the same with SGZoomSlider but there the SGImageView sets it
- (void)awakeFromNib {
PGZoomSliderCell *cell = [[PGZoomSliderCell alloc] init];

[cell setControlSize: [[slider cell] controlSize]];
[cell setBezeled:NO];
[cell setBordered:NO];

[cell setAction: [[slider cell] action]];
[cell setTarget: [[slider cell] target]];

[cell setMaxValue: [[slider cell] maxValue]];
[cell setMinValue: [[slider cell] minValue]];

[slider setCell:cell];
[cell release];
}


and my cell is:
- (void)drawBarInside:(NSRect)aRect flipped:(BOOL)flipped {
	aRect.origin.x += 7.0f;
	aRect.origin.y += aRect.size.height / 2 - 4.0f;
	aRect.size.height = 9.0f;
	aRect.size.width -= 14.0f;

	//draw white bar
	NSBezierPath *path = [NSBezierPath bezierPathWithRect:aRect];
	[[NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0] set];
	[path stroke];
}

- (void)drawKnob:(NSRect)aRect {
if(aRect.origin.y < 0) aRect.origin.y = 0; //bad slider calls us with negative values


	//bg disabled

	aRect.origin.x += aRect.size.height / 2 - 4.0f;
	aRect.origin.y += aRect.size.height / 2 - 4.0f;
	aRect.size.height = 7.0f;
	aRect.size.width = 8.0f;

	//draw white oval
	NSBezierPath *path = [NSBezierPath bezierPathWithOvalInRect:aRect];
	[[NSColor colorWithDeviceRed:1.0 green:1.0 blue:1.0 alpha:1.0] set];
	[path fill];
}

Thanks in advance,
Regards, Dominik
_______________________________________________
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: encrypting a pdf
  • Next by Date: Re: encrypting a pdf
  • Previous by thread: Re: unwanted cell copy being interposed during click in outline
  • Next by thread: minimal redraw with scrollPoint
  • Index(es):
    • Date
    • Thread