Various small fixes for windows menu support.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5369 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
richard 1999-12-03 10:27:39 +00:00
parent d5d19ed0e7
commit 2243389ba2
4 changed files with 29 additions and 30 deletions

View file

@ -1,3 +1,10 @@
Fri Dec 3 10:27:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
* Source/NSApplication.m: ([-updateWindowsItem:]) modified to show
document state image with new menus.
* Source/NSMenuView.m: Implement ([-setNeedsDisplayForItemAtIndex:])
* Source/NSMenuItemCell.m: Fix so that images are drawn.
Fri Dec 3 05:21:40 1999 Nicola Pero <n.pero@mi.flashnet.it> Fri Dec 3 05:21:40 1999 Nicola Pero <n.pero@mi.flashnet.it>
* Source/NSTableColumn.m ([-setWidth:]): Tiny changing. * Source/NSTableColumn.m ([-setWidth:]): Tiny changing.

View file

@ -1884,49 +1884,39 @@ NSAssert([event retainCount] > 0, NSInternalInconsistencyException);
NSMenuItemCell *cell; NSMenuItemCell *cell;
NSCellImagePosition oldPos; NSCellImagePosition oldPos;
NSImage *oldImage; NSImage *oldImage;
NSImage *newImage;
BOOL changed; BOOL changed;
found = YES; found = YES;
cell = [view menuItemCellForItemAtIndex: i]; cell = [view menuItemCellForItemAtIndex: i];
oldPos = [cell imagePosition]; oldPos = [cell imagePosition];
oldImage = [cell image]; oldImage = [cell image];
newImage = oldImage;
changed = NO; changed = NO;
if ([aWindow representedFilename] == nil) if (oldPos != NSImageLeft)
{ {
if (oldPos != NSNoImage) [cell setImagePosition: NSImageLeft];
{ changed = YES;
[cell setImagePosition: NSNoImage]; }
changed = YES; if ([aWindow isDocumentEdited])
} {
newImage = [NSImage imageNamed: @"common_WMCloseBroken"];
} }
else else
{ {
NSImage *newImage = oldImage; newImage = [NSImage imageNamed: @"common_WMClose"];
}
if (oldPos != NSImageLeft) if (newImage != oldImage)
{ {
[cell setImagePosition: NSImageLeft]; [item setImage: newImage];
changed = YES; [cell setImage: newImage];
} changed = YES;
if ([aWindow isDocumentEdited])
{
newImage = [NSImage imageNamed: @"common_WMCloseBroken"];
}
else
{
newImage = [NSImage imageNamed: @"common_WMClose"];
}
if (newImage != oldImage)
{
[cell setImage: newImage];
changed = YES;
}
} }
if (changed) if (changed)
{ {
[menu sizeToFit]; [menu sizeToFit];
[menu update]; [view setNeedsDisplayForItemAtIndex: i];
} }
break; break;
} }

View file

@ -559,7 +559,7 @@
if (mcell_imageToDisplay) if (mcell_imageToDisplay)
{ {
mcell_imageSize = [mcell_imageToDisplay size]; mcell_imageWidth = [mcell_imageToDisplay size].width;
[mcell_imageToDisplay setBackgroundColor: backgroundColor]; [mcell_imageToDisplay setBackgroundColor: backgroundColor];
} }

View file

@ -580,9 +580,11 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
(frame.size.height - point.y) / cellSize.height; (frame.size.height - point.y) / cellSize.height;
} }
- (void)setNeedsDisplayForItemAtIndex: (int)index - (void) setNeedsDisplayForItemAtIndex: (int)index
{ {
[[menuv_itemCells objectAtIndex: index] setNeedsDisplay: YES]; NSRect aRect = [self rectOfItemAtIndex: index];
[self setNeedsDisplayInRect: aRect];
} }
- (NSPoint)locationForSubmenu: (NSMenu *)aSubmenu - (NSPoint)locationForSubmenu: (NSMenu *)aSubmenu