Re: NSScrollView: iPhoto/iTunes border type?
Re: NSScrollView: iPhoto/iTunes border type?
- Subject: Re: NSScrollView: iPhoto/iTunes border type?
- From: "John C. Randolph" <email@hidden>
- Date: Sat, 3 Sep 2005 14:44:10 -0700
On Sep 1, 2005, at 2:14 AM, Stephane Sudre wrote:
On 30 août 05, at 19:05, John C. Randolph wrote:
On Aug 30, 2005, at 8:40 AM, Stephane Sudre wrote:
On 30 août 05, at 16:57, Christopher Hickman wrote:
Is the XBorderedView class on this page
<http://www.cocoadev.com/index.pl?NSTableViewBezeledBorder> what
you are
looking for? It is an NSView subclass that you put your scroll
view inside.
This view provides the beveled look like iTunes.
Sure but I'm looking for a solution without having to add an
additional level in the view hierarchy.
I don't know what your objection is to having an extra view,
Well, having an extra view is like drawing a rect with a lot of
strokeLine instead of fill. The result might be the same, but one
of the solutions is the right one, the other is not.
but you can probably do what you want by subclassing
NSScrollView, and overriding -tile and -drawRect:
Thanks for the tip. It looks promising.
BTW, I was bored last night, so I took another look at this
question. Overriding -tile definitely works:
@implementation MyScrollView
- (void) tile
{
id vScroller, hScroller;
id contentView = [self contentView];
NSRect scrollerFrame;
[super tile];
[contentView setFrame:NSInsetRect([contentView frame], 2.0, 2.0)];
if (vScroller = [self verticalScroller])
{
scrollerFrame = [vScroller frame];
scrollerFrame = NSInsetRect(scrollerFrame, 0.0, 2.0);
scrollerFrame.origin.x -= 1.0;
[vScroller setFrame:scrollerFrame];
}
if (hScroller = [self horizontalScroller])
{
scrollerFrame = [hScroller frame];
scrollerFrame = NSInsetRect(scrollerFrame, 0.2, 0.0);
scrollerFrame.origin.y += 1.0;
[hScroller setFrame:scrollerFrame];
}
}
- (void) drawRect:(NSRect) rect
{
[super drawRect:rect];
[[NSColor redColor] set];
NSFrameRect(_bounds);
[[NSColor blueColor] set];
NSFrameRect(NSInsetRect(_bounds, 1.0, 1.0));
}
@end
You'll need to write your own -drawRect: that matches the bezel style
you want, but this should be what you need.
-jcr
John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.
_______________________________________________
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