From 952bb4bb7c8ca5df2d2628f84005d942a53d5a5b Mon Sep 17 00:00:00 2001 From: Aparajita Fishman Date: Fri, 18 Jun 2010 11:39:30 -0400 Subject: [PATCH] added CPShadow shadowViewEnclosingView --- AppKit/CPShadowView.j | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/AppKit/CPShadowView.j b/AppKit/CPShadowView.j index 36cfabdad..72fb69620 100644 --- a/AppKit/CPShadowView.j +++ b/AppKit/CPShadowView.j @@ -93,6 +93,31 @@ var LIGHT_LEFT_INSET = 3.0, ]]]; } ++ (id)shadowViewEnclosingView:(CPView)aView +{ + return [self shadowViewEnclosingView:aView withWeight:CPLightShadow]; +} + ++ (id)shadowViewEnclosingView:(CPView)aView withWeight:(CPShadowWeight)aWeight +{ + var shadowView = [[CPShadowView alloc] initWithFrame:[aView frame]]; + [shadowView setWeight:aWeight]; + + var size = [shadowView frame].size, + width = size.width - [shadowView leftInset] - [shadowView rightInset], + height = size.height - [shadowView topInset] - [shadowView bottomInset], + enclosingView = [aView superview]; + + [shadowView setHitTests:[aView hitTests]]; + [shadowView setAutoresizingMask:[aView autoresizingMask]]; + [aView removeFromSuperview]; + [shadowView addSubview:aView]; + [aView setFrame:CGRectMake([shadowView leftInset], [shadowView topInset], width, height)] + [enclosingView addSubview:shadowView]; + + return shadowView; +} + - (id)initWithFrame:(CGRect)aFrame { self = [super initWithFrame:aFrame];