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