mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 17:10:37 +00:00
setMainMenu: fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4747 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
8edf3a229f
commit
f8dc080c34
1 changed files with 21 additions and 4 deletions
|
@ -1092,12 +1092,20 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
|
||||
- (void) setMainMenu: (NSMenu*)aMenu
|
||||
{
|
||||
unsigned i, j;
|
||||
NSMenuItem *mc;
|
||||
NSArray *mi;
|
||||
unsigned i, j;
|
||||
NSMenuItem *mc;
|
||||
NSArray *mi;
|
||||
|
||||
if (main_menu != nil && main_menu != aMenu)
|
||||
{
|
||||
[main_menu close];
|
||||
}
|
||||
|
||||
ASSIGN(main_menu, aMenu);
|
||||
|
||||
[aMenu setTitle:
|
||||
[[[NSProcessInfo processInfo] processName] lastPathComponent]];
|
||||
[aMenu sizeToFit];
|
||||
/*
|
||||
* Find a menucell with the title Windows this is the default windows menu
|
||||
*/
|
||||
|
@ -1113,6 +1121,12 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ([self isActive])
|
||||
{
|
||||
[main_menu update];
|
||||
[main_menu display];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1214,12 +1228,12 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
break;
|
||||
i++;
|
||||
}
|
||||
|
||||
item = [menu insertItemWithTitle: aString
|
||||
action: @selector(makeKeyAndOrderFront:)
|
||||
keyEquivalent: @""
|
||||
atIndex: i];
|
||||
[item setTarget: aWindow];
|
||||
[menu sizeToFit];
|
||||
[menu update];
|
||||
}
|
||||
|
||||
|
@ -1243,6 +1257,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
if ([item target] == aWindow)
|
||||
{
|
||||
[menu removeItem: item];
|
||||
[menu sizeToFit];
|
||||
[menu update];
|
||||
break;
|
||||
}
|
||||
|
@ -1299,6 +1314,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
filename: [win representedFilename] != nil];
|
||||
[windows removeLastObject];
|
||||
}
|
||||
[aMenu sizeToFit];
|
||||
[aMenu update];
|
||||
}
|
||||
}
|
||||
|
@ -1360,6 +1376,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
|||
if (changed)
|
||||
{
|
||||
[(id)[item controlView] sizeToFit];
|
||||
[menu sizeToFit];
|
||||
[menu update];
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue