Fix for item removal.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5371 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-12-03 11:52:11 +00:00
parent 661f85f0d5
commit a0bad93a22
2 changed files with 20 additions and 4 deletions

View file

@ -1,9 +1,16 @@
Fri Dec 3 10:27:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Fri Dec 3 11:34:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSApplication.m: ([-updateWindowsItem:]) modified to show
document state image with new menus.
([-changeWindowsitem:title:filename:]) updated to understand filename
format and discard path info.
* Source/NSMenuView.m: Implement ([-setNeedsDisplayForItemAtIndex:])
and fixed ([-itemRemoved:]) to update the highlighted item properly
and avoid a crash.
* Source/NSMenuItemCell.m: Fix so that images are drawn.
* Source/NSWindow.m: ([-setTitle:]), ([-setRepresentedFilename:]),
([-setTitleWithRepresentedFilename:]), ([-setMiniwindowTitle:])
rewritten to conform to documented behavior.
Fri Dec 3 05:21:40 1999 Nicola Pero <n.pero@mi.flashnet.it>

View file

@ -279,7 +279,7 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
//
// Notification Methods
//
- (void)itemChanged: (NSNotification *)notification
- (void) itemChanged: (NSNotification *)notification
{
int index = [[[notification userInfo] objectForKey: @"NSMenuItemIndex"]
intValue];
@ -291,7 +291,7 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
[self setNeedsSizing: YES];
}
- (void)itemAdded: (NSNotification *)notification
- (void) itemAdded: (NSNotification *)notification
{
int index = [[[notification userInfo]
objectForKey: @"NSMenuItemIndex"] intValue];
@ -314,13 +314,22 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
[self setNeedsSizing: YES];
}
- (void)itemRemoved: (NSNotification *)notification
- (void) itemRemoved: (NSNotification *)notification
{
int wasHighlighted = [self highlightedItemIndex];
int index = [[[notification userInfo] objectForKey: @"NSMenuItemIndex"]
intValue];
if (index <= wasHighlighted)
{
[self setHighlightedItemIndex: -1];
}
[menuv_itemCells removeObjectAtIndex: index];
if (wasHighlighted > index)
{
[self setHighlightedItemIndex: --wasHighlighted];
}
// Mark the menu view as needing to be resized.
[self setNeedsSizing: YES];
}