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

Side by Side Diff: ui/base/gestures/gesture_types.h

Issue 10365009: Adding Gesture Recognition to RenderWidgetHostViewWin (web client) (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Merge cleanup. (Implementing four new virtuals added in the base.) Created 8 years, 7 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
« no previous file with comments | « ui/aura/root_window.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BASE_GESTURES_GESTURE_TYPES_H_ 5 #ifndef UI_BASE_GESTURES_GESTURE_TYPES_H_
6 #define UI_BASE_GESTURES_GESTURE_TYPES_H_ 6 #define UI_BASE_GESTURES_GESTURE_TYPES_H_
7 #pragma once 7 #pragma once
8 8
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "ui/base/events.h" 10 #include "ui/base/events.h"
(...skipping 22 matching lines...) Expand all
33 }; 33 };
34 34
35 // An abstract type to represent gesture-events. 35 // An abstract type to represent gesture-events.
36 class UI_EXPORT GestureEvent { 36 class UI_EXPORT GestureEvent {
37 public: 37 public:
38 virtual ~GestureEvent() {} 38 virtual ~GestureEvent() {}
39 39
40 // A gesture event can have multiple touches. This function should return the 40 // A gesture event can have multiple touches. This function should return the
41 // lowest ID of the touches in this gesture. 41 // lowest ID of the touches in this gesture.
42 virtual int GetLowestTouchId() const = 0; 42 virtual int GetLowestTouchId() const = 0;
43
44 // A helper function used in several (all) derived classes.
45 // Returns lowest set bit, or -1 if no bits are set.
46 static int LowestBit(unsigned int bitfield) {
47 int i = -1;
48 // Find the index of the least significant 1 bit
49 while (bitfield && (!((1 << ++i) & bitfield)));
50 return i;
51 }
43 }; 52 };
44 53
45 // An abstract type for consumers of gesture-events created by the 54 // An abstract type for consumers of gesture-events created by the
46 // gesture-recognizer. 55 // gesture-recognizer.
47 class UI_EXPORT GestureConsumer { 56 class UI_EXPORT GestureConsumer {
48 public: 57 public:
49 GestureConsumer() 58 GestureConsumer()
50 : ignores_events_(false) { 59 : ignores_events_(false) {
51 } 60 }
52 61
(...skipping 16 matching lines...) Expand all
69 class UI_EXPORT GestureEventHelper { 78 class UI_EXPORT GestureEventHelper {
70 public: 79 public:
71 virtual ~GestureEventHelper() { 80 virtual ~GestureEventHelper() {
72 } 81 }
73 82
74 // |flags| is ui::EventFlags. The meaning of |param_first| and |param_second| 83 // |flags| is ui::EventFlags. The meaning of |param_first| and |param_second|
75 // depends on the specific gesture type (|type|). 84 // depends on the specific gesture type (|type|).
76 virtual GestureEvent* CreateGestureEvent(EventType type, 85 virtual GestureEvent* CreateGestureEvent(EventType type,
77 const gfx::Point& location, 86 const gfx::Point& location,
78 int flags, 87 int flags,
79 const base::Time time, 88 base::Time time,
80 float param_first, 89 float param_first,
81 float param_second, 90 float param_second,
82 unsigned int touch_id_bitfield) = 0; 91 unsigned int touch_id_bitfield) = 0;
83 92
84 virtual TouchEvent* CreateTouchEvent(EventType type, 93 virtual TouchEvent* CreateTouchEvent(EventType type,
85 const gfx::Point& location, 94 const gfx::Point& location,
86 int touch_id, 95 int touch_id,
87 base::TimeDelta time_stamp) = 0; 96 base::TimeDelta time_stamp) = 0;
88 97
89 virtual bool DispatchLongPressGestureEvent(GestureEvent* event) = 0; 98 virtual bool DispatchLongPressGestureEvent(GestureEvent* event) = 0;
90 virtual bool DispatchCancelTouchEvent(TouchEvent* event) = 0; 99 virtual bool DispatchCancelTouchEvent(TouchEvent* event) = 0;
91 }; 100 };
92 101
93 } // namespace ui 102 } // namespace ui
94 103
95 #endif // UI_BASE_GESTURES_GESTURE_TYPES_H_ 104 #endif // UI_BASE_GESTURES_GESTURE_TYPES_H_
OLDNEW
« no previous file with comments | « ui/aura/root_window.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698