diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-17 18:04:08 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-17 18:04:08 +0000 |
commit | 9cd458d48d4ed44370505d533e8393f01089d0f2 (patch) | |
tree | 0765e132799afe97f7a2587a3d898119f55b63b8 /chrome/browser/cocoa/download_item_cell.mm | |
parent | aad2c10972fc50c91aae71fac60ccf01e296d91e (diff) | |
download | chromium_src-9cd458d48d4ed44370505d533e8393f01089d0f2.zip chromium_src-9cd458d48d4ed44370505d533e8393f01089d0f2.tar.gz chromium_src-9cd458d48d4ed44370505d533e8393f01089d0f2.tar.bz2 |
Clean up download item look, part 1 of many.
BUG=18902
TEST=items look like buttons all the time, not only on hover. icon is 16x16 :-/. spacing slightly modified (not final yet).
Review URL: http://codereview.chromium.org/172030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23550 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/download_item_cell.mm')
-rw-r--r-- | chrome/browser/cocoa/download_item_cell.mm | 65 |
1 files changed, 29 insertions, 36 deletions
diff --git a/chrome/browser/cocoa/download_item_cell.mm b/chrome/browser/cocoa/download_item_cell.mm index b1d5a29..795cc99 100644 --- a/chrome/browser/cocoa/download_item_cell.mm +++ b/chrome/browser/cocoa/download_item_cell.mm @@ -16,19 +16,19 @@ namespace { // Distance from top border to icon -const CGFloat kImagePaddingTop = 1; +const CGFloat kImagePaddingTop = 8; // Distance from left border to icon -const CGFloat kImagePaddingLeft = 1; +const CGFloat kImagePaddingLeft = 5; // Width of icon -const CGFloat kImageWidth = 32; +const CGFloat kImageWidth = 16; // Height of icon -const CGFloat kImageHeight = 32; +const CGFloat kImageHeight = 16; // x coordinate of download name string, in view coords -const CGFloat kTextPosLeft = kImagePaddingLeft + kImageWidth + 1; +const CGFloat kTextPosLeft = kImagePaddingLeft + kImageWidth + 4 + 1; // Distance from end of download name string to dropdown area const CGFloat kTextPaddingRight = 3; @@ -44,8 +44,9 @@ const CGFloat kPrimaryTextOnlyPosTop = 10; // y coordinate of status message, in view coords const CGFloat kSecondaryTextPosTop = 17; -// Width of dropdown area on the right -const CGFloat kDropdownAreaWidth = 18; +// Width of dropdown area on the right (includes 1px for the border on each +// side). +const CGFloat kDropdownAreaWidth = 14; // Width of dropdown arrow const CGFloat kDropdownArrowWidth = 5; @@ -260,13 +261,12 @@ NSTimeInterval kHideStatusDuration = 0.3; } - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView*)controlView { - - // Constants from Cole. Will kConstan them once the feedback loop + // Constants from Cole. Will kConstant them once the feedback loop // is complete. NSRect drawFrame = NSInsetRect(cellFrame, 0.5, 0.5); NSRect innerFrame = NSInsetRect(cellFrame, 1, 1); - const float radius = 3.5; + const float radius = 5; NSWindow* window = [controlView window]; BOOL active = [window isKeyWindow] || [window isMainWindow]; @@ -276,10 +276,6 @@ NSTimeInterval kHideStatusDuration = 0.3; NSDivideRect(drawFrame, &dropdownDrawRect, &buttonDrawRect, kDropdownAreaWidth, NSMaxXEdge); - NSRect buttonInnerRect, dropdownInnerRect; - NSDivideRect(innerFrame, &dropdownInnerRect, &buttonInnerRect, - kDropdownAreaWidth, NSMaxXEdge); - NSBezierPath* buttonInnerPath = [self leftRoundedPath:radius inRect:buttonDrawRect]; NSBezierPath* buttonOuterPath = [self @@ -292,27 +288,24 @@ NSTimeInterval kHideStatusDuration = 0.3; rightRoundedPath:(radius + 1) inRect:NSInsetRect(dropdownDrawRect, -1, -1)]; - // Stroke the borders and appropriate fill gradient. If we're borderless, - // the only time we want to draw the inner gradient is if we're highlighted. - if ([self isHighlighted] || [self isMouseInside]) { - [self drawBorderAndFillForTheme:theme - controlView:controlView - outerPath:buttonOuterPath - innerPath:buttonInnerPath - showHighlightGradient:[self isMouseOverButtonPart] - showClickedGradient:[self isButtonPartPressed] - active:active - cellFrame:cellFrame]; - - [self drawBorderAndFillForTheme: theme - controlView:controlView - outerPath:dropdownOuterPath - innerPath:dropdownInnerPath - showHighlightGradient:[self isMouseOverDropdownPart] - showClickedGradient:[self isDropdownPartPressed] - active:active - cellFrame:cellFrame]; - } + // Stroke the borders and appropriate fill gradient. + [self drawBorderAndFillForTheme:theme + controlView:controlView + outerPath:buttonOuterPath + innerPath:buttonInnerPath + showHighlightGradient:[self isMouseOverButtonPart] + showClickedGradient:[self isButtonPartPressed] + active:active + cellFrame:cellFrame]; + + [self drawBorderAndFillForTheme: theme + controlView:controlView + outerPath:dropdownOuterPath + innerPath:dropdownInnerPath + showHighlightGradient:[self isMouseOverDropdownPart] + showClickedGradient:[self isDropdownPartPressed] + active:active + cellFrame:cellFrame]; [self drawInteriorWithFrame:innerFrame inView:controlView]; } @@ -364,7 +357,7 @@ NSTimeInterval kHideStatusDuration = 0.3; // Popup arrow. Put center of mass of the arrow in the center of the // dropdown area. - CGFloat cx = NSMaxX(cellFrame) - kDropdownAreaWidth/2; + CGFloat cx = NSMaxX(cellFrame) - kDropdownAreaWidth/2 + 0.5; CGFloat cy = NSMidY(cellFrame); NSPoint p1 = NSMakePoint(cx - kDropdownArrowWidth/2, cy - kDropdownArrowHeight/3); |