mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-27 08:55:52 +00:00
Added themable _CPDocModalWindowView
This commit is contained in:
1 parent
42868ecbee
commit
0e6df9d299
1 file changed
+25
-6
@@ -9,6 +9,17 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
|
||||
CPView _shadowView;
|
||||
}
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
{
|
||||
return @"doc-modal-window-view";
|
||||
}
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[[CPColor whiteColor], [CPNull null], 8]
|
||||
forKeys:[ @"body-color", @"attached-sheet-shadow-color", @"height-shadow"]];
|
||||
}
|
||||
|
||||
+ (CPColor)bodyBackgroundColor
|
||||
{
|
||||
if (!_CPStandardWindowViewBodyBackgroundColor)
|
||||
@@ -23,21 +34,17 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
|
||||
|
||||
if (self)
|
||||
{
|
||||
var theClass = [self class],
|
||||
bounds = [self bounds];
|
||||
var bounds = [self bounds];
|
||||
|
||||
_bodyView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds))];
|
||||
|
||||
[_bodyView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
[_bodyView setBackgroundColor:[theClass bodyBackgroundColor]];
|
||||
[_bodyView setHitTests:NO];
|
||||
|
||||
[self addSubview:_bodyView];
|
||||
|
||||
var bundle = [CPBundle bundleForClass:[CPWindow class]];
|
||||
_shadowView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, _CGRectGetWidth(bounds), 8)];
|
||||
_shadowView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, _CGRectGetWidth(bounds), [self valueForThemeAttribute:@"height-shadow"])];
|
||||
[_shadowView setAutoresizingMask:CPViewWidthSizable];
|
||||
[_shadowView setBackgroundColor:[CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/CPWindowAttachedSheetShadow.png"] size:CGSizeMake(9,8)]]];
|
||||
[self addSubview:_shadowView];
|
||||
}
|
||||
|
||||
@@ -59,5 +66,17 @@ var _CPStandardWindowViewBodyBackgroundColor = nil;
|
||||
// do nothing, already a sheet
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
var bounds = [self bounds];
|
||||
|
||||
[_bodyView setBackgroundColor:[self valueForThemeAttribute:@"body-color"]];
|
||||
|
||||
[_shadowView setFrame:CGRectMake(0,0, _CGRectGetWidth(bounds), [self valueForThemeAttribute:@"height-shadow"])];
|
||||
[_shadowView setBackgroundColor:[self valueForThemeAttribute:@"attached-sheet-shadow-color"]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in new issue
Block a user