我有主窗口和几个子窗口,我想在用户单击停靠图标时显示主窗口,但如果只有一个,则不将其设为关键窗口(如果没有关键窗口,它将自动成为关键窗口)。
这是当前代码:
if ( fMainWinDelegate ) {
if (not [NSApp keyWindow]) {
NSLog(@"AppDelegate::applicationShouldHandleReopen [fMainWinDelegate showWindow]");
[fMainWinDelegate showWindow];
}
else {
if ([fMainWinDelegate.window isMiniaturized]) {
NSLog(@"AppDelegate::applicationShouldHandleReopen [fMainWinDelegate.window deminiaturize:self]");
[fMainWinDelegate.window deminiaturize:self];
//this one is not working, it make window also the key window
}
else if (not [fMainWinDelegate.window isVisible] && not [fMainWinDelegate.window isMiniaturized]) {
NSLog(@"AppDelegate::applicationShouldHandleReopen [fMainWinDelegate.window orderFront:self]");
[fMainWinDelegate.window orderFront:self];
}
}
}