OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/cocoa/bookmarks/bookmark_button.h" | 5 #import "chrome/browser/ui/cocoa/bookmarks/bookmark_button.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 // to open menu"). | 353 // to open menu"). |
354 - (void)mouseEntered:(NSEvent*)event { | 354 - (void)mouseEntered:(NSEvent*)event { |
355 [delegate_ mouseEnteredButton:self event:event]; | 355 [delegate_ mouseEnteredButton:self event:event]; |
356 } | 356 } |
357 | 357 |
358 // See comments above mouseEntered:. | 358 // See comments above mouseEntered:. |
359 - (void)mouseExited:(NSEvent*)event { | 359 - (void)mouseExited:(NSEvent*)event { |
360 [delegate_ mouseExitedButton:self event:event]; | 360 [delegate_ mouseExitedButton:self event:event]; |
361 } | 361 } |
362 | 362 |
363 - (void)mouseDown:(NSEvent*)theEvent { | |
364 // Clicking on a bookmark button in Material Design should highlight it. | |
365 const int kCellTag = [[self cell] tag]; | |
366 if (kCellTag == kMaterialStandardButtonTypeWithLimitedClickFeedback && | |
367 [self isEnabled]) { | |
368 [self highlight:YES]; | |
369 } | |
370 [super mouseDown:theEvent]; | |
371 } | |
372 | |
373 - (void)mouseMoved:(NSEvent*)theEvent { | 363 - (void)mouseMoved:(NSEvent*)theEvent { |
374 if ([delegate_ respondsToSelector:@selector(mouseMoved:)]) | 364 if ([delegate_ respondsToSelector:@selector(mouseMoved:)]) |
375 [id(delegate_) mouseMoved:theEvent]; | 365 [id(delegate_) mouseMoved:theEvent]; |
376 } | 366 } |
377 | 367 |
378 - (void)mouseDragged:(NSEvent*)theEvent { | 368 - (void)mouseDragged:(NSEvent*)theEvent { |
379 if ([delegate_ respondsToSelector:@selector(mouseDragged:)]) | 369 if ([delegate_ respondsToSelector:@selector(mouseDragged:)]) |
380 [id(delegate_) mouseDragged:theEvent]; | 370 [id(delegate_) mouseDragged:theEvent]; |
381 } | 371 } |
382 | 372 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 [[cell clipPathForFrame:bounds inView:self] setClip]; | 518 [[cell clipPathForFrame:bounds inView:self] setClip]; |
529 [cell drawWithFrame:bounds inView:self]; | 519 [cell drawWithFrame:bounds inView:self]; |
530 | 520 |
531 CGContextEndTransparencyLayer(cgContext); | 521 CGContextEndTransparencyLayer(cgContext); |
532 [image unlockFocus]; | 522 [image unlockFocus]; |
533 | 523 |
534 return image.autorelease(); | 524 return image.autorelease(); |
535 } | 525 } |
536 | 526 |
537 @end | 527 @end |
OLD | NEW |