OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef VIEWS_TOUCHUI_GESTURE_MANAGER_H_ | |
6 #define VIEWS_TOUCHUI_GESTURE_MANAGER_H_ | |
7 #pragma once | |
8 | |
9 #include "base/memory/singleton.h" | |
10 #include "views/view.h" | |
11 | |
12 namespace ui { | |
13 enum TouchStatus; | |
14 } | |
15 | |
16 namespace views { | |
17 class TouchEvent; | |
18 | |
19 // A GestureManager singleton detects gestures occurring in the | |
20 // incoming feed of touch events across all of the RootViews in | |
21 // the system. In response to a given touch event, the GestureManager | |
22 // updates its internal state and optionally dispatches synthetic | |
23 // events to the invoking view. | |
24 // | |
25 class VIEWS_EXPORT GestureManager { | |
26 public: | |
27 virtual ~GestureManager(); | |
28 | |
29 static GestureManager* GetInstance(); | |
30 | |
31 // Invoked for each touch event that could contribute to the current gesture. | |
32 // Takes the event and the View that originated it and which will also | |
33 // be the target of any generated synthetic event. Finally, status | |
34 // specifies if a touch sequence is in progress or not, so that the | |
35 // GestureManager state can correctly reflect events that are handled | |
36 // already. | |
37 // Returns true if the event resulted in firing a synthetic event. | |
38 virtual bool ProcessTouchEventForGesture(const TouchEvent& event, | |
39 View* source, | |
40 ui::TouchStatus status); | |
41 | |
42 // TODO(rjkroege): Write the remainder of this class. | |
43 // It will appear in a subsequent CL. | |
44 | |
45 protected: | |
46 GestureManager(); | |
47 | |
48 private: | |
49 friend struct DefaultSingletonTraits<GestureManager>; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(GestureManager); | |
52 }; | |
53 | |
54 | |
55 } // namespace views | |
56 | |
57 #endif // VIEWS_TOUCHUI_GESTURE_MANAGER_H_ | |
OLD | NEW |