Adopted by: NSTextAttachmentCell
Declared in: AppKit/NSTextAttachment.h
The NSTextAttachmentCell protocol declares the interface for objects that draw text attachment icons and handle mouse events on their icons. With the exceptions of cellBaselineOffset:, setAttachment: and attachment, all of these methods are implemented by the NSCell class and described in that class specification.
See the NSAttributedString and NSTextView class specifications for general information on text attachments.
- Drawing
- - drawWithFrame:inView:
- - highlight:withFrame:inView:
- Cell size and position
- - cellSize
- - cellBaselineOffset
- Event handling
- - wantsToTrackMouse
- - trackMouse:inRect:ofView:untilMouseUp:
- Setting the attachment
- - setAttachment:
- - attachment
- (NSTextAttachment *)attachment
See Also: - setAttachment:
- (NSPoint)cellBaselineOffset
See Also: - icon (NSFileWrapper)
- (NSSize)cellSize
See Also: - icon (NSFileWrapper) - fileWrapper (NSTextAttachment)
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView
*)aView
See Also: - drawWithFrame:inView: (NSCell) - lockFocus (NSView)
- (void)highlight:(BOOL)flag
withFrame:(NSRect)cellFrame
inView:(NSView *)aView
See Also: - highlight:withFrame:inView: (NSCell) - lockFocus (NSView)
- (void)setAttachment:(NSTextAttachment
*)anAttachment
See Also: - attachment, - setAttachmentCell: (NSTextAttachment)
- (BOOL)trackMouse:(NSEvent
*)theEvent
inRect:(NSRect)cellFrame
ofView:(NSView *)aTextView
untilMouseUp:(BOOL)flag
NSTextAttachmentCell's implementation of this method calls upon aTextView's delegate to handle the event. If theEvent is a mouse-up event for a double click, the text attachment cell sends the delegate a textView:doubleClickedOnCell:inRect: message and returns true. Otherwise, depending on whether the user clicks or drags the cell, it sends the delegate a textView:clickedOnCell:inRect: or a textView:draggingCell:inRect:event: message and returns true. NSTextAttachmentCell's implementation returns false only if flag is false and the mouse is dragged outside of cellFrame. The delegate methods are invoked only if the delegate responds.
See Also: - wantsToTrackMouse, - trackMouse:inRect:ofView:untilMouseUp: (NSCell) - lockFocus (NSView)
- (BOOL)wantsToTrackMouse
For an attachment in an attributed string, if the attachment cell returns false its attachment character should be selected rather than the cell being asked to track the mouse. This results in the attachment icon behaving as any regular glyph in text.