- Package:
- com.apple.yellow.application
The NSCellForTextAttachment 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
- drawWithFrameInView
- highlightWithFrameInView
- Cell size and position
- cellSize
- cellBaselineOffset
- cellFrame
- Event handling
- wantsToTrackMouse
- trackMouse
- Setting the attachment
- setAttachment
- attachment
public abstract NSTextAttachment attachment()
See Also: setAttachment
public abstract NSPoint cellBaselineOffset()
See Also: - icon (NSFileWrapper)
public abstract NSRect cellFrame(
NSTextContainer textContainer,
NSRect lineFrag,
NSPoint position,
int charIndex)
public abstract NSSize cellSize()
See Also: - icon (NSFileWrapper), - fileWrapper (NSTextAttachment)
public abstract void drawWithFrameInView(
NSRect cellFrame,
NSView aView)
See Also: - drawWithFrameInViewdrawWithFrame:inView: (NSCell), - lockFocus (NSView)
public abstract void drawWithFrameInView(
NSRect cellFrame,
NSView aView,
int charIndex)
public abstract void highlightWithFrameInView(
boolean flag,
NSRect cellFrame,
NSView aView)
See Also: - highlightWithFrameInViewhighlight:withFrame:inView: (NSCell), - lockFocus (NSView)
public abstract void setAttachment(NSTextAttachment anAttachment)
See Also: attachment, - setAttachmentCell: (NSTextAttachment)
public abstract boolean trackMouse(
NSEvent theEvent,
NSRect cellFrame,
NSView aTextView,
int charIndex,
boolean flag)
public abstract boolean trackMouse(
NSEvent theEvent,
NSRect cellFrame,
NSView aTextView,
boolean 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 textViewDoubleClickedCelltextView:doubleClickedOnCell:inRect: message and returns true. Otherwise, depending on whether the user clicks or drags the cell, it sends the delegate a textViewClickedCelltextView:clickedOnCell:inRect: or a textViewDraggedCelltextView:draggedCell: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)
public abstract boolean 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.