1/*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23package org.netbeans.jemmy.drivers;
24
25import org.netbeans.jemmy.Timeout;
26import org.netbeans.jemmy.operators.ComponentOperator;
27
28/**
29 * Defines how to simulate mouse operations.
30 */
31public interface MouseDriver {
32
33    /**
34     * Presses mouse.
35     *
36     * @param oper Component operator.
37     * @param x Relative x coordinate.
38     * @param y Relative y coordinate.
39     * @param mouseButton mouse button ({@code InputEvent.BUTTON*_MASK}
40     * field)
41     * @param modifiers a combination of {@code InputEvent.*_MASK} fields.
42     */
43    public void pressMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers);
44
45    /**
46     * Releases mouse.
47     *
48     * @param oper Component operator.
49     * @param x Relative x coordinate.
50     * @param y Relative y coordinate.
51     * @param mouseButton mouse button ({@code InputEvent.BUTTON*_MASK}
52     * field)
53     * @param modifiers a combination of {@code InputEvent.*_MASK} fields.
54     */
55    public void releaseMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers);
56
57    /**
58     * Clicks mouse.
59     *
60     * @param oper Component operator.
61     * @param x Relative x coordinate.
62     * @param y Relative y coordinate.
63     * @param clickCount How many times to click.
64     * @param mouseButton mouse button ({@code InputEvent.BUTTON*_MASK}
65     * field)
66     * @param modifiers a combination of {@code InputEvent.*_MASK} fields.
67     * @param mouseClick Time between pressing and releasing mouse.
68     */
69    public void clickMouse(ComponentOperator oper, int x, int y, int clickCount, int mouseButton,
70            int modifiers, Timeout mouseClick);
71
72    /**
73     * Moves mouse.
74     *
75     * @param oper Component operator.
76     * @param x Relative x coordinate.
77     * @param y Relative y coordinate.
78     */
79    public void moveMouse(ComponentOperator oper, int x, int y);
80
81    /**
82     * Drags mouse.
83     *
84     * @param oper Component operator.
85     * @param x Relative x coordinate.
86     * @param y Relative y coordinate.
87     * @param mouseButton mouse button ({@code InputEvent.BUTTON*_MASK}
88     * field)
89     * @param modifiers a combination of {@code InputEvent.*_MASK} fields.
90     */
91    public void dragMouse(ComponentOperator oper, int x, int y, int mouseButton, int modifiers);
92
93    /**
94     * Performs drag'n'drop.
95     *
96     * @param oper Component operator.
97     * @param start_x Relative x coordinate of start point.
98     * @param start_y Relative y coordinate of start point.
99     * @param end_x Relative x coordinate of end point.
100     * @param end_y Relative y coordinate of end point.
101     * @param mouseButton mouse button ({@code InputEvent.BUTTON*_MASK}
102     * field)
103     * @param modifiers a combination of {@code InputEvent.*_MASK} fields.
104     * @param before Time to sleep after taking (before dragging)
105     * @param after Time to sleep before dropping (after dragging)
106     */
107    public void dragNDrop(ComponentOperator oper, int start_x, int start_y, int end_x, int end_y,
108            int mouseButton, int modifiers, Timeout before, Timeout after);
109
110    /**
111     * Moves mouse inside a component.
112     *
113     * @param oper Component operator.
114     */
115    public void enterMouse(ComponentOperator oper);
116
117    /**
118     * Moves mouse outside a component.
119     *
120     * @param oper Component operator.
121     */
122    public void exitMouse(ComponentOperator oper);
123}
124