mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 03:02:19 +00:00
implemented imageDimsWhenDisabled on CPButton
This commit is contained in:
1 parent
90cd519916
commit
ea47baa1fc
2 files changed
+19
No files matched your search
@@ -554,6 +554,7 @@ CPButtonStateMixed = CPThemeState("mixed");
|
||||
[contentView setTextShadowOffset:[self currentValueForThemeAttribute:@"text-shadow-offset"]];
|
||||
[contentView setImagePosition:[self currentValueForThemeAttribute:@"image-position"]];
|
||||
[contentView setImageScaling:[self currentValueForThemeAttribute:@"image-scaling"]];
|
||||
[contentView setDimsImage:[self hasThemeState:CPThemeStateDisabled] && _imageDimsWhenDisabled];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ var HORIZONTAL_MARGIN = 3.0,
|
||||
|
||||
CPCellImagePosition _imagePosition;
|
||||
CPImageScaling _imageScaling;
|
||||
BOOL _shouldDimImage;
|
||||
|
||||
CPImage _image;
|
||||
CPString _text;
|
||||
@@ -216,6 +217,16 @@ var HORIZONTAL_MARGIN = 3.0,
|
||||
return _imageScaling;
|
||||
}
|
||||
|
||||
- (void)setDimsImage:(BOOL)shouldDimImage
|
||||
{
|
||||
var shouldDimImage = !!shouldDimImage;
|
||||
if (_shouldDimImage !== shouldDimImage)
|
||||
{
|
||||
_shouldDimImage = shouldDimImage;
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setTextColor:(CPColor)aTextColor
|
||||
{
|
||||
if (_textColor === aTextColor)
|
||||
@@ -577,6 +588,13 @@ var HORIZONTAL_MARGIN = 3.0,
|
||||
imageHeight *= scale;
|
||||
}
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
if (CPFeatureIsCompatible(CPOpacityRequiresFilterFeature))
|
||||
_DOMElement.style.filter = @"alpha(opacity=" + _shouldDimImage ? 50 : 100 + ")";
|
||||
else
|
||||
_DOMElement.style.opacity = _shouldDimImage ? 0.5 : 1.0;
|
||||
#endif
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
_DOMImageElement.width = imageWidth;
|
||||
_DOMImageElement.height = imageHeight;
|
||||
|
||||
Reference in new issue
Block a user