1 /* 2 * Copyright (c) 2011, 2014, 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. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 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 com.sun.webkit.event; 27 28 import java.lang.annotation.Native; 29 30 public final class WCMouseEvent { 31 32 // id 33 @Native public final static int MOUSE_PRESSED = 0; 34 @Native public final static int MOUSE_RELEASED = 1; 35 @Native public final static int MOUSE_MOVED = 2; 36 @Native public final static int MOUSE_DRAGGED = 3; 37 @Native public final static int MOUSE_WHEEL = 4; 38 39 // button 40 @Native public final static int NOBUTTON = 0; 41 @Native public final static int BUTTON1 = 1; 42 @Native public final static int BUTTON2 = 2; 43 @Native public final static int BUTTON3 = 4; 44 45 private final int id; 46 private final long when; 47 48 private final int button; 49 private final int clickCount; 50 51 private final int x; 52 private final int y; 53 private final int screenX; 54 private final int screenY; 55 56 private final boolean shift; 57 private final boolean control; 58 private final boolean alt; 59 private final boolean meta; 60 61 private final boolean popupTrigger; 62 63 public WCMouseEvent(int id, int button, int clickCount, int x, int y, int screenX, int screenY, 64 long when, boolean shift, boolean control, boolean alt, boolean meta, boolean popupTrigger) 65 { 66 this.id = id; 67 this.button = button; 68 this.clickCount = clickCount; 69 this.x = x; 70 this.y = y; 71 this.screenX = screenX; 72 this.screenY = screenY; 73 this.when = when; 74 this.shift = shift; 75 this.control = control; 76 this.alt = alt; 77 this.meta = meta; 78 this.popupTrigger = popupTrigger; 79 } 80 81 public int getID() { return id; } 82 public long getWhen() { return when; } 83 84 public int getButton() { return button; } 85 public int getClickCount() { return clickCount; } 86 87 public int getX() { return x; } 88 public int getY() { return y; } 89 public int getScreenX() { return screenX; } 90 public int getScreenY() { return screenY; } 91 92 public boolean isShiftDown() { return shift; } 93 public boolean isControlDown() { return control; } 94 public boolean isAltDown() { return alt; } 95 public boolean isMetaDown() { return meta; } 96 97 public boolean isPopupTrigger() { return popupTrigger; } 98 }