mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-04 08:06:16 +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:
1 parent
8439dc1c0f
commit
cfba019e3d
1 file changed
+7
-1
@@ -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