Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Declared in | NSTextAttachment.h |
Companion guides | |
Related sample code |
NSTextAttachment
objects are used by the NSAttributedString
class cluster as the values for attachment attributes (stored in the attributed string under the key named NSAttachmentAttributeName
). The objects you create with this class are referred to as text attachment objects, or when no confusion will result, as text attachments or merely attachments.
A text attachment object contains an NSFileWrapper object, which in turn holds the contents of the attached file. It also uses a cell object conforming to the NSTextAttachmentCell protocol to draw and handle mouse events. Most of the behavior of a text attachment is relegated to the file wrapper and the attachment cell. See the corresponding class and protocol specifications for more information.
See the NSAttributedString and NSTextView class specifications for general information on text attachments.
Returns the object used to draw the icon for the receiver and to handle mouse events.
- (id < NSTextAttachmentCell >)attachmentCell
The object used to draw the icon for the receiver and to handle mouse events.
An NSTextAttachment
object by default uses an NSTextAttachmentCell
object that displays the attached file’s icon, or its contents if the file contains an image.
– fileWrapper
– image
(NSCell
)– icon
(NSFileWrapper
)– setAttachmentCell:
NSTextAttachment.h
Returns the receiver’s file wrapper.
- (NSFileWrapper *)fileWrapper
The receiver’s file wrapper.
The file wrapper holds the contents of the attached file.
NSTextAttachment.h
Initializes a newly allocated NSTextAttachment
object to contain the given file wrapper.
- (id)initWithFileWrapper:(NSFileWrapper *)aWrapper
The file wrapper for the receiver.
The receiver initialized to contain aWrapper and use an NSTextAttachmentCell
as its attachment cell.
This method is the designated initializer for the NSTextAttachment
class.
If aWrapper contains an image file that the receiver can interpret as an NSImage
object, sets the attachment cell’s image to the NSImage
rather than to the icon of aWrapper.
NSTextAttachment.h
Sets the object used to draw the icon for the receiver and to handle mouse events.
- (void)setAttachmentCell:(id < NSTextAttachmentCell >)aCell
The object used to draw the icon for the receiver and to handle mouse events.
– setFileWrapper:
– setImage:
(NSCell
)– icon
(NSFileWrapper
)– attachmentCell
NSTextAttachment.h
Sets the receiver’s file wrapper.
- (void)setFileWrapper:(NSFileWrapper *)aWrapper
The file wrapper for the receiver.
The file wrapper holds the contents of the attached file.
NSTextAttachment.h
This character is used to denote an attachment.
enum { NSAttachmentCharacter = 0xfffc };
NSAttachmentCharacter
Specifies a character that denotes attachment an attachment.
Available in Mac OS X v10.0 and later.
Declared in NSTextAttachment.h
.
NSTextAttachment.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)