OLD | NEW |
1 /** | 1 /** |
2 * A custom KeyboardEvent that attempts to eliminate cross-browser | 2 * A custom KeyboardEvent that attempts to eliminate cross-browser |
3 * inconsistencies, and also provide both keyCode and charCode information | 3 * inconsistencies, and also provide both keyCode and charCode information |
4 * for all key events (when such information can be determined). | 4 * for all key events (when such information can be determined). |
5 * | 5 * |
6 * KeyEvent tries to provide a higher level, more polished keyboard event | 6 * KeyEvent tries to provide a higher level, more polished keyboard event |
7 * information on top of the "raw" [KeyboardEvent]. | 7 * information on top of the "raw" [KeyboardEvent]. |
8 * | 8 * |
9 * The mechanics of using KeyEvents is a little different from the underlying | 9 * The mechanics of using KeyEvents is a little different from the underlying |
10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add | 10 * [KeyboardEvent]. To use KeyEvents, you need to create a stream and then add |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 new _KeyboardEventHandler('keydown'); | 180 new _KeyboardEventHandler('keydown'); |
181 /** Accessor to provide a stream of KeyEvents on the desired target. */ | 181 /** Accessor to provide a stream of KeyEvents on the desired target. */ |
182 static EventStreamProvider<KeyEvent> keyUpEvent = | 182 static EventStreamProvider<KeyEvent> keyUpEvent = |
183 new _KeyboardEventHandler('keyup'); | 183 new _KeyboardEventHandler('keyup'); |
184 /** Accessor to provide a stream of KeyEvents on the desired target. */ | 184 /** Accessor to provide a stream of KeyEvents on the desired target. */ |
185 static EventStreamProvider<KeyEvent> keyPressEvent = | 185 static EventStreamProvider<KeyEvent> keyPressEvent = |
186 new _KeyboardEventHandler('keypress'); | 186 new _KeyboardEventHandler('keypress'); |
187 | 187 |
188 /** Accessor to the clipboardData available for this event. */ | 188 /** Accessor to the clipboardData available for this event. */ |
189 DataTransfer get clipboardData => _parent.clipboardData; | 189 DataTransfer get clipboardData => _parent.clipboardData; |
190 String get code => parent.code; | 190 String get code => _parent.code; |
191 /** True if the ctrl key is pressed during this event. */ | 191 /** True if the ctrl key is pressed during this event. */ |
192 bool get ctrlKey => _parent.ctrlKey; | 192 bool get ctrlKey => _parent.ctrlKey; |
193 int get detail => _parent.detail; | 193 int get detail => _parent.detail; |
194 String get key => parent.key; | 194 String get key => _parent.key; |
195 /** | 195 /** |
196 * Accessor to the part of the keyboard that the key was pressed from (one of | 196 * Accessor to the part of the keyboard that the key was pressed from (one of |
197 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT, | 197 * KeyLocation.STANDARD, KeyLocation.RIGHT, KeyLocation.LEFT, |
198 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK). | 198 * KeyLocation.NUMPAD, KeyLocation.MOBILE, KeyLocation.JOYSTICK). |
199 */ | 199 */ |
200 int get keyLocation => _parent.keyLocation; | 200 int get keyLocation => _parent.keyLocation; |
201 Point get layer => _parent.layer; | |
202 /** True if the Meta (or Mac command) key is pressed during this event. */ | 201 /** True if the Meta (or Mac command) key is pressed during this event. */ |
203 bool get metaKey => _parent.metaKey; | 202 bool get metaKey => _parent.metaKey; |
204 Point get page => _parent.page; | |
205 /** True if the shift key was pressed during this event. */ | 203 /** True if the shift key was pressed during this event. */ |
206 bool get shiftKey => _parent.shiftKey; | 204 bool get shiftKey => _parent.shiftKey; |
207 InputDevice get sourceDevice => parent.sourceDevice; | 205 InputDevice get sourceDevice => _parent.sourceDevice; |
208 Window get view => _parent.view; | 206 Window get view => _parent.view; |
209 void _initUIEvent(String type, bool canBubble, bool cancelable, | 207 void _initUIEvent(String type, bool canBubble, bool cancelable, |
210 Window view, int detail) { | 208 Window view, int detail) { |
211 throw new UnsupportedError("Cannot initialize a UI Event from a KeyEvent."); | 209 throw new UnsupportedError("Cannot initialize a UI Event from a KeyEvent."); |
212 } | 210 } |
213 String get _shadowKeyIdentifier => JS('String', '#.keyIdentifier', _parent); | 211 String get _shadowKeyIdentifier => JS('String', '#.keyIdentifier', _parent); |
214 | 212 |
215 int get _charCode => charCode; | 213 int get _charCode => charCode; |
216 int get _keyCode => keyCode; | 214 int get _keyCode => keyCode; |
217 int get _which => which; | 215 int get _which => which; |
218 | 216 |
219 String get _keyIdentifier { | 217 String get _keyIdentifier { |
220 throw new UnsupportedError("keyIdentifier is unsupported."); | 218 throw new UnsupportedError("keyIdentifier is unsupported."); |
221 } | 219 } |
222 void _initKeyboardEvent(String type, bool canBubble, bool cancelable, | 220 void _initKeyboardEvent(String type, bool canBubble, bool cancelable, |
223 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, | 221 Window view, String keyIdentifier, int keyLocation, bool ctrlKey, |
224 bool altKey, bool shiftKey, bool metaKey) { | 222 bool altKey, bool shiftKey, bool metaKey) { |
225 throw new UnsupportedError( | 223 throw new UnsupportedError( |
226 "Cannot initialize a KeyboardEvent from a KeyEvent."); | 224 "Cannot initialize a KeyboardEvent from a KeyEvent."); |
227 } | 225 } |
228 @Experimental() // untriaged | 226 @Experimental() // untriaged |
229 bool getModifierState(String keyArgument) => throw new UnimplementedError(); | 227 bool getModifierState(String keyArgument) => throw new UnimplementedError(); |
230 @Experimental() // untriaged | 228 @Experimental() // untriaged |
231 int get location => throw new UnimplementedError(); | 229 int get location => throw new UnimplementedError(); |
232 @Experimental() // untriaged | 230 @Experimental() // untriaged |
233 bool get repeat => throw new UnimplementedError(); | 231 bool get repeat => throw new UnimplementedError(); |
234 dynamic get _get_view => throw new UnimplementedError(); | 232 dynamic get _get_view => throw new UnimplementedError(); |
235 } | 233 } |
OLD | NEW |