mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 14:41:28 +00:00
Added support for indentation levels in menu items.
Reviewed by me.
This commit is contained in:
@@ -109,7 +109,9 @@
|
||||
|
||||
_keyEquivalent = aKeyEquivalent || @"";
|
||||
_keyEquivalentModifierMask = CPPlatformActionKeyMask;
|
||||
|
||||
|
||||
_indentationLevel = 0;
|
||||
|
||||
_mnemonicLocation = CPNotFound;
|
||||
}
|
||||
|
||||
@@ -675,7 +677,7 @@ CPControlKeyMask
|
||||
- (void)setIndentationLevel:(unsigned)aLevel
|
||||
{
|
||||
if (aLevel < 0)
|
||||
[CPException raise:CPInvalidArgumentException reason:"setIndentationLevel: argument must be greater than 0."];
|
||||
[CPException raise:CPInvalidArgumentException reason:"setIndentationLevel: argument must be greater than or equal to 0."];
|
||||
|
||||
_indentationLevel = MIN(15, aLevel);
|
||||
}
|
||||
@@ -802,6 +804,8 @@ var CPMenuItemIsSeparatorKey = @"CPMenuItemIsSeparatorKey",
|
||||
CPMenuItemKeyEquivalentKey = @"CPMenuItemKeyEquivalentKey",
|
||||
CPMenuItemKeyEquivalentModifierMaskKey = @"CPMenuItemKeyEquivalentModifierMaskKey",
|
||||
|
||||
CPMenuItemIndentationLevelKey = @"CPMenuItemIndentationLevelKey",
|
||||
|
||||
CPMenuItemRepresentedObjectKey = @"CPMenuItemRepresentedObjectKey",
|
||||
CPMenuItemViewKey = @"CPMenuItemViewKey";
|
||||
|
||||
@@ -851,7 +855,9 @@ var CPMenuItemIsSeparatorKey = @"CPMenuItemIsSeparatorKey",
|
||||
// int _mnemonicLocation;
|
||||
|
||||
// BOOL _isAlternate;
|
||||
// int _indentationLevel;
|
||||
|
||||
// Default is 0.
|
||||
[self setIndentationLevel:[aCoder decodeIntForKey:CPMenuItemIndentationLevelKey] || 0];
|
||||
|
||||
// CPString _toolTip;
|
||||
|
||||
@@ -894,6 +900,9 @@ var CPMenuItemIsSeparatorKey = @"CPMenuItemIsSeparatorKey",
|
||||
if (_keyEquivalentModifierMask)
|
||||
[aCoder encodeObject:_keyEquivalentModifierMask forKey:CPMenuItemKeyEquivalentModifierMaskKey];
|
||||
|
||||
if (_indentationLevel > 0)
|
||||
[aCoder encodeInt:_indentationLevel forKey:CPMenuItemIndentationLevelKey];
|
||||
|
||||
ENCODE_IFNOT(CPMenuItemRepresentedObjectKey, _representedObject, nil);
|
||||
ENCODE_IFNOT(CPMenuItemViewKey, _view, nil);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
// _mnemonicLocation = [aCoder decodeObjectForKey:"NSMnemonicLoc"];
|
||||
|
||||
// _isAlternate = [aCoder decodeBoolForKey:"NSIsAlternate"];
|
||||
// _indentationLevel = [aCoder decodeBoolForKey:"NSIndent"];
|
||||
_indentationLevel = [aCoder decodeIntForKey:"NSIndent"];
|
||||
|
||||
// _toolTip;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user