render_widget_host_view_mac_delegate.h revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
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.
4
5#ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
6#define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
7
8#import <Cocoa/Cocoa.h>
9
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:
12// - Implement the methods listed in the protocol below.
13// - Implement any method, and if the view is requested to perform that method
14//   and cannot, the delegate's implementation will be used.
15//
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.
18
19@protocol RenderWidgetHostViewMacDelegate
20@optional
21// Notification that the view is gone.
22- (void)viewGone:(NSView*)view;
23
24// Handle an event. All incoming key and mouse events flow through this delegate
25// method if implemented. Return YES if the event is fully handled, or NO if
26// normal processing should take place.
27- (BOOL)handleEvent:(NSEvent*)event;
28
29// Notification that a wheel event was unhandled.
30- (void)gotUnhandledWheelEvent;
31
32// Notification of scroll offset pinning.
33- (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right;
34
35// Notification of whether the view has a horizontal scrollbar.
36- (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar;
37
38// Provides validation of user interface items. If the return value is NO, then
39// the delegate is unaware of that item and |valid| is undefined.  Otherwise,
40// |valid| contains the validity of the specified item.
41- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item
42                      isValidItem:(BOOL*)valid;
43
44@end
45
46#endif  // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
47