Re: I need a milder application badge (solution)
Re: I need a milder application badge (solution)
- Subject: Re: I need a milder application badge (solution)
- From: Sherm Pendley <email@hidden>
- Date: Sat, 25 Jul 2009 14:25:49 -0400
On Sat, Jul 25, 2009 at 1:54 PM, Jay Reynolds
Freeman<email@hidden> wrote:
> What I want to do is modify the dock icon while the application running.
> The only interface I can find to do this is
> NSApp.setApplicationIconImage: , which requires an NSImage. I have no way
> to get at the actual view being used to draw the dock icon, in order to
> subclass it; I have to create a new NSImage somehow, and pass that to
> setApplicationIconImage.
You don't need to subclass anything just to draw into an NSImage. You
can call an NSImage's -lockFocus method to direct all the usual
drawing functions and methods to draw into that image, instead of into
an onscreen view. Don't forget to call -unlockFocus when you're done!
So, what you want to do is, get the default image, -copy it and
-autorelease the copy, send the copy a -lockFocus, draw whatever
content you want to add to the icon, using all the usual functions &
methods you'd have used in a subclass' -drawRect: method, send the
copy a -unlockFocus, send the copy to -setApplicationIconImage:.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden