Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(352)

Side by Side Diff: ui/aura/event.h

Issue 9773024: This patch implements Chromium's Aura gesture recognizer in terms of utouch-grail and utouch-frame … (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 struct Properties {
tdresser 2012/03/29 17:44:38 If this is being refactored, we should update the
312 Properties()
313 : delta_x(0.f),
314 delta_y(0.f),
315 scale_x(1.f),
316 scale_y(1.f) {
317 }
318
319 // For drag gestures
320 float delta_x;
321 float delta_y;
322
323 // For pinch gestures
324 float scale_x;
325 float scale_y;
326 };
327
312 GestureEvent(ui::EventType type, 328 GestureEvent(ui::EventType type,
313 int x, 329 int x,
314 int y, 330 int y,
315 int flags, 331 int flags,
316 base::Time time_stamp, 332 base::Time time_stamp,
317 float delta_x, 333 float delta_x,
318 float delta_y); 334 float delta_y);
319 335
336 GestureEvent(ui::EventType type,
337 int x,
338 int y,
339 int flags,
340 base::Time time_stamp,
341 const Properties& properties);
342
320 // Create a new TouchEvent which is identical to the provided model. 343 // Create a new TouchEvent which is identical to the provided model.
321 // If source / target windows are provided, the model location will be 344 // If source / target windows are provided, the model location will be
322 // converted from |source| coordinate system to |target| coordinate system. 345 // converted from |source| coordinate system to |target| coordinate system.
323 GestureEvent(const GestureEvent& model, Window* source, Window* target); 346 GestureEvent(const GestureEvent& model, Window* source, Window* target);
324 347
325 float delta_x() const { return delta_x_; } 348 float delta_x() const { return properties_.delta_x; }
326 float delta_y() const { return delta_y_; } 349 float delta_y() const { return properties_.delta_y; }
350
351 float scale_x() const { return properties_.scale_x; }
352 float scale_y() const { return properties_.scale_y; }
353
354 const Properties& properties() const { return properties_; }
327 355
328 private: 356 private:
329 float delta_x_; 357 Properties properties_;
330 float delta_y_;
331 358
332 DISALLOW_COPY_AND_ASSIGN(GestureEvent); 359 DISALLOW_COPY_AND_ASSIGN(GestureEvent);
333 }; 360 };
334 361
335 } // namespace aura 362 } // namespace aura
336 363
337 #endif // UI_AURA_EVENT_H_ 364 #endif // UI_AURA_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698