mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 00:30:49 +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
|
@ -1,3 +1,10 @@
|
||||||
|
2004-01-16 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Headers/AppKit/NSImageView.h: Added ivars for traget and action.
|
||||||
|
* Source/NSImageView.m: Implemented target and action handling and
|
||||||
|
sending of the action when an image gets dropped on the
|
||||||
|
view. Patch by Kazunobu Kuriyama (kazunobu.kuriyama@nifty.com)
|
||||||
|
|
||||||
2004-01-15 Serg Stoyan <stoyan@on.com.ua>
|
2004-01-15 Serg Stoyan <stoyan@on.com.ua>
|
||||||
|
|
||||||
* Images/common_MiniWindowTile.m: New file.
|
* Images/common_MiniWindowTile.m: New file.
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
@interface NSImageView : NSControl
|
@interface NSImageView : NSControl
|
||||||
{
|
{
|
||||||
|
id _target;
|
||||||
|
SEL _action;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSImage *)image;
|
- (NSImage *)image;
|
||||||
|
|
|
@ -46,7 +46,7 @@ static Class imageCellClass;
|
||||||
{
|
{
|
||||||
if (self == [NSImageView class])
|
if (self == [NSImageView class])
|
||||||
{
|
{
|
||||||
[self setVersion: 1];
|
[self setVersion: 2];
|
||||||
imageCellClass = [NSImageCell class];
|
imageCellClass = [NSImageCell class];
|
||||||
usedCellClass = imageCellClass;
|
usedCellClass = imageCellClass;
|
||||||
}
|
}
|
||||||
|
@ -193,6 +193,7 @@ static Class imageCellClass;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
[self setImage: image];
|
[self setImage: image];
|
||||||
|
[self sendAction: _action to: _target];
|
||||||
RELEASE(image);
|
RELEASE(image);
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -237,5 +238,51 @@ static Class imageCellClass;
|
||||||
return NSDragOperationCopy;
|
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
|
@end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue