OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "chrome/browser/cocoa/download_item_cell.h" | 5 #import "chrome/browser/cocoa/download_item_cell.h" |
6 | 6 |
7 #include "app/gfx/canvas_paint.h" | 7 #include "app/gfx/canvas_paint.h" |
8 #include "app/gfx/text_elider.h" | 8 #include "app/gfx/text_elider.h" |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/mac_util.h" | 10 #include "base/mac_util.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 bgGradient = [theme gradientForStyle:GTMThemeStyleToolBarButton | 390 bgGradient = [theme gradientForStyle:GTMThemeStyleToolBarButton |
391 state:active]; | 391 state:active]; |
392 } | 392 } |
393 | 393 |
394 NSRect buttonDrawRect, dropdownDrawRect; | 394 NSRect buttonDrawRect, dropdownDrawRect; |
395 NSDivideRect(drawFrame, &dropdownDrawRect, &buttonDrawRect, | 395 NSDivideRect(drawFrame, &dropdownDrawRect, &buttonDrawRect, |
396 kDropdownAreaWidth, NSMaxXEdge); | 396 kDropdownAreaWidth, NSMaxXEdge); |
397 | 397 |
398 NSBezierPath* buttonInnerPath = [self | 398 NSBezierPath* buttonInnerPath = [self |
399 leftRoundedPath:radius inRect:buttonDrawRect]; | 399 leftRoundedPath:radius inRect:buttonDrawRect]; |
400 NSBezierPath* buttonOuterPath = [self | |
401 leftRoundedPath:(radius + 1) | |
402 inRect:NSInsetRect(buttonDrawRect, -1, -1)]; | |
403 | |
404 NSBezierPath* dropdownInnerPath = [self | 400 NSBezierPath* dropdownInnerPath = [self |
405 rightRoundedPath:radius inRect:dropdownDrawRect]; | 401 rightRoundedPath:radius inRect:dropdownDrawRect]; |
406 NSBezierPath* dropdownOuterPath = [self | |
407 rightRoundedPath:(radius + 1) | |
408 inRect:NSInsetRect(dropdownDrawRect, -1, -1)]; | |
409 | 402 |
410 // Stroke the borders and appropriate fill gradient. | 403 // Stroke the borders and appropriate fill gradient. |
411 [self drawBorderAndFillForTheme:theme | 404 [self drawBorderAndFillForTheme:theme |
412 controlView:controlView | 405 controlView:controlView |
413 outerPath:buttonOuterPath | |
414 innerPath:buttonInnerPath | 406 innerPath:buttonInnerPath |
415 showClickedGradient:[self isButtonPartPressed] | 407 showClickedGradient:[self isButtonPartPressed] |
416 showHighlightGradient:[self isMouseOverButtonPart] | 408 showHighlightGradient:[self isMouseOverButtonPart] |
417 hoverAlpha:0.0 | 409 hoverAlpha:0.0 |
418 active:active | 410 active:active |
419 cellFrame:cellFrame | 411 cellFrame:cellFrame |
420 defaultGradient:bgGradient]; | 412 defaultGradient:bgGradient]; |
421 | 413 |
422 [self drawBorderAndFillForTheme:theme | 414 [self drawBorderAndFillForTheme:theme |
423 controlView:controlView | 415 controlView:controlView |
424 outerPath:dropdownOuterPath | |
425 innerPath:dropdownInnerPath | 416 innerPath:dropdownInnerPath |
426 showClickedGradient:[self isDropdownPartPressed] | 417 showClickedGradient:[self isDropdownPartPressed] |
427 showHighlightGradient:[self isMouseOverDropdownPart] | 418 showHighlightGradient:[self isMouseOverDropdownPart] |
428 hoverAlpha:0.0 | 419 hoverAlpha:0.0 |
429 active:active | 420 active:active |
430 cellFrame:cellFrame | 421 cellFrame:cellFrame |
431 defaultGradient:bgGradient]; | 422 defaultGradient:bgGradient]; |
432 | 423 |
433 [self drawInteriorWithFrame:innerFrame inView:controlView]; | 424 [self drawInteriorWithFrame:innerFrame inView:controlView]; |
434 } | 425 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 } | 606 } |
616 return self; | 607 return self; |
617 } | 608 } |
618 | 609 |
619 - (void)setCurrentProgress:(NSAnimationProgress)progress { | 610 - (void)setCurrentProgress:(NSAnimationProgress)progress { |
620 [super setCurrentProgress:progress]; | 611 [super setCurrentProgress:progress]; |
621 [cell_ animation:self progressed:progress]; | 612 [cell_ animation:self progressed:progress]; |
622 } | 613 } |
623 | 614 |
624 @end | 615 @end |
OLD | NEW |