OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 15 matching lines...) Expand all Loading... |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #ifndef WebInputEvent_h | 31 #ifndef WebInputEvent_h |
32 #define WebInputEvent_h | 32 #define WebInputEvent_h |
33 | 33 |
34 #include "../platform/WebCommon.h" | 34 #include "../platform/WebCommon.h" |
35 #include "../platform/WebGestureDevice.h" | 35 #include "../platform/WebGestureDevice.h" |
| 36 #include "../platform/WebPointerProperties.h" |
36 #include "../platform/WebRect.h" | 37 #include "../platform/WebRect.h" |
37 #include "WebTouchPoint.h" | 38 #include "WebTouchPoint.h" |
38 | 39 |
39 #include <string.h> | 40 #include <string.h> |
40 | 41 |
41 namespace blink { | 42 namespace blink { |
42 | 43 |
43 // The classes defined in this file are intended to be used with | 44 // The classes defined in this file are intended to be used with |
44 // WebWidget's handleInputEvent method. These event types are cross- | 45 // WebWidget's handleInputEvent method. These event types are cross- |
45 // platform and correspond closely to WebCore's Platform*Event classes. | 46 // platform and correspond closely to WebCore's Platform*Event classes. |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // Sets keyIdentifier based on the value of windowsKeyCode. This is | 294 // Sets keyIdentifier based on the value of windowsKeyCode. This is |
294 // handy for generating synthetic keyboard events. | 295 // handy for generating synthetic keyboard events. |
295 BLINK_EXPORT void setKeyIdentifierFromWindowsKeyCode(); | 296 BLINK_EXPORT void setKeyIdentifierFromWindowsKeyCode(); |
296 | 297 |
297 static int windowsKeyCodeWithoutLocation(int keycode); | 298 static int windowsKeyCodeWithoutLocation(int keycode); |
298 static int locationModifiersFromWindowsKeyCode(int keycode); | 299 static int locationModifiersFromWindowsKeyCode(int keycode); |
299 }; | 300 }; |
300 | 301 |
301 // WebMouseEvent -------------------------------------------------------------- | 302 // WebMouseEvent -------------------------------------------------------------- |
302 | 303 |
303 class WebMouseEvent : public WebInputEvent { | 304 class WebMouseEvent : public WebInputEvent, public WebPointerProperties { |
304 public: | 305 public: |
305 enum Button { | |
306 ButtonNone = -1, | |
307 ButtonLeft, | |
308 ButtonMiddle, | |
309 ButtonRight | |
310 }; | |
311 | |
312 Button button; | |
313 int x; | 306 int x; |
314 int y; | 307 int y; |
315 int windowX; | 308 int windowX; |
316 int windowY; | 309 int windowY; |
317 int globalX; | 310 int globalX; |
318 int globalY; | 311 int globalY; |
319 int movementX; | 312 int movementX; |
320 int movementY; | 313 int movementY; |
321 int clickCount; | 314 int clickCount; |
322 | 315 |
323 WebMouseEvent() | 316 WebMouseEvent() |
324 : WebInputEvent(sizeof(WebMouseEvent)) | 317 : WebInputEvent(sizeof(WebMouseEvent)) |
325 , button(ButtonNone) | 318 , WebPointerProperties() |
326 , x(0) | 319 , x(0) |
327 , y(0) | 320 , y(0) |
328 , windowX(0) | 321 , windowX(0) |
329 , windowY(0) | 322 , windowY(0) |
330 , globalX(0) | 323 , globalX(0) |
331 , globalY(0) | 324 , globalY(0) |
332 , movementX(0) | 325 , movementX(0) |
333 , movementY(0) | 326 , movementY(0) |
334 , clickCount(0) | 327 , clickCount(0) |
335 { | 328 { |
336 } | 329 } |
337 | 330 |
338 protected: | 331 protected: |
339 explicit WebMouseEvent(unsigned sizeParam) | 332 explicit WebMouseEvent(unsigned sizeParam) |
340 : WebInputEvent(sizeParam) | 333 : WebInputEvent(sizeParam) |
341 , button(ButtonNone) | 334 , WebPointerProperties() |
342 , x(0) | 335 , x(0) |
343 , y(0) | 336 , y(0) |
344 , windowX(0) | 337 , windowX(0) |
345 , windowY(0) | 338 , windowY(0) |
346 , globalX(0) | 339 , globalX(0) |
347 , globalY(0) | 340 , globalY(0) |
348 , movementX(0) | 341 , movementX(0) |
349 , movementY(0) | 342 , movementY(0) |
350 , clickCount(0) | 343 , clickCount(0) |
351 { | 344 { |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 , y(0) | 508 , y(0) |
516 , globalX(0) | 509 , globalX(0) |
517 , globalY(0) | 510 , globalY(0) |
518 { | 511 { |
519 memset(&data, 0, sizeof(data)); | 512 memset(&data, 0, sizeof(data)); |
520 } | 513 } |
521 }; | 514 }; |
522 | 515 |
523 // WebTouchEvent -------------------------------------------------------------- | 516 // WebTouchEvent -------------------------------------------------------------- |
524 | 517 |
| 518 // TODO(e_hakkinen): Replace with WebPointerEvent. crbug.com/508283 |
525 class WebTouchEvent : public WebInputEvent { | 519 class WebTouchEvent : public WebInputEvent { |
526 public: | 520 public: |
527 // Maximum number of simultaneous touches supported on | 521 // Maximum number of simultaneous touches supported on |
528 // Ash/Aura. | 522 // Ash/Aura. |
529 enum { touchesLengthCap = 16 }; | 523 enum { touchesLengthCap = 16 }; |
530 | 524 |
531 unsigned touchesLength; | 525 unsigned touchesLength; |
532 // List of all touches, regardless of state. | 526 // List of all touches, regardless of state. |
533 WebTouchPoint touches[touchesLengthCap]; | 527 WebTouchPoint touches[touchesLengthCap]; |
534 | 528 |
(...skipping 19 matching lines...) Expand all Loading... |
554 , uniqueTouchEventId(0) | 548 , uniqueTouchEventId(0) |
555 { | 549 { |
556 } | 550 } |
557 }; | 551 }; |
558 | 552 |
559 #pragma pack(pop) | 553 #pragma pack(pop) |
560 | 554 |
561 } // namespace blink | 555 } // namespace blink |
562 | 556 |
563 #endif | 557 #endif |
OLD | NEW |