mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 16:10:48 +00:00
Merge pull request #302 from trunkmaster/menu-unhide
NSApplication: toggle menu item "Hide" title and action on user click.
This commit is contained in:
commit
5cd432374c
1 changed files with 19 additions and 1 deletions
|
@ -2496,6 +2496,7 @@ image.</p><p>See Also: -applicationIconImage</p>
|
|||
NSDictionary *info;
|
||||
NSWindow *win;
|
||||
NSEnumerator *iter;
|
||||
id<NSMenuItem> menuItem;
|
||||
|
||||
[nc postNotificationName: NSApplicationWillHideNotification
|
||||
object: self];
|
||||
|
@ -2543,7 +2544,16 @@ image.</p><p>See Also: -applicationIconImage</p>
|
|||
[_hidden addObject: win];
|
||||
[win orderOut: self];
|
||||
}
|
||||
}
|
||||
}
|
||||
menuItem = [sender isKindOfClass:[NSMenuItem class]]
|
||||
? sender
|
||||
: [_main_menu itemWithTitle:_(@"Hide")];
|
||||
if (menuItem)
|
||||
{
|
||||
[menuItem setAction:@selector(unhide:)];
|
||||
[menuItem setTitle:_(@"Show")];
|
||||
}
|
||||
|
||||
_app_is_hidden = YES;
|
||||
|
||||
if (YES == [[NSUserDefaults standardUserDefaults]
|
||||
|
@ -2606,6 +2616,14 @@ image.</p><p>See Also: -applicationIconImage</p>
|
|||
*/
|
||||
- (void) unhide: (id)sender
|
||||
{
|
||||
id<NSMenuItem> menuItem = [sender isKindOfClass:[NSMenuItem class]]
|
||||
? sender
|
||||
: [_main_menu itemWithTitle:_(@"Show")];
|
||||
if (menuItem)
|
||||
{
|
||||
[menuItem setAction:@selector(hide:)];
|
||||
[menuItem setTitle:_(@"Hide")];
|
||||
}
|
||||
if (_app_is_hidden)
|
||||
{
|
||||
[self unhideWithoutActivation];
|
||||
|
|
Loading…
Reference in a new issue