| Index: ui/events/gesture_detection/gesture_listeners.h
|
| diff --git a/ui/events/gesture_detection/gesture_listeners.h b/ui/events/gesture_detection/gesture_listeners.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1d623476b765c57257cf9c0250b2876517bd21d9
|
| --- /dev/null
|
| +++ b/ui/events/gesture_detection/gesture_listeners.h
|
| @@ -0,0 +1,83 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef UI_EVENTS_GESTURE_DETECTION_GESTURE_LISTENERS_H_
|
| +#define UI_EVENTS_GESTURE_DETECTION_GESTURE_LISTENERS_H_
|
| +
|
| +#include "ui/events/gesture_detection/gesture_detection_export.h"
|
| +
|
| +namespace ui {
|
| +
|
| +class MotionEvent;
|
| +
|
| +// Client through which |GestureDetector| signals gesture detection.
|
| +class GESTURE_DETECTION_EXPORT GestureListener {
|
| + public:
|
| + virtual ~GestureListener() {}
|
| + virtual bool OnDown(const MotionEvent& e) = 0;
|
| + virtual void OnShowPress(const MotionEvent& e) = 0;
|
| + virtual bool OnSingleTapUp(const MotionEvent& e) = 0;
|
| + virtual void OnLongPress(const MotionEvent& e) = 0;
|
| + virtual bool OnScroll(const MotionEvent& e1,
|
| + const MotionEvent& e2,
|
| + float distance_x,
|
| + float distance_y) = 0;
|
| + virtual bool OnFling(const MotionEvent& e1,
|
| + const MotionEvent& e2,
|
| + float velocity_x,
|
| + float velocity_y) = 0;
|
| + // Added for Chromium (Aura).
|
| + virtual bool OnSwipe(const MotionEvent& e1,
|
| + const MotionEvent& e2,
|
| + float velocity_x,
|
| + float velocity_y) = 0;
|
| + virtual bool OnTwoFingerTap(const MotionEvent& e1, const MotionEvent& e2) = 0;
|
| +};
|
| +
|
| +// Client through which |GestureDetector| signals double-tap detection.
|
| +class GESTURE_DETECTION_EXPORT DoubleTapListener {
|
| + public:
|
| + virtual ~DoubleTapListener() {}
|
| + virtual bool OnSingleTapConfirmed(const MotionEvent& e) = 0;
|
| + virtual bool OnDoubleTap(const MotionEvent& e) = 0;
|
| + virtual bool OnDoubleTapEvent(const MotionEvent& e) = 0;
|
| +};
|
| +
|
| +// A convenience class to extend when you only want to listen for a subset
|
| +// of all the gestures. This implements all methods in the
|
| +// |GestureListener| and |DoubleTapListener| but does
|
| +// nothing and returns false for all applicable methods.
|
| +class GESTURE_DETECTION_EXPORT SimpleGestureListener
|
| + : public GestureListener,
|
| + public DoubleTapListener {
|
| + public:
|
| + // GestureListener implementation.
|
| + virtual bool OnDown(const MotionEvent& e) override;
|
| + virtual void OnShowPress(const MotionEvent& e) override;
|
| + virtual bool OnSingleTapUp(const MotionEvent& e) override;
|
| + virtual void OnLongPress(const MotionEvent& e) override;
|
| + virtual bool OnScroll(const MotionEvent& e1,
|
| + const MotionEvent& e2,
|
| + float distance_x,
|
| + float distance_y) override;
|
| + virtual bool OnFling(const MotionEvent& e1,
|
| + const MotionEvent& e2,
|
| + float velocity_x,
|
| + float velocity_y) override;
|
| + virtual bool OnSwipe(const MotionEvent& e1,
|
| + const MotionEvent& e2,
|
| + float velocity_x,
|
| + float velocity_y) override;
|
| + virtual bool OnTwoFingerTap(const MotionEvent& e1,
|
| + const MotionEvent& e2) override;
|
| +
|
| + // DoubleTapListener implementation.
|
| + virtual bool OnSingleTapConfirmed(const MotionEvent& e) override;
|
| + virtual bool OnDoubleTap(const MotionEvent& e) override;
|
| + virtual bool OnDoubleTapEvent(const MotionEvent& e) override;
|
| +};
|
| +
|
| +} // namespace ui
|
| +
|
| +#endif // UI_EVENTS_GESTURE_DETECTION_GESTURE_LISTENERS_H_
|
|
|