25 @
typedef CPShadowWeight
38 CPShadowWeight _weight;
50 @"content-inset": CGInsetMakeZero()
54 + (CGRect)frameForContentFrame:(CGRect)aFrame withWeight:(CPShadowWeight)aWeight
57 inset = [shadowView valueForThemeAttribute:@"content-inset" inState:(aWeight == CPLightShadow) ? CPThemeStateShadowViewLight : CPThemeStateShadowViewHeavy];
59 return CGRectMake(CGRectGetMinX(aFrame) - inset.left, CGRectGetMinY(aFrame) - inset.top, CGRectGetWidth(aFrame) + inset.left + inset.right, CGRectGetHeight(aFrame) + inset.top + inset.bottom);
62 + (id)shadowViewEnclosingView:(
CPView)aView
67 + (id)shadowViewEnclosingView:(
CPView)aView withWeight:(CPShadowWeight)aWeight
69 var shadowView = [[
self alloc] initWithFrame:[aView
frame]];
73 [shadowView setWeight:aWeight];
75 var size = [shadowView frame].size,
76 inset = [shadowView currentValueForThemeAttribute:@"content-inset"],
77 width = size.width - inset.left - inset.right,
78 height = size.height - inset.top - inset.bottom,
81 [shadowView setHitTests:[aView
hitTests]];
84 [shadowView addSubview:aView];
85 [aView
setFrame:CGRectMake(inset.left, inset.top, width, height)];
86 [enclosingView addSubview:shadowView];
92 - (id)initWithFrame:(CGRect)aFrame
106 - (void)setWeight:(CPShadowWeight)aWeight
108 if (_weight == aWeight)
123 return [
self currentValueForThemeAttribute:@"content-inset"].left;
128 return [
self currentValueForThemeAttribute:@"content-inset"].right;
133 return [
self currentValueForThemeAttribute:@"content-inset"].top;
138 return [
self currentValueForThemeAttribute:@"content-inset"].bottom;
141 - (float)horizontalInset
143 var currentContentInset = [
self currentValueForThemeAttribute:@"content-inset"];
145 return currentContentInset.left + currentContentInset.right;
148 - (float)verticalInset
150 var currentContentInset = [
self currentValueForThemeAttribute:@"content-inset"];
152 return currentContentInset.top + currentContentInset.bottom;
155 - (CGRect)frameForContentFrame:(CGRect)aFrame
157 return [[
self class] frameForContentFrame:aFrame withWeight:_weight];
160 - (void)setFrameForContentFrame:(CGRect)aFrame
165 - (void)layoutSubviews
id initWithFrame:(CGRect aFrame)
BOOL setThemeState:(ThemeState aState)
An object representation of nil.
void setFrame:(CGRect aFrame)
CPThemeStateShadowViewHeavy
void removeFromSuperview()
A mutable key-value pair collection.
CPThemeStateShadowViewLight
An immutable string (collection of characters).
CGRect frameForContentFrame:(CGRect aFrame)
CPShadowWeight CPLightShadow
void setBackgroundColor:(CPColor aColor)
void setHitTests:(BOOL shouldHitTest)
unsigned autoresizingMask()
id shadowViewEnclosingView:withWeight:(CPView aView, [withWeight] CPShadowWeight aWeight)
void setWeight:(CPShadowWeight aWeight)