Merge branch 'Aristo2' of github.mv.usa.alcatel.com:amercada/Cappuccino into Aristo2
No files matched your search
@@ -31,18 +31,9 @@
|
||||
CPLightShadow = 0;
|
||||
CPHeavyShadow = 1;
|
||||
|
||||
var CPShadowViewLightBackgroundColor = nil,
|
||||
CPShadowViewHeavyBackgroundColor = nil;
|
||||
CPThemeStateShadowViewLight = CPThemeState("shadowview-style-light");
|
||||
CPThemeStateShadowViewHeavy = CPThemeState("shadowview-style-heavy");
|
||||
|
||||
var LIGHT_LEFT_INSET = 3.0,
|
||||
LIGHT_RIGHT_INSET = 3.0,
|
||||
LIGHT_TOP_INSET = 3.0,
|
||||
LIGHT_BOTTOM_INSET = 5.0,
|
||||
|
||||
HEAVY_LEFT_INSET = 7.0,
|
||||
HEAVY_RIGHT_INSET = 7.0,
|
||||
HEAVY_TOP_INSET = 5.0,
|
||||
HEAVY_BOTTOM_INSET = 5.0;
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@@ -52,40 +43,25 @@ var LIGHT_LEFT_INSET = 3.0,
|
||||
CPShadowWeight _weight;
|
||||
}
|
||||
|
||||
+ (void)initialize
|
||||
+ (CPString)defaultThemeClass
|
||||
{
|
||||
if (self !== [CPShadowView class])
|
||||
return;
|
||||
return "shadow-view";
|
||||
}
|
||||
|
||||
var bundle = [CPBundle bundleForClass:[self class]];
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithJSObject:{
|
||||
@"bezel-color": [CPNull null],
|
||||
@"content-inset": CGInsetMakeZero()
|
||||
}];
|
||||
}
|
||||
|
||||
CPShadowViewLightBackgroundColor = CPColorWithImages([
|
||||
[@"CPShadowView/CPShadowViewLightTopLeft.png", 9.0, 9.0, bundle],
|
||||
[@"CPShadowView/CPShadowViewLightTop.png", 1.0, 9.0, bundle],
|
||||
[@"CPShadowView/CPShadowViewLightTopRight.png", 9.0, 9.0, bundle],
|
||||
+ (CGRect)frameForContentFrame:(CGRect)aFrame withWeight:(CPShadowWeight)aWeight
|
||||
{
|
||||
var shadowView = [CPShadowView new],
|
||||
inset = [shadowView valueForThemeAttribute:@"content-inset" inState:(aWeight == CPLightShadow) ? CPThemeStateShadowViewLight : CPThemeStateShadowViewHeavy];
|
||||
|
||||
[@"CPShadowView/CPShadowViewLightLeft.png", 9.0, 1.0, bundle],
|
||||
nil,
|
||||
[@"CPShadowView/CPShadowViewLightRight.png", 9.0, 1.0, bundle],
|
||||
|
||||
[@"CPShadowView/CPShadowViewLightBottomLeft.png", 9.0, 9.0, bundle],
|
||||
[@"CPShadowView/CPShadowViewLightBottom.png", 1.0, 9.0, bundle],
|
||||
[@"CPShadowView/CPShadowViewLightBottomRight.png", 9.0, 9.0, bundle]
|
||||
]);
|
||||
|
||||
CPShadowViewHeavyBackgroundColor = CPColorWithImages([
|
||||
[@"CPShadowView/CPShadowViewHeavyTopLeft.png", 17.0, 17.0, bundle],
|
||||
[@"CPShadowView/CPShadowViewHeavyTop.png", 1.0, 17.0, bundle],
|
||||
[@"CPShadowView/CPShadowViewHeavyTopRight.png", 17.0, 17.0, bundle],
|
||||
|
||||
[@"CPShadowView/CPShadowViewHeavyLeft.png", 17.0, 1.0, bundle],
|
||||
nil,
|
||||
[@"CPShadowView/CPShadowViewHeavyRight.png", 17.0, 1.0, bundle],
|
||||
|
||||
[@"CPShadowView/CPShadowViewHeavyBottomLeft.png", 17.0, 17.0, bundle],
|
||||
[@"CPShadowView/CPShadowViewHeavyBottom.png", 1.0, 17.0, bundle],
|
||||
[@"CPShadowView/CPShadowViewHeavyBottomRight.png", 17.0, 17.0, bundle]
|
||||
]);
|
||||
return CGRectMake(_CGRectGetMinX(aFrame) - inset.left, _CGRectGetMinY(aFrame) - inset.top, _CGRectGetWidth(aFrame) + inset.left + inset.right, _CGRectGetHeight(aFrame) + inset.top + inset.bottom);
|
||||
}
|
||||
|
||||
+ (id)shadowViewEnclosingView:(CPView)aView
|
||||
@@ -102,15 +78,16 @@ var LIGHT_LEFT_INSET = 3.0,
|
||||
[shadowView setWeight:aWeight];
|
||||
|
||||
var size = [shadowView frame].size,
|
||||
width = size.width - [shadowView leftInset] - [shadowView rightInset],
|
||||
height = size.height - [shadowView topInset] - [shadowView bottomInset],
|
||||
inset = [shadowView currentValueForThemeAttribute:@"content-inset"],
|
||||
width = size.width - inset.left - inset.right,
|
||||
height = size.height - inset.top - inset.bottom,
|
||||
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)]
|
||||
[aView setFrame:CGRectMake(inset.left, inset.top, width, height)];
|
||||
[enclosingView addSubview:shadowView];
|
||||
}
|
||||
|
||||
@@ -123,9 +100,7 @@ var LIGHT_LEFT_INSET = 3.0,
|
||||
|
||||
if (self)
|
||||
{
|
||||
_weight = CPLightShadow;
|
||||
|
||||
[self setBackgroundColor:CPShadowViewLightBackgroundColor];
|
||||
[self setWeight:CPLightShadow];
|
||||
|
||||
[self setHitTests:NO];
|
||||
}
|
||||
@@ -141,54 +116,45 @@ var LIGHT_LEFT_INSET = 3.0,
|
||||
_weight = aWeight;
|
||||
|
||||
if (_weight == CPLightShadow)
|
||||
[self setBackgroundColor:CPShadowViewLightBackgroundColor];
|
||||
|
||||
[self setThemeState:CPThemeStateShadowViewLight];
|
||||
else
|
||||
[self setBackgroundColor:CPShadowViewHeavyBackgroundColor];
|
||||
[self setThemeState:CPThemeStateShadowViewHeavy];
|
||||
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (float)leftInset
|
||||
{
|
||||
return _weight == CPLightShadow ? LIGHT_LEFT_INSET : HEAVY_LEFT_INSET;
|
||||
return [self currentValueForThemeAttribute:@"content-inset"].left;
|
||||
}
|
||||
|
||||
- (float)rightInset
|
||||
{
|
||||
return _weight == CPLightShadow ? LIGHT_RIGHT_INSET : HEAVY_RIGHT_INSET;
|
||||
return [self currentValueForThemeAttribute:@"content-inset"].right;
|
||||
}
|
||||
|
||||
- (float)topInset
|
||||
{
|
||||
return _weight == CPLightShadow ? LIGHT_TOP_INSET : HEAVY_TOP_INSET;
|
||||
return [self currentValueForThemeAttribute:@"content-inset"].top;
|
||||
}
|
||||
|
||||
- (float)bottomInset
|
||||
{
|
||||
return _weight == CPLightShadow ? LIGHT_BOTTOM_INSET : HEAVY_BOTTOM_INSET;
|
||||
return [self currentValueForThemeAttribute:@"content-inset"].bottom;
|
||||
}
|
||||
|
||||
- (float)horizontalInset
|
||||
{
|
||||
if (_weight == CPLightShadow)
|
||||
return LIGHT_LEFT_INSET + LIGHT_RIGHT_INSET;
|
||||
var currentContentInset = [self currentValueForThemeAttribute:@"content-inset"];
|
||||
|
||||
return HEAVY_LEFT_INSET + HEAVY_RIGHT_INSET;
|
||||
return currentContentInset.left + currentContentInset.right;
|
||||
}
|
||||
|
||||
- (float)verticalInset
|
||||
{
|
||||
if (_weight == CPLightShadow)
|
||||
return LIGHT_TOP_INSET + LIGHT_BOTTOM_INSET;
|
||||
var currentContentInset = [self currentValueForThemeAttribute:@"content-inset"];
|
||||
|
||||
return HEAVY_TOP_INSET + HEAVY_BOTTOM_INSET;
|
||||
}
|
||||
|
||||
+ (CGRect)frameForContentFrame:(CGRect)aFrame withWeight:(CPShadowWeight)aWeight
|
||||
{
|
||||
if (aWeight == CPLightShadow)
|
||||
return CGRectMake(_CGRectGetMinX(aFrame) - LIGHT_LEFT_INSET, _CGRectGetMinY(aFrame) - LIGHT_TOP_INSET, _CGRectGetWidth(aFrame) + LIGHT_LEFT_INSET + LIGHT_RIGHT_INSET, _CGRectGetHeight(aFrame) + LIGHT_TOP_INSET + LIGHT_BOTTOM_INSET);
|
||||
else
|
||||
return CGRectMake(_CGRectGetMinX(aFrame) - HEAVY_LEFT_INSET, _CGRectGetMinY(aFrame) - HEAVY_TOP_INSET, _CGRectGetWidth(aFrame) + HEAVY_LEFT_INSET + HEAVY_RIGHT_INSET, _CGRectGetHeight(aFrame) + HEAVY_TOP_INSET + HEAVY_BOTTOM_INSET);
|
||||
return currentContentInset.top + currentContentInset.bottom;
|
||||
}
|
||||
|
||||
- (CGRect)frameForContentFrame:(CGRect)aFrame
|
||||
@@ -201,4 +167,11 @@ var LIGHT_LEFT_INSET = 3.0,
|
||||
[self setFrame:[self frameForContentFrame:aFrame]];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
[self setBackgroundColor:[self currentValueForThemeAttribute:@"bezel-color"]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Before Width: | Height: | Size: 339 B |
|
Before Width: | Height: | Size: 338 B |
|
Before Width: | Height: | Size: 106 B |
|
Before Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 88 B |
|
Before Width: | Height: | Size: 214 B |
|
Before Width: | Height: | Size: 85 B |
|
Before Width: | Height: | Size: 68 B |
|
Before Width: | Height: | Size: 84 B |
|
Before Width: | Height: | Size: 196 B |
|
Before Width: | Height: | Size: 87 B |
|
Before Width: | Height: | Size: 205 B |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 97 B |
|
Before Width: | Height: | Size: 184 B |
|
Before Width: | Height: | Size: 74 B |
|
Before Width: | Height: | Size: 72 B |
|
Before Width: | Height: | Size: 74 B |
|
Before Width: | Height: | Size: 86 B |
|
Before Width: | Height: | Size: 74 B |
|
Before Width: | Height: | Size: 85 B |
|
Before Width: | Height: | Size: 425 B |
|
Before Width: | Height: | Size: 420 B |
|
Before Width: | Height: | Size: 630 B |
|
Before Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 418 B |
|
Before Width: | Height: | Size: 415 B |
|
Before Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 407 B |
|
Before Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 81 B |
|
Before Width: | Height: | Size: 129 B |
|
Before Width: | Height: | Size: 134 B |
|
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 213 B |
|
Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 210 B |
|
Before Width: | Height: | Size: 85 B After Width: | Height: | Size: 85 B |
|
Before Width: | Height: | Size: 82 B After Width: | Height: | Size: 82 B |
|
Before Width: | Height: | Size: 80 B After Width: | Height: | Size: 80 B |
|
Before Width: | Height: | Size: 190 B After Width: | Height: | Size: 190 B |
|
Before Width: | Height: | Size: 213 B After Width: | Height: | Size: 213 B |
|
Before Width: | Height: | Size: 85 B After Width: | Height: | Size: 85 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 144 B After Width: | Height: | Size: 144 B |
|
Before Width: | Height: | Size: 83 B After Width: | Height: | Size: 83 B |
|
Before Width: | Height: | Size: 74 B After Width: | Height: | Size: 74 B |
|
Before Width: | Height: | Size: 72 B After Width: | Height: | Size: 72 B |
|
Before Width: | Height: | Size: 128 B After Width: | Height: | Size: 128 B |
|
Before Width: | Height: | Size: 138 B After Width: | Height: | Size: 138 B |
|
Before Width: | Height: | Size: 79 B After Width: | Height: | Size: 79 B |
@@ -1778,6 +1778,50 @@ var themedButtonValues = nil,
|
||||
return levelIndicator;
|
||||
}
|
||||
|
||||
+ (CPShadowView)themedShadowView
|
||||
{
|
||||
var shadowView = [[CPShadowView alloc] initWithFrame:CGRectMakeZero()],
|
||||
|
||||
lightColor = PatternColor(
|
||||
[
|
||||
[@"shadow-view-light-top-left.png", 9.0, 9.0],
|
||||
[@"shadow-view-light-top.png", 1.0, 9.0],
|
||||
[@"shadow-view-light-top-right.png", 9.0, 9.0],
|
||||
[@"shadow-view-light-left.png", 9.0, 1.0],
|
||||
nil,
|
||||
[@"shadow-view-light-right.png", 9.0, 1.0],
|
||||
[@"shadow-view-light-bottom-left.png", 9.0, 9.0],
|
||||
[@"shadow-view-light-bottom.png", 1.0, 9.0],
|
||||
[@"shadow-view-light-bottom-right.png", 9.0, 9.0]
|
||||
]),
|
||||
|
||||
heavyColor = PatternColor(
|
||||
[
|
||||
[@"shadow-view-heavy-top-left.png", 17.0, 17.0],
|
||||
[@"shadow-view-heavy-top.png", 1.0, 17.0],
|
||||
[@"shadow-view-heavy-top-right.png", 17.0, 17.0],
|
||||
[@"shadow-view-heavy-left.png", 17.0, 1.0],
|
||||
nil,
|
||||
[@"shadow-view-heavy-right.png", 17.0, 1.0],
|
||||
[@"shadow-view-heavy-bottom-left.png", 17.0, 17.0],
|
||||
[@"shadow-view-heavy-bottom.png", 1.0, 17.0],
|
||||
[@"shadow-view-heavy-bottom-right.png", 17.0, 17.0]
|
||||
]),
|
||||
|
||||
themedShadowViewValues =
|
||||
[
|
||||
[@"bezel-color", lightColor, CPThemeStateShadowViewLight],
|
||||
[@"bezel-color", heavyColor, CPThemeStateShadowViewHeavy],
|
||||
|
||||
[@"content-inset", CGInsetMake(3.0, 3.0, 5.0, 3.0), CPThemeStateShadowViewLight],
|
||||
[@"content-inset", CGInsetMake(5.0, 7.0, 5.0, 7.0), CPThemeStateShadowViewHeavy]
|
||||
];
|
||||
|
||||
[self registerThemeValues:themedShadowViewValues forView:shadowView];
|
||||
|
||||
return shadowView;
|
||||
}
|
||||
|
||||
+(_CPWindowView)themedWindowView
|
||||
{
|
||||
var windowView = [[_CPWindowView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)],
|
||||
|
||||
@@ -30,25 +30,31 @@
|
||||
|
||||
var imageView = [[CPImageView alloc] initWithFrame:CGRectMake(20.0, 50.0, 290.0, 250.0)],
|
||||
image = CPImageInBundle("280px-1730_Homann_Map_of_Scandinavia,_Norway,_Sweden,_Denmark,_Finland_and_the_Baltics_-_Geographicus_-_Scandinavia-homann-1730.jpg", CGSizeMake(280, 240)),
|
||||
imageViewShadow = [[CPImageView alloc] initWithFrame:CGRectMake(320.0, 50.0, 290.0, 250.0)];
|
||||
|
||||
imageViewShadow = [[CPImageView alloc] initWithFrame:CGRectMake(320.0, 50.0, 290.0, 250.0)],
|
||||
imageViewShadowHeavy = [[CPImageView alloc] initWithFrame:CGRectMake(620.0, 50.0, 290.0, 250.0)];
|
||||
|
||||
// Test CPImage -data method
|
||||
// Create an image from a filename based image
|
||||
var im = [[CPImage alloc] initWithData:[image data]],
|
||||
|
||||
// Create an image from a data based image
|
||||
otherImage = [[CPImage alloc] initWithData:[im data]];
|
||||
|
||||
[imageView setImageScaling:CPImageScaleNone];
|
||||
[imageViewShadow setImageScaling:CPImageScaleNone];
|
||||
|
||||
[imageView setImage:image];
|
||||
[imageView setImageScaling:CPImageScaleNone];
|
||||
[imageView setImage:image];
|
||||
[contentView addSubview:imageView];
|
||||
|
||||
[imageViewShadow setImageScaling:CPImageScaleNone];
|
||||
[imageViewShadow setImage:otherImage];
|
||||
[imageViewShadow setHasShadow:YES];
|
||||
|
||||
[contentView addSubview:imageView];
|
||||
[contentView addSubview:imageViewShadow];
|
||||
|
||||
[imageViewShadowHeavy setImageScaling:CPImageScaleNone];
|
||||
[imageViewShadowHeavy setImage:image];
|
||||
[imageViewShadowHeavy setHasShadow:YES];
|
||||
[imageViewShadowHeavy._shadowView setWeight:CPHeavyShadow];
|
||||
[contentView addSubview:imageViewShadowHeavy];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
|
||||
// Uncomment the following line to turn on the standard menu bar.
|
||||
|
||||