OLD | NEW |
1 | 1 |
2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #ifndef UI_VIEWS_EVENTS_EVENT_H_ | 6 #ifndef UI_VIEWS_EVENTS_EVENT_H_ |
7 #define UI_VIEWS_EVENTS_EVENT_H_ | 7 #define UI_VIEWS_EVENTS_EVENT_H_ |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 | 272 |
273 // Angle of the major axis away from the X axis. Default 0.0. | 273 // Angle of the major axis away from the X axis. Default 0.0. |
274 const float rotation_angle_; | 274 const float rotation_angle_; |
275 | 275 |
276 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. | 276 // Force (pressure) of the touch. Normalized to be [0, 1]. Default to be 0.0. |
277 const float force_; | 277 const float force_; |
278 | 278 |
279 DISALLOW_COPY_AND_ASSIGN(TouchEvent); | 279 DISALLOW_COPY_AND_ASSIGN(TouchEvent); |
280 }; | 280 }; |
281 | 281 |
282 //////////////////////////////////////////////////////////////////////////////// | |
283 // KeyEvent class | |
284 // | |
285 // KeyEvent encapsulates keyboard input events - key press and release. | |
286 // | |
287 //////////////////////////////////////////////////////////////////////////////// | |
288 class VIEWS_EXPORT KeyEvent : public Event { | |
289 public: | |
290 explicit KeyEvent(const NativeEvent& native_event); | |
291 | |
292 // Creates a new KeyEvent synthetically (i.e. not in response to an input | |
293 // event from the host environment). This is typically only used in testing as | |
294 // some metadata obtainable from the underlying native event is not present. | |
295 // It's also used by input methods to fabricate keyboard events. | |
296 KeyEvent(ui::EventType type, ui::KeyboardCode key_code, int event_flags); | |
297 | |
298 ui::KeyboardCode key_code() const { return key_code_; } | |
299 | |
300 // These setters allow an I18N virtual keyboard to fabricate a keyboard event | |
301 // which does not have a corresponding ui::KeyboardCode (example: U+00E1 Latin | |
302 // small letter A with acute, U+0410 Cyrillic capital letter A.) | |
303 // GetCharacter() and GetUnmodifiedCharacter() return the character. | |
304 void set_character(uint16 character) { character_ = character; } | |
305 void set_unmodified_character(uint16 unmodified_character) { | |
306 unmodified_character_ = unmodified_character; | |
307 } | |
308 | |
309 // Gets the character generated by this key event. It only supports Unicode | |
310 // BMP characters. | |
311 uint16 GetCharacter() const; | |
312 | |
313 // Gets the character generated by this key event ignoring concurrently-held | |
314 // modifiers (except shift). | |
315 uint16 GetUnmodifiedCharacter() const; | |
316 | |
317 private: | |
318 ui::KeyboardCode key_code_; | |
319 | |
320 uint16 character_; | |
321 uint16 unmodified_character_; | |
322 | |
323 DISALLOW_COPY_AND_ASSIGN(KeyEvent); | |
324 }; | |
325 | |
326 class ScrollEvent; | 282 class ScrollEvent; |
327 | 283 |
328 //////////////////////////////////////////////////////////////////////////////// | 284 //////////////////////////////////////////////////////////////////////////////// |
329 // | 285 // |
330 // MouseWheelEvent class | 286 // MouseWheelEvent class |
331 // | 287 // |
332 // A MouseWheelEvent is used to propagate mouse wheel user events. | 288 // A MouseWheelEvent is used to propagate mouse wheel user events. |
333 // Note: e.GetOffset() > 0 means scroll up / left. | 289 // Note: e.GetOffset() > 0 means scroll up / left. |
334 // | 290 // |
335 //////////////////////////////////////////////////////////////////////////////// | 291 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); | 410 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); |
455 }; | 411 }; |
456 | 412 |
457 #if defined(OS_WIN) | 413 #if defined(OS_WIN) |
458 int GetModifiersFromKeyState(); | 414 int GetModifiersFromKeyState(); |
459 #endif | 415 #endif |
460 | 416 |
461 } // namespace views | 417 } // namespace views |
462 | 418 |
463 #endif // UI_VIEWS_EVENTS_EVENT_H_ | 419 #endif // UI_VIEWS_EVENTS_EVENT_H_ |
OLD | NEW |