renamed ivar _changed to _needsSizing.

([NSMenu -sizeToFit]): Changed call [_view update] to [_view sizeToFit]
([NSMenu -displayTransient]): call [NSMenuView-update] to ensure that the
menuView knows it belongs to a transient menu
([NSMenu -closeTransient]): call [NSMenuView-update] to ensue that the
menuView knows it is not transient anymore.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16319 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
wim 2003-04-01 19:51:41 +00:00
parent 8c21a2167e
commit e08b524b9b

View file

@ -317,7 +317,7 @@ static NSNotificationCenter *nc;
_changedMessagesEnabled = YES; _changedMessagesEnabled = YES;
_notifications = [[NSMutableArray alloc] init]; _notifications = [[NSMutableArray alloc] init];
_changed = YES; _needsSizing = YES;
// According to the spec, menus do autoenable by default. // According to the spec, menus do autoenable by default.
_autoenable = YES; _autoenable = YES;
@ -392,7 +392,7 @@ static NSNotificationCenter *nc;
return; return;
[_items insertObject: newItem atIndex: index]; [_items insertObject: newItem atIndex: index];
_changed = YES; _needsSizing = YES;
// Create the notification for the menu representation. // Create the notification for the menu representation.
d = [NSDictionary d = [NSDictionary
@ -464,7 +464,7 @@ static NSNotificationCenter *nc;
[anItem setMenu: nil]; [anItem setMenu: nil];
[_items removeObjectAtIndex: index]; [_items removeObjectAtIndex: index];
_changed = YES; _needsSizing = YES;
d = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: index] d = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: index]
forKey: @"NSMenuItemIndex"]; forKey: @"NSMenuItemIndex"];
@ -488,7 +488,7 @@ static NSNotificationCenter *nc;
if (-1 == index) if (-1 == index)
return; return;
_changed = YES; _needsSizing = YES;
d = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: index] d = [NSDictionary dictionaryWithObject: [NSNumber numberWithInt: index]
forKey: @"NSMenuItemIndex"]; forKey: @"NSMenuItemIndex"];
@ -814,7 +814,7 @@ static NSNotificationCenter *nc;
[self setMenuChangedMessagesEnabled: YES]; [self setMenuChangedMessagesEnabled: YES];
} }
if (_changed && ([_aWindow isVisible] || [_bWindow isVisible])) if (_needsSizing && ([_aWindow isVisible] || [_bWindow isVisible]))
{ {
NSDebugLLog (@"NSMenu", @" Calling Size To Fit (A)"); NSDebugLLog (@"NSMenu", @" Calling Size To Fit (A)");
[self sizeToFit]; [self sizeToFit];
@ -917,7 +917,7 @@ static NSNotificationCenter *nc;
{ {
ASSIGN(_title, aTitle); ASSIGN(_title, aTitle);
_changed = YES; _needsSizing = YES;
if ([_aWindow isVisible] || [_bWindow isVisible]) if ([_aWindow isVisible] || [_bWindow isVisible])
{ {
[self sizeToFit]; [self sizeToFit];
@ -999,8 +999,8 @@ static NSNotificationCenter *nc;
NSRect menuFrame; NSRect menuFrame;
NSSize size; NSSize size;
[_view update]; [_view sizeToFit];
menuFrame = [_view frame]; menuFrame = [_view frame];
size = menuFrame.size; size = menuFrame.size;
@ -1038,7 +1038,7 @@ static NSNotificationCenter *nc;
[_view setNeedsDisplay: YES]; [_view setNeedsDisplay: YES];
_changed = NO; _needsSizing = NO;
} }
/* /*
@ -1228,8 +1228,8 @@ static NSNotificationCenter *nc;
NSDebugLLog (@"NSMenu", NSDebugLLog (@"NSMenu",
@"trying to display while alreay displayed transient"); @"trying to display while alreay displayed transient");
} }
if (_changed) if (_needsSizing)
{ {
[self sizeToFit]; [self sizeToFit];
} }
@ -1296,8 +1296,8 @@ static NSNotificationCenter *nc;
contentView = [_bWindow contentView]; contentView = [_bWindow contentView];
[contentView addSubview: _view]; [contentView addSubview: _view];
// [_view update]; [_view update];
if (_changed) if (_needsSizing)
{ {
[self sizeToFit]; [self sizeToFit];
} }
@ -1384,8 +1384,9 @@ static NSNotificationCenter *nc;
contentView = [_aWindow contentView]; contentView = [_aWindow contentView];
[contentView addSubview: _view]; [contentView addSubview: _view];
[contentView setNeedsDisplay: YES];
[contentView setNeedsDisplay: YES];
// Restore the old submenu (if any). // Restore the old submenu (if any).
if (_superMenu != nil) if (_superMenu != nil)
{ {
@ -1397,6 +1398,7 @@ static NSNotificationCenter *nc;
[[self menuRepresentation] setHighlightedItemIndex: _oldHiglightedIndex]; [[self menuRepresentation] setHighlightedItemIndex: _oldHiglightedIndex];
_transient = NO; _transient = NO;
[_view update];
} }
- (NSWindow*) window - (NSWindow*) window