52938
|
1 |
/*
|
|
2 |
* Copyright (c) 2002-2016, the original author or authors.
|
|
3 |
*
|
|
4 |
* This software is distributable under the BSD license. See the terms of the
|
|
5 |
* BSD license in the documentation provided with this software.
|
|
6 |
*
|
58903
|
7 |
* https://opensource.org/licenses/BSD-3-Clause
|
52938
|
8 |
*/
|
|
9 |
package jdk.internal.org.jline.terminal;
|
|
10 |
|
|
11 |
import java.util.EnumSet;
|
|
12 |
|
|
13 |
public class MouseEvent {
|
|
14 |
|
|
15 |
public enum Type {
|
|
16 |
Released,
|
|
17 |
Pressed,
|
|
18 |
Wheel,
|
|
19 |
Moved,
|
|
20 |
Dragged
|
|
21 |
}
|
|
22 |
|
|
23 |
public enum Button {
|
|
24 |
NoButton,
|
|
25 |
Button1,
|
|
26 |
Button2,
|
|
27 |
Button3,
|
|
28 |
WheelUp,
|
|
29 |
WheelDown
|
|
30 |
}
|
|
31 |
|
|
32 |
public enum Modifier {
|
|
33 |
Shift,
|
|
34 |
Alt,
|
|
35 |
Control
|
|
36 |
}
|
|
37 |
|
|
38 |
private final Type type;
|
|
39 |
private final Button button;
|
|
40 |
private final EnumSet<Modifier> modifiers;
|
|
41 |
private final int x;
|
|
42 |
private final int y;
|
|
43 |
|
|
44 |
public MouseEvent(Type type, Button button, EnumSet<Modifier> modifiers, int x, int y) {
|
|
45 |
this.type = type;
|
|
46 |
this.button = button;
|
|
47 |
this.modifiers = modifiers;
|
|
48 |
this.x = x;
|
|
49 |
this.y = y;
|
|
50 |
}
|
|
51 |
|
|
52 |
public Type getType() {
|
|
53 |
return type;
|
|
54 |
}
|
|
55 |
|
|
56 |
public Button getButton() {
|
|
57 |
return button;
|
|
58 |
}
|
|
59 |
|
|
60 |
public EnumSet<Modifier> getModifiers() {
|
|
61 |
return modifiers;
|
|
62 |
}
|
|
63 |
|
|
64 |
public int getX() {
|
|
65 |
return x;
|
|
66 |
}
|
|
67 |
|
|
68 |
public int getY() {
|
|
69 |
return y;
|
|
70 |
}
|
|
71 |
|
|
72 |
@Override
|
|
73 |
public String toString() {
|
|
74 |
return "MouseEvent[" +
|
|
75 |
"type=" + type +
|
|
76 |
", button=" + button +
|
|
77 |
", modifiers=" + modifiers +
|
|
78 |
", x=" + x +
|
|
79 |
", y=" + y +
|
|
80 |
']';
|
|
81 |
}
|
|
82 |
}
|