Re: Dynamically changing an application's icon / Adding a badge
Re: Dynamically changing an application's icon / Adding a badge
- Subject: Re: Dynamically changing an application's icon / Adding a badge
- From: John Timmer <email@hidden>
- Date: Sun, 23 Oct 2005 15:21:58 -0400
- Thread-topic: Dynamically changing an application's icon / Adding a badge
> Is it possible to add a badge onto my application (a la Mail,
> OmniWeb, Transmit, iChat, etc.) without using Carbon? I noticed this
> function in Cocoa:
>
> [NSApp setApplicationIconImage:myIcon];
>
> However, I don't know if this will be able to layer on a new icon
> onto the existing application icon, or if this just swaps out the
> existing icon completely. Carbon has some Dock Icon functions like
> OverlayApplicationDockTileImage which probably would do what I want,
> but I'd like to keep to Cocoa-only if at all possible.
If your badge is already an NSImage, and you have a reference to the
unmodified dock icon, it's quite easy. Simply make a new image of the
appropriate size, lock focus on it, composite your dock image on top of it,
then composite the badge on top of that. You can control where the badge
winds up this way.
I put some source code up that makes a dock image out of two downloaded
image here ( http://mysite.verizon.net/jtimmer/software.html). Look at the
jt_StockGraphObject.m file.
JT
_______________________________________________
This mind intentionally left blank
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden