mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-04 01:43:40 +00:00
+12
-3
@@ -829,8 +829,9 @@ var _CPMenuBarVisible = NO,
|
||||
@end
|
||||
|
||||
|
||||
var CPMenuTitleKey = @"CPMenuTitleKey",
|
||||
CPMenuItemsKey = @"CPMenuItemsKey";
|
||||
var CPMenuTitleKey = @"CPMenuTitleKey",
|
||||
CPMenuItemsKey = @"CPMenuItemsKey",
|
||||
CPMenuShowsStateColumnKey = @"CPMenuShowsStateColumnKey";
|
||||
|
||||
@implementation CPMenu (CPCoding)
|
||||
|
||||
@@ -847,6 +848,8 @@ var CPMenuTitleKey = @"CPMenuTitleKey",
|
||||
{
|
||||
_title = [aCoder decodeObjectForKey:CPMenuTitleKey];
|
||||
_items = [aCoder decodeObjectForKey:CPMenuItemsKey];
|
||||
|
||||
_showsStateColumn = ![aCoder containsValueForKey:CPMenuShowsStateColumnKey] || [aCoder decodeBoolForKey:CPMenuShowsStateColumnKey];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -860,6 +863,9 @@ var CPMenuTitleKey = @"CPMenuTitleKey",
|
||||
{
|
||||
[aCoder encodeObject:_title forKey:CPMenuTitleKey];
|
||||
[aCoder encodeObject:_items forKey:CPMenuItemsKey];
|
||||
|
||||
if (!_showsStateColumn)
|
||||
[aCoder encodeBool:_showsStateColumn forKey:CPMenuShowsStateColumnKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1777,8 +1783,11 @@ var _CPMenuBarWindowBackgroundColor = nil,
|
||||
{
|
||||
if ([_trackingMenuItem submenu] != nil)
|
||||
{
|
||||
var action = [_trackingMenuItem action];
|
||||
|
||||
// If the item has a submenu, but not direct action, a.k.a. a "pure" menu, simply show the menu.
|
||||
if (![_trackingMenuItem action])
|
||||
// FIXME: (?) should we use submenuAction: or not?
|
||||
if (!action || action === @selector(submenuAction:))
|
||||
return [self showMenu:anEvent];
|
||||
|
||||
// If this is a hybrid button/menu, show it in a bit...
|
||||
|
||||
+4
-2
@@ -761,6 +761,7 @@ var CPMenuItemTitleKey = @"CPMenuItemTitleKey",
|
||||
CPMenuItemIsHiddenKey = @"CPMenuItemIsHiddenKey",
|
||||
|
||||
CPMenuItemTagKey = @"CPMenuItemTagKey",
|
||||
CPMenuItemStateKey = @"CPMenuItemStateKey",
|
||||
|
||||
CPMenuItemImageKey = @"CPMenuItemImageKey",
|
||||
CPMenuItemAlternateImageKey = @"CPMenuItemAlternateImageKey",
|
||||
@@ -796,7 +797,7 @@ var CPMenuItemTitleKey = @"CPMenuItemTitleKey",
|
||||
_isEnabled = DEFAULT_VALUE(CPMenuItemIsEnabledKey, YES);
|
||||
_isHidden = DEFAULT_VALUE(CPMenuItemIsHiddenKey, NO);
|
||||
_tag = DEFAULT_VALUE(CPMenuItemTagKey, 0);
|
||||
|
||||
_state = DEFAULT_VALUE(CPMenuItemStateKey, CPOffState);
|
||||
// int _state;
|
||||
|
||||
_image = DEFAULT_VALUE(CPMenuItemImageKey, nil);
|
||||
@@ -840,6 +841,7 @@ var CPMenuItemTitleKey = @"CPMenuItemTitleKey",
|
||||
ENCODE_IFNOT(CPMenuItemIsHiddenKey, _isHidden, NO);
|
||||
|
||||
ENCODE_IFNOT(CPMenuItemTagKey, _tag, 0);
|
||||
ENCODE_IFNOT(CPMenuItemStateKey, _state, CPOffState);
|
||||
|
||||
ENCODE_IFNOT(CPMenuItemImageKey, _image, nil);
|
||||
ENCODE_IFNOT(CPMenuItemAlternateImageKey, _alternateImage, nil);
|
||||
@@ -848,7 +850,7 @@ var CPMenuItemTitleKey = @"CPMenuItemTitleKey",
|
||||
ENCODE_IFNOT(CPMenuItemMenuKey, _menu, nil);
|
||||
|
||||
ENCODE_IFNOT(CPMenuItemRepresentedObjectKey, _representedObject, nil);
|
||||
ENCODE_IFNOT(CPMenuItemViewKey, _view, nil)
|
||||
ENCODE_IFNOT(CPMenuItemViewKey, _view, nil);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -33,8 +33,10 @@
|
||||
|
||||
if (self)
|
||||
{
|
||||
_title = [aCoder decodeObjectForKey:"NSTitle"];
|
||||
_items = [aCoder decodeObjectForKey:"NSMenuItems"];
|
||||
_title = [aCoder decodeObjectForKey:@"NSTitle"];
|
||||
_items = [aCoder decodeObjectForKey:@"NSMenuItems"];
|
||||
|
||||
//_showsStateColumn = ![aCoder containsValueForKey:@"NSMenuExcludeMarkColumn"] || ![aCoder decodeBoolForKey:@"NSMenuExcludeMarkColumn"];
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
_isHidden = [aCoder decodeBoolForKey:"NSIsHidden"];
|
||||
|
||||
// _tag = [aCoder decodeIntForKey:"NSTag"];
|
||||
// _state = [aCoder decodeIntForKey:"NSState"];
|
||||
_state = [aCoder decodeIntForKey:"NSState"];
|
||||
|
||||
// _image = [aCoder decodeObjectForKey:"NSImage"];
|
||||
// _alternateImage = [aCoder decodeObjectForKey:""];
|
||||
|
||||
Reference in New Issue
Block a user