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 #ifndef UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_ | 5 #ifndef UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_ |
6 #define UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_ | 6 #define UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_ |
7 | 7 |
8 #import <AppKit/AppKit.h> | 8 #import <AppKit/AppKit.h> |
9 | 9 |
10 #include "base/mac/scoped_block.h" | 10 #include "base/mac/scoped_block.h" |
11 #include "base/memory/scoped_nsobject.h" | 11 #include "base/mac/scoped_nsobject.h" |
12 #include "ui/message_center/message_center_export.h" | 12 #include "ui/message_center/message_center_export.h" |
13 | 13 |
14 namespace message_center { | 14 namespace message_center { |
15 | 15 |
16 // Callback block for when the status item is clicked. | 16 // Callback block for when the status item is clicked. |
17 typedef void(^StatusItemClickedCallack)(); | 17 typedef void(^StatusItemClickedCallack)(); |
18 | 18 |
19 } // namespace message_center | 19 } // namespace message_center |
20 | 20 |
21 // This view is meant to be used with a NSStatusItem. It will fire a callback | 21 // This view is meant to be used with a NSStatusItem. It will fire a callback |
22 // when it is clicked. It draws a small icon and the unread count, if greater | 22 // when it is clicked. It draws a small icon and the unread count, if greater |
23 // than zero, to the icon's right. It can also paint the highlight background | 23 // than zero, to the icon's right. It can also paint the highlight background |
24 // pattern outisde of a mouse event sequence, for when an attached window is | 24 // pattern outisde of a mouse event sequence, for when an attached window is |
25 // open. | 25 // open. |
26 MESSAGE_CENTER_EXPORT | 26 MESSAGE_CENTER_EXPORT |
27 @interface MCStatusItemView : NSView { | 27 @interface MCStatusItemView : NSView { |
28 @private | 28 @private |
29 // The status item. | 29 // The status item. |
30 scoped_nsobject<NSStatusItem> statusItem_; | 30 base::scoped_nsobject<NSStatusItem> statusItem_; |
31 | 31 |
32 // Callback issued when the status item is clicked. | 32 // Callback issued when the status item is clicked. |
33 base::mac::ScopedBlock<message_center::StatusItemClickedCallack> callback_; | 33 base::mac::ScopedBlock<message_center::StatusItemClickedCallack> callback_; |
34 | 34 |
35 // The unread count number to be drawn next to the icon. | 35 // The unread count number to be drawn next to the icon. |
36 size_t unreadCount_; | 36 size_t unreadCount_; |
37 | 37 |
38 // Whether or not to force the highlight pattern to be drawn. | 38 // Whether or not to force the highlight pattern to be drawn. |
39 BOOL highlight_; | 39 BOOL highlight_; |
40 | 40 |
41 // Whether or not the view is currently handling mouse events and should | 41 // Whether or not the view is currently handling mouse events and should |
42 // draw the highlight pattern. | 42 // draw the highlight pattern. |
43 BOOL inMouseEventSequence_; | 43 BOOL inMouseEventSequence_; |
44 } | 44 } |
45 | 45 |
46 @property(copy, nonatomic) message_center::StatusItemClickedCallack callback; | 46 @property(copy, nonatomic) message_center::StatusItemClickedCallack callback; |
47 @property(nonatomic) size_t unreadCount; | 47 @property(nonatomic) size_t unreadCount; |
48 @property(nonatomic) BOOL highlight; | 48 @property(nonatomic) BOOL highlight; |
49 | 49 |
50 // Designated initializer. Creates a new NSStatusItem in the system menubar. | 50 // Designated initializer. Creates a new NSStatusItem in the system menubar. |
51 - (id)init; | 51 - (id)init; |
52 | 52 |
53 // Removes the status item from the menubar. Must be called to break the | 53 // Removes the status item from the menubar. Must be called to break the |
54 // retain cycle between self and the NSStatusItem view. | 54 // retain cycle between self and the NSStatusItem view. |
55 - (void)removeItem; | 55 - (void)removeItem; |
56 | 56 |
57 @end | 57 @end |
58 | 58 |
59 #endif // UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_ | 59 #endif // UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_ |
OLD | NEW |