mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-11 11:07:07 +00:00
Fix spacing issues in CPPopUpButton.
Reviewed by me.
This commit is contained in:
1 parent
3ac6b3c1fb
commit
c8101d481e
3 files changed
+35
-8
No files matched your search
+22
-5
@@ -527,19 +527,36 @@ var _CPButtonClassName = nil,
|
||||
[_imageAndTextView setFrameSize:size];
|
||||
}
|
||||
|
||||
- (CGRect)contentRectForBounds:(CGRect)aRect
|
||||
- (CGRect)contentRectForBounds:(CGRect)bounds
|
||||
{
|
||||
if (_isBordered)
|
||||
{
|
||||
if (_bezelStyle === CPHUDBezelStyle)
|
||||
aRect.size.height -= 4.0;
|
||||
{
|
||||
bounds.origin.x += 5.0;
|
||||
bounds.origin.y += 2.0;
|
||||
bounds.size.width -= 5.0 * 2;
|
||||
bounds.size.height -= 2.0 + 4.0;
|
||||
}
|
||||
|
||||
else if (_bezelStyle === CPRoundRectBezelStyle)
|
||||
aRect.size.height -= 2.0;
|
||||
{
|
||||
bounds.origin.x += 5.0;
|
||||
bounds.origin.y += 1.0;
|
||||
bounds.size.width -= 5.0 * 2;
|
||||
bounds.size.height -= 1.0 + 2.0;
|
||||
}
|
||||
|
||||
else if (_bezelStyle === CPTexturedRoundedBezelStyle)
|
||||
aRect.size.height -= 2.0;
|
||||
{
|
||||
bounds.origin.x += 5.0;
|
||||
bounds.origin.y += 2.0;
|
||||
bounds.size.width -= 5.0 * 2;
|
||||
bounds.size.height -= 2.0 + 3.0;
|
||||
}
|
||||
}
|
||||
|
||||
return aRect;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)aRect
|
||||
|
||||
@@ -691,6 +691,7 @@ var CPControlBlackColor = [CPColor blackColor];
|
||||
var CPControlValueKey = "CPControlValueKey",
|
||||
CPControlIsEnabledKey = "CPControlIsEnabledKey",
|
||||
CPControlAlignmentKey = "CPControlAlignmentKey",
|
||||
CPControlVerticalAlignmentKey = @"CPControlVerticalAlignmentKey",
|
||||
CPControlFontKey = "CPControlFontKey",
|
||||
CPControlTextColorKey = "CPControlTextColorKey",
|
||||
CPControlTargetKey = "CPControlTargetKey",
|
||||
@@ -720,6 +721,7 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey";
|
||||
[self setEnabled:[aCoder decodeBoolForKey:CPControlIsEnabledKey]];
|
||||
|
||||
[self setAlignment:[aCoder decodeIntForKey:CPControlAlignmentKey]];
|
||||
[self setVerticalAlignment:[aCoder decodeIntForKey:CPControlVerticalAlignmentKey]];
|
||||
[self setFont:[aCoder decodeObjectForKey:CPControlFontKey]];
|
||||
[self setTextColor:[aCoder decodeObjectForKey:CPControlTextColorKey]];
|
||||
|
||||
@@ -744,6 +746,8 @@ var __Deprecated__CPImageViewImageKey = @"CPImageViewImageKey";
|
||||
[aCoder encodeBool:_isEnabled forKey:CPControlIsEnabledKey];
|
||||
|
||||
[aCoder encodeInt:_alignment forKey:CPControlAlignmentKey];
|
||||
[aCoder encodeInt:_verticalAlignment forKey:CPControlVerticalAlignmentKey];
|
||||
|
||||
[aCoder encodeObject:_font forKey:CPControlFontKey];
|
||||
[aCoder encodeObject:_textColor forKey:CPControlTextColorKey];
|
||||
|
||||
|
||||
@@ -706,10 +706,16 @@ var CPPopUpButtonArrowsImage = nil;
|
||||
|
||||
- (CGRect)contentRectForBounds:(CGRect)bounds
|
||||
{
|
||||
if ([self isBordered])
|
||||
return CGRectMake(3.0, 2.0, CGRectGetWidth(bounds) - 16.0, CGRectGetHeight(bounds) - 5.0);
|
||||
var contentRect = [super contentRectForBounds:bounds];
|
||||
|
||||
return bounds;
|
||||
if ([self isBordered])
|
||||
{
|
||||
contentRect.size.width -= 16.0;
|
||||
|
||||
return contentRect;
|
||||
}
|
||||
|
||||
return contentRect;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in new issue
Block a user