| 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_AURA_EVENT_H_ | 5 #ifndef UI_AURA_EVENT_H_ |
| 6 #define UI_AURA_EVENT_H_ | 6 #define UI_AURA_EVENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/event_types.h" | 10 #include "base/event_types.h" |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 class AURA_EXPORT ScrollEvent : public MouseEvent { | 287 class AURA_EXPORT ScrollEvent : public MouseEvent { |
| 288 public: | 288 public: |
| 289 explicit ScrollEvent(const base::NativeEvent& native_event); | 289 explicit ScrollEvent(const base::NativeEvent& native_event); |
| 290 ScrollEvent(const ScrollEvent& model, | 290 ScrollEvent(const ScrollEvent& model, |
| 291 Window* source, | 291 Window* source, |
| 292 Window* target, | 292 Window* target, |
| 293 ui::EventType type, | 293 ui::EventType type, |
| 294 int flags) | 294 int flags) |
| 295 : MouseEvent(model, source, target, type, flags), | 295 : MouseEvent(model, source, target, type, flags), |
| 296 x_offset_(model.x_offset_), | 296 x_offset_(model.x_offset_), |
| 297 y_offset_(model.y_offset_) { | 297 y_offset_(model.y_offset_) {} |
| 298 } | |
| 299 | 298 |
| 300 float x_offset() const { return x_offset_; } | 299 float x_offset() const { return x_offset_; } |
| 301 float y_offset() const { return y_offset_; } | 300 float y_offset() const { return y_offset_; } |
| 302 | 301 |
| 303 private: | 302 private: |
| 304 float x_offset_; | 303 float x_offset_; |
| 305 float y_offset_; | 304 float y_offset_; |
| 306 | 305 |
| 307 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); | 306 DISALLOW_COPY_AND_ASSIGN(ScrollEvent); |
| 308 }; | 307 }; |
| 309 | 308 |
| 310 class AURA_EXPORT GestureEvent : public LocatedEvent { | 309 class AURA_EXPORT GestureEvent : public LocatedEvent { |
| 311 public: | 310 public: |
| 311 // Bundles properties of a gesture event and allows |
| 312 // for a uniform c'tor signature for GestureEvent. |
| 313 // REMARK(tvoss): Instead of modelling "isolated" fields |
| 314 // in this property, a 3x3 transformation matrix might be |
| 315 // more appropriate. |
| 316 struct Properties { |
| 317 Properties() |
| 318 : point_id(-1), |
| 319 delta_x(0.f), |
| 320 delta_y(0.f), |
| 321 scale_x(1.f), |
| 322 scale_y(1.f) { |
| 323 } |
| 324 |
| 325 // Point or touch-id in case of long-press gestures. |
| 326 int point_id; |
| 327 |
| 328 // For drag gestures |
| 329 float delta_x; |
| 330 float delta_y; |
| 331 |
| 332 // For pinch gestures |
| 333 float scale_x; |
| 334 float scale_y; |
| 335 }; |
| 336 |
| 312 GestureEvent(ui::EventType type, | 337 GestureEvent(ui::EventType type, |
| 313 int x, | 338 int x, |
| 314 int y, | 339 int y, |
| 315 int flags, | 340 int flags, |
| 316 base::Time time_stamp, | 341 base::Time time_stamp, |
| 317 float delta_x, | 342 const Properties& properties); |
| 318 float delta_y); | |
| 319 | 343 |
| 320 // Create a new TouchEvent which is identical to the provided model. | 344 // Create a new TouchEvent which is identical to the provided model. |
| 321 // If source / target windows are provided, the model location will be | 345 // If source / target windows are provided, the model location will be |
| 322 // converted from |source| coordinate system to |target| coordinate system. | 346 // converted from |source| coordinate system to |target| coordinate system. |
| 323 GestureEvent(const GestureEvent& model, Window* source, Window* target); | 347 GestureEvent(const GestureEvent& model, Window* source, Window* target); |
| 324 | 348 |
| 325 float delta_x() const { return delta_x_; } | 349 int point_id() const { return properties_.point_id; } |
| 326 float delta_y() const { return delta_y_; } | 350 |
| 351 float delta_x() const { return properties_.delta_x; } |
| 352 float delta_y() const { return properties_.delta_y; } |
| 353 |
| 354 float scale_x() const { return properties_.scale_x; } |
| 355 float scale_y() const { return properties_.scale_y; } |
| 356 |
| 357 const Properties& properties() const { return properties_; } |
| 327 | 358 |
| 328 private: | 359 private: |
| 329 float delta_x_; | 360 Properties properties_; |
| 330 float delta_y_; | |
| 331 | 361 |
| 332 DISALLOW_COPY_AND_ASSIGN(GestureEvent); | 362 DISALLOW_COPY_AND_ASSIGN(GestureEvent); |
| 333 }; | 363 }; |
| 334 | 364 |
| 335 } // namespace aura | 365 } // namespace aura |
| 336 | 366 |
| 337 #endif // UI_AURA_EVENT_H_ | 367 #endif // UI_AURA_EVENT_H_ |
| OLD | NEW |