• 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: setting color of a progress indicator?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: setting color of a progress indicator?


  • Subject: Re: setting color of a progress indicator?
  • From: Cryx <email@hidden>
  • Date: Sun, 28 Apr 2002 23:00:22 -0500

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.

  • Follow-Ups:
    • Re: setting color of a progress indicator?
      • From: Bob Newhart <email@hidden>
    • ANNOUNCE+Need Input: Cocoa and Carbon interactive FAQTs
      • From: Christopher Holland <email@hidden>
References: 
 >Re: setting color of a progress indicator? (From: Julien Guimont <email@hidden>)

  • Prev by Date: Announcing: The Missing Cocoa Docs
  • Next by Date: Re: Trying to make an NSString...
  • Previous by thread: Re: setting color of a progress indicator?
  • Next by thread: ANNOUNCE+Need Input: Cocoa and Carbon interactive FAQTs
  • Index(es):
    • Date
    • Thread