NSTextAttachment Class Reference
| Inherits from | |
| Conforms to | |
| Framework | /System/Library/Frameworks/AppKit.framework |
| Availability | Available in OS X v10.0 and later. |
| Declared in | NSTextAttachment.h |
| Companion guides | |
Overview
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.
Adopted Protocols
Instance Methods
attachmentCell
Returns the object used to draw the icon for the receiver and to handle mouse events.
Return Value
The object used to draw the icon for the receiver and to handle mouse events.
Discussion
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.
Availability
- Available in OS X v10.0 and later.
See Also
-
– fileWrapper -
– image(NSCell) -
– icon(NSFileWrapper) -
– setAttachmentCell:
Declared In
NSTextAttachment.hfileWrapper
Returns the receiver’s file wrapper.
Return Value
The receiver’s file wrapper.
Discussion
The file wrapper holds the contents of the attached file.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSTextAttachment.hinitWithFileWrapper:
Initializes a newly allocated NSTextAttachment object to contain the given file wrapper.
Parameters
- aWrapper
The file wrapper for the receiver.
Return Value
The receiver initialized to contain aWrapper and use an NSTextAttachmentCell as its attachment cell.
Discussion
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.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSTextAttachment.hsetAttachmentCell:
Sets the object used to draw the icon for the receiver and to handle mouse events.
Parameters
- aCell
The object used to draw the icon for the receiver and to handle mouse events.
Availability
- Available in OS X v10.0 and later.
See Also
-
– setFileWrapper: -
– setImage:(NSCell) -
– icon(NSFileWrapper) -
– attachmentCell
Declared In
NSTextAttachment.hsetFileWrapper:
Sets the receiver’s file wrapper.
Parameters
- aWrapper
The file wrapper for the receiver.
Discussion
The file wrapper holds the contents of the attached file.
Availability
- Available in OS X v10.0 and later.
See Also
Declared In
NSTextAttachment.hConstants
Attachment Character
This character is used to denote an attachment.
enum {
NSAttachmentCharacter = 0xfffc
};
Constants
NSAttachmentCharacterSpecifies a character that denotes attachment an attachment.
Available in OS X v10.0 and later.
Declared in
NSTextAttachment.h.
Declared In
NSTextAttachment.h© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)