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

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 {
312 Properties()
rjkroege 2012/04/02 17:05:15 Why introduce the struct?
313 : point_id(-1),
314 delta_x(0.f),
315 delta_y(0.f),
316 scale_x(1.f),
317 scale_y(1.f) {
318 }
319
320 int point_id;
321
322 // For drag gestures
323 float delta_x;
324 float delta_y;
325
326 // For pinch gestures
327 float scale_x;
328 float scale_y;
329 };
330
312 GestureEvent(ui::EventType type, 331 GestureEvent(ui::EventType type,
313 int x, 332 int x,
314 int y, 333 int y,
315 int flags, 334 int flags,
316 base::Time time_stamp, 335 base::Time time_stamp,
317 float delta_x, 336 const Properties& properties);
318 float delta_y);
319 337
320 // Create a new TouchEvent which is identical to the provided model. 338 // Create a new TouchEvent which is identical to the provided model.
321 // If source / target windows are provided, the model location will be 339 // If source / target windows are provided, the model location will be
322 // converted from |source| coordinate system to |target| coordinate system. 340 // converted from |source| coordinate system to |target| coordinate system.
323 GestureEvent(const GestureEvent& model, Window* source, Window* target); 341 GestureEvent(const GestureEvent& model, Window* source, Window* target);
324 342
325 float delta_x() const { return delta_x_; } 343 int point_id() const { return properties_.point_id; }
326 float delta_y() const { return delta_y_; } 344
345 float delta_x() const { return properties_.delta_x; }
346 float delta_y() const { return properties_.delta_y; }
347
348 float scale_x() const { return properties_.scale_x; }
349 float scale_y() const { return properties_.scale_y; }
350
351 const Properties& properties() const { return properties_; }
327 352
328 private: 353 private:
329 float delta_x_; 354 Properties properties_;
330 float delta_y_;
331 355
332 DISALLOW_COPY_AND_ASSIGN(GestureEvent); 356 DISALLOW_COPY_AND_ASSIGN(GestureEvent);
333 }; 357 };
334 358
335 } // namespace aura 359 } // namespace aura
336 360
337 #endif // UI_AURA_EVENT_H_ 361 #endif // UI_AURA_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698