* Source/NSMenuItem.m: encodeWithCoder: only encode the NSSubitems

key if the menu is not owned by a popup.   This avoids an
	assertion error when loading the resulting nib into InterfaceBuilder.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28446 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2009-08-09 03:27:13 +00:00
parent 423d1f0826
commit 8179620995
2 changed files with 16 additions and 2 deletions

View file

@ -506,9 +506,17 @@ static Class imageClass;
[aCoder encodeObject: _onStateImage forKey: @"NSOnImage"];
[aCoder encodeObject: _offStateImage forKey: @"NSOffImage"]; // ???????
[aCoder encodeObject: _mixedStateImage forKey: @"NSMixedImage"];
[aCoder encodeObject: _target forKey: @"NSTarget"];
[aCoder encodeObject: _target forKey: @"NSTarget"];
[aCoder encodeObject: _menu forKey: @"NSMenu"];
[aCoder encodeObject: _submenu forKey: @"NSSubmenu"];
// If the menu is owned by a popup, then don't encode the children.
// This prevents an assertion error in IB as these keys should not
// be present in a menu item when it's encoded as part of a popup.
if([_menu _ownedByPopUp] == NO)
{
[aCoder encodeObject: _submenu forKey: @"NSSubmenu"];
}
[aCoder encodeInt: _keyEquivalentModifierMask forKey: @"NSKeyEquivModMask"];
[aCoder encodeInt: _mnemonicLocation forKey: @"NSMnemonicLoc"];
[aCoder encodeInt: _state forKey: @"NSState"];