Revert "Merge pull request #2152 from daboe01/Fix-for-missing-backgroundcolor-support-textfield"

This reverts commit 5c193f49df, reversing
changes made to 5b2ef77c2c.
This commit is contained in:
Antoine Mercadal committed 2014-09-04 14:34:09 -07:00
1 parent 5c193f49df
commit 57f2d3e26a
2 files changed
+10 -27

No files matched your search

+9 -20
View File
@@ -130,6 +130,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
BOOL _drawsBackground;
CPColor _textFieldBackgroundColor;
CPString _placeholderString;
CPString _stringValue;
@@ -531,32 +533,23 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
Sets the background color, which is shown for non-bezeled text fields with drawsBackground set to YES
@param aColor The background color
*/
- (void)setBackgroundColor:(CPColor)aColor
- (void)setTextFieldBackgroundColor:(CPColor)aColor
{
// _backgroundColor is defined on CPView.
if (_backgroundColor == aColor)
if (_textFieldBackgroundColor == aColor)
return;
_backgroundColor = aColor;
_textFieldBackgroundColor = aColor;
[self setNeedsLayout];
[self setNeedsDisplay:YES];
}
/*
Deprecated. See: https://github.com/cappuccino/cappuccino/pull/2152
*/
- (void)setTextFieldBackgroundColor:(CPColor)aColor
{
[self setBackgroundColor:aColor];
}
/*!
Deprecated. See: https://github.com/cappuccino/cappuccino/pull/2152
Returns the background color.
*/
- (CPColor)textFieldBackgroundColor
{
return _backgroundColor;
return _textFieldBackgroundColor;
}
/*! @ignore */
@@ -1778,10 +1771,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[contentView setText:string];
[contentView setTextColor:[self currentValueForThemeAttribute:@"text-color"]];
if (_backgroundColor)
[contentView setBackgroundColor:_backgroundColor];
[contentView setFont:[self currentValueForThemeAttribute:@"font"]];
[contentView setAlignment:[self currentValueForThemeAttribute:@"alignment"]];
[contentView setVerticalAlignment:[self currentValueForThemeAttribute:@"vertical-alignment"]];
@@ -1924,7 +1913,7 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
[self setDrawsBackground:[aCoder decodeBoolForKey:CPTextFieldDrawsBackgroundKey]];
[self setBackgroundColor:[aCoder decodeObjectForKey:CPTextFieldBackgroundColorKey]];
[self setTextFieldBackgroundColor:[aCoder decodeObjectForKey:CPTextFieldBackgroundColorKey]];
[self setLineBreakMode:[aCoder decodeIntForKey:CPTextFieldLineBreakModeKey]];
[self setAlignment:[aCoder decodeIntForKey:CPTextFieldAlignmentKey]];
@@ -1948,7 +1937,7 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
[aCoder encodeBool:_drawsBackground forKey:CPTextFieldDrawsBackgroundKey];
[aCoder encodeObject:_backgroundColor forKey:CPTextFieldBackgroundColorKey];
[aCoder encodeObject:_textFieldBackgroundColor forKey:CPTextFieldBackgroundColorKey];
[aCoder encodeInt:[self lineBreakMode] forKey:CPTextFieldLineBreakModeKey];
[aCoder encodeInt:[self alignment] forKey:CPTextFieldAlignmentKey];
+1 -7
View File
@@ -37,8 +37,7 @@
[contentView addSubview:textField];
var shadowLabel = [CPTextField labelWithTitle:@"This text should have a shadow."],
championOfLightLabel = [CPTextField labelWithTitle:@"This text should have no shadow."],
redLabel = [CPTextField labelWithTitle:@"This text should be white on a red background."];
championOfLightLabel = [CPTextField labelWithTitle:@"This text should have no shadow."];
[shadowLabel setTextColor:[CPColor blackColor]];
[shadowLabel setTextShadowOffset:CGSizeMake(0, 1)];
@@ -48,16 +47,11 @@
[championOfLightLabel setTextShadowOffset:CGSizeMake(0, 1)];
[championOfLightLabel setTextShadowColor:[CPColor clearColor]];
[redLabel setTextColor:[CPColor whiteColor]];
[redLabel setBackgroundColor:[CPColor redColor]];
[shadowLabel setFrame:CGRectMake(15, CGRectGetMaxY([textField frame]) + 10, 300, 18)];
[championOfLightLabel setFrame:CGRectMake(15, CGRectGetMaxY([shadowLabel frame]) + 2, 300, 18)];
[redLabel setFrame:CGRectMake(15, CGRectGetMaxY([championOfLightLabel frame]) + 10, 300, 18)];
[contentView addSubview:shadowLabel];
[contentView addSubview:championOfLightLabel];
[contentView addSubview:redLabel];
var jumpLabel = [CPTextField labelWithTitle:@"The text of these text fields should not move ('jump') when a field becomes the first responder. Labels on the right should replicate the input."];