mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:00:47 +00:00
Make sure menu views get cleaned up properly.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@20122 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
030ceb1136
commit
7e1492f50b
3 changed files with 31 additions and 14 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2004-09-24 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/NSMenuView.m (-setMenu:): Only call update when the new
|
||||||
|
menu is not nil.
|
||||||
|
* Source/NSMenu.m (-setMenuRepresentation:): Unset the menu of the
|
||||||
|
old view.
|
||||||
|
(-dealloc): Unset the menu of the view.
|
||||||
|
(-initWithTitle:): Use setMenuRepresentation: to set the view.
|
||||||
|
|
||||||
2004-09-24 Adam Fedor <fedor@gnu.org>
|
2004-09-24 Adam Fedor <fedor@gnu.org>
|
||||||
|
|
||||||
* Version 0.9.4
|
* Version 0.9.4
|
||||||
|
|
|
@ -300,6 +300,7 @@ static NSNotificationCenter *nc;
|
||||||
RELEASE(_notifications);
|
RELEASE(_notifications);
|
||||||
RELEASE(_title);
|
RELEASE(_title);
|
||||||
RELEASE(_items);
|
RELEASE(_items);
|
||||||
|
[_view setMenu: nil];
|
||||||
RELEASE(_view);
|
RELEASE(_view);
|
||||||
RELEASE(_aWindow);
|
RELEASE(_aWindow);
|
||||||
RELEASE(_bWindow);
|
RELEASE(_bWindow);
|
||||||
|
@ -312,14 +313,14 @@ static NSNotificationCenter *nc;
|
||||||
*/
|
*/
|
||||||
- (id) initWithTitle: (NSString*)aTitle
|
- (id) initWithTitle: (NSString*)aTitle
|
||||||
{
|
{
|
||||||
NSView *contentView;
|
NSMenuView *menuRep;
|
||||||
|
|
||||||
[super init];
|
[super init];
|
||||||
|
|
||||||
// Keep the title.
|
// Keep the title.
|
||||||
ASSIGN(_title, aTitle);
|
ASSIGN(_title, aTitle);
|
||||||
|
|
||||||
// Create an array to store out menu items.
|
// Create an array to store our menu items.
|
||||||
_items = [[NSMutableArray alloc] init];
|
_items = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
_changedMessagesEnabled = YES;
|
_changedMessagesEnabled = YES;
|
||||||
|
@ -340,11 +341,9 @@ static NSNotificationCenter *nc;
|
||||||
[_bWindow setLevel: NSPopUpMenuWindowLevel];
|
[_bWindow setLevel: NSPopUpMenuWindowLevel];
|
||||||
|
|
||||||
// Create a NSMenuView to draw our menu items.
|
// Create a NSMenuView to draw our menu items.
|
||||||
_view = [[NSMenuView alloc] initWithFrame: NSZeroRect];
|
menuRep = [[NSMenuView alloc] initWithFrame: NSZeroRect];
|
||||||
[_view setMenu: self];
|
[self setMenuRepresentation: menuRep];
|
||||||
|
RELEASE(menuRep);
|
||||||
contentView = [_aWindow contentView];
|
|
||||||
[contentView addSubview: _view];
|
|
||||||
|
|
||||||
/* Set up the notification to start the process of redisplaying
|
/* Set up the notification to start the process of redisplaying
|
||||||
the menus where the user left them the last time.
|
the menus where the user left them the last time.
|
||||||
|
@ -940,9 +939,18 @@ static NSNotificationCenter *nc;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the old representation
|
if (_view == menuRep)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
contentView = [_aWindow contentView];
|
contentView = [_aWindow contentView];
|
||||||
[contentView removeSubview: _view];
|
if (_view != nil)
|
||||||
|
{
|
||||||
|
// remove the old representation
|
||||||
|
[contentView removeSubview: _view];
|
||||||
|
[_view setMenu: nil];
|
||||||
|
}
|
||||||
|
|
||||||
ASSIGN(_view, menuRep);
|
ASSIGN(_view, menuRep);
|
||||||
[_view setMenu: self];
|
[_view setMenu: self];
|
||||||
|
|
|
@ -185,12 +185,12 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
selector: @selector(itemRemoved:)
|
selector: @selector(itemRemoved:)
|
||||||
name: NSMenuDidRemoveItemNotification
|
name: NSMenuDidRemoveItemNotification
|
||||||
object: _attachedMenu];
|
object: _attachedMenu];
|
||||||
|
|
||||||
|
// Force menu view's layout to be recalculated.
|
||||||
|
[self setNeedsSizing: YES];
|
||||||
|
|
||||||
|
[self update];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Force menu view's layout to be recalculated.
|
|
||||||
[self setNeedsSizing: YES];
|
|
||||||
|
|
||||||
[self update];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSMenu*) menu
|
- (NSMenu*) menu
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue