[TOC] [Prev] [Next] [Bottom]


NSTextAttachmentCell

Inherits From:
NSCell : NSObject

Conforms To:
NSTextAttachmentCell
NSObject (NSObject)

Declared In:
NSTextAttachment.h

Class Description

NSTextAttachmentCell implements the functionality of the NSTextAttachmentCell protocol. See the NSTextAttachment protocol specification for a general discussion of the protocol's methods. This specification describes only those methods whose implementations have features peculiar to this class.

See the NSAttributedString and NSTextView class specifications for general information on text attachments.


Adopted Protocols

NSTextAttachmentCell
- attachment
- cellBaselineOffset
- cellSize
- drawWithFrame:inView:
- highlight:withFrame:inView:
- trackMouse:inRect:ofView:untilMouseUp:
- setAttachment:
- wantsToTrackMouse

Instance Methods

trackMouse:inRect:ofView:untilMouseUp:

@protocol NSTextAttachmentCell

- (BOOL)trackMouse:(NSEvent *)theEvent
inRect:(NSRect)cellFrame
ofView:(NSView *)aTextView
untilMouseUp:(BOOL)flag

Handles a mouse-down event on the receiver's image. NSTextAttachmentCell's implementation of this method calls upon aTextView's delegate to handle the event. If theEvent concludes as a double click, the text attachment cell sends the delegate a textView:doubleClickedOnCell:inRect: message and returns YES. 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 YES. NSTextAttachmentCell's implementation returns NO only if flag is NO and the mouse is dragged outside of cellFrame. The delegate methods are invoked only if the delegate can respond to them.

See also: - wantsToTrackMouse, - trackMouse:inRect:ofView:untilMouseUp: (NSCell), - lockFocus (NSView)


wantsToTrackMouse

@protocol NSTextAttachmentCell

- (BOOL)wantsToTrackMouse

Returns YES. NSTextAttachmentCell objects support dragging. An NSTextView invokes this method before sending trackMouse:inRect:ofView:untilMouseUp: to the text attachment cell.

A more static subclass might override this method to return NO, which results in the attachment image behaving as any other glyph in the text, and not allow itself to be dragged or to perform a method on being clicked.



[TOC] [Prev] [Next] [Bottom]

Copyright © 1997, Apple Computer, Inc. All rights reserved.