Re: Scrolling List of Thumbnails?
Re: Scrolling List of Thumbnails?
- Subject: Re: Scrolling List of Thumbnails?
- From: John Pannell <email@hidden>
- Date: Thu, 17 Jun 2004 13:00:45 -0600
Hi listers-
On Jun 17, 2004, at 12:03 PM, James DiPalma wrote:
>
An NSmatrix in highlight mode or track mode should be sending mouse
>
events to its cells, so you probably need some kind of NSActionCell
>
subclass that displays images how you want them displayed. Embedding
>
an NSImageCell into an NSActionCell subclass should be pretty easy
>
(imageCell ivar used whenever needed), but you won't be able to get IB
>
to create a matrix of NSCells, nor NSActionCells, so maybe an
>
NSButtonCell subclass that embeds an NSImageCell.
It is quite easy to add the needed functionality (support for
target/action) to a subclass of NSImageCell. Here's a sample header
and implementation with the relevant additions...
Header...
#import <AppKit/AppKit.h>
@interface PSMActionImageCell : NSImageCell {
int tag;
id target;
SEL action;
BOOL enabled;
}
- (id)target;
- (void)setTarget:(id)anObject;
- (SEL)action;
- (void)setAction:(SEL)aSelector;
- (int)tag;
- (void)setTag:(int)value;
@end
Implementation...
@implementation PSMActionImageCell
- (id)target
{
return target;
}
- (void)setTarget:(id)anObject
{
[anObject retain];
[target release];
target = anObject;
}
- (SEL)action
{
return action;
}
- (void)setAction:(SEL)aSelector
{
action = aSelector;
}
- (int)tag
{
return tag;
}
- (void)setTag:(int)value
{
tag = value;
}
A matrix of these will be clickable and generate the proper messages
(as set by assigning the target of the matrix in IB).
Hope this helps!
John
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.