• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
nspopupbuttoncell as textattachment
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Prev by Date: Re: How to completely release every object allocated when opening a NIB file ?
  • Next by Date: Re: Setting a documents file type during save as=8 5
  • Previous by thread: Re: ScreenSaverDefaults woes...
  • Next by thread: NSDate and Date formatters
  • Index(es):
    • Date
    • Thread