Re: NSLayoutManager question
Re: NSLayoutManager question
- Subject: Re: NSLayoutManager question
- From: Douglas Davidson <email@hidden>
- Date: Wed, 20 Feb 2002 09:57:20 -0800
On Tuesday, February 19, 2002, at 05:56 PM, Paul Bayley wrote:
I wish to change the text area selection behavior of a Cocoa
application and I'm a bit lost. I believe this is handled by
NSLayoutManager but not certain. I'm sure somebody will correct me if
I'm wrong.
The behavior I wish to change is when selecting text via dragging
I do not want to select the trailing hard return (linefeed). The
current behavior selects the linefeed when selecting right or down. I
do not wish to change the triple-click behavior which selects a line
including the trailing linefeed.
I also want to create a click-and-hold gesture as well as a
drag-the-selection gesture, but those are secondary concerns.
It seems to me, browsing Apple's documentation, that the selection
behavior is performed by NSLayoutManager. However I'm not quite sure
how to alter the behavior of NSLayoutManager to my liking.
No, this behavior is determined by NSTextView, primarily in its
mouseDown: method. NSTextView is the view, NSTextStorage the model (or
part of it), and NSLayoutManager the controller; this is view behavior.
NSLayoutManager is consulted, primarily through
glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph:, and
you could consider intervening there, but the primary responsibility
lies with NSTextView.
(glyphIndexForPoint:inTextContainer:fractionOfDistanceThroughGlyph: is
not the right method to override, however; see the NSLayoutManager
header for details.)
Possibly someone else on the list has tried to do something like this
before.
Douglas Davidson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.