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 public final class WCMouseEvent {
  29 
  30     // id
  31     public final static int MOUSE_PRESSED = 0;
  32     public final static int MOUSE_RELEASED = 1;
  33     public final static int MOUSE_MOVED = 2;
  34     public final static int MOUSE_DRAGGED = 3;
  35     public final static int MOUSE_WHEEL = 4;
  36 
  37     // button
  38     public final static int NOBUTTON = 0;
  39     public final static int BUTTON1 = 1;
  40     public final static int BUTTON2 = 2;
  41     public final static int BUTTON3 = 4;
  42 
  43     private final int id;
  44     private final long when;
  45 
  46     private final int button;
  47     private final int clickCount;
  48 
  49     private final int x;
  50     private final int y;
  51     private final int screenX;
  52     private final int screenY;
  53 
  54     private final boolean shift;
  55     private final boolean control;
  56     private final boolean alt;
  57     private final boolean meta;
  58 
  59     private final boolean popupTrigger;
  60 
  61     public WCMouseEvent(int id, int button, int clickCount, int x, int y, int screenX, int screenY,
  62                         long when, boolean shift, boolean control, boolean alt, boolean meta, boolean popupTrigger)
  63     {
  64         this.id = id;
  65         this.button = button;
  66         this.clickCount = clickCount;
  67         this.x = x;
  68         this.y = y;
  69         this.screenX = screenX;
  70         this.screenY = screenY;
  71         this.when = when;
  72         this.shift = shift;
  73         this.control = control;
  74         this.alt = alt;
  75         this.meta = meta;
  76         this.popupTrigger = popupTrigger;
  77     }
  78 
  79     public int getID() { return id; }
  80     public long getWhen() { return when; }
  81 
  82     public int getButton() { return button; }
  83     public int getClickCount() { return clickCount; }
  84 
  85     public int getX() { return x; }
  86     public int getY() { return y; }
  87     public int getScreenX() { return screenX; }
  88     public int getScreenY() { return screenY; }
  89 
  90     public boolean isShiftDown() { return shift; }
  91     public boolean isControlDown() { return control; }
  92     public boolean isAltDown() { return alt; }
  93     public boolean isMetaDown() { return meta; }
  94 
  95     public boolean isPopupTrigger() { return popupTrigger; }
  96 }