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

Side by Side Diff: views/events/event.h

Issue 8364039: Initial views touchui GestureRecognizer support (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Added gesture tests in view_unittest Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 VIEWS_EVENTS_EVENT_H_ 5 #ifndef VIEWS_EVENTS_EVENT_H_
6 #define VIEWS_EVENTS_EVENT_H_ 6 #define 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/time.h" 10 #include "base/time.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // 56 //
57 //////////////////////////////////////////////////////////////////////////////// 57 ////////////////////////////////////////////////////////////////////////////////
58 class VIEWS_EXPORT Event { 58 class VIEWS_EXPORT Event {
59 public: 59 public:
60 const NativeEvent& native_event() const { return native_event_; } 60 const NativeEvent& native_event() const { return native_event_; }
61 #if defined(TOOLKIT_USES_GTK) 61 #if defined(TOOLKIT_USES_GTK)
62 GdkEvent* gdk_event() const { return gdk_event_; } 62 GdkEvent* gdk_event() const { return gdk_event_; }
63 #endif 63 #endif
64 ui::EventType type() const { return type_; } 64 ui::EventType type() const { return type_; }
65 const base::Time& time_stamp() const { return time_stamp_; } 65 const base::Time& time_stamp() const { return time_stamp_; }
66
67 // Required for Gesture testing purpose.
68 void set_time_stamp(base::Time time_stamp) { time_stamp_ = time_stamp; }
69 void set_native_event(const NativeEvent& event) { native_event_ = event; }
rjkroege 2011/11/09 02:43:30 Per other discussion, am not convinced this is nec
Gajen 2011/11/10 15:52:55 Deprecated in this patch, now issue is moved to ht
70
66 int flags() const { return flags_; } 71 int flags() const { return flags_; }
67 void set_flags(int flags) { flags_ = flags; } 72 void set_flags(int flags) { flags_ = flags; }
68 73
69 // The following methods return true if the respective keys were pressed at 74 // The following methods return true if the respective keys were pressed at
70 // the time the event was created. 75 // the time the event was created.
71 bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; } 76 bool IsShiftDown() const { return (flags_ & ui::EF_SHIFT_DOWN) != 0; }
72 bool IsControlDown() const { return (flags_ & ui::EF_CONTROL_DOWN) != 0; } 77 bool IsControlDown() const { return (flags_ & ui::EF_CONTROL_DOWN) != 0; }
73 bool IsCapsLockDown() const { return (flags_ & ui::EF_CAPS_LOCK_DOWN) != 0; } 78 bool IsCapsLockDown() const { return (flags_ & ui::EF_CAPS_LOCK_DOWN) != 0; }
74 bool IsAltDown() const { return (flags_ & ui::EF_ALT_DOWN) != 0; } 79 bool IsAltDown() const { return (flags_ & ui::EF_ALT_DOWN) != 0; }
75 80
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 private: 432 private:
428 // Data associated with the drag/drop session. 433 // Data associated with the drag/drop session.
429 const ui::OSExchangeData& data_; 434 const ui::OSExchangeData& data_;
430 435
431 // Bitmask of supported ui::DragDropTypes::DragOperation by the source. 436 // Bitmask of supported ui::DragDropTypes::DragOperation by the source.
432 int source_operations_; 437 int source_operations_;
433 438
434 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent); 439 DISALLOW_COPY_AND_ASSIGN(DropTargetEvent);
435 }; 440 };
436 441
442 ////////////////////////////////////////////////////////////////////////////////
443 // GestureEvent class
444 //
445 ////////////////////////////////////////////////////////////////////////////////
446 class VIEWS_EXPORT GestureEvent : public LocatedEvent {
447 public:
448 GestureEvent(ui::EventType type, int x, int y, int flags,
449 base::Time time_stamp, float delta_x, float delta_y);
450
451 // Create a new GestureEvent which is identical to the provided model.
452 // If source / target views are provided, the model location will be converted
453 // from |source| coordinate system to |target| coordinate system.
454 GestureEvent(const GestureEvent& model, View* source, View* target);
455
456 float delta_x() const { return delta_x_; }
457 float delta_y() const { return delta_y_; }
458
459 private:
460 friend class internal::RootView;
461
462 GestureEvent(const GestureEvent& model, View* root);
463
464 float delta_x_;
465 float delta_y_;
466
467 DISALLOW_COPY_AND_ASSIGN(GestureEvent);
468 };
469
437 } // namespace views 470 } // namespace views
438 471
439 #endif // VIEWS_EVENTS_EVENT_H_ 472 #endif // VIEWS_EVENTS_EVENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698