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: Gregory Weston <email@hidden>
- Date: Sun, 23 Oct 2005 08:42:46 -0400
Chad Armstrong wrote:
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 I point out that technically it's not possible given that some of
Cocoa lies on top of Carbon anyway, would that help? Or if you really
want to, just make a category on NSApplication that offers
overlayApplicationIconWithImage: and restoreApplicationIconImage
methods.
// Typed into browser. 10.3, 10.4 or (10.2+Safari).
- (void)overlayApplicationIconWithImage:(NSImage*)inImage
{
CGImageRef theImageRef = WebConvertNSImageToCGImageRef(inImage);
if(theImageRef) (void)OverlayApplicationDockTileImage(theImageRef);
}
- (void)restoreApplicationIconImage
{
(void)RestoreApplicationDockTileImage();
}
_______________________________________________
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