// Copyright © 2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. namespace CefSharp { /// /// Implement this interface to handle events related to keyboard input. /// public interface IKeyboardHandler { /// /// Called before a keyboard event is sent to the renderer. /// Return true if the event was handled or false /// otherwise. If the event will be handled in as a keyboard /// shortcut set isKeyboardShortcut to true and return false. /// /// the ChromiumWebBrowser control /// The browser instance. /// Whether this was a key up/down/raw/etc... /// /// The Windows key code for the key event. This value is used by the DOM /// specification. Sometimes it comes directly from the event (i.e. on /// Windows) and sometimes it's determined using a mapping function. See /// WebCore/platform/chromium/KeyboardCodes.h for the list of values. /// /// The native key code. On Windows this appears to be in the format of WM_KEYDOWN/WM_KEYUP/etc... lParam data. /// What other modifier keys are currently down: Shift/Control/Alt/OS X Command/etc... /// /// Indicates whether the event is considered a "system key" event (see /// http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details). /// /// See the summary for an explanation of when to set this to true. /// Returns true if the event was handled or false otherwise. bool OnPreKeyEvent(IWebBrowser chromiumWebBrowser, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut); /// /// Called after the renderer and JavaScript in the page has had a chance to /// handle the event. Return true if the keyboard event was handled or false otherwise. /// /// the ChromiumWebBrowser control /// The browser instance. /// Whether this was a key up/down/raw/etc... /// /// The Windows key code for the key event. This value is used by the DOM /// specification. Sometimes it comes directly from the event (i.e. on /// Windows) and sometimes it's determined using a mapping function. See /// WebCore/platform/chromium/KeyboardCodes.h for the list of values. /// /// The native key code. On Windows this appears to be in the format of WM_KEYDOWN/WM_KEYUP/etc... lParam data. /// What other modifier keys are currently down: Shift/Control/Alt/OS X Command/etc... /// /// Indicates whether the event is considered a "system key" event (see /// http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details). /// /// Return true if the keyboard event was handled or false otherwise. bool OnKeyEvent(IWebBrowser chromiumWebBrowser, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey); } }