Protocol

NSTextAttachmentCell

A set of methods that declares the interface for objects that draw text attachment icons and handle mouse events on their icons.

Declaration

@protocol NSTextAttachmentCell

Overview

With the exceptions of cellBaselineOffset, attachment, and attachment, all of these methods are implemented by the NSCell class.For general information on text attachments, see NSAttributedString and NSTextView.

Topics

Drawing

- drawWithFrame:inView:

Draws the receiver’s image within cellFrame in aView, which is the view currently focused.

Required.

- drawWithFrame:inView:characterIndex:

Draws the receiver’s image within cellFrame in aView, which is the view currently focused. charIndex is the index of the attachment character within the text.

Required.

- drawWithFrame:inView:characterIndex:layoutManager:

Draws the receiver’s image within cellFrame in controlView, which is the view currently focused. charIndex is the index of the attachment character within the text. layoutManager is the layout manager for the text.

Required.

- highlight:withFrame:inView:

Draws the receiver’s image—with highlighting if flag is YES—within cellFrame in aView, which should be the focus view.

Required.

Cell size and position

- cellSize

Returns the size of the attachment’s icon.

Required.

- cellBaselineOffset

Returns the position where the attachment cell’s image should be drawn in text, relative to the current point established in the glyph layout.

Required.

- cellFrameForTextContainer:proposedLineFragment:glyphPosition:characterIndex:

Returns the frame of the cell as it would be drawn as the character at the given glyph position, and character index, charIndex, in textContainer.

Required.

Event handling

- wantsToTrackMouse

Returns YES if the receiver will handle a mouse event occurring over its image (to support dragging, for example), NO otherwise.

Required.

- wantsToTrackMouseForEvent:inRect:ofView:atCharacterIndex:

Allows an attachment to specify what events it would want to track the mouse for.

Required.

- trackMouse:inRect:ofView:untilMouseUp:

Handles a mouse-down event on the receiver’s image.

Required.

- trackMouse:inRect:ofView:atCharacterIndex:untilMouseUp:

Handles a mouse-down event on the receiver’s image.

Required.

Setting the attachment

attachment

Returns the text attachment object that owns the receiver.

Required.

Relationships

Inherits From

Conforming Types

See Also

Attachments

NSTextAttachment

The values for the attachment attributes of attributed strings and related objects.

NSTextAttachmentCell

An object that implements the functionality of the text attachment cell protocol.

NSTextAttachmentContainer

A set of methods that defines the interface to text attachment objects from NSLayoutManager.