double-click support
[fanfix.git] / src / jexer / event / TMouseEvent.java
index 59e35161095095af262672674147b330673b4de4..e4b44833fe4a0893e58de6c53df28858069a6ca8 100644 (file)
@@ -3,7 +3,7 @@
  *
  * The MIT License (MIT)
  *
- * Copyright (C) 2016 Kevin Lamonte
+ * Copyright (C) 2017 Kevin Lamonte
  *
  * Permission is hereby granted, free of charge, to any person obtaining a
  * copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,12 @@ public final class TMouseEvent extends TInputEvent {
         /**
          * Mouse button up.  X and Y will have screen coordinates.
          */
-        MOUSE_UP
+        MOUSE_UP,
+
+        /**
+         * Mouse double-click.  X and Y will have screen coordinates.
+         */
+        MOUSE_DOUBLE_CLICK
     }
 
     /**
@@ -135,6 +140,15 @@ public final class TMouseEvent extends TInputEvent {
         return absoluteX;
     }
 
+    /**
+     * Set absoluteX.
+     *
+     * @param absoluteX the new value
+     */
+    public void setAbsoluteX(final int absoluteX) {
+        this.absoluteX = absoluteX;
+    }
+
     /**
      * Mouse Y - absolute screen coordinate.
      */
@@ -149,6 +163,15 @@ public final class TMouseEvent extends TInputEvent {
         return absoluteY;
     }
 
+    /**
+     * Set absoluteY.
+     *
+     * @param absoluteY the new value
+     */
+    public void setAbsoluteY(final int absoluteY) {
+        this.absoluteY = absoluteY;
+    }
+
     /**
      * Mouse button 1 (left button).
      */
@@ -250,6 +273,17 @@ public final class TMouseEvent extends TInputEvent {
         this.mouseWheelDown     = mouseWheelDown;
     }
 
+    /**
+     * Create a duplicate instance.
+     *
+     * @return duplicate intance
+     */
+    public TMouseEvent dup() {
+        TMouseEvent mouse = new TMouseEvent(type, x, y, absoluteX, absoluteY,
+            mouse1, mouse2, mouse3, mouseWheelUp, mouseWheelDown);
+        return mouse;
+    }
+
     /**
      * Make human-readable description of this TMouseEvent.
      *