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

Unified Diff: ui/events/gesture_detection/scale_gesture_listeners.h

Issue 617423002: Make GestureTextSelector detect its own gestures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Sort gyp/gn Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: ui/events/gesture_detection/scale_gesture_listeners.h
diff --git a/ui/events/gesture_detection/scale_gesture_listeners.h b/ui/events/gesture_detection/scale_gesture_listeners.h
new file mode 100644
index 0000000000000000000000000000000000000000..583ef7ea06e4ba20addc1a7788c52a3a5bea0fdf
--- /dev/null
+++ b/ui/events/gesture_detection/scale_gesture_listeners.h
@@ -0,0 +1,47 @@
+// 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_SCALE_GESTURE_LISTENERS_H_
+#define UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_LISTENERS_H_
+
+#include "ui/events/gesture_detection/gesture_detection_export.h"
+
+namespace ui {
+
+class MotionEvent;
+class ScaleGestureDetector;
+
+// Client through which |ScaleGestureDetector| signals scale detection.
+class GESTURE_DETECTION_EXPORT ScaleGestureListener {
+ public:
+ virtual ~ScaleGestureListener() {}
+ virtual bool OnScale(const ScaleGestureDetector& detector,
+ const MotionEvent& e) = 0;
+ virtual bool OnScaleBegin(const ScaleGestureDetector& detector,
+ const MotionEvent& e) = 0;
+ virtual void OnScaleEnd(const ScaleGestureDetector& detector,
+ const MotionEvent& e) = 0;
+};
+
+// A convenience class to extend when you only want to listen for a subset of
+// scaling-related events. This implements all methods in
+// |ScaleGestureListener| but does nothing.
+// |OnScale()| returns false so that a subclass can retrieve the accumulated
+// scale factor in an overridden |OnScaleEnd()|.
+// |OnScaleBegin() returns true.
+class GESTURE_DETECTION_EXPORT SimpleScaleGestureListener
+ : public ScaleGestureListener {
+ public:
+ // ScaleGestureListener implementation.
+ virtual bool OnScale(const ScaleGestureDetector&,
+ const MotionEvent&) override;
+ virtual bool OnScaleBegin(const ScaleGestureDetector&,
+ const MotionEvent&) override;
+ virtual void OnScaleEnd(const ScaleGestureDetector&,
+ const MotionEvent&) override;
+};
+
+} // namespace ui
+
+#endif // UI_EVENTS_GESTURE_DETECTION_SCALE_GESTURE_LISTENERS_H_
« no previous file with comments | « ui/events/gesture_detection/scale_gesture_detector.cc ('k') | ui/events/gesture_detection/scale_gesture_listeners.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698