Skip navigation.
 
mlRe: Handling files dropped onto NSTextView
FROM : Douglas Davidson
DATE : Wed Aug 16 18:42:57 2006

On Aug 16, 2006, at 7:40 AM, Daniel Jalkut wrote:

> My assumption is that if you want to customize the representation 
> of the linked files in your attributed text, the thing to do would 
> be to subclass NSLayoutManager and override 
> drawGlyphsForGlyphRange:atPoint:.


Daniel, in general you would be right; for ordinary glyphs the right 
place to customize drawing would be at the NSLayoutManager level. 
However, for attachments, NSLayoutManager lets the drawing be done by 
the NSTextAttachmentCell; it merely reserves a place for it in the 
layout.  So, customization of attachment drawing is usually best done 
at the NSTextAttachmentCell level--either by using a custom cell 
subclass, or by using a custom image with a standard cell.  I believe 
I've posted some examples of this before.

In this case, however, I believe the issue is as Jim Correia says--
what is desired is to customize the handling of the data as it comes 
in, which is handled in the same way for drag and drop and for copy/
paste, so the right thing is to customize pasteboard reading.

Douglas Davidson

Related mailsAuthorDate
mlHandling files dropped onto NSTextView David Dunham Aug 16, 06:06
mlRe: Handling files dropped onto NSTextView Daniel Jalkut Aug 16, 16:40
mlRe: Handling files dropped onto NSTextView Jim Correia Aug 16, 17:33
mlRe: Handling files dropped onto NSTextView David Dunham Aug 16, 17:46
mlRe: Handling files dropped onto NSTextView Douglas Davidson Aug 16, 18:42
mlRe: Handling files dropped onto NSTextView David Dunham Aug 17, 04:32
mlRe: Handling files dropped onto NSTextView Jim Correia Aug 17, 05:23
mlRe: Handling files dropped onto NSTextView Christiaan Hofman Aug 17, 10:03
mlRe: Handling files dropped onto NSTextView David Dunham Aug 19, 19:55