| 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/text_elider.h" | 7 #include "app/gfx/text_elider.h" |
| 8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
| 9 #include "base/mac_util.h" | 9 #include "base/mac_util.h" |
| 10 #include "base/sys_string_conversions.h" | 10 #include "base/sys_string_conversions.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 | 175 |
| 176 - (void)setShowsBorderOnlyWhileMouseInside:(BOOL)showOnly { | 176 - (void)setShowsBorderOnlyWhileMouseInside:(BOOL)showOnly { |
| 177 // Override to make sure it doesn't do anything if it's called accidentally. | 177 // Override to make sure it doesn't do anything if it's called accidentally. |
| 178 } | 178 } |
| 179 | 179 |
| 180 - (void)mouseEntered:(NSEvent*)theEvent { | 180 - (void)mouseEntered:(NSEvent*)theEvent { |
| 181 mouseInsideCount_++; | 181 mouseInsideCount_++; |
| 182 if ([theEvent trackingArea] == trackingAreaButton_.get()) | 182 if ([theEvent trackingArea] == trackingAreaButton_.get()) |
| 183 mousePosition_ = kDownloadItemMouseOverButtonPart; | 183 mousePosition_ = kDownloadItemMouseOverButtonPart; |
| 184 else if ([theEvent trackingArea] == trackingAreaDropdown_.get()) | 184 else if ([theEvent trackingArea] == trackingAreaDropdown_.get()) |
| 185 mousePosition_ = kDownloadItemMouseOverButtonPart; | 185 mousePosition_ = kDownloadItemMouseOverDropdownPart; |
| 186 [[self controlView] setNeedsDisplay:YES]; | 186 [[self controlView] setNeedsDisplay:YES]; |
| 187 } | 187 } |
| 188 | 188 |
| 189 - (void)mouseExited:(NSEvent *)theEvent { | 189 - (void)mouseExited:(NSEvent *)theEvent { |
| 190 mouseInsideCount_--; | 190 mouseInsideCount_--; |
| 191 if (mouseInsideCount_ == 0) | 191 if (mouseInsideCount_ == 0) |
| 192 mousePosition_ = kDownloadItemMouseOutside; | 192 mousePosition_ = kDownloadItemMouseOutside; |
| 193 [[self controlView] setNeedsDisplay:YES]; | 193 [[self controlView] setNeedsDisplay:YES]; |
| 194 } | 194 } |
| 195 | 195 |
| 196 - (BOOL)isMouseInside { | 196 - (BOOL)isMouseInside { |
| 197 return mousePosition_ != kDownloadItemMouseOutside; | 197 return mousePosition_ != kDownloadItemMouseOutside; |
| 198 } | 198 } |
| 199 | 199 |
| 200 - (BOOL)isMouseOverButtonPart { | 200 - (BOOL)isMouseOverButtonPart { |
| 201 return mousePosition_ == kDownloadItemMouseOverButtonPart; | 201 return mousePosition_ == kDownloadItemMouseOverButtonPart; |
| 202 } | 202 } |
| 203 | 203 |
| 204 - (BOOL)isButtonPartPressed { | 204 - (BOOL)isButtonPartPressed { |
| 205 return [self isHighlighted] | 205 return [self isHighlighted] |
| 206 && mousePosition_ == kDownloadItemMouseOverButtonPart; | 206 && mousePosition_ == kDownloadItemMouseOverButtonPart; |
| 207 } | 207 } |
| 208 | 208 |
| 209 - (BOOL)isMouseOverDropdownPart { | 209 - (BOOL)isMouseOverDropdownPart { |
| 210 return mousePosition_ == kDownloadItemMouseOverButtonPart; | 210 return mousePosition_ == kDownloadItemMouseOverDropdownPart; |
| 211 } | 211 } |
| 212 | 212 |
| 213 - (BOOL)isDropdownPartPressed { | 213 - (BOOL)isDropdownPartPressed { |
| 214 return [self isHighlighted] | 214 return [self isHighlighted] |
| 215 && mousePosition_ == kDownloadItemMouseOverButtonPart; | 215 && mousePosition_ == kDownloadItemMouseOverDropdownPart; |
| 216 } | 216 } |
| 217 | 217 |
| 218 - (NSBezierPath*)leftRoundedPath:(CGFloat)radius inRect:(NSRect)rect { | 218 - (NSBezierPath*)leftRoundedPath:(CGFloat)radius inRect:(NSRect)rect { |
| 219 | 219 |
| 220 NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect)); | 220 NSPoint topLeft = NSMakePoint(NSMinX(rect), NSMaxY(rect)); |
| 221 NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect)); | 221 NSPoint topRight = NSMakePoint(NSMaxX(rect), NSMaxY(rect)); |
| 222 NSPoint bottomRight = NSMakePoint(NSMaxX(rect) , NSMinY(rect)); | 222 NSPoint bottomRight = NSMakePoint(NSMaxX(rect) , NSMinY(rect)); |
| 223 | 223 |
| 224 NSBezierPath* path = [NSBezierPath bezierPath]; | 224 NSBezierPath* path = [NSBezierPath bezierPath]; |
| 225 [path moveToPoint:topRight]; | 225 [path moveToPoint:topRight]; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 } | 428 } |
| 429 return self; | 429 return self; |
| 430 } | 430 } |
| 431 | 431 |
| 432 - (void)setCurrentProgress:(NSAnimationProgress)progress { | 432 - (void)setCurrentProgress:(NSAnimationProgress)progress { |
| 433 [super setCurrentProgress:progress]; | 433 [super setCurrentProgress:progress]; |
| 434 [cell_ animationProgressed:progress]; | 434 [cell_ animationProgressed:progress]; |
| 435 } | 435 } |
| 436 | 436 |
| 437 @end | 437 @end |
| OLD | NEW |