render_widget_host_view_mac_delegate.h revision a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 The Chromium Authors. All rights reserved.
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file.
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#import <Cocoa/Cocoa.h>
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// This protocol is used as a delegate for the NSView class used in the
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// hierarchy. There are two ways to extend the view:
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// - Implement the methods listed in the protocol below.
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// - Implement any method, and if the view is requested to perform that method
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//   and cannot, the delegate's implementation will be used.
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)//
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Like any Objective-C delegate, it is not retained by the delegator object.
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The delegator object will call the -viewGone: method when it is going away.
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
19a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)@class NSEvent;
205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@protocol RenderWidgetHostViewMacDelegate
215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@optional
225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Notification that the view is gone.
235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)viewGone:(NSView*)view;
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Handle an event. All incoming key and mouse events flow through this delegate
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// method if implemented. Return YES if the event is fully handled, or NO if
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// normal processing should take place.
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (BOOL)handleEvent:(NSEvent*)event;
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Notification that a wheel event was unhandled.
315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)gotUnhandledWheelEvent;
325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Notification of scroll offset pinning.
345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right;
355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Notification of whether the view has a horizontal scrollbar.
375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar;
385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Provides validation of user interface items. If the return value is NO, then
405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// the delegate is unaware of that item and |valid| is undefined.  Otherwise,
415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// |valid| contains the validity of the specified item.
425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item
435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)                      isValidItem:(BOOL*)valid;
445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
45a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)@required
46a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// Notification of when a gesture begins/ends.
47a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)- (void)beginGestureWithEvent:(NSEvent*)event;
48a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)- (void)endGestureWithEvent:(NSEvent*)event;
49a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
50a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// This is a low level API which provides touches associated with an event.
51a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// It is used in conjunction with gestures to determine finger placement
52a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)// on the trackpad.
53a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)- (void)touchesMovedWithEvent:(NSEvent*)event;
54a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)- (void)touchesBeganWithEvent:(NSEvent*)event;
55a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)- (void)touchesCancelledWithEvent:(NSEvent*)event;
56a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)- (void)touchesEndedWithEvent:(NSEvent*)event;
57a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)
585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)@end
595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#endif  // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
61