15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package sun.lwawt.macosx;
27
28 import java.awt.event.*;
29
30 /**
31 * A class representing Cocoa NSEvent class with the fields only necessary for
32 * JDK functionality.
33 */
34 final class NSEvent {
35 private int type;
36 private int modifierFlags;
37
38 // Mouse event information
39 private int clickCount;
40 private int buttonNumber;
41 private int x;
42 private int y;
43 private double scrollDeltaY;
44 private double scrollDeltaX;
45 private int absX;
46 private int absY;
47
48 // Key event information
49 private short keyCode;
50 private String characters;
51 private String charactersIgnoringModifiers;
52
53 // Called from native
54 NSEvent(int type, int modifierFlags, short keyCode, String characters, String charactersIgnoringModifiers) {
55 this.type = type;
56 this.modifierFlags = modifierFlags;
57 this.keyCode = keyCode;
58 this.characters = characters;
59 this.charactersIgnoringModifiers = charactersIgnoringModifiers;
60 }
61
62 // Called from native
63 NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
64 int x, int y, int absX, int absY,
65 double scrollDeltaY, double scrollDeltaX) {
66 this.type = type;
67 this.modifierFlags = modifierFlags;
68 this.clickCount = clickCount;
69 this.buttonNumber = buttonNumber;
70 this.x = x;
71 this.y = y;
72 this.absX = absX;
73 this.absY = absY;
74 this.scrollDeltaY = scrollDeltaY;
75 this.scrollDeltaX = scrollDeltaX;
76 }
77
78 int getType() {
79 return type;
80 }
81
82 int getModifierFlags() {
83 return modifierFlags;
84 }
85
86 int getClickCount() {
87 return clickCount;
88 }
89
90 int getButtonNumber() {
91 return buttonNumber;
92 }
93
94 int getX() {
95 return x;
96 }
97
98 int getY() {
99 return y;
100 }
101
102 double getScrollDeltaY() {
103 return scrollDeltaY;
104 }
105
106 double getScrollDeltaX() {
107 return scrollDeltaX;
108 }
109
110 int getAbsX() {
111 return absX;
112 }
113
114 int getAbsY() {
115 return absY;
116 }
117
118 short getKeyCode() {
119 return keyCode;
120 }
121
122 String getCharactersIgnoringModifiers() {
123 return charactersIgnoringModifiers;
124 }
125
126 String getCharacters() {
127 return characters;
128 }
129
|
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package sun.lwawt.macosx;
27
28 import java.awt.event.*;
29
30 /**
31 * A class representing Cocoa NSEvent class with the fields only necessary for
32 * JDK functionality.
33 */
34 final class NSEvent {
35
36 static final int SCROLL_PHASE_UNSUPPORTED = 1;
37 static final int SCROLL_PHASE_BEGAN = 2;
38 static final int SCROLL_PHASE_CONTINUED = 3;
39 static final int SCROLL_MASK_PHASE_CANCELLED = 4;
40 static final int SCROLL_MASK_PHASE_ENDED = 5;
41
42 private int type;
43 private int modifierFlags;
44
45 // Mouse event information
46 private int clickCount;
47 private int buttonNumber;
48 private int x;
49 private int y;
50 private double scrollDeltaY;
51 private double scrollDeltaX;
52 private int scrollPhase;
53 private int absX;
54 private int absY;
55
56 // Key event information
57 private short keyCode;
58 private String characters;
59 private String charactersIgnoringModifiers;
60
61 // Called from native
62 NSEvent(int type, int modifierFlags, short keyCode, String characters, String charactersIgnoringModifiers) {
63 this.type = type;
64 this.modifierFlags = modifierFlags;
65 this.keyCode = keyCode;
66 this.characters = characters;
67 this.charactersIgnoringModifiers = charactersIgnoringModifiers;
68 }
69
70 // Called from native
71 NSEvent(int type, int modifierFlags, int clickCount, int buttonNumber,
72 int x, int y, int absX, int absY,
73 double scrollDeltaY, double scrollDeltaX, int scrollPhase) {
74 this.type = type;
75 this.modifierFlags = modifierFlags;
76 this.clickCount = clickCount;
77 this.buttonNumber = buttonNumber;
78 this.x = x;
79 this.y = y;
80 this.absX = absX;
81 this.absY = absY;
82 this.scrollDeltaY = scrollDeltaY;
83 this.scrollDeltaX = scrollDeltaX;
84 this.scrollPhase = scrollPhase;
85 }
86
87 int getType() {
88 return type;
89 }
90
91 int getModifierFlags() {
92 return modifierFlags;
93 }
94
95 int getClickCount() {
96 return clickCount;
97 }
98
99 int getButtonNumber() {
100 return buttonNumber;
101 }
102
103 int getX() {
104 return x;
105 }
106
107 int getY() {
108 return y;
109 }
110
111 double getScrollDeltaY() {
112 return scrollDeltaY;
113 }
114
115 double getScrollDeltaX() {
116 return scrollDeltaX;
117 }
118
119 int getScrollPhase() {
120 return scrollPhase;
121 }
122
123 int getAbsX() {
124 return absX;
125 }
126
127 int getAbsY() {
128 return absY;
129 }
130
131 short getKeyCode() {
132 return keyCode;
133 }
134
135 String getCharactersIgnoringModifiers() {
136 return charactersIgnoringModifiers;
137 }
138
139 String getCharacters() {
140 return characters;
141 }
142
|