Re: Shadowed text view
Re: Shadowed text view
- Subject: Re: Shadowed text view
- From: Eamon Ford <email@hidden>
- Date: Wed, 14 Dec 2005 00:33:43 -0800
I don't think that's available for free members though...
But now that I know it's called, I did a search and found this:
<
http://www.trystx.com/development.html>
A full-out application that uses the raised editor, and you can
download the source for free.
On Dec 13, 2005, at 2:34 PM, Todd Ransom wrote:
There is a sample app called RaisedEditor that demonstrates exactly
how to do this. It is in the WWDC 2003 sample code which i think
you can download from developer.apple.com.
Todd Ransom
Return Self Software
http://returnself.com
On Dec 12, 2005, at 4:50 PM, Eamon Ford wrote:
Hey all,
I'm trying to make a shadowed text view like in Address Book and
iCal, and I've succeeded in making the shadow and gray outline,
but what would be the best way to draw the text in the right place
and highlight it when it's selected?
Here's my drawRect: method (most of this code is from Jeremy
Dronfield):
- (void)drawRect:(NSRect)aRect
{
NSTextView * textView = [controller textView];
NSRange charRange = NSMakeRange(0, [[[textView textStorage]
characters] count]);
NSRange glyphRange = [[textView layoutManager]
glyphRangeForCharacterRange:charRange actualCharacterRange:nil];
NSRect rect = [[textView layoutManager]
boundingRectForGlyphRange:glyphRange inTextContainer:[textView
textContainer]];
NSColor *backgroundColor = [NSColor whiteColor];
[backgroundColor set];
NSRectFill([self bounds]);
NSColor *fillColor = [NSColor whiteColor];
NSColor *outlineColor = [NSColor grayColor];
NSShadow *viewShadow = [[NSShadow alloc] init];
[viewShadow setShadowOffset:NSMakeSize(3.5, -3.5)];
[viewShadow setShadowBlurRadius:6.5];
[fillColor setFill];
[outlineColor setStroke];
NSBezierPath *outline = [NSBezierPath bezierPathWithRect:rect];
[outline setLineWidth:1.0];
[outline setLineJoinStyle:NSMiterLineJoinStyle];
[outline stroke];
[viewShadow set];
[outline fill]; // <- important to put the shadow on the fill,
not the stroke
[viewShadow release];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden