• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to draw a horizontal line in a NSTextView?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to draw a horizontal line in a NSTextView?


  • Subject: Re: How to draw a horizontal line in a NSTextView?
  • From: Mike Ferris <email@hidden>
  • Date: Sat, 7 Dec 2002 09:54:17 -0800

What I would try first is using a custom attachment. You can make an NSTextAttachmentCell subclass that will draw the line. To get the "all the way across" behavior you would probably want to override these NSTextAttachmentCell methods:

- (NSRect)cellFrameForTextContainer:(NSTextContainer *)textContainer proposedLineFragment:(NSRect)lineFrag glyphPosition:(NSPoint)position characterIndex:(unsigned)charIndex;

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView characterIndex:(unsigned)charIndex layoutManager:(NSLayoutManager *)layoutManager;

The first would return a rect that had the right width given the width of the textContainer (or its view). The second would simply draw the line.

Mike Ferris
_______________________________________________
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.

References: 
 >How to draw a horizontal line in a NSTextView? (From: Arthur Clemens <email@hidden>)

  • Prev by Date: Re: Hyphenation... hm...
  • Next by Date: Re: How to run prefPane from Project Builder/gdb
  • Previous by thread: Re: How to draw a horizontal line in a NSTextView?
  • Next by thread: Delegate methods for NSImageView (?)
  • Index(es):
    • Date
    • Thread