OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 /// @domName KeyboardEvent; @docsEditable true | 6 /// @docsEditable true |
blois
2013/01/15 22:26:32
Not docsEditable
Andrei Mouravski
2013/01/16 00:24:25
Done.
| |
7 @DomName('KeyboardEvent') | |
7 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { | 8 class $CLASSNAME$EXTENDS$IMPLEMENTS$NATIVESPEC { |
8 | 9 |
9 factory $CLASSNAME(String type, Window view, | 10 factory $CLASSNAME(String type, Window view, |
10 [bool canBubble = true, bool cancelable = true, | 11 [bool canBubble = true, bool cancelable = true, |
11 String keyIdentifier = "", int keyLocation = 1, bool ctrlKey = false, | 12 String keyIdentifier = "", int keyLocation = 1, bool ctrlKey = false, |
12 bool altKey = false, bool shiftKey = false, bool metaKey = false, | 13 bool altKey = false, bool shiftKey = false, bool metaKey = false, |
13 bool altGraphKey = false]) { | 14 bool altGraphKey = false]) { |
14 final e = document.$dom_createEvent("KeyboardEvent"); | 15 final e = document.$dom_createEvent("KeyboardEvent"); |
15 e.$dom_initKeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, | 16 e.$dom_initKeyboardEvent(type, canBubble, cancelable, view, keyIdentifier, |
16 keyLocation, ctrlKey, altKey, shiftKey, metaKey, altGraphKey); | 17 keyLocation, ctrlKey, altKey, shiftKey, metaKey, altGraphKey); |
17 return e; | 18 return e; |
18 } | 19 } |
19 | 20 |
20 /** @domName KeyboardEvent.initKeyboardEvent */ | 21 @DomName('KeyboardEvent.initKeyboardEvent') |
21 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable, | 22 void $dom_initKeyboardEvent(String type, bool canBubble, bool cancelable, |
22 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, | 23 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, |
23 bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) { | 24 bool altKey, bool shiftKey, bool metaKey, bool altGraphKey) { |
24 if (JS('bool', 'typeof(#.initKeyEvent) == "function"', this)) { | 25 if (JS('bool', 'typeof(#.initKeyEvent) == "function"', this)) { |
25 // initKeyEvent is only in Firefox (instead of initKeyboardEvent). It has | 26 // initKeyEvent is only in Firefox (instead of initKeyboardEvent). It has |
26 // a slightly different signature, and allows you to specify keyCode and | 27 // a slightly different signature, and allows you to specify keyCode and |
27 // charCode as the last two arguments, but we just set them as the default | 28 // charCode as the last two arguments, but we just set them as the default |
28 // since they can't be specified in other browsers. | 29 // since they can't be specified in other browsers. |
29 JS('void', '#.initKeyEvent(#, #, #, #, #, #, #, #, 0, 0)', this, | 30 JS('void', '#.initKeyEvent(#, #, #, #, #, #, #, #, 0, 0)', this, |
30 type, canBubble, cancelable, view, | 31 type, canBubble, cancelable, view, |
31 ctrlKey, altKey, shiftKey, metaKey); | 32 ctrlKey, altKey, shiftKey, metaKey); |
32 } else { | 33 } else { |
33 // initKeyboardEvent is for all other browsers. | 34 // initKeyboardEvent is for all other browsers. |
34 JS('void', '#.initKeyboardEvent(#, #, #, #, #, #, #, #, #, #, #)', this, | 35 JS('void', '#.initKeyboardEvent(#, #, #, #, #, #, #, #, #, #, #)', this, |
35 type, canBubble, cancelable, view, keyIdentifier, keyLocation, | 36 type, canBubble, cancelable, view, keyIdentifier, keyLocation, |
36 ctrlKey, altKey, shiftKey, metaKey, altGraphKey); | 37 ctrlKey, altKey, shiftKey, metaKey, altGraphKey); |
37 } | 38 } |
38 } | 39 } |
39 | 40 |
40 /** @domName KeyboardEvent.keyCode */ | 41 @DomName('KeyboardEvent.keyCode') |
41 int get keyCode => $dom_keyCode; | 42 int get keyCode => $dom_keyCode; |
42 | 43 |
43 /** @domName KeyboardEvent.charCode */ | 44 @DomName('KeyboardEvent.charCode') |
44 int get charCode => $dom_charCode; | 45 int get charCode => $dom_charCode; |
45 $!MEMBERS | 46 $!MEMBERS |
46 } | 47 } |
OLD | NEW |