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 CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
6 #define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_
8 #import <Cocoa/Cocoa.h>
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.
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.
19 @protocol RenderWidgetHostViewMacDelegate
21 // Notification that the view is gone.
22 - (void)viewGone
:(NSView
*)view
;
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
;
29 // Notification that a wheel event was unhandled.
30 - (void)gotUnhandledWheelEvent
;
32 // Notification of scroll offset pinning.
33 - (void)scrollOffsetPinnedToLeft
:(BOOL
)left toRight
:(BOOL
)right
;
35 // Notification of whether the view has a horizontal scrollbar.
36 - (void)setHasHorizontalScrollbar
:(BOOL
)has_horizontal_scrollbar
;
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
;
44 // Notification that the compositing IO surface has been created.
45 - (void)compositingIOSurfaceCreated
;
49 #endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_