Chromium Code Reviews| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); | 408 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); |
| 409 }; | 409 }; |
| 410 | 410 |
| 411 //////////////////////////////////////////////////////////////////////////////// | 411 //////////////////////////////////////////////////////////////////////////////// |
| 412 // GestureEvent class | 412 // GestureEvent class |
| 413 // | 413 // |
| 414 //////////////////////////////////////////////////////////////////////////////// | 414 //////////////////////////////////////////////////////////////////////////////// |
| 415 class VIEWS_EXPORT GestureEvent : public LocatedEvent, | 415 class VIEWS_EXPORT GestureEvent : public LocatedEvent, |
| 416 public ui::GestureEvent { | 416 public ui::GestureEvent { |
| 417 public: | 417 public: |
| 418 GestureEvent(ui::EventType type, | |
| 419 int x, | |
| 420 int y, | |
| 421 int flags, | |
| 422 base::Time time_stamp, | |
| 423 float delta_x, | |
| 424 float delta_y, | |
| 425 unsigned int touch_ids_bitfield); | |
| 426 | |
| 418 explicit GestureEvent(const NativeEvent& native_event); | 427 explicit GestureEvent(const NativeEvent& native_event); |
| 419 | 428 |
| 420 // Create a new GestureEvent which is identical to the provided model. | 429 // Create a new GestureEvent which is identical to the provided model. |
| 421 // If source / target views are provided, the model location will be converted | 430 // If source / target views are provided, the model location will be converted |
| 422 // from |source| coordinate system to |target| coordinate system. | 431 // from |source| coordinate system to |target| coordinate system. |
| 423 GestureEvent(const GestureEvent& model, View* source, View* target); | 432 GestureEvent(const GestureEvent& model, View* source, View* target); |
| 424 | 433 |
| 425 virtual ~GestureEvent(); | 434 virtual ~GestureEvent(); |
| 426 | 435 |
| 427 float delta_x() const { return delta_x_; } | 436 float delta_x() const { return delta_x_; } |
| 428 float delta_y() const { return delta_y_; } | 437 float delta_y() const { return delta_y_; } |
| 429 | 438 |
| 430 protected: | 439 protected: |
| 431 GestureEvent(ui::EventType type, int x, int y, int flags); | 440 GestureEvent(ui::EventType type, int x, int y, int flags); |
| 432 | 441 |
| 433 private: | 442 private: |
| 434 friend class internal::RootView; | 443 friend class internal::RootView; |
| 435 | 444 |
| 436 GestureEvent(const GestureEvent& model, View* root); | 445 GestureEvent(const GestureEvent& model, View* root); |
| 437 | 446 |
| 438 // Overridden from ui::GestureEvent. | 447 // Overridden from ui::GestureEvent. |
| 439 virtual int GetLowestTouchId() const OVERRIDE; | 448 virtual int GetLowestTouchId() const OVERRIDE; |
| 440 | 449 |
| 441 float delta_x_; | 450 float delta_x_; |
| 442 float delta_y_; | 451 float delta_y_; |
| 443 | 452 |
| 453 // The set of indices of ones in the binary representation of | |
| 454 // touch_ids_bitfield_ is the set of touch_ids associate with this gesture. | |
|
sky
2012/05/03 22:39:19
Place |s variable names in comments, eg |touch_ids
| |
| 455 // This value is stored as a bitfield because the number of touch ids varies, | |
| 456 // but we currently don't need more than 32 touches at a time. | |
| 457 const unsigned int touch_ids_bitfield_; | |
| 458 | |
| 444 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | 459 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
| 445 }; | 460 }; |
| 446 | 461 |
| 447 class VIEWS_EXPORT GestureEventForTest : public GestureEvent { | 462 class VIEWS_EXPORT GestureEventForTest : public GestureEvent { |
| 448 public: | 463 public: |
| 449 GestureEventForTest(ui::EventType type, int x, int y, int flags); | 464 GestureEventForTest(ui::EventType type, int x, int y, int flags); |
| 450 | 465 |
| 451 private: | 466 private: |
| 452 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); | 467 DISALLOW_COPY_AND_ASSIGN(GestureEventForTest); |
| 453 }; | 468 }; |
| 454 | 469 |
| 455 } // namespace views | 470 } // namespace views |
| 456 | 471 |
| 457 #endif // UI_VIEWS_EVENTS_EVENT_H_ | 472 #endif // UI_VIEWS_EVENTS_EVENT_H_ |
| OLD | NEW |