mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:50:48 +00:00
Moved the main menu handling into the class NSMenu and fixed activation problem on Windows.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20342 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
7c48004c48
commit
a99759f89c
4 changed files with 49 additions and 8 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-11-11 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSMenu.h
|
||||||
|
* Source/NSMenu.m (-setMain:): New internal method to set the main
|
||||||
|
menu of an application. Uses code from [NSApplication
|
||||||
|
setMainMenu:] plus a display call for the new main menu.
|
||||||
|
* Source/NSApplication.m (-setMainMenu:): Use the new method on
|
||||||
|
NSMenu to flag a menu as main and cleaned up the logic.
|
||||||
|
|
||||||
2004-11-11 15:08 Alexander Malmberg <alexander@malmberg.org>
|
2004-11-11 15:08 Alexander Malmberg <alexander@malmberg.org>
|
||||||
|
|
||||||
* Source/NSCell.m (-_setupTextWithFrame:inView:editor:): Reduce the
|
* Source/NSCell.m (-_setupTextWithFrame:inView:editor:): Reduce the
|
||||||
|
|
|
@ -589,6 +589,13 @@ The displayed menus on the screen have the following structure:
|
||||||
*/
|
*/
|
||||||
- (NSWindow*) window;
|
- (NSWindow*) window;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Flag this menu to be the main menu of the application,
|
||||||
|
when isMain is YES. Flag it as no longer being the main
|
||||||
|
menu when NO is handed in.
|
||||||
|
*/
|
||||||
|
- (void) setMain: (BOOL)isMain;
|
||||||
|
|
||||||
/* Shows the menu window on screen */
|
/* Shows the menu window on screen */
|
||||||
/**
|
/**
|
||||||
Show menu on the screen. This method can/should be used by
|
Show menu on the screen. This method can/should be used by
|
||||||
|
|
|
@ -2278,19 +2278,22 @@ image.
|
||||||
*/
|
*/
|
||||||
- (void) setMainMenu: (NSMenu*)aMenu
|
- (void) setMainMenu: (NSMenu*)aMenu
|
||||||
{
|
{
|
||||||
if (_main_menu != nil && _main_menu != aMenu)
|
if (_main_menu == aMenu)
|
||||||
{
|
{
|
||||||
[_main_menu close];
|
return;
|
||||||
[[_main_menu window] setLevel: NSSubmenuWindowLevel];
|
}
|
||||||
|
|
||||||
|
if (_main_menu != nil)
|
||||||
|
{
|
||||||
|
[_main_menu setMain: NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSIGN(_main_menu, aMenu);
|
ASSIGN(_main_menu, aMenu);
|
||||||
|
|
||||||
// Set the title of the window.
|
if (_main_menu != nil)
|
||||||
// This wont be displayed, but the window manager may need it.
|
{
|
||||||
[[_main_menu window] setTitle: [[NSProcessInfo processInfo] processName]];
|
[_main_menu setMain: YES];
|
||||||
[[_main_menu window] setLevel: NSMainMenuWindowLevel];
|
}
|
||||||
[_main_menu setGeometry];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) rightMouseDown: (NSEvent*)theEvent
|
- (void) rightMouseDown: (NSEvent*)theEvent
|
||||||
|
|
|
@ -1431,6 +1431,28 @@ static NSNotificationCenter *nc;
|
||||||
return (NSWindow *)_aWindow;
|
return (NSWindow *)_aWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setMain: (BOOL)isMain
|
||||||
|
{
|
||||||
|
if (isMain)
|
||||||
|
{
|
||||||
|
// Set the title of the window.
|
||||||
|
// This wont be displayed, but the window manager may need it.
|
||||||
|
[[self window] setTitle: [[NSProcessInfo processInfo] processName]];
|
||||||
|
[[self window] setLevel: NSMainMenuWindowLevel];
|
||||||
|
[self setGeometry];
|
||||||
|
|
||||||
|
if ([NSApp isActive])
|
||||||
|
{
|
||||||
|
[self display];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
[self close];
|
||||||
|
[[self window] setLevel: NSSubmenuWindowLevel];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Set the frame origin of the receiver to aPoint. If a submenu of
|
Set the frame origin of the receiver to aPoint. If a submenu of
|
||||||
the receiver is attached. The frame origin of the submenu is set
|
the receiver is attached. The frame origin of the submenu is set
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue