On Sat, Jul 25, 2009 at 1:54 PM, Jay Reynolds Freeman<jay_reynolds_free...@mac.com> 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com