mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 15:10:38 +00:00
Submitted patch to NSImageView to handle target and action.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18424 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ad79c64452
commit
97aabef74c
3 changed files with 57 additions and 1 deletions
|
@ -46,7 +46,7 @@ static Class imageCellClass;
|
|||
{
|
||||
if (self == [NSImageView class])
|
||||
{
|
||||
[self setVersion: 1];
|
||||
[self setVersion: 2];
|
||||
imageCellClass = [NSImageCell class];
|
||||
usedCellClass = imageCellClass;
|
||||
}
|
||||
|
@ -193,6 +193,7 @@ static Class imageCellClass;
|
|||
else
|
||||
{
|
||||
[self setImage: image];
|
||||
[self sendAction: _action to: _target];
|
||||
RELEASE(image);
|
||||
return YES;
|
||||
}
|
||||
|
@ -237,5 +238,51 @@ static Class imageCellClass;
|
|||
return NSDragOperationCopy;
|
||||
}
|
||||
|
||||
//
|
||||
// Target and Action
|
||||
//
|
||||
// Target and action are handled by NSImageView itself, not its own cell.
|
||||
//
|
||||
- (id) target
|
||||
{
|
||||
return _target;
|
||||
}
|
||||
|
||||
- (void) setTarget: (id)anObject
|
||||
{
|
||||
_target = anObject;
|
||||
}
|
||||
|
||||
- (SEL) action
|
||||
{
|
||||
return _action;
|
||||
}
|
||||
|
||||
- (void) setAction: (SEL)aSelector
|
||||
{
|
||||
_action = aSelector;
|
||||
}
|
||||
|
||||
//
|
||||
// NSCoding Protocol
|
||||
//
|
||||
- (void) encodeWithCoder: (NSCoder *)aCoder
|
||||
{
|
||||
[super encodeWithCoder: aCoder];
|
||||
[aCoder encodeConditionalObject: _target];
|
||||
[aCoder encodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
}
|
||||
|
||||
- (id) initWithCoder: (NSCoder *)aDecoder
|
||||
{
|
||||
self = [super initWithCoder: aDecoder];
|
||||
if ([aDecoder versionForClassName: @"NSImageView"] >= 2)
|
||||
{
|
||||
_target = [aDecoder decodeObject];
|
||||
[aDecoder decodeValueOfObjCType: @encode(SEL) at: &_action];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue