Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / ui / message_center / cocoa / status_item_view.h
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
3 // found in the LICENSE file.
4
5 #ifndef UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_
6 #define UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_
7
8 #import <AppKit/AppKit.h>
9
10 #include "base/mac/scoped_block.h"
11 #include "base/mac/scoped_nsobject.h"
12 #include "ui/message_center/message_center_export.h"
13
14 namespace message_center {
15
16 // Callback block for when the status item is clicked.
17 typedef void(^StatusItemClickedCallback)();
18
19 }  // namespace message_center
20
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
23 // than zero, to the icon's right. It can also paint the highlight background
24 // pattern outside of a mouse event sequence, for when an attached window is
25 // open.
26 MESSAGE_CENTER_EXPORT
27 @interface MCStatusItemView : NSView {
28  @private
29   // The status item.
30   base::scoped_nsobject<NSStatusItem> statusItem_;
31
32   // Callback issued when the status item is clicked.
33   base::mac::ScopedBlock<message_center::StatusItemClickedCallback> callback_;
34
35   // The unread count number to be drawn next to the icon.
36   size_t unreadCount_;
37
38   // Whether or not we are to display the quiet mode version of the status icon.
39   BOOL quietMode_;
40
41   // Whether or not to force the highlight pattern to be drawn.
42   BOOL highlight_;
43
44   // Whether or not the view is currently handling mouse events and should
45   // draw the highlight pattern.
46   BOOL inMouseEventSequence_;
47 }
48
49 @property(copy, nonatomic) message_center::StatusItemClickedCallback callback;
50 @property(nonatomic) BOOL highlight;
51
52 // Designated initializer. Creates a new NSStatusItem in the system menubar.
53 - (id)init;
54
55 // Sets the unread count and quiet mode status of the icon.
56 - (void)setUnreadCount:(size_t)unreadCount withQuietMode:(BOOL)quietMode;
57
58 // Removes the status item from the menubar. Must be called to break the
59 // retain cycle between self and the NSStatusItem view.
60 - (void)removeItem;
61
62 @end
63
64 @interface MCStatusItemView (TestingAPI)
65
66 - (size_t)unreadCount;
67
68 @end
69
70 #endif  // UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_