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

Setting the Attachment

attachment

Returns the text attachment object that owns the cell.

Required.

Drawing the Cell Contents

- drawWithFrame:inView:

Draws the cell's image in the specified rectangle of the currently focused view.

Required.

- drawWithFrame:inView:characterIndex:

Draws the cell's image at the specified index point in the view.

Required.

- drawWithFrame:inView:characterIndex:layoutManager:

Draws the cell's image using the specified layout manager.

Required.

- highlight:withFrame:inView:

Draws the receiver’s image with optional highlighting.

Required.

Proiding the Cell Metrics

- cellSize

Returns the size of the attachment’s icon.

Required.

- cellBaselineOffset

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

Required.

- cellFrameForTextContainer:proposedLineFragment:glyphPosition:characterIndex:

Returns the frame of the cell to draw at the specified position in a text container.

Required.

Responding to Mouse Events

- wantsToTrackMouse

Returns a Boolean value that indicates whether the attachment handles mouse events occurring over its image.

Required.

- wantsToTrackMouseForEvent:inRect:ofView:atCharacterIndex:

Allows an attachment to specify the events for which it tracks the mouse.

Required.

- trackMouse:inRect:ofView:untilMouseUp:

Handles a mouse-down event on the cell's image, and optionally waits until a mouse-up event

Required.

- trackMouse:inRect:ofView:atCharacterIndex:untilMouseUp:

Handles a mouse-down event on the image at the specified character position.

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.