OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ |
6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ |
7 | 7 |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 // This protocol is used as a delegate for the NSView class used in the | 10 // This protocol is used as a delegate for the NSView class used in the |
11 // hierarchy. There are two ways to extend the view: | 11 // hierarchy. There are two ways to extend the view: |
12 // - Implement the methods listed in the protocol below. | 12 // - Implement the methods listed in the protocol below. |
13 // - Implement any method, and if the view is requested to perform that method | 13 // - Implement any method, and if the view is requested to perform that method |
14 // and cannot, the delegate's implementation will be used. | 14 // and cannot, the delegate's implementation will be used. |
15 // | 15 // |
16 // Like any Objective-C delegate, it is not retained by the delegator object. | 16 // Like any Objective-C delegate, it is not retained by the delegator object. |
17 // The delegator object will call the -viewGone: method when it is going away. | 17 // The delegator object will call the -viewGone: method when it is going away. |
18 | 18 |
19 @class NSEvent; | 19 @class NSEvent; |
20 @protocol RenderWidgetHostViewMacDelegate | 20 @protocol RenderWidgetHostViewMacDelegate |
21 @optional | 21 @optional |
22 // Notification that the view is gone. | 22 // Notification that the view is gone. |
23 - (void)viewGone:(NSView*)view; | 23 - (void)viewGone:(NSView*)view; |
24 | 24 |
25 // Handle an event. All incoming key and mouse events flow through this delegate | 25 // Handle an event. All incoming key and mouse events flow through this delegate |
26 // method if implemented. Return YES if the event is fully handled, or NO if | 26 // method if implemented. Return YES if the event is fully handled, or NO if |
27 // normal processing should take place. | 27 // normal processing should take place. |
28 - (BOOL)handleEvent:(NSEvent*)event; | 28 - (BOOL)handleEvent:(NSEvent*)event; |
29 | 29 |
| 30 // Notification that a wheel event was unhandled. |
| 31 - (void)gotUnhandledWheelEvent; |
| 32 |
| 33 // Notification of scroll offset pinning. |
| 34 - (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right; |
| 35 |
| 36 // Notification of whether the view has a horizontal scrollbar. |
| 37 - (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar; |
| 38 |
30 // Provides validation of user interface items. If the return value is NO, then | 39 // Provides validation of user interface items. If the return value is NO, then |
31 // the delegate is unaware of that item and |valid| is undefined. Otherwise, | 40 // the delegate is unaware of that item and |valid| is undefined. Otherwise, |
32 // |valid| contains the validity of the specified item. | 41 // |valid| contains the validity of the specified item. |
33 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item | 42 - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item |
34 isValidItem:(BOOL*)valid; | 43 isValidItem:(BOOL*)valid; |
35 | 44 |
36 @required | 45 @required |
37 // Notification of when a gesture begins/ends. | 46 // Notification of when a gesture begins/ends. |
38 - (void)beginGestureWithEvent:(NSEvent*)event; | 47 - (void)beginGestureWithEvent:(NSEvent*)event; |
39 - (void)endGestureWithEvent:(NSEvent*)event; | 48 - (void)endGestureWithEvent:(NSEvent*)event; |
40 | 49 |
41 // This is a low level API which provides touches associated with an event. | 50 // This is a low level API which provides touches associated with an event. |
42 // It is used in conjunction with gestures to determine finger placement | 51 // It is used in conjunction with gestures to determine finger placement |
43 // on the trackpad. | 52 // on the trackpad. |
44 - (void)touchesMovedWithEvent:(NSEvent*)event; | 53 - (void)touchesMovedWithEvent:(NSEvent*)event; |
45 - (void)touchesBeganWithEvent:(NSEvent*)event; | 54 - (void)touchesBeganWithEvent:(NSEvent*)event; |
46 - (void)touchesCancelledWithEvent:(NSEvent*)event; | 55 - (void)touchesCancelledWithEvent:(NSEvent*)event; |
47 - (void)touchesEndedWithEvent:(NSEvent*)event; | 56 - (void)touchesEndedWithEvent:(NSEvent*)event; |
48 | 57 |
49 // These methods control whether a given view is allowed to rubberband in the | 58 // These methods control whether a given view is allowed to rubberband in the |
50 // given direction. This is inversely related to whether the view is allowed to | 59 // given direction. This is inversely related to whether the view is allowed to |
51 // 2-finger history swipe in the given direction. | 60 // 2-finger history swipe in the given direction. |
52 - (BOOL)canRubberbandLeft:(NSView*)view; | 61 - (BOOL)canRubberbandLeft:(NSView*)view; |
53 - (BOOL)canRubberbandRight:(NSView*)view; | 62 - (BOOL)canRubberbandRight:(NSView*)view; |
54 | |
55 // Notification that a wheel event was received. | |
56 // |consumed| indicates whether the renderer or the render_widget_host_view | |
57 // delegate consumed the event. | |
58 - (void)gotWheelEventConsumed:(BOOL)consumed; | |
59 @end | 63 @end |
60 | 64 |
61 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ | 65 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ |
OLD | NEW |