mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 06:31:27 +00:00
CPCoding support for CPResponder menus. This allows context menus to be set for collection view items through the item prototype.
This commit is contained in:
@@ -341,7 +341,8 @@ CPDeleteForwardKeyCode = 46;
|
||||
|
||||
@end
|
||||
|
||||
var CPResponderNextResponderKey = @"CPResponderNextResponderKey";
|
||||
var CPResponderNextResponderKey = @"CPResponderNextResponderKey",
|
||||
CPResponderMenuKey = @"CPResponderMenuKey";
|
||||
|
||||
@implementation CPResponder (CPCoding)
|
||||
|
||||
@@ -355,7 +356,10 @@ var CPResponderNextResponderKey = @"CPResponderNextResponderKey";
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_nextResponder = [aCoder decodeObjectForKey:CPResponderNextResponderKey];
|
||||
_menu = [aCoder decodeObjectForKey:CPResponderMenuKey];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -369,6 +373,8 @@ var CPResponderNextResponderKey = @"CPResponderNextResponderKey";
|
||||
// This will come out nil on the other side with decodeObjectForKey:
|
||||
if (_nextResponder !== nil)
|
||||
[aCoder encodeConditionalObject:_nextResponder forKey:CPResponderNextResponderKey];
|
||||
|
||||
[aCoder encodeObject:_menu forKey:CPResponderMenuKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user