Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
- Subject: Using NSTextView's delegate method textView:draggedCell:inRect:event:atIndex: selectively
- From: Philip Dow <email@hidden>
- Date: Fri, 2 Mar 2007 01:27:30 +0100
Hi all, especially Douglas =)
I'm looking for a way to selectively take advantage of NSTextView's
delegate method textView:draggedCell:inRect:event:atIndex:
selectively. By that I mean I would like to use it for some text
attachments but not others.
The situation is, some of my attachments contain additional data
whose pasteboard implementation I would like to control. Others, for
example embedded images, do not, and I would prefer to have the
system handle them in the default way.
What comes to mind is using two other delegate methods instead:
- textView:writablePasteboardTypesForCell:atIndex:
- textView:writeCell:atIndex:toPasteboard:type:
This is what I've been doing. However, it does not give me control
over the dragged image, which is something I woud like to customize
when writing my own pasteboard data.
I have tried overwriting textView:draggedCell:inRect:event:atIndex: ,
and it works fine when I'm working with my custom data. However,
whenever I don't want to handle the drag, preferring to use the
default implementation, I must still manually code that default
implementation. There is no super method to call here.
Try as I might, I cannot get the same behavior as the default
implementation. I'm having a heck of a time putting the data on the
pasteboard in the right way so that the drag's receivers behave as
they would if I had never implemented this delegate method in the
first place.
I've looked an NSTextAttachmentCell's
trackMouse:inRect:ofView:untilMouseUp: and thought about implementing
my own delegate method there that first asked if it should at all
call the draggedCell method, but I'm thinking I'll have a difficult
time overriding this method to get the default behavior otherwise as
well.
If I could get the current dragged image from the writeCell method
then perhaps I could reset it, but I don't know how to do that and it
seems a bit of a hack.
Is there as way to accomplish any of this, or should I file a feature
request?
Thanks,
-Phil
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden