1/* 2 * Copyright (C) 2006 Apple Inc. 3 * Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Library General Public 7 * License as published by the Free Software Foundation; either 8 * version 2 of the License, or (at your option) any later version. 9 * 10 * This library is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 * Library General Public License for more details. 14 * 15 * You should have received a copy of the GNU Library General Public License 16 * along with this library; see the file COPYING.LIB. If not, write to 17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 * Boston, MA 02110-1301, USA. 19 */ 20 21[ 22 ConstructorConditional=DOM4_EVENTS_CONSTRUCTOR, 23 ConstructorTemplate=Event, 24] interface KeyboardEvent : UIEvent { 25 26#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT 27 // KeyLocationCode 28 const unsigned long KEY_LOCATION_STANDARD = 0x00; 29 const unsigned long KEY_LOCATION_LEFT = 0x01; 30 const unsigned long KEY_LOCATION_RIGHT = 0x02; 31 const unsigned long KEY_LOCATION_NUMPAD = 0x03; 32#endif 33 34#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT 35 const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00; 36 const unsigned long DOM_KEY_LOCATION_LEFT = 0x01; 37 const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02; 38 const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03; 39 // FIXME: The following constants are defined in the specification but 40 // not yet supported. 41 // const unsigned long DOM_KEY_LOCATION_MOBILE = 0x04; 42 // const unsigned long DOM_KEY_LOCATION_JOYSTICK = 0x05; 43#endif 44 45 [InitializedByEventConstructor] readonly attribute DOMString keyIdentifier; 46 [InitializedByEventConstructor] readonly attribute unsigned long location; 47 [InitializedByEventConstructor, ImplementedAs=location] readonly attribute unsigned long keyLocation; // Deprecated. 48 [InitializedByEventConstructor] readonly attribute boolean ctrlKey; 49 [InitializedByEventConstructor] readonly attribute boolean shiftKey; 50 [InitializedByEventConstructor] readonly attribute boolean altKey; 51 [InitializedByEventConstructor] readonly attribute boolean metaKey; 52 readonly attribute boolean altGraphKey; 53 54#if !defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT 55 boolean getModifierState([Default=Undefined] optional DOMString keyIdentifierArg); 56#endif 57 58 // FIXME: this does not match the version in the DOM spec. 59 void initKeyboardEvent([Default=Undefined] optional DOMString type, 60 [Default=Undefined] optional boolean canBubble, 61 [Default=Undefined] optional boolean cancelable, 62 [Default=Undefined] optional DOMWindow view, 63 [Default=Undefined] optional DOMString keyIdentifier, 64 [Default=Undefined] optional unsigned long location, 65 [Default=Undefined] optional boolean ctrlKey, 66 [Default=Undefined] optional boolean altKey, 67 [Default=Undefined] optional boolean shiftKey, 68 [Default=Undefined] optional boolean metaKey, 69 [Default=Undefined] optional boolean altGraphKey); 70 71 // WebKit Extensions 72#if (!defined(LANGUAGE_JAVASCRIPT) || !LANGUAGE_JAVASCRIPT) && (!defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT) 73 readonly attribute long keyCode; 74 readonly attribute long charCode; 75 76 void initKeyboardEvent([Default=Undefined] optional DOMString type, 77 [Default=Undefined] optional boolean canBubble, 78 [Default=Undefined] optional boolean cancelable, 79 [Default=Undefined] optional DOMWindow view, 80 [Default=Undefined] optional DOMString keyIdentifier, 81 [Default=Undefined] optional unsigned long location, 82 [Default=Undefined] optional boolean ctrlKey, 83 [Default=Undefined] optional boolean altKey, 84 [Default=Undefined] optional boolean shiftKey, 85 [Default=Undefined] optional boolean metaKey); 86#endif 87 88#if defined(LANGUAGE_OBJECTIVE_C) && LANGUAGE_OBJECTIVE_C 89 // For backward compatibility. 90 void initKeyboardEvent([Default=Undefined] optional DOMString type, 91 [Default=Undefined] optional boolean canBubble, 92 [Default=Undefined] optional boolean cancelable, 93 [Default=Undefined] optional DOMWindow view, 94 [Default=Undefined] optional DOMString keyIdentifier, 95 [Default=Undefined] optional unsigned long keyLocation, 96 [Default=Undefined] optional boolean ctrlKey, 97 [Default=Undefined] optional boolean altKey, 98 [Default=Undefined] optional boolean shiftKey, 99 [Default=Undefined] optional boolean metaKey, 100 [Default=Undefined] optional boolean altGraphKey); 101 102 void initKeyboardEvent([Default=Undefined] optional DOMString type, 103 [Default=Undefined] optional boolean canBubble, 104 [Default=Undefined] optional boolean cancelable, 105 [Default=Undefined] optional DOMWindow view, 106 [Default=Undefined] optional DOMString keyIdentifier, 107 [Default=Undefined] optional unsigned long keyLocation, 108 [Default=Undefined] optional boolean ctrlKey, 109 [Default=Undefined] optional boolean altKey, 110 [Default=Undefined] optional boolean shiftKey, 111 [Default=Undefined] optional boolean metaKey); 112#endif 113 114}; 115 116