NSTextContainer subclass question
NSTextContainer subclass question
- Subject: NSTextContainer subclass question
- From: Brock Brandenberg <email@hidden>
- Date: Wed, 27 Nov 2002 12:40:31 -0600
In a quick sample project, I have a subclass of NSTextContainer that
overrides the lineFragmentRectForProposedRect: method, returning appropriate
rects for a custom shape. In an NSApplication delegate, I'm simply replacing
the default NSTextContainer for a NSTextView that is instantiated from a nib
with my subclass. When text is entered into the NSTextView and the shape
will no longer hold all of the text, the subclass method will return a
NSZeroRect. In this case, the NSTextView no longer draws the text. As long
as the text is short enough to fit the shape, however, it draws.
Is it a requirement that an NSLayoutManager has enough text containers to
hold all the text before drawing occurs? In my example, I'm hacking the sole
NSTextContainer for a NSTextView, so I assume that I'm breaking its usual
operation in some way. However, I would assume that there is some way to
catch the end of layout for this sole container and at least tell the
NSTextView to draw what it can to make this sample work. I'm familiar with
the NSLayoutManager delegate methods, so in my particular application, I can
insure that extra containers are added to hold the text. However, I'd like
to avoid having to do so and would rather ignore any overflowed text. The
docs are pretty thin around NSTextContainer subclasses and their interaction
with the rest of the text system, so any assistance with handling text
container overflow would be helpful.
Thanks,
Brock Brandenberg
----- industrial design @ www.bergdesign.com ------
_______________________________________________
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.