blob: 81290890642cf9440c2ebcea6d686615e93d8173 [file] [log] [blame]
The Android Open Source Project31dd5032009-03-03 19:32:27 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.launcher;
18
19/**
20 * Interface defining an object that can receive a drag.
21 *
22 */
23public interface DropTarget {
24
25 /**
26 * Handle an object being dropped on the DropTarget
27 *
28 * @param source DragSource where the drag started
29 * @param x X coordinate of the drop location
30 * @param y Y coordinate of the drop location
31 * @param xOffset Horizontal offset with the object being dragged where the original touch happened
32 * @param yOffset Vertical offset with the object being dragged where the original touch happened
33 * @param dragInfo Data associated with the object being dragged
34 *
35 */
36 void onDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo);
37
38 void onDragEnter(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo);
39
40 void onDragOver(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo);
41
42 void onDragExit(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo);
43
44 /**
45 * Indicates whether a drop action can occur at the specified location. The method
46 * {@link #onDrop(DragSource, int, int, int, int, Object)} will be invoked on this
47 * drop target only if this method returns true.
48 *
49 * @param source DragSource where the drag started
50 * @param x X coordinate of the drop location
51 * @param y Y coordinate of the drop location
52 * @param xOffset Horizontal offset with the object being dragged where the original touch happened
53 * @param yOffset Vertical offset with the object being dragged where the original touch happened
54 * @param dragInfo Data associated with the object being dragged
55 *
56 * return True if the drop is accepted, false otherwise.
57 */
58 boolean acceptDrop(DragSource source, int x, int y, int xOffset, int yOffset, Object dragInfo);
59}