| 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" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 | 12 |
| 13 namespace { | |
| 14 | |
| 15 // The width of the status bar item when it's just the icon. | 13 // The width of the status bar item when it's just the icon. |
| 16 const CGFloat kStatusItemLength = 26; | 14 const CGFloat kStatusItemLength = 26; |
| 17 | 15 |
| 18 // The amount of space between the left and right edges and the content of the | 16 // The amount of space between the left and right edges and the content of the |
| 19 // status item. | 17 // status item. |
| 20 const CGFloat kMargin = 5; | 18 const CGFloat kMargin = 5; |
| 21 | 19 |
| 22 // The amount of space between the icon and the unread count number. | |
| 23 const CGFloat kUnreadCountPadding = 3; | |
| 24 | |
| 25 // The lower-left Y coordinate of the unread count number. | |
| 26 const CGFloat kUnreadCountMinY = 4; | |
| 27 | |
| 28 } // namespace | |
| 29 | 20 |
| 30 @interface MCStatusItemView (Private) | 21 @interface MCStatusItemView (Private) |
| 31 // Whether or not the status item should be drawn highlighted. | 22 // Whether or not the status item should be drawn highlighted. |
| 32 - (BOOL)shouldHighlight; | 23 - (BOOL)shouldHighlight; |
| 33 | 24 |
| 34 - (int)getTrayResourceId; | 25 - (int)getTrayResourceId; |
| 35 | |
| 36 @end | 26 @end |
| 37 | 27 |
| 38 @implementation MCStatusItemView | 28 @implementation MCStatusItemView |
| 39 | 29 |
| 40 @synthesize highlight = highlight_; | 30 @synthesize highlight = highlight_; |
| 41 | 31 |
| 42 - (id)init { | 32 - (id)init { |
| 43 statusItem_.reset([[[NSStatusBar systemStatusBar] statusItemWithLength: | 33 statusItem_.reset([[[NSStatusBar systemStatusBar] statusItemWithLength: |
| 44 NSVariableStatusItemLength] retain]); | 34 NSVariableStatusItemLength] retain]); |
| 45 CGFloat thickness = [[statusItem_ statusBar] thickness]; | 35 CGFloat thickness = [[statusItem_ statusBar] thickness]; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 { IDR_TRAY_DO_NOT_DISTURB_EMPTY, | 157 { IDR_TRAY_DO_NOT_DISTURB_EMPTY, |
| 168 IDR_TRAY_DO_NOT_DISTURB_EMPTY_PRESSED }, | 158 IDR_TRAY_DO_NOT_DISTURB_EMPTY_PRESSED }, |
| 169 { IDR_TRAY_DO_NOT_DISTURB_ATTENTION, | 159 { IDR_TRAY_DO_NOT_DISTURB_ATTENTION, |
| 170 IDR_TRAY_DO_NOT_DISTURB_ATTENTION_PRESSED }, | 160 IDR_TRAY_DO_NOT_DISTURB_ATTENTION_PRESSED }, |
| 171 }, | 161 }, |
| 172 }; | 162 }; |
| 173 return kResourceIds[quietMode_][hasUnreadItems][highlight]; | 163 return kResourceIds[quietMode_][hasUnreadItems][highlight]; |
| 174 } | 164 } |
| 175 | 165 |
| 176 @end | 166 @end |
| OLD | NEW |