• 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
Drawing a *blue* ProgressIndicator on the Dock app icon in the background / offscreen drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Drawing a *blue* ProgressIndicator on the Dock app icon in the background / offscreen drawing


  • Subject: Drawing a *blue* ProgressIndicator on the Dock app icon in the background / offscreen drawing
  • From: Marc Liyanage <email@hidden>
  • Date: Fri, 6 Feb 2004 03:01:44 +0100

I have a document window with a progress bar for a long-running operation.

I use the following method in my document class to badge the progress bar onto my application's icon in the Dock. It all works well and looks great if the document's window is in the foreground.

However, the whole point of a progress indicator in the Dock icon is of course that it's to be used when my document window is hidden / minimized / not visible, i.e. *not* in the foreground. And that's exactly when it does not work because as soon as my doc window is no longer key or main, the progress indicator's color switches from blue to gray, and that is impossible to see in the dock icon. I want the completed portion of the progress indicator to stay blue no matter what.

Is there a way to achieve this? Do I have to use a second progress bar and draw that offscreen? How would I do this? As I understand it I can't just alloc/init one and configure it, it needs to be part of the view hierarchy, including a full window instance? Would that draw in blue at all?



- (void)badgeAppIcon {

NSData *progressImageData = [progressIndicator dataWithPDFInsideRect:[progressIndicator bounds]];
NSImage *progressImage = [[[NSImage alloc] initWithData:progressImageData] autorelease];

[progressImage setScalesWhenResized:YES];
[progressImage lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
[progressImage setSize:NSMakeSize(128.0, 20.0)];
[progressImage unlockFocus];

NSImage *appIcon = [[[NSImage imageNamed:@"NSApplicationIcon"] copyWithZone:nil] autorelease];
[appIcon lockFocus];
[progressImage compositeToPoint:NSMakePoint(0, 0) operation:NSCompositeSourceOver];
[appIcon unlockFocus];

[[NSApplication sharedApplication] setApplicationIconImage:appIcon];

}
_______________________________________________
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: Drawing a *blue* ProgressIndicator on the Dock app icon in the background / offscreen drawing
      • From: Marc Liyanage <email@hidden>
  • Prev by Date: Re: base64
  • Next by Date: OpenGL and the Dock
  • Previous by thread: RE: Are we still supposed to register Creator code (bundle signature) for OS X app?
  • Next by thread: Re: Drawing a *blue* ProgressIndicator on the Dock app icon in the background / offscreen drawing
  • Index(es):
    • Date
    • Thread