Fix search results being clipped in app list.
[chromium-blink-merge.git] / ui / message_center / cocoa / status_item_view.h
blob5d2bd63f1c49ff40c223601f5c3ab7659890bb2d
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.
5 #ifndef UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_
6 #define UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_
8 #import <AppKit/AppKit.h>
10 #include "base/mac/scoped_block.h"
11 #include "base/mac/scoped_nsobject.h"
12 #include "ui/message_center/message_center_export.h"
14 namespace message_center {
16 // Callback block for when the status item is clicked.
17 typedef void(^StatusItemClickedCallback)();
19 } // namespace message_center
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_;
32 // Callback issued when the status item is clicked.
33 base::mac::ScopedBlock<message_center::StatusItemClickedCallback> callback_;
35 // The unread count number to be drawn next to the icon.
36 size_t unreadCount_;
38 // Whether or not we are to display the quiet mode version of the status icon.
39 BOOL quietMode_;
41 // Whether or not to force the highlight pattern to be drawn.
42 BOOL highlight_;
44 // Whether or not the view is currently handling mouse events and should
45 // draw the highlight pattern.
46 BOOL inMouseEventSequence_;
49 @property(copy, nonatomic) message_center::StatusItemClickedCallback callback;
50 @property(nonatomic) BOOL highlight;
52 // Designated initializer. Creates a new NSStatusItem in the system menubar.
53 - (id)init;
55 // Sets the unread count and quiet mode status of the icon.
56 - (void)setUnreadCount:(size_t)unreadCount withQuietMode:(BOOL)quietMode;
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;
62 @end
64 @interface MCStatusItemView (TestingAPI)
66 - (size_t)unreadCount;
68 @end
70 #endif // UI_MESSAGE_CENTER_COCOA_STATUS_ITEM_VIEW_H_