1 // Copyright 2013 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 package org.chromium.chrome.browser.compositor.layouts.eventfilter; 6 7 /** 8 * Interface that describes gesture callbacks. 9 */ 10 public interface GestureHandler { 11 12 /** 13 * Called on down touch event. 14 * 15 * @param x The X position of the event in the host view space in dp. 16 * @param y The Y position of the event in the host view space in dp. 17 * @param fromMouse Whether the event originates from a mouse. 18 * @param buttons State of all buttons that are pressed. 19 */ onDown(float x, float y, boolean fromMouse, int buttons)20 void onDown(float x, float y, boolean fromMouse, int buttons); 21 22 /** 23 * Called on up or cancel touch event. 24 */ onUpOrCancel()25 void onUpOrCancel(); 26 27 /** 28 * Called on drag/scroll touch event 29 * 30 * @param x The X position of the event in the host view space in dp. 31 * @param y The Y position of the event in the host view space in dp. 32 * @param dx The change in X since the last movement event. 33 * @param dy The change in Y since the last movement event. 34 * @param tx The total change in X since the start of this drag. 35 * @param ty The total change in Y since the start of this drag. 36 */ drag(float x, float y, float dx, float dy, float tx, float ty)37 void drag(float x, float y, float dx, float dy, float tx, float ty); 38 39 /** 40 * Called on click touch event. 41 * 42 * @param x The X position of the event in the host view space in dp. 43 * @param y The Y position of the event in the host view space in dp. 44 * @param fromMouse Whether the event originates from a mouse. 45 * @param buttons State of all buttons that were pressed when onDown was invoked. 46 */ click(float x, float y, boolean fromMouse, int buttons)47 void click(float x, float y, boolean fromMouse, int buttons); 48 49 /** 50 * Called on fling touch event. 51 * 52 * @param x The X position of the event in the host view space in dp. 53 * @param y The Y position of the event in the host view space in dp. 54 * @param velocityX 55 * @param velocityY 56 */ fling(float x, float y, float velocityX, float velocityY)57 void fling(float x, float y, float velocityX, float velocityY); 58 59 /** 60 * Called on long press touch event. 61 * 62 * @param x The X position of the event in the host view space in dp. 63 * @param y The Y position of the event in the host view space in dp. 64 */ onLongPress(float x, float y)65 void onLongPress(float x, float y); 66 67 /** 68 * Called on pinch touch event. 69 * 70 * @param x0 The X position of the first finger in the host view space in dp. 71 * @param y0 The Y position of the first finger in the host view space in dp. 72 * @param x1 The X position of the second finger in the host view space in dp. 73 * @param y1 The Y position of the second finger in the host view space in dp. 74 * @param firstEvent Whether the onPinch call is the first of multiple. 75 */ onPinch(float x0, float y0, float x1, float y1, boolean firstEvent)76 void onPinch(float x0, float y0, float x1, float y1, boolean firstEvent); 77 } 78