mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 10:01:14 +00:00
keep main menu available when using micrtosoft style
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27692 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
6d63225010
commit
a1b67a4d07
4 changed files with 50 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
2009-01-25 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSMenu.m: Keep the main menu in the main window (or visible
|
||||
if there is no main menu) when using microsoft style menus.
|
||||
* Source/NSWindow.m: If the main windows closes and it contains
|
||||
the main menu, unset the menu.
|
||||
|
||||
2009-01-25 11:51-EST Gregory John Casamento <greg_casamento@yahoo.com>
|
||||
|
||||
* Source/NSMenuView.m: Return from the trackWithEvent: method
|
||||
|
|
|
@ -438,6 +438,7 @@
|
|||
return AUTORELEASE(v);
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -942,6 +942,31 @@ static BOOL menuBarVisible = YES;
|
|||
|
||||
- (void) update
|
||||
{
|
||||
if (self == [NSApp mainMenu])
|
||||
{
|
||||
/* For microsoft style menus, we attempt to notice that we have
|
||||
* a main window, and make sure that the menu appears in it.
|
||||
*/
|
||||
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil) ==
|
||||
NSWindows95InterfaceStyle)
|
||||
{
|
||||
NSWindow *w = [NSApp mainWindow];
|
||||
|
||||
if (w == nil)
|
||||
{
|
||||
/* Make sure we are set up properly and displayed.
|
||||
*/
|
||||
if ([_aWindow isVisible] == NO)
|
||||
{
|
||||
[self setMain: YES];
|
||||
}
|
||||
}
|
||||
else if ([w menu] != self)
|
||||
{
|
||||
[w setMenu: self];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_delegate)
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(menuNeedsUpdate:)])
|
||||
|
@ -1186,10 +1211,10 @@ static BOOL menuBarVisible = YES;
|
|||
|
||||
- (void) setDelegate: (id)delegate
|
||||
{
|
||||
_delegate=delegate;
|
||||
_delegate = delegate;
|
||||
}
|
||||
|
||||
- (float)menuBarHeight
|
||||
- (float) menuBarHeight
|
||||
{
|
||||
// FIXME
|
||||
return [NSMenuView menuBarHeight];
|
||||
|
@ -1683,7 +1708,6 @@ static BOOL menuBarVisible = YES;
|
|||
{
|
||||
NSMenu *sub = [self attachedMenu];
|
||||
|
||||
|
||||
if (_menu.transient)
|
||||
{
|
||||
NSDebugLLog (@"NSMenu", @"We should not close ordinary menu while transient version is still open");
|
||||
|
@ -1784,15 +1808,22 @@ static BOOL menuBarVisible = YES;
|
|||
RELEASE(newRep);
|
||||
if (newStyle == NSWindows95InterfaceStyle)
|
||||
{
|
||||
/* Put menu in the main window for microsoft style.
|
||||
*/
|
||||
[[NSApp mainWindow] setMenu: self];
|
||||
}
|
||||
else if ([[NSApp mainWindow] menu] == self)
|
||||
{
|
||||
/* Remove the menu from the main window.
|
||||
*/
|
||||
[[NSApp mainWindow] setMenu: nil];
|
||||
}
|
||||
}
|
||||
|
||||
if (newStyle != NSWindows95InterfaceStyle)
|
||||
/* Adjust the menu window to suit the menu view unless the menu
|
||||
* is being displayed in the application main window.
|
||||
*/
|
||||
if ([[NSApp mainWindow] menu] != self)
|
||||
{
|
||||
[[self window] setTitle: [[NSProcessInfo processInfo] processName]];
|
||||
[[self window] setLevel: NSMainMenuWindowLevel];
|
||||
|
|
|
@ -1775,6 +1775,12 @@ many times.
|
|||
{
|
||||
[_wv setInputState: GSTitleBarNormal];
|
||||
}
|
||||
if ([self menu] == [NSApp mainMenu])
|
||||
{
|
||||
/* This window contains the main menu ... remove it.
|
||||
*/
|
||||
[self setMenu: nil];
|
||||
}
|
||||
[nc postNotificationName: NSWindowDidResignMainNotification object: self];
|
||||
}
|
||||
}
|
||||
|
@ -2645,9 +2651,7 @@ resetCursorRectsForView(NSView *theView)
|
|||
_f.has_opened = NO;
|
||||
[NSApp removeWindowsItem: self];
|
||||
[self orderOut: self];
|
||||
|
||||
RELEASE(pool);
|
||||
|
||||
_f.has_closed = YES;
|
||||
RELEASE(self);
|
||||
}
|
||||
|
@ -5175,6 +5179,7 @@ current key view.<br />
|
|||
*/
|
||||
menuView = [_wv removeMenuView];
|
||||
[[self menu] setMenuRepresentation: menuView];
|
||||
[menuView sizeToFit];
|
||||
|
||||
/* Set the new menu, and transfer the new menu representation
|
||||
* to the window decoration view.
|
||||
|
|
Loading…
Reference in a new issue