API  0.9.10
CPMenuItem.j
Go to the documentation of this file.
1 /*
2  * CPMenuItem.j
3  * AppKit
4  *
5  * Created by Francisco Tolmasky.
6  * Copyright 2008, 280 North, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 
24 
25 
26 @global CPApp
27 
29  CPEscapeFunctionKey: "\u238B",
30  CPTabCharacter: "\u21E5",
31  CPBackTabCharacter: "\u21E4",
32  CPSpaceFunctionKey: "\u2423",
33  CPCarriageReturnCharacter: "\u23CE",
34  CPBackspaceCharacter: "\u232B",
35  CPDeleteFunctionKey: "\u232B",
36  CPDeleteCharacter: "\u2326",
37  CPHomeFunctionKey: "\u21F1",
38  CPEndFunctionKey: "\u21F2",
39  CPPageUpFunctionKey: "\u21DE",
40  CPPageDownFunctionKey: "\u21DF",
41  CPUpArrowFunctionKey: "\u2191",
42  CPDownArrowFunctionKey: "\u2193",
43  CPLeftArrowFunctionKey: "\u2190",
44  CPRightArrowFunctionKey: "\u2192",
45  CPClearDisplayFunctionKey: "\u2327",
46  };
47 
55 @implementation CPMenuItem : CPObject
56 {
57  BOOL _isSeparator;
58 
59  CPString _title;
60  //CPAttributedString _attributedTitle;
61 
62  CPFont _font;
63 
64  id _target;
65  SEL _action;
66 
67  BOOL _isEnabled;
68  BOOL _isHidden;
69 
70  int _tag;
71  int _state;
72 
73  CPImage _image;
74  CPImage _alternateImage;
75  CPImage _onStateImage;
76  CPImage _offStateImage;
77  CPImage _mixedStateImage;
78 
79  CPMenu _submenu;
80  CPMenu _menu;
81 
82  CPString _keyEquivalent;
83  unsigned _keyEquivalentModifierMask;
84 
85  int _mnemonicLocation;
86 
87  BOOL _isAlternate;
88  int _indentationLevel;
89 
90  CPString _toolTip;
91  id _representedObject;
92  CPView _view;
93 
94  int _changeCount;
95 
96  _CPMenuItemView _menuItemView;
97 }
98 
99 + (Class)_binderClassForBinding:(CPString)aBinding
100 {
101  if ([aBinding hasPrefix:CPEnabledBinding])
102  return [CPMultipleValueAndBinding class];
103  else if (aBinding === CPTargetBinding || [aBinding hasPrefix:CPArgumentBinding])
104  return [CPActionBinding class];
105 
106  return [super _binderClassForBinding:aBinding];
107 }
108 
109 - (id)init
110 {
111  return [self initWithTitle:@"" action:nil keyEquivalent:nil];
112 }
113 
121 - (id)initWithTitle:(CPString)aTitle action:(SEL)anAction keyEquivalent:(CPString)aKeyEquivalent
122 {
123  self = [super init];
124 
125  if (self)
126  {
127  _changeCount = 0;
128  _isSeparator = NO;
129 
130  _title = aTitle;
131  _action = anAction;
132 
133  _isEnabled = YES;
134  _isHidden = NO;
135 
136  _tag = 0;
137  _state = CPOffState;
138 
139  _keyEquivalent = aKeyEquivalent || @"";
140  _keyEquivalentModifierMask = CPPlatformActionKeyMask;
141 
142  _indentationLevel = 0;
143 
144  _mnemonicLocation = CPNotFound;
145  }
146 
147  return self;
148 }
149 
150 // Enabling a Menu Item
155 - (void)setEnabled:(BOOL)isEnabled
156 {
157  if (_isEnabled === isEnabled)
158  return;
159 
160  if (!isEnabled && [self isHighlighted])
161  [_menu _highlightItemAtIndex:CPNotFound];
162 
163  _isEnabled = !!isEnabled;
164 
165  [_menuItemView setDirty];
166  [_menu itemChanged:self];
167 }
168 
172 - (BOOL)isEnabled
173 {
174  return _isEnabled;
175 }
176 
177 // Managing Hidden Status
182 - (void)setHidden:(BOOL)isHidden
183 {
184  if (_isHidden == isHidden)
185  return;
186 
187  _isHidden = isHidden;
188 
189  [_menu itemChanged:self];
190 }
191 
195 - (BOOL)isHidden
196 {
197  return _isHidden;
198 }
199 
204 {
205  if (_isHidden)
206  return YES;
207 
208  var supermenu = [_menu supermenu];
209 
210  if ([[supermenu itemAtIndex:[supermenu indexOfItemWithSubmenu:_menu]] isHiddenOrHasHiddenAncestor])
211  return YES;
212 
213  return NO;
214 }
215 
216 // Managing Target and Action
221 - (void)setTarget:(id)aTarget
222 {
223  _target = aTarget;
224 }
225 
229 - (id)target
230 {
231  return _target;
232 }
233 
238 - (void)setAction:(SEL)anAction
239 {
240  _action = anAction;
241 }
242 
246 - (SEL)action
247 {
248  return _action;
249 }
250 
251 // Managing the Title
256 - (void)setTitle:(CPString)aTitle
257 {
258  _mnemonicLocation = CPNotFound;
259 
260  if (_title == aTitle)
261  return;
262 
263  _title = aTitle;
264 
265  [_menuItemView setDirty];
266 
267  [_menu itemChanged:self];
268 }
269 
274 {
275  return _title;
276 }
277 
281 - (void)setTextColor:(CPString)aColor
282 {
283  //FIXME IMPLEMENT
284 }
285 
290 - (void)setFont:(CPFont)aFont
291 {
292  if ([_font isEqual:aFont])
293  return;
294 
295  _font = aFont;
296 
297  [_menu itemChanged:self];
298 
299  [_menuItemView setDirty];
300 }
301 
306 {
307  return _font;
308 }
309 
310 /*
311 - (void)setAttributedTitle:(CPAttributedString)aTitle
312 {
313 }
314 
315 - (CPAttributedString)attributedTitle
316 {
317 }
318 */
319 
320 // Managing the Tag
325 - (void)setTag:(int)aTag
326 {
327  _tag = aTag;
328 }
329 
333 - (int)tag
334 {
335  return _tag;
336 }
337 
346 - (void)setState:(int)aState
347 {
348  if (_state == aState)
349  return;
350 
351  _state = aState;
352 
353  [_menu itemChanged:self];
354 
355  [_menuItemView setDirty];
356 }
357 
366 - (int)state
367 {
368  return _state;
369 }
370 
371 // Managing the Image
376 - (void)setImage:(CPImage)anImage
377 {
378  if (_image == anImage)
379  return;
380 
381  _image = anImage;
382 
383  [_menuItemView setDirty];
384 
385  [_menu itemChanged:self];
386 }
387 
392 {
393  return _image;
394 }
395 
400 - (void)setAlternateImage:(CPImage)anImage
401 {
402  _alternateImage = anImage;
403 }
404 
409 {
410  return _alternateImage;
411 }
412 
418 - (void)setOnStateImage:(CPImage)anImage
419 {
420  if (_onStateImage == anImage)
421  return;
422 
423  _onStateImage = anImage;
424  [_menu itemChanged:self];
425 }
426 
431 {
432  return _onStateImage;
433 }
434 
439 - (void)setOffStateImage:(CPImage)anImage
440 {
441  if (_offStateImage == anImage)
442  return;
443 
444  _offStateImage = anImage;
445  [_menu itemChanged:self];
446 }
447 
452 {
453  return _offStateImage;
454 }
455 
460 - (void)setMixedStateImage:(CPImage)anImage
461 {
462  if (_mixedStateImage == anImage)
463  return;
464 
465  _mixedStateImage = anImage;
466  [_menu itemChanged:self];
467 }
468 
474 {
475  return _mixedStateImage;
476 }
477 
478 // Managing Submenus
483 - (void)setSubmenu:(CPMenu)aMenu
484 {
485  if (_submenu === aMenu)
486  return;
487 
488  var supermenu = [_submenu supermenu];
489 
490  if (supermenu)
491  [CPException raise:CPInvalidArgumentException
492  reason: @"Can't add submenu \"" + [aMenu title] + "\" to item \"" + [self title] + "\", because it is already submenu of \"" + [[aMenu supermenu] title] + "\""];
493 
494  _submenu = aMenu;
495 
496  if (_submenu)
497  {
498  [_submenu setSupermenu:_menu];
499  [_submenu setTitle:[self title]]
500 
501  [self setTarget:_menu];
502  [self setAction:@selector(submenuAction:)];
503  }
504  else
505  {
506  [self setTarget:nil];
507  [self setAction:NULL];
508  }
509 
510  [_menuItemView setDirty];
511 
512  [_menu itemChanged:self];
513 }
514 
519 {
520  return _submenu;
521 }
522 
526 - (BOOL)hasSubmenu
527 {
528  return _submenu ? YES : NO;
529 }
530 
531 // Getting a Separator Item
532 
537 {
538  var separatorItem = [[self alloc] initWithTitle:@"" action:nil keyEquivalent:nil];
539 
540  separatorItem._isSeparator = YES;
541 
542  return separatorItem;
543 }
544 
549 {
550  return _isSeparator;
551 }
552 
553 // Managing the Owning Menu
558 - (void)setMenu:(CPMenu)aMenu
559 {
560  _menu = aMenu;
561 }
562 
567 {
568  return _menu;
569 }
570 
571 //
572 
577 - (void)setKeyEquivalent:(CPString)aString
578 {
579  _keyEquivalent = aString || @"";
580 }
581 
586 {
587  return _keyEquivalent;
588 }
589 
600 - (void)setKeyEquivalentModifierMask:(unsigned)aMask
601 {
602  _keyEquivalentModifierMask = aMask;
603 }
604 
616 {
617  return _keyEquivalentModifierMask;
618 }
619 
621 {
622  if (![_keyEquivalent length])
623  return @"";
624 
625  var string = _keyEquivalent.toUpperCase(),
626  needsShift = _keyEquivalentModifierMask & CPShiftKeyMask ||
627  (string === _keyEquivalent && _keyEquivalent.toLowerCase() !== _keyEquivalent.toUpperCase());
628 
629  if ([CPMenuItemStringRepresentationDictionary objectForKey:string])
630  string = [CPMenuItemStringRepresentationDictionary objectForKey:string];
631 
633  {
634  if (_keyEquivalentModifierMask & CPCommandKeyMask)
635  string = "\u2318" + string;
636 
637  if (needsShift)
638  string = "\u21E7" + string;
639 
640  if (_keyEquivalentModifierMask & CPAlternateKeyMask)
641  string = "\u2325" + string;
642 
643  if (_keyEquivalentModifierMask & CPControlKeyMask)
644  string = "\u2303" + string;
645  }
646  else
647  {
648  if (needsShift)
649  string = "Shift-" + string;
650 
651  if (_keyEquivalentModifierMask & CPAlternateKeyMask)
652  string = "Alt-" + string;
653 
654  if (_keyEquivalentModifierMask & CPControlKeyMask || _keyEquivalentModifierMask & CPCommandKeyMask)
655  string = "Ctrl-" + string;
656  }
657 
658  return string;
659 }
660 
661 // Managing Mnemonics
667 - (void)setMnemonicLocation:(unsigned)aLocation
668 {
669  _mnemonicLocation = aLocation;
670 }
671 
675 - (unsigned)mnemonicLocation
676 {
677  return _mnemonicLocation;
678 }
679 
684 - (void)setTitleWithMnemonicLocation:(CPString)aTitle
685 {
686  var location = [aTitle rangeOfString:@"&"].location;
687 
688  if (location == CPNotFound)
689  [self setTitle:aTitle];
690  else
691  {
692  [self setTitle:[aTitle substringToIndex:location] + [aTitle substringFromIndex:location + 1]];
693  [self setMnemonicLocation:location];
694  }
695 }
696 
701 {
702  return _mnemonicLocation == CPNotFound ? @"" : [_title characterAtIndex:_mnemonicLocation];
703 }
704 
705 // Managing Alternates
706 
711 - (void)setAlternate:(BOOL)isAlternate
712 {
713  _isAlternate = isAlternate;
714 }
715 
719 - (BOOL)isAlternate
720 {
721  return _isAlternate;
722 }
723 
724 // Managing Indentation Levels
725 
731 - (void)setIndentationLevel:(unsigned)aLevel
732 {
733  if (aLevel < 0)
734  [CPException raise:CPInvalidArgumentException reason:"setIndentationLevel: argument must be greater than or equal to 0."];
735 
736  _indentationLevel = MIN(15, aLevel);
737 }
738 
742 - (unsigned)indentationLevel
743 {
744  return _indentationLevel;
745 }
746 
747 // Managing Tool Tips
752 - (void)setToolTip:(CPString)aToolTip
753 {
754  _toolTip = aToolTip;
755 }
756 
761 {
762  return _toolTip;
763 }
764 
765 // Representing an Object
766 
771 - (void)setRepresentedObject:(id)anObject
772 {
773  _representedObject = anObject;
774 }
775 
780 {
781  return _representedObject;
782 }
783 
784 // Managing the View
785 
790 - (void)setView:(CPView)aView
791 {
792  if (_view === aView)
793  return;
794 
795  _view = aView;
796 
797  [_menuItemView setDirty];
798 
799  [_menu itemChanged:self];
800 }
801 
806 {
807  return _view;
808 }
809 
810 // Getting Highlighted Status
811 
816 {
817  return [[self menu] highlightedItem] == self;
818 }
819 
820 #pragma mark CPObject Overrides
821 
825 - (id)copy
826 {
827  var item = [[CPMenuItem alloc] init];
828 
829  // No point in going through accessors and doing lots of unnecessary state checking/updating
830  item._isSeparator = _isSeparator;
831 
832  [item setTitle:_title];
833  [item setFont:_font];
834  [item setTarget:_target];
835  [item setAction:_action];
836  [item setEnabled:_isEnabled];
837  [item setHidden:_isHidden]
838  [item setTag:_tag];
839  [item setState:_state];
840  [item setImage:_image];
841  [item setAlternateImage:_alternateImage];
842  [item setOnStateImage:_onStateImage];
843  [item setOffStateImage:_offStateImage];
844  [item setMixedStateImage:_mixedStateImage];
845  [item setKeyEquivalent:_keyEquivalent];
846  [item setKeyEquivalentModifierMask:_keyEquivalentModifierMask];
847  [item setMnemonicLocation:_mnemonicLocation];
848  [item setAlternate:_isAlternate];
849  [item setIndentationLevel:_indentationLevel];
850  [item setToolTip:_toolTip];
851  [item setRepresentedObject:_representedObject];
852 
853  return item;
854 }
855 
857 {
858  return [self copy];
859 }
860 
861 #pragma mark Internal
862 
863 /*
864  @ignore
865 */
866 - (id)_menuItemView
867 {
868  if (!_menuItemView)
869  _menuItemView = [[_CPMenuItemView alloc] initWithFrame:CGRectMakeZero() forMenuItem:self];
870 
871  return _menuItemView;
872 }
873 
874 - (BOOL)_isSelectable
875 {
876  return ![self submenu] || [self action] !== @selector(submenuAction:) || [self target] !== [self menu];
877 }
878 
879 - (BOOL)_isMenuBarButton
880 {
881  return ![self submenu] && [self menu] === [CPApp mainMenu];
882 }
883 
885 {
886  return [super description] + @" target: " + [self target] + @" action: " + CPStringFromSelector([self action]);
887 }
888 
889 @end
890 
891 var CPMenuItemIsSeparatorKey = @"CPMenuItemIsSeparatorKey",
892 
893  CPMenuItemTitleKey = @"CPMenuItemTitleKey",
894  CPMenuItemTargetKey = @"CPMenuItemTargetKey",
895  CPMenuItemActionKey = @"CPMenuItemActionKey",
896 
897  CPMenuItemIsEnabledKey = @"CPMenuItemIsEnabledKey",
898  CPMenuItemIsHiddenKey = @"CPMenuItemIsHiddenKey",
899 
900  CPMenuItemTagKey = @"CPMenuItemTagKey",
901  CPMenuItemStateKey = @"CPMenuItemStateKey",
902 
903  CPMenuItemImageKey = @"CPMenuItemImageKey",
904  CPMenuItemAlternateImageKey = @"CPMenuItemAlternateImageKey",
905 
906  CPMenuItemSubmenuKey = @"CPMenuItemSubmenuKey",
907  CPMenuItemMenuKey = @"CPMenuItemMenuKey",
908 
909  CPMenuItemKeyEquivalentKey = @"CPMenuItemKeyEquivalentKey",
910  CPMenuItemKeyEquivalentModifierMaskKey = @"CPMenuItemKeyEquivalentModifierMaskKey",
911 
912  CPMenuItemIndentationLevelKey = @"CPMenuItemIndentationLevelKey",
913 
914  CPMenuItemRepresentedObjectKey = @"CPMenuItemRepresentedObjectKey",
915  CPMenuItemViewKey = @"CPMenuItemViewKey";
916 
917 #define DEFAULT_VALUE(aKey, aDefaultValue) [aCoder containsValueForKey:(aKey)] ? [aCoder decodeObjectForKey:(aKey)] : (aDefaultValue)
918 #define ENCODE_IFNOT(aKey, aValue, aDefaultValue) if ((aValue) !== (aDefaultValue)) [aCoder encodeObject:(aValue) forKey:(aKey)];
919 
920 @implementation CPMenuItem (CPCoding)
926 - (id)initWithCoder:(CPCoder)aCoder
927 {
928  self = [super init];
929 
930  if (self)
931  {
932  _changeCount = 0;
933  _isSeparator = [aCoder containsValueForKey:CPMenuItemIsSeparatorKey] && [aCoder decodeBoolForKey:CPMenuItemIsSeparatorKey];
934 
935  _title = [aCoder decodeObjectForKey:CPMenuItemTitleKey];
936 
937 // _font;
938 
939  _target = [aCoder decodeObjectForKey:CPMenuItemTargetKey];
940  _action = [aCoder decodeObjectForKey:CPMenuItemActionKey];
941 
942  _isEnabled = DEFAULT_VALUE(CPMenuItemIsEnabledKey, YES);
943  _isHidden = [aCoder decodeBoolForKey:CPMenuItemIsHiddenKey];
944  _tag = [aCoder decodeIntForKey:CPMenuItemTagKey];
945  _state = [aCoder decodeIntForKey:CPMenuItemStateKey];
946 
947  _image = [aCoder decodeObjectForKey:CPMenuItemImageKey];
948  _alternateImage = [aCoder decodeObjectForKey:CPMenuItemAlternateImageKey];
949 // CPImage _onStateImage;
950 // CPImage _offStateImage;
951 // CPImage _mixedStateImage;
952 
953  // This order matters because setSubmenu: needs _menu to be around.
954  _menu = [aCoder decodeObjectForKey:CPMenuItemMenuKey];
955  [self setSubmenu:[aCoder decodeObjectForKey:CPMenuItemSubmenuKey]];
956 
957  _keyEquivalent = [aCoder decodeObjectForKey:CPMenuItemKeyEquivalentKey] || @"";
958  _keyEquivalentModifierMask = [aCoder decodeIntForKey:CPMenuItemKeyEquivalentModifierMaskKey];
959 
960 // int _mnemonicLocation;
961 
962 // BOOL _isAlternate;
963 
964  [self setIndentationLevel:[aCoder decodeIntForKey:CPMenuItemIndentationLevelKey]];
965 
966 // CPString _toolTip;
967 
968  _representedObject = [aCoder decodeObjectForKey:CPMenuItemRepresentedObjectKey];
969  _view = [aCoder decodeObjectForKey:CPMenuItemViewKey];
970  }
971 
972  return self;
973 }
974 
979 - (void)encodeWithCoder:(CPCoder)aCoder
980 {
981  if (_isSeparator)
982  [aCoder encodeBool:_isSeparator forKey:CPMenuItemIsSeparatorKey];
983 
984  [aCoder encodeObject:_title forKey:CPMenuItemTitleKey];
985 
986  [aCoder encodeObject:_target forKey:CPMenuItemTargetKey];
987  [aCoder encodeObject:_action forKey:CPMenuItemActionKey];
988 
989  ENCODE_IFNOT(CPMenuItemIsEnabledKey, _isEnabled, YES);
990  ENCODE_IFNOT(CPMenuItemIsHiddenKey, _isHidden, NO);
991 
992  ENCODE_IFNOT(CPMenuItemTagKey, _tag, 0);
994 
995  ENCODE_IFNOT(CPMenuItemImageKey, _image, nil);
996  ENCODE_IFNOT(CPMenuItemAlternateImageKey, _alternateImage, nil);
997 
998  ENCODE_IFNOT(CPMenuItemSubmenuKey, _submenu, nil);
999  ENCODE_IFNOT(CPMenuItemMenuKey, _menu, nil);
1000 
1001  if (_keyEquivalent && _keyEquivalent.length)
1002  [aCoder encodeObject:_keyEquivalent forKey:CPMenuItemKeyEquivalentKey];
1003 
1004  if (_keyEquivalentModifierMask)
1005  [aCoder encodeObject:_keyEquivalentModifierMask forKey:CPMenuItemKeyEquivalentModifierMaskKey];
1006 
1007  if (_indentationLevel > 0)
1008  [aCoder encodeInt:_indentationLevel forKey:CPMenuItemIndentationLevelKey];
1009 
1010  ENCODE_IFNOT(CPMenuItemRepresentedObjectKey, _representedObject, nil);
1011  ENCODE_IFNOT(CPMenuItemViewKey, _view, nil);
1012 }
1013 
1014 @end
Used to implement exception handling (creating & raising).
Definition: CPException.h:2
Definition: CPFont.h:2
var CPMenuItemStateKey
Definition: CPMenuItem.j:901
var CPMenuItemIsHiddenKey
Definition: CPMenuItem.j:898
var CPMenuItemTargetKey
Definition: CPMenuItem.j:894
Definition: CPMenu.h:2
var CPMenuItemIsEnabledKey
Definition: CPMenuItem.j:897
var isEqual
BOOL isHidden()
Definition: CPMenuItem.j:195
unsigned indentationLevel()
Definition: CPMenuItem.j:742
#define DEFAULT_VALUE(aKey, aDefaultValue)
Definition: CPMenuItem.j:917
CPRightArrowFunctionKey
CPString keyEquivalent()
Definition: CPMenuItem.j:585
CPMenu supermenu()
Definition: CPMenu.j:580
CPString keyEquivalentStringRepresentation()
Definition: CPMenuItem.j:620
CPImage image()
Definition: CPMenuItem.j:391
CPMenuItem separatorItem()
Definition: CPMenuItem.j:536
CPHomeFunctionKey
CPDeleteFunctionKey
CPMenuItem highlightedItem()
Definition: CPMenu.j:935
var CPMenuItemTagKey
Definition: CPMenuItem.j:900
void raise:reason:(CPString aName, [reason] CPString aReason)
Definition: CPException.j:66
CPPageDownFunctionKey
var CPMenuItemKeyEquivalentKey
Definition: CPMenuItem.j:909
CPMenu menu()
Definition: CPMenuItem.j:566
CPImage alternateImage()
Definition: CPMenuItem.j:408
#define ENCODE_IFNOT(aKey, aValue, aDefaultValue)
Definition: CPMenuItem.j:918
global CPApp var CPMenuItemStringRepresentationDictionary
Definition: CPMenuItem.j:28
SEL action()
Definition: CPMenuItem.j:246
CPView view()
Definition: CPMenuItem.j:805
CPString description()
Definition: CPObject.j:358
void setMnemonicLocation:(unsigned aLocation)
Definition: CPMenuItem.j:667
var CPMenuItemKeyEquivalentModifierMaskKey
Definition: CPMenuItem.j:910
CPEnabledBinding
CPFont font()
Definition: CPMenuItem.j:305
CPString title()
Definition: CPMenu.j:704
CPTabCharacter
Definition: CPText.j:48
var CPMenuItemImageKey
Definition: CPMenuItem.j:903
CPAlternateKeyMask
An immutable string (collection of characters).
Definition: CPString.h:2
var CPMenuItemSubmenuKey
Definition: CPMenuItem.j:906
CPString substringToIndex:(unsigned anIndex)
Definition: CPString.j:306
CPString description()
Definition: CPMenuItem.j:884
BOOL hasSubmenu()
Definition: CPMenuItem.j:526
Definition: CPImage.h:2
CPCommandKeyMask
CPEndFunctionKey
CPPageUpFunctionKey
CPString mnemonic()
Definition: CPMenuItem.j:700
CPEscapeFunctionKey
var CPMenuItemRepresentedObjectKey
Definition: CPMenuItem.j:914
BOOL isSeparatorItem()
Definition: CPMenuItem.j:548
CPString toolTip()
Definition: CPMenuItem.j:760
CPImage offStateImage()
Definition: CPMenuItem.j:451
CPBackTabCharacter
Definition: CPText.j:52
CPLeftArrowFunctionKey
int length()
Definition: CPString.j:186
CPShiftKeyMask
var CPMenuItemMenuKey
Definition: CPMenuItem.j:907
var CPMenuItemTitleKey
Definition: CPMenuItem.j:893
CPUpArrowFunctionKey
unsigned keyEquivalentModifierMask()
Definition: CPMenuItem.j:615
function CPBrowserIsOperatingSystem(anOperatingSystem)
CPClearDisplayFunctionKey
CPImage mixedStateImage()
Definition: CPMenuItem.j:473
CPString substringFromIndex:(unsigned anIndex)
Definition: CPString.j:281
CPPlatformActionKeyMask
Defines methods for use when archiving & restoring (enc/decoding).
Definition: CPCoder.h:2
var CPMenuItemViewKey
Definition: CPMenuItem.j:915
CPNotFound
Definition: CPObjJRuntime.j:62
BOOL isHighlighted()
Definition: CPMenuItem.j:815
CPSpaceFunctionKey
var CPMenuItemActionKey
Definition: CPMenuItem.j:895
id init()
Definition: CPObject.j:145
CPMenu submenu()
Definition: CPMenuItem.j:518
CPDownArrowFunctionKey
void setAction:(SEL anAction)
Definition: CPMenuItem.j:238
CPMacOperatingSystem
id initWithTitle:action:keyEquivalent:(CPString aTitle, [action] SEL anAction, [keyEquivalent] CPString aKeyEquivalent)
Definition: CPMenuItem.j:121
var CPMenuItemAlternateImageKey
Definition: CPMenuItem.j:904
unsigned mnemonicLocation()
Definition: CPMenuItem.j:675
void setIndentationLevel:(unsigned aLevel)
Definition: CPMenuItem.j:731
CPImage onStateImage()
Definition: CPMenuItem.j:430
void setTarget:(id aTarget)
Definition: CPMenuItem.j:221
BOOL isHiddenOrHasHiddenAncestor()
Definition: CPMenuItem.j:203
CPCarriageReturnCharacter
Definition: CPText.j:51
function CPStringFromSelector(aSelector)
Definition: CPObjJRuntime.j:23
CPControlKeyMask
id mutableCopy()
Definition: CPMenuItem.j:856
CPOffState
Definition: CPControl.j:78
CPArgumentBinding
var CPMenuItemIndentationLevelKey
Definition: CPMenuItem.j:912
CPTargetBinding
CPDeleteCharacter
Definition: CPText.j:53
CPBackspaceCharacter
Definition: CPText.j:47
BOOL isAlternate()
Definition: CPMenuItem.j:719
id representedObject()
Definition: CPMenuItem.j:779
CPString title()
Definition: CPMenuItem.j:273
void setSubmenu:(CPMenu aMenu)
Definition: CPMenuItem.j:483
CPRange rangeOfString:(CPString aString)
Definition: CPString.j:322
id alloc()
Definition: CPObject.j:130
var CPMenuItemIsSeparatorKey
Definition: CPMenuItem.j:891
Definition: CPView.j:136
BOOL isEnabled()
Definition: CPMenuItem.j:172
void setTitle:(CPString aTitle)
Definition: CPMenuItem.j:256