OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_VIEWS_EVENTS_EVENT_H_ | 5 #ifndef UI_VIEWS_EVENTS_EVENT_H_ |
6 #define UI_VIEWS_EVENTS_EVENT_H_ | 6 #define UI_VIEWS_EVENTS_EVENT_H_ |
7 #pragma once | 7 #pragma once |
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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); | 399 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); |
400 }; | 400 }; |
401 | 401 |
402 //////////////////////////////////////////////////////////////////////////////// | 402 //////////////////////////////////////////////////////////////////////////////// |
403 // GestureEvent class | 403 // GestureEvent class |
404 // | 404 // |
405 //////////////////////////////////////////////////////////////////////////////// | 405 //////////////////////////////////////////////////////////////////////////////// |
406 class VIEWS_EXPORT GestureEvent : public LocatedEvent, | 406 class VIEWS_EXPORT GestureEvent : public LocatedEvent, |
407 public ui::GestureEvent { | 407 public ui::GestureEvent { |
408 public: | 408 public: |
| 409 GestureEvent(ui::EventType type, |
| 410 int x, |
| 411 int y, |
| 412 int flags, |
| 413 const base::Time& time_stamp, |
| 414 float delta_x, |
| 415 float delta_y, |
| 416 unsigned int touch_ids_bitfield); |
| 417 |
409 explicit GestureEvent(const NativeEvent& native_event); | 418 explicit GestureEvent(const NativeEvent& native_event); |
410 | 419 |
411 // Create a new GestureEvent which is identical to the provided model. | 420 // Create a new GestureEvent which is identical to the provided model. |
412 // If source / target views are provided, the model location will be converted | 421 // If source / target views are provided, the model location will be converted |
413 // from |source| coordinate system to |target| coordinate system. | 422 // from |source| coordinate system to |target| coordinate system. |
414 GestureEvent(const GestureEvent& model, View* source, View* target); | 423 GestureEvent(const GestureEvent& model, View* source, View* target); |
415 | 424 |
416 virtual ~GestureEvent(); | 425 virtual ~GestureEvent(); |
417 | 426 |
418 float delta_x() const { return delta_x_; } | 427 float delta_x() const { return delta_x_; } |
419 float delta_y() const { return delta_y_; } | 428 float delta_y() const { return delta_y_; } |
420 | 429 |
421 protected: | 430 protected: |
422 GestureEvent(ui::EventType type, int x, int y, int flags); | 431 GestureEvent(ui::EventType type, int x, int y, int flags); |
423 | 432 |
424 private: | 433 private: |
425 friend class internal::RootView; | 434 friend class internal::RootView; |
426 | 435 |
427 GestureEvent(const GestureEvent& model, View* root); | 436 GestureEvent(const GestureEvent& model, View* root); |
428 | 437 |
429 // Overridden from ui::GestureEvent. | 438 // Overridden from ui::GestureEvent. |
430 virtual int GetLowestTouchId() const OVERRIDE; | 439 virtual int GetLowestTouchId() const OVERRIDE; |
431 | 440 |
432 float delta_x_; | 441 float delta_x_; |
433 float delta_y_; | 442 float delta_y_; |
434 | 443 |
| 444 // The set of indices of ones in the binary representation of |
| 445 // |touch_ids_bitfield_| is the set of touch_ids associate with this gesture. |
| 446 // This value is stored as a bitfield because the number of touch ids varies, |
| 447 // but we currently don't need more than 32 touches at a time. |
| 448 const unsigned int touch_ids_bitfield_; |
| 449 |
435 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | 450 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
436 }; | 451 }; |
437 | 452 |
438 class VIEWS_EXPORT GestureEventForTest : public GestureEvent { | 453 class VIEWS_EXPORT GestureEventForTest : public GestureEvent { |
439 public: | 454 public: |
440 GestureEventForTest(ui::EventType type, int x, int y, int flags); | 455 GestureEventForTest(ui::EventType type, int x, int y, int flags); |
441 | 456 |
442 private: | 457 private: |
443 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); | 458 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); |
444 }; | 459 }; |
445 | 460 |
446 } // namespace views | 461 } // namespace views |
447 | 462 |
448 #endif // UI_VIEWS_EVENTS_EVENT_H_ | 463 #endif // UI_VIEWS_EVENTS_EVENT_H_ |
OLD | NEW |