i've set up my own quit function with my app, that fades the window out before quitting. here is the code:
it works from the menu bar and Command+Q as i added the key equivalent to the menu item. however, when i quit the app from the dock menu, it does a normal quit (no fadeout)... how can i make the dock menu's quit function reflect my own quit function?
PHP:
- (IBAction)quitApplication:(id)sender {
SetSystemUIMode(kUIModeNormal, 0);
timer = [[NSTimer scheduledTimerWithTimeInterval:0.02 target:self selector:@selector(allWindowsFadeOUT:) userInfo:nil repeats:YES] retain];
}
- (void)allWindowsFadeOUT:(NSTimer *)theTimer
{
if (([mainWindow alphaValue] > 0.0) || ([mainWindow2 alphaValue] > 0.0)){
[mainWindow setAlphaValue:[mainWindow alphaValue] - 0.1];
[mainWindow2 setAlphaValue:[mainWindow2 alphaValue] - 0.1];
[aboutWindow setAlphaValue:[aboutWindow alphaValue] - 0.1];
[[NSColorPanel sharedColorPanel] setAlphaValue:[[NSColorPanel sharedColorPanel] alphaValue] -0.1];
}
else
{
[timer invalidate];
[timer release];
timer = nil;
[NSApp terminate:nil];
}
}
it works from the menu bar and Command+Q as i added the key equivalent to the menu item. however, when i quit the app from the dock menu, it does a normal quit (no fadeout)... how can i make the dock menu's quit function reflect my own quit function?