per-window menu setting tweaks.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27686 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-01-25 13:47:30 +00:00
parent c47c417df7
commit 0d5c221a7d
8 changed files with 100 additions and 35 deletions

View file

@ -5164,19 +5164,30 @@ current key view.<br />
- (void) setMenu: (NSMenu *)menu
{
NSMenuView *menuView;
menuView = [[self menu] menuRepresentation];
if (menuView != nil)
[_wv removeMenuView: menuView];
[super setMenu: menu];
menuView = [menu menuRepresentation];
if (menuView != nil)
if ([self menu] != menu)
{
[menu close];
[menuView setHorizontal: YES];
[menuView sizeToFit];
[_wv addMenuView: menuView];
NSMenuView *menuView;
/* Restore the old representation to its original menu after
* removing it from the window. If we didn't do this, the menu
* representation would be left without a partent view or
* window to draw in.
*/
menuView = [_wv removeMenuView];
[[self menu] setMenuRepresentation: menuView];
/* Set the new menu, and transfer the new menu representation
* to the window decoration view.
*/
[super setMenu: menu];
menuView = [menu menuRepresentation];
if (menuView != nil)
{
[menu close];
[menuView setHorizontal: YES];
[menuView sizeToFit];
[_wv addMenuView: menuView];
}
}
}