![]() |
API 0.9.5
|
00001 /* 00002 * CPMenuItem.j 00003 * AppKit 00004 * 00005 * Created by Francisco Tolmasky. 00006 * Copyright 2008, 280 North, Inc. 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00021 */ 00022 00023 00024 00025 00026 var CPMenuItemStringRepresentationDictionary = [CPDictionary dictionary]; 00027 [CPMenuItemStringRepresentationDictionary setObject:"\u238B" forKey:CPEscapeFunctionKey]; 00028 [CPMenuItemStringRepresentationDictionary setObject:"\u21E5" forKey:CPTabCharacter]; 00029 [CPMenuItemStringRepresentationDictionary setObject:"\u21E4" forKey:CPBackTabCharacter]; 00030 [CPMenuItemStringRepresentationDictionary setObject:"\u2423" forKey:CPSpaceFunctionKey]; 00031 [CPMenuItemStringRepresentationDictionary setObject:"\u23CE" forKey:CPCarriageReturnCharacter]; 00032 [CPMenuItemStringRepresentationDictionary setObject:"\u232B" forKey:CPBackspaceCharacter]; 00033 [CPMenuItemStringRepresentationDictionary setObject:"\u232B" forKey:CPDeleteFunctionKey]; 00034 [CPMenuItemStringRepresentationDictionary setObject:"\u2326" forKey:CPDeleteCharacter]; 00035 [CPMenuItemStringRepresentationDictionary setObject:"\u21F1" forKey:CPHomeFunctionKey]; 00036 [CPMenuItemStringRepresentationDictionary setObject:"\u21F2" forKey:CPEndFunctionKey]; 00037 [CPMenuItemStringRepresentationDictionary setObject:"\u21DE" forKey:CPPageUpFunctionKey]; 00038 [CPMenuItemStringRepresentationDictionary setObject:"\u21DF" forKey:CPPageDownFunctionKey]; 00039 [CPMenuItemStringRepresentationDictionary setObject:"\u2191" forKey:CPUpArrowFunctionKey]; 00040 [CPMenuItemStringRepresentationDictionary setObject:"\u2193" forKey:CPDownArrowFunctionKey]; 00041 [CPMenuItemStringRepresentationDictionary setObject:"\u2190" forKey:CPLeftArrowFunctionKey]; 00042 [CPMenuItemStringRepresentationDictionary setObject:"\u2192" forKey:CPRightArrowFunctionKey]; 00043 [CPMenuItemStringRepresentationDictionary setObject:"\u2327" forKey:CPClearDisplayFunctionKey]; 00044 00053 @implementation CPMenuItem : CPObject 00054 { 00055 BOOL _isSeparator; 00056 00057 CPString _title; 00058 //CPAttributedString _attributedTitle; 00059 00060 CPFont _font; 00061 00062 id _target; 00063 SEL _action; 00064 00065 BOOL _isEnabled; 00066 BOOL _isHidden; 00067 00068 int _tag; 00069 int _state; 00070 00071 CPImage _image; 00072 CPImage _alternateImage; 00073 CPImage _onStateImage; 00074 CPImage _offStateImage; 00075 CPImage _mixedStateImage; 00076 00077 CPMenu _submenu; 00078 CPMenu _menu; 00079 00080 CPString _keyEquivalent; 00081 unsigned _keyEquivalentModifierMask; 00082 00083 int _mnemonicLocation; 00084 00085 BOOL _isAlternate; 00086 int _indentationLevel; 00087 00088 CPString _toolTip; 00089 id _representedObject; 00090 CPView _view; 00091 00092 int _changeCount; 00093 00094 _CPMenuItemView _menuItemView; 00095 } 00096 00097 - (id)init 00098 { 00099 return [self initWithTitle:@"" action:nil keyEquivalent:nil]; 00100 } 00101 00109 - (id)initWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent 00110 { 00111 self = [super init]; 00112 00113 if (self) 00114 { 00115 _changeCount = 0; 00116 _isSeparator = NO; 00117 00118 _title = aTitle; 00119 _action = anAction; 00120 00121 _isEnabled = YES; 00122 _isHidden = NO; 00123 00124 _tag = 0; 00125 _state = CPOffState; 00126 00127 _keyEquivalent = aKeyEquivalent || @""; 00128 _keyEquivalentModifierMask = CPPlatformActionKeyMask; 00129 00130 _indentationLevel = 0; 00131 00132 _mnemonicLocation = CPNotFound; 00133 } 00134 00135 return self; 00136 } 00137 00138 // Enabling a Menu Item 00143 - (void)setEnabled:(BOOL)isEnabled 00144 { 00145 if (_isEnabled === isEnabled) 00146 return; 00147 00148 _isEnabled = !!isEnabled; 00149 00150 [_menuItemView setDirty]; 00151 [_menu itemChanged:self]; 00152 } 00153 00157 - (BOOL)isEnabled 00158 { 00159 return _isEnabled; 00160 } 00161 00162 // Managing Hidden Status 00167 - (void)setHidden:(BOOL)isHidden 00168 { 00169 if (_isHidden == isHidden) 00170 return; 00171 00172 _isHidden = isHidden; 00173 00174 [_menu itemChanged:self]; 00175 } 00176 00180 - (BOOL)isHidden 00181 { 00182 return _isHidden; 00183 } 00184 00188 - (BOOL)isHiddenOrHasHiddenAncestor 00189 { 00190 if (_isHidden) 00191 return YES; 00192 00193 var supermenu = [_menu supermenu]; 00194 00195 if ([[supermenu itemAtIndex:[supermenu indexOfItemWithSubmenu:_menu]] isHiddenOrHasHiddenAncestor]) 00196 return YES; 00197 00198 return NO; 00199 } 00200 00201 // Managing Target and Action 00206 - (void)setTarget:(id)aTarget 00207 { 00208 _target = aTarget; 00209 } 00210 00214 - (id)target 00215 { 00216 return _target; 00217 } 00218 00223 - (void)setAction:(SEL)anAction 00224 { 00225 _action = anAction; 00226 } 00227 00231 - (SEL)action 00232 { 00233 return _action; 00234 } 00235 00236 // Managing the Title 00241 - (void)setTitle:(CPString)aTitle 00242 { 00243 _mnemonicLocation = CPNotFound; 00244 00245 if (_title == aTitle) 00246 return; 00247 00248 _title = aTitle; 00249 00250 [_menuItemView setDirty]; 00251 00252 [_menu itemChanged:self]; 00253 } 00254 00258 - (CPString)title 00259 { 00260 return _title; 00261 } 00262 00266 - (void)setTextColor:(CPString)aColor 00267 { 00268 //FIXME IMPLEMENT 00269 } 00270 00275 - (void)setFont:(CPFont)aFont 00276 { 00277 if (_font == aFont) 00278 return; 00279 00280 _font = aFont; 00281 00282 [_menu itemChanged:self]; 00283 00284 [_menuItemView setDirty]; 00285 } 00286 00290 - (CPFont)font 00291 { 00292 return _font; 00293 } 00294 00295 /* 00296 - (void)setAttributedTitle:(CPAttributedString)aTitle 00297 { 00298 } 00299 00300 - (CPAttributedString)attributedTitle 00301 { 00302 } 00303 */ 00304 00305 // Managing the Tag 00310 - (void)setTag:(int)aTag 00311 { 00312 _tag = aTag; 00313 } 00314 00318 - (int)tag 00319 { 00320 return _tag; 00321 } 00322 00331 - (void)setState:(int)aState 00332 { 00333 if (_state == aState) 00334 return; 00335 00336 _state = aState; 00337 00338 [_menu itemChanged:self]; 00339 00340 [_menuItemView setDirty]; 00341 } 00342 00351 - (int)state 00352 { 00353 return _state; 00354 } 00355 00356 // Managing the Image 00361 - (void)setImage:(CPImage)anImage 00362 { 00363 if (_image == anImage) 00364 return; 00365 00366 _image = anImage; 00367 00368 [_menuItemView setDirty]; 00369 00370 [_menu itemChanged:self]; 00371 } 00372 00376 - (CPImage)image 00377 { 00378 return _image; 00379 } 00380 00385 - (void)setAlternateImage:(CPImage)anImage 00386 { 00387 _alternateImage = anImage; 00388 } 00389 00393 - (CPImage)alternateImage 00394 { 00395 return _alternateImage; 00396 } 00397 00403 - (void)setOnStateImage:(CPImage)anImage 00404 { 00405 if (_onStateImage == anImage) 00406 return; 00407 00408 _onStateImage = anImage; 00409 [_menu itemChanged:self]; 00410 } 00411 00415 - (CPImage)onStateImage 00416 { 00417 return _onStateImage; 00418 } 00419 00424 - (void)setOffStateImage:(CPImage)anImage 00425 { 00426 if (_offStateImage == anImage) 00427 return; 00428 00429 _offStateImage = anImage; 00430 [_menu itemChanged:self]; 00431 } 00432 00436 - (CPImage)offStateImage 00437 { 00438 return _offStateImage; 00439 } 00440 00445 - (void)setMixedStateImage:(CPImage)anImage 00446 { 00447 if (_mixedStateImage == anImage) 00448 return; 00449 00450 _mixedStateImage = anImage; 00451 [_menu itemChanged:self]; 00452 } 00453 00458 - (CPImage)mixedStateImage 00459 { 00460 return _mixedStateImage; 00461 } 00462 00463 // Managing Submenus 00468 - (void)setSubmenu:(CPMenu)aMenu 00469 { 00470 if (_submenu === aMenu) 00471 return; 00472 00473 var supermenu = [_submenu supermenu]; 00474 00475 if (supermenu) 00476 [CPException raise:CPInvalidArgumentException 00477 reason: @"Can't add submenu \"" + [aMenu title] + "\" to item \"" + [self title] + "\", because it is already submenu of \"" + [[aMenu supermenu] title] + "\""]; 00478 00479 _submenu = aMenu; 00480 00481 if (_submenu) 00482 { 00483 [_submenu setSupermenu:_menu]; 00484 [_submenu setTitle:[self title]] 00485 00486 [self setTarget:_menu]; 00487 [self setAction:@selector(submenuAction:)]; 00488 } 00489 else 00490 { 00491 [self setTarget:nil]; 00492 [self setAction:NULL]; 00493 } 00494 00495 [_menuItemView setDirty]; 00496 00497 [_menu itemChanged:self]; 00498 } 00499 00503 - (CPMenu)submenu 00504 { 00505 return _submenu; 00506 } 00507 00511 - (BOOL)hasSubmenu 00512 { 00513 return _submenu ? YES : NO; 00514 } 00515 00516 // Getting a Separator Item 00517 00521 + (CPMenuItem)separatorItem 00522 { 00523 var separatorItem = [[self alloc] initWithTitle:@"" action:nil keyEquivalent:nil]; 00524 00525 separatorItem._isSeparator = YES; 00526 00527 return separatorItem; 00528 } 00529 00533 - (BOOL)isSeparatorItem 00534 { 00535 return _isSeparator; 00536 } 00537 00538 // Managing the Owning Menu 00543 - (void)setMenu:(CPMenu)aMenu 00544 { 00545 _menu = aMenu; 00546 } 00547 00551 - (CPMenu)menu 00552 { 00553 return _menu; 00554 } 00555 00556 // 00557 00562 - (void)setKeyEquivalent:(CPString)aString 00563 { 00564 _keyEquivalent = aString || @""; 00565 } 00566 00570 - (CPString)keyEquivalent 00571 { 00572 return _keyEquivalent; 00573 } 00574 00585 - (void)setKeyEquivalentModifierMask:(unsigned)aMask 00586 { 00587 _keyEquivalentModifierMask = aMask; 00588 } 00589 00600 - (unsigned)keyEquivalentModifierMask 00601 { 00602 return _keyEquivalentModifierMask; 00603 } 00604 00605 - (CPString)keyEquivalentStringRepresentation 00606 { 00607 if (![_keyEquivalent length]) 00608 return @""; 00609 00610 var string = _keyEquivalent.toUpperCase(), 00611 needsShift = _keyEquivalentModifierMask & CPShiftKeyMask || 00612 (string === _keyEquivalent && _keyEquivalent.toLowerCase() !== _keyEquivalent.toUpperCase()); 00613 00614 if ([CPMenuItemStringRepresentationDictionary objectForKey:string]) 00615 string = [CPMenuItemStringRepresentationDictionary objectForKey:string]; 00616 00617 if (CPBrowserIsOperatingSystem(CPMacOperatingSystem)) 00618 { 00619 if (_keyEquivalentModifierMask & CPCommandKeyMask) 00620 string = "\u2318" + string; 00621 00622 if (needsShift) 00623 string = "\u21E7" + string; 00624 00625 if (_keyEquivalentModifierMask & CPAlternateKeyMask) 00626 string = "\u2325" + string; 00627 00628 if (_keyEquivalentModifierMask & CPControlKeyMask) 00629 string = "\u2303" + string; 00630 } 00631 else 00632 { 00633 if (needsShift) 00634 string = "Shift-" + string; 00635 00636 if (_keyEquivalentModifierMask & CPAlternateKeyMask) 00637 string = "Alt-" + string; 00638 00639 if (_keyEquivalentModifierMask & CPControlKeyMask || _keyEquivalentModifierMask & CPCommandKeyMask) 00640 string = "Ctrl-" + string; 00641 } 00642 00643 return string; 00644 } 00645 00646 // Managing Mnemonics 00652 - (void)setMnemonicLocation:(unsigned)aLocation 00653 { 00654 _mnemonicLocation = aLocation; 00655 } 00656 00660 - (unsigned)mnemonicLocation 00661 { 00662 return _mnemonicLocation; 00663 } 00664 00669 - (void)setTitleWithMnemonicLocation:(CPString)aTitle 00670 { 00671 var location = [aTitle rangeOfString:@"&"].location; 00672 00673 if (location == CPNotFound) 00674 [self setTitle:aTitle]; 00675 else 00676 { 00677 [self setTitle:[aTitle substringToIndex:location] + [aTitle substringFromIndex:location + 1]]; 00678 [self setMnemonicLocation:location]; 00679 } 00680 } 00681 00685 - (CPString)mnemonic 00686 { 00687 return _mnemonicLocation == CPNotFound ? @"" : [_title characterAtIndex:_mnemonicLocation]; 00688 } 00689 00690 // Managing Alternates 00691 00696 - (void)setAlternate:(BOOL)isAlternate 00697 { 00698 _isAlternate = isAlternate; 00699 } 00700 00704 - (BOOL)isAlternate 00705 { 00706 return _isAlternate; 00707 } 00708 00709 // Managing Indentation Levels 00710 00716 - (void)setIndentationLevel:(unsigned)aLevel 00717 { 00718 if (aLevel < 0) 00719 [CPException raise:CPInvalidArgumentException reason:"setIndentationLevel: argument must be greater than or equal to 0."]; 00720 00721 _indentationLevel = MIN(15, aLevel); 00722 } 00723 00727 - (unsigned)indentationLevel 00728 { 00729 return _indentationLevel; 00730 } 00731 00732 // Managing Tool Tips 00737 - (void)setToolTip:(CPString)aToolTip 00738 { 00739 _toolTip = aToolTip; 00740 } 00741 00745 - (CPString)toolTip 00746 { 00747 return _toolTip; 00748 } 00749 00750 // Representing an Object 00751 00756 - (void)setRepresentedObject:(id)anObject 00757 { 00758 _representedObject = anObject; 00759 } 00760 00764 - (id)representedObject 00765 { 00766 return _representedObject; 00767 } 00768 00769 // Managing the View 00770 00775 - (void)setView:(CPView)aView 00776 { 00777 if (_view === aView) 00778 return; 00779 00780 _view = aView; 00781 00782 [_menuItemView setDirty]; 00783 00784 [_menu itemChanged:self]; 00785 } 00786 00790 - (CPView)view 00791 { 00792 return _view; 00793 } 00794 00795 // Getting Highlighted Status 00796 00800 - (BOOL)isHighlighted 00801 { 00802 return [[self menu] highlightedItem] == self; 00803 } 00804 00805 #pragma mark CPObject Overrides 00806 00810 - (id)copy 00811 { 00812 var item = [[CPMenuItem alloc] init]; 00813 00814 // No point in going through accessors and doing lots of unnecessary state checking/updating 00815 item._isSeparator = _isSeparator; 00816 00817 [item setTitle:_title]; 00818 [item setFont:_font]; 00819 [item setTarget:_target]; 00820 [item setAction:_action]; 00821 [item setEnabled:_isEnabled]; 00822 [item setHidden:_isHidden] 00823 [item setTag:_tag]; 00824 [item setState:_state]; 00825 [item setImage:_image]; 00826 [item setAlternateImage:_alternateImage]; 00827 [item setOnStateImage:_onStateImage]; 00828 [item setOffStateImage:_offStateImage]; 00829 [item setMixedStateImage:_mixedStateImage]; 00830 [item setKeyEquivalent:_keyEquivalent]; 00831 [item setKeyEquivalentModifierMask:_keyEquivalentModifierMask]; 00832 [item setMnemonicLocation:_mnemonicLocation]; 00833 [item setAlternate:_isAlternate]; 00834 [item setIndentationLevel:_indentationLevel]; 00835 [item setToolTip:_toolTip]; 00836 [item setRepresentedObject:_representedObject]; 00837 00838 return item; 00839 } 00840 00841 - (id)mutableCopy 00842 { 00843 return [self copy]; 00844 } 00845 00846 #pragma mark Internal 00847 00848 /* 00849 @ignore 00850 */ 00851 - (id)_menuItemView 00852 { 00853 if (!_menuItemView) 00854 _menuItemView = [[_CPMenuItemView alloc] initWithFrame:CGRectMakeZero() forMenuItem:self]; 00855 00856 return _menuItemView; 00857 } 00858 00859 - (BOOL)_isSelectable 00860 { 00861 return ![self submenu] || [self action] !== @selector(submenuAction:) || [self target] !== [self menu]; 00862 } 00863 00864 - (BOOL)_isMenuBarButton 00865 { 00866 return ![self submenu] && [self menu] === [CPApp mainMenu]; 00867 } 00868 00869 - (CPString)description 00870 { 00871 return [super description] + @" target: " + [self target] + @" action: " + CPStringFromSelector([self action]); 00872 } 00873 00874 @end 00875 00876 var CPMenuItemIsSeparatorKey = @"CPMenuItemIsSeparatorKey", 00877 00878 CPMenuItemTitleKey = @"CPMenuItemTitleKey", 00879 CPMenuItemTargetKey = @"CPMenuItemTargetKey", 00880 CPMenuItemActionKey = @"CPMenuItemActionKey", 00881 00882 CPMenuItemIsEnabledKey = @"CPMenuItemIsEnabledKey", 00883 CPMenuItemIsHiddenKey = @"CPMenuItemIsHiddenKey", 00884 00885 CPMenuItemTagKey = @"CPMenuItemTagKey", 00886 CPMenuItemStateKey = @"CPMenuItemStateKey", 00887 00888 CPMenuItemImageKey = @"CPMenuItemImageKey", 00889 CPMenuItemAlternateImageKey = @"CPMenuItemAlternateImageKey", 00890 00891 CPMenuItemSubmenuKey = @"CPMenuItemSubmenuKey", 00892 CPMenuItemMenuKey = @"CPMenuItemMenuKey", 00893 00894 CPMenuItemKeyEquivalentKey = @"CPMenuItemKeyEquivalentKey", 00895 CPMenuItemKeyEquivalentModifierMaskKey = @"CPMenuItemKeyEquivalentModifierMaskKey", 00896 00897 CPMenuItemIndentationLevelKey = @"CPMenuItemIndentationLevelKey", 00898 00899 CPMenuItemRepresentedObjectKey = @"CPMenuItemRepresentedObjectKey", 00900 CPMenuItemViewKey = @"CPMenuItemViewKey"; 00901 00902 #define DEFAULT_VALUE(aKey, aDefaultValue) [aCoder containsValueForKey:(aKey)] ? [aCoder decodeObjectForKey:(aKey)] : (aDefaultValue) 00903 #define ENCODE_IFNOT(aKey, aValue, aDefaultValue) if ((aValue) !== (aDefaultValue)) [aCoder encodeObject:(aValue) forKey:(aKey)]; 00904 00905 @implementation CPMenuItem (CPCoding) 00911 - (id)initWithCoder:(CPCoder)aCoder 00912 { 00913 self = [super init]; 00914 00915 if (self) 00916 { 00917 _changeCount = 0; 00918 _isSeparator = [aCoder containsValueForKey:CPMenuItemIsSeparatorKey] && [aCoder decodeBoolForKey:CPMenuItemIsSeparatorKey]; 00919 00920 _title = [aCoder decodeObjectForKey:CPMenuItemTitleKey]; 00921 00922 // _font; 00923 00924 _target = [aCoder decodeObjectForKey:CPMenuItemTargetKey]; 00925 _action = [aCoder decodeObjectForKey:CPMenuItemActionKey]; 00926 00927 _isEnabled = DEFAULT_VALUE(CPMenuItemIsEnabledKey, YES); 00928 _isHidden = DEFAULT_VALUE(CPMenuItemIsHiddenKey, NO); 00929 _tag = DEFAULT_VALUE(CPMenuItemTagKey, 0); 00930 _state = DEFAULT_VALUE(CPMenuItemStateKey, CPOffState); 00931 00932 _image = DEFAULT_VALUE(CPMenuItemImageKey, nil); 00933 _alternateImage = DEFAULT_VALUE(CPMenuItemAlternateImageKey, nil); 00934 // CPImage _onStateImage; 00935 // CPImage _offStateImage; 00936 // CPImage _mixedStateImage; 00937 00938 // This order matters because setSubmenu: needs _menu to be around. 00939 _menu = DEFAULT_VALUE(CPMenuItemMenuKey, nil); 00940 [self setSubmenu:DEFAULT_VALUE(CPMenuItemSubmenuKey, nil)]; 00941 00942 _keyEquivalent = [aCoder decodeObjectForKey:CPMenuItemKeyEquivalentKey] || @""; 00943 _keyEquivalentModifierMask = [aCoder decodeObjectForKey:CPMenuItemKeyEquivalentModifierMaskKey] || 0; 00944 00945 // int _mnemonicLocation; 00946 00947 // BOOL _isAlternate; 00948 00949 // Default is 0. 00950 [self setIndentationLevel:[aCoder decodeIntForKey:CPMenuItemIndentationLevelKey] || 0]; 00951 00952 // CPString _toolTip; 00953 00954 _representedObject = DEFAULT_VALUE(CPMenuItemRepresentedObjectKey, nil); 00955 _view = DEFAULT_VALUE(CPMenuItemViewKey, nil); 00956 } 00957 00958 return self; 00959 } 00960 00965 - (void)encodeWithCoder:(CPCoder)aCoder 00966 { 00967 if (_isSeparator) 00968 [aCoder encodeBool:_isSeparator forKey:CPMenuItemIsSeparatorKey]; 00969 00970 [aCoder encodeObject:_title forKey:CPMenuItemTitleKey]; 00971 00972 [aCoder encodeObject:_target forKey:CPMenuItemTargetKey]; 00973 [aCoder encodeObject:_action forKey:CPMenuItemActionKey]; 00974 00975 ENCODE_IFNOT(CPMenuItemIsEnabledKey, _isEnabled, YES); 00976 ENCODE_IFNOT(CPMenuItemIsHiddenKey, _isHidden, NO); 00977 00978 ENCODE_IFNOT(CPMenuItemTagKey, _tag, 0); 00979 ENCODE_IFNOT(CPMenuItemStateKey, _state, CPOffState); 00980 00981 ENCODE_IFNOT(CPMenuItemImageKey, _image, nil); 00982 ENCODE_IFNOT(CPMenuItemAlternateImageKey, _alternateImage, nil); 00983 00984 ENCODE_IFNOT(CPMenuItemSubmenuKey, _submenu, nil); 00985 ENCODE_IFNOT(CPMenuItemMenuKey, _menu, nil); 00986 00987 if (_keyEquivalent && _keyEquivalent.length) 00988 [aCoder encodeObject:_keyEquivalent forKey:CPMenuItemKeyEquivalentKey]; 00989 00990 if (_keyEquivalentModifierMask) 00991 [aCoder encodeObject:_keyEquivalentModifierMask forKey:CPMenuItemKeyEquivalentModifierMaskKey]; 00992 00993 if (_indentationLevel > 0) 00994 [aCoder encodeInt:_indentationLevel forKey:CPMenuItemIndentationLevelKey]; 00995 00996 ENCODE_IFNOT(CPMenuItemRepresentedObjectKey, _representedObject, nil); 00997 ENCODE_IFNOT(CPMenuItemViewKey, _view, nil); 00998 } 00999 01000 @end