Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/cocoa/status_item_view.h" | 5 #import "ui/message_center/cocoa/status_item_view.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "grit/ui_resources.h" | 10 #include "grit/ui_resources.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 if (callback_) | 62 if (callback_) |
| 63 callback_.get()(); | 63 callback_.get()(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 - (void)mouseUp:(NSEvent*)event { | 66 - (void)mouseUp:(NSEvent*)event { |
| 67 DCHECK(inMouseEventSequence_); | 67 DCHECK(inMouseEventSequence_); |
| 68 inMouseEventSequence_ = NO; | 68 inMouseEventSequence_ = NO; |
| 69 [self setNeedsDisplay:YES]; | 69 [self setNeedsDisplay:YES]; |
| 70 } | 70 } |
| 71 | 71 |
| 72 - (void)rightMouseDown:(NSEvent*)event { | |
| 73 [self mouseDown:event]; | |
| 74 } | |
| 75 | |
| 76 - (void)rightMouseUp:(NSEvent*)event { | |
| 77 [self mouseUp:event]; | |
| 78 } | |
|
Nico
2013/05/28 16:05:08
otherMouseDown/Up: too?
Robert Sesek
2013/05/28 16:16:23
Done.
| |
| 79 | |
| 72 - (void)drawRect:(NSRect)dirtyRect { | 80 - (void)drawRect:(NSRect)dirtyRect { |
| 73 NSRect frame = [self bounds]; | 81 NSRect frame = [self bounds]; |
| 74 | 82 |
| 75 // Draw the background color. | 83 // Draw the background color. |
| 76 BOOL highlight = highlight_ || inMouseEventSequence_; | 84 BOOL highlight = highlight_ || inMouseEventSequence_; |
| 77 [statusItem_ drawStatusBarBackgroundInRect:frame | 85 [statusItem_ drawStatusBarBackgroundInRect:frame |
| 78 withHighlight:highlight]; | 86 withHighlight:highlight]; |
| 79 | 87 |
| 80 // Draw the icon. | 88 // Draw the icon. |
| 81 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 89 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 NSPoint countPoint = NSMakePoint( | 121 NSPoint countPoint = NSMakePoint( |
| 114 floorf(NSMinX(textSlice) + (NSWidth(textSlice) - stringSize.width) / 2), | 122 floorf(NSMinX(textSlice) + (NSWidth(textSlice) - stringSize.width) / 2), |
| 115 floorf(NSMinY(textSlice) + | 123 floorf(NSMinY(textSlice) + |
| 116 (NSHeight(textSlice) - stringSize.height) / 2)); | 124 (NSHeight(textSlice) - stringSize.height) / 2)); |
| 117 | 125 |
| 118 [count drawAtPoint:countPoint withAttributes:attributes]; | 126 [count drawAtPoint:countPoint withAttributes:attributes]; |
| 119 } | 127 } |
| 120 } | 128 } |
| 121 | 129 |
| 122 @end | 130 @end |
| OLD | NEW |