Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / base / cocoa / base_view.h
blob642ada2011d0812a58ed8c8ace2895b803b850cf
1 // Copyright (c) 2012 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_BASE_COCOA_BASE_VIEW_H_
6 #define UI_BASE_COCOA_BASE_VIEW_H_
8 #import <Cocoa/Cocoa.h>
10 #include "base/mac/scoped_nsobject.h"
11 #import "ui/base/cocoa/tracking_area.h"
12 #include "ui/base/ui_base_export.h"
13 #include "ui/gfx/geometry/rect.h"
15 // A view that provides common functionality that many views will need:
16 // - Automatic registration for mouse-moved events.
17 // - Funneling of mouse and key events to two methods
18 // - Coordinate conversion utilities
19 UI_BASE_EXPORT
20 @interface BaseView : NSView {
21 @public
22 enum EventHandled {
23 kEventNotHandled,
24 kEventHandled
27 @private
28 ui::ScopedCrTrackingArea trackingArea_;
29 BOOL dragging_;
30 base::scoped_nsobject<NSEvent> pendingExitEvent_;
33 // Override these methods (mouseEvent, keyEvent) in a subclass.
34 - (void)mouseEvent:(NSEvent *)theEvent;
36 // keyEvent should return kEventHandled if it handled the event, or
37 // kEventNotHandled if it should be forwarded to BaseView's super class.
38 - (EventHandled)keyEvent:(NSEvent *)theEvent;
40 // Useful rect conversions (doing coordinate flipping)
41 - (gfx::Rect)flipNSRectToRect:(NSRect)rect;
42 - (NSRect)flipRectToNSRect:(gfx::Rect)rect;
44 @end
46 // A notification that a view may issue when it receives first responder status.
47 // The name is |kViewDidBecomeFirstResponder|, the object is the view, and the
48 // NSSelectionDirection is wrapped in an NSNumber under the key
49 // |kSelectionDirection|.
50 UI_BASE_EXPORT extern NSString* kViewDidBecomeFirstResponder;
51 UI_BASE_EXPORT extern NSString* kSelectionDirection;
53 #endif // UI_BASE_COCOA_BASE_VIEW_H_