Re: setting color of a progress indicator?
Re: setting color of a progress indicator?
- Subject: Re: setting color of a progress indicator?
- From: Bob Newhart <email@hidden>
- Date: Mon, 29 Apr 2002 19:12:23 -0700
Well, this would be a real pain, but you could do the following:
* Create an NSImage
* Draw a progress bar into the NSImage
* Get the uncompressed TIFF representation of this image and hue-shift it to
whatever color you want
* Subclass NSProgressIndicator and override the drawRect method to draw your
image stretched over the appropriate length.
Doing an indeterminate progress bar would _really_ suck - you'd have to get
32 images for each frame of the animation.
Jason
Cryx Tried to Tell Me:
>
That's almost exactly what I did, but the solution that works for me is
>
a little simpler. There's some nice border functions in the AppKit, but
>
you could probably use a swatch of one the system shadow control colors
>
to achieve a shadow instead. With some compositing a gradient to round
>
the indicator could be probably be achieved too.
>
>
Here's the basics of what I did:
>
>
-(void)drawRect:(NSRect)aRect {
>
NSRect slice,remainder;
>
NSRect insetRect = NSInsetRect(aRect,2.0,2.0);
>
>
NSDrawGroove(aRect,aRect);
>
>
NSDivideRect(insetRect,&slice,&remainder,NSWidth(insetRect)*percent,NSMinXEdge>
)
>
;
>
[[NSColor redColor] drawSwatchInRect:slice];
>
[[NSColor whiteColor] drawSwatchInRect:remainder];
>
}
>
>
On Sunday, April 28, 2002, at 08:45 PM, Julien Guimont wrote:
>
>
> I had the same question 2 weeks ago. I think it can't be done by simply
>
> setting something in NSPRogressindicator.
>
>
>
> The solution I found, which can be a little more faster, is to make a
>
> new NSView subclass et create your progress bar using a rectangle of
>
> the color of your choice to bound the rect of your view and use a
>
> NSAffineTransform to scale it to the percentage you want. Apply a nice
>
> tiff on that with the same scaling and you have a progress bar.
>
>
>
> Yes it has no wavy effect in it but, who wants to spend cycle doing
>
> that;)... I wish I could.
>
>
>
> Do you think there is an API to make little shadow (like the one on
>
> window) behind my view, or to make the candy like theme programmaticaly
>
> without using tiff?
>
>
>
> Thanx
>
>
>
> Julien Guimont
>
> email@hidden
>
> www.juggysoft.com
>
> _______________________________________________
>
> 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.
>
_______________________________________________
>
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.
_______________________________________________
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.