mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 22:30:48 +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
|
- (void) setMainMenu: (NSMenu*)aMenu
|
||||||
{
|
{
|
||||||
unsigned i, j;
|
unsigned i, j;
|
||||||
NSMenuItem *mc;
|
NSMenuItem *mc;
|
||||||
NSArray *mi;
|
NSArray *mi;
|
||||||
|
|
||||||
|
if (main_menu != nil && main_menu != aMenu)
|
||||||
|
{
|
||||||
|
[main_menu close];
|
||||||
|
}
|
||||||
|
|
||||||
ASSIGN(main_menu, aMenu);
|
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
|
* Find a menucell with the title Windows this is the default windows menu
|
||||||
*/
|
*/
|
||||||
|
@ -1113,6 +1121,12 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([self isActive])
|
||||||
|
{
|
||||||
|
[main_menu update];
|
||||||
|
[main_menu display];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1214,12 +1228,12 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
||||||
break;
|
break;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
item = [menu insertItemWithTitle: aString
|
item = [menu insertItemWithTitle: aString
|
||||||
action: @selector(makeKeyAndOrderFront:)
|
action: @selector(makeKeyAndOrderFront:)
|
||||||
keyEquivalent: @""
|
keyEquivalent: @""
|
||||||
atIndex: i];
|
atIndex: i];
|
||||||
[item setTarget: aWindow];
|
[item setTarget: aWindow];
|
||||||
|
[menu sizeToFit];
|
||||||
[menu update];
|
[menu update];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1243,6 +1257,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
||||||
if ([item target] == aWindow)
|
if ([item target] == aWindow)
|
||||||
{
|
{
|
||||||
[menu removeItem: item];
|
[menu removeItem: item];
|
||||||
|
[menu sizeToFit];
|
||||||
[menu update];
|
[menu update];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1299,6 +1314,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
||||||
filename: [win representedFilename] != nil];
|
filename: [win representedFilename] != nil];
|
||||||
[windows removeLastObject];
|
[windows removeLastObject];
|
||||||
}
|
}
|
||||||
|
[aMenu sizeToFit];
|
||||||
[aMenu update];
|
[aMenu update];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1360,6 +1376,7 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
[(id)[item controlView] sizeToFit];
|
[(id)[item controlView] sizeToFit];
|
||||||
|
[menu sizeToFit];
|
||||||
[menu update];
|
[menu update];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue