nspopupbuttoncell as textattachment
nspopupbuttoncell as textattachment
- Subject: nspopupbuttoncell as textattachment
- From: Francisco Tolmasky <email@hidden>
- Date: Wed, 14 Jan 2004 01:58:08 -0800
I'm trying to put a few controls into a text view I have, very much
like in AddressBook and iCal (the pop up in the card view and so
forth). I have begun to make a subclass of nspopupbuttoncell that
conforms to the NSAttachmentCell protocol, but only with limited luck.
Does anyone know if anyone has already done this, or have a few
pointers?
Here is my code so far:
- (id)initTextCell:(NSString *)aStringValue pullsDown:(BOOL)pullsDown
{
self= [super initTextCell: aStringValue pullsDown: pullsDown];
if(self)
{
[self setBordered: NO];
[self setControlSize: NSMiniControlSize];
[self setFont: [NSFont boldSystemFontOfSize: 11]];
}
return self;
}
- (NSTextAttachment *)textAttachment
{
return textAttachment;
}
- (void)setAttachment:(NSTextAttachment *)aTextAttachment
{
textAttachment= aTextAttachment;
}
- (NSPoint)cellBaselineOffset
{
return NSMakePoint(0.0,0.0);
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)aView
characterIndex:(unsigned)charIndex
{
[self drawWithFrame: cellFrame inView: aView];
}
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
characterIndex:(unsigned)charIndex
layoutManager:(NSLayoutManager*)layoutManager
{
[self drawWithFrame: cellFrame inView: controlView];
}
- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame
ofView:(NSView *)aTextView atCharacterIndex:(unsigned)charIndex
untilMouseUp:(BOOL)flag
{
return [self trackMouse: theEvent inRect: cellFrame ofView:
aTextView untilMouseUp: flag];
}
- (BOOL)wantsToTrackMouse
{
return YES;
}
Francisco Tolmasky
email@hidden
http://users.adelphia.net/~ftolmasky
_______________________________________________
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.