render_widget_host_view_mac_delegate.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// Copyright (c) 2012 The Chromium Authors. All rights reserved. 28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// Use of this source code is governed by a BSD-style license that can be 38d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// found in the LICENSE file. 48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt#ifndef CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ 6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt#define CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ 78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#import <Cocoa/Cocoa.h> 98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// This protocol is used as a delegate for the NSView class used in the 118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// hierarchy. There are two ways to extend the view: 128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// - Implement the methods listed in the protocol below. 138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// - Implement any method, and if the view is requested to perform that method 148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// and cannot, the delegate's implementation will be used. 158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// 168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// Like any Objective-C delegate, it is not retained by the delegator object. 177832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt// The delegator object will call the -viewGone: method when it is going away. 188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 19fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt@protocol RenderWidgetHostViewMacDelegate 20fb79edc9df1f20461e90e478363d207348213d35Dmitry Shmidt@optional 218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// Notification that the view is gone. 228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt- (void)viewGone:(NSView*)view; 237832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt 247832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt// Handle an event. All incoming key and mouse events flow through this delegate 258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// method if implemented. Return YES if the event is fully handled, or NO if 268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// normal processing should take place. 278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt- (BOOL)handleEvent:(NSEvent*)event; 288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// Notification that a wheel event was unhandled. 308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt- (void)gotUnhandledWheelEvent; 318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// Notification of scroll offset pinning. 338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt- (void)scrollOffsetPinnedToLeft:(BOOL)left toRight:(BOOL)right; 348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// Notification of whether the view has a horizontal scrollbar. 368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt- (void)setHasHorizontalScrollbar:(BOOL)has_horizontal_scrollbar; 378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// Provides validation of user interface items. If the return value is NO, then 398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// the delegate is unaware of that item and |valid| is undefined. Otherwise, 408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt// |valid| contains the validity of the specified item. 418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item 428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt isValidItem:(BOOL*)valid; 438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt 448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt@end 457832adbbd72a1b784b7fb74a71a5d4085b0cb0d3Dmitry Shmidt 468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif // CONTENT_PUBLIC_BROWSER_RENDER_WIDGET_HOST_VIEW_MAC_DELEGATE_H_ 47051af73b8f8014eff33330aead0f36944b3403e6Dmitry Shmidt