gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] libvob/org/nongnu/libvob/mouse MouseMultiplexer...


From: Tuomas J. Lukka
Subject: [Gzz-commits] libvob/org/nongnu/libvob/mouse MouseMultiplexer...
Date: Wed, 06 Aug 2003 03:25:21 -0400

CVSROOT:        /cvsroot/libvob
Module name:    libvob
Branch:         
Changes by:     Tuomas J. Lukka <address@hidden>        03/08/06 03:25:21

Modified files:
        org/nongnu/libvob/mouse: MouseMultiplexer.java 

Log message:
        javadoc

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/libvob/libvob/org/nongnu/libvob/mouse/MouseMultiplexer.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: libvob/org/nongnu/libvob/mouse/MouseMultiplexer.java
diff -u libvob/org/nongnu/libvob/mouse/MouseMultiplexer.java:1.1 
libvob/org/nongnu/libvob/mouse/MouseMultiplexer.java:1.2
--- libvob/org/nongnu/libvob/mouse/MouseMultiplexer.java:1.1    Tue Aug  5 
14:07:18 2003
+++ libvob/org/nongnu/libvob/mouse/MouseMultiplexer.java        Wed Aug  6 
03:25:21 2003
@@ -9,17 +9,33 @@
 /** A class to send mouse events to the listeners that want them.
  */
 public class MouseMultiplexer {
+    /** A constant representing the horizontal direction.
+     */
     public static final int HORIZONTAL = 1;
+    /** A constant representing the vertical direction.
+     */
     public static final int VERTICAL = 2;
 
-    public final static int MAXBUTTON = 3;
+    /** The largest button number accepted plus one.
+     */
+    public final static int MAXBUTTON = 4;
 
+    /** The modifier mask for shift.
+     */
     public final static int SHIFT_MASK = 1;
+    /** The modifier mask for control.
+     */
     public final static int CONTROL_MASK = 2;
+    /** The modifier mask for alt.
+     */
     public final static int ALT_MASK = 4;
 
+    /** The maximum modifier mask plus one.
+     */
     public final static int MAXMASK = 8;
 
+    /** A constant that is all modifier masks ored together.
+     */
     private final static int ALLMASK = 7;
 
     //-- Internal data structures
@@ -33,14 +49,20 @@
     private RelativeAxisListener[] wheelListeners = 
                new RelativeAxisListener[ MAXMASK ];
 
-    //-- Helper class which is used to send events to RelativeAxisListeners
-
+    /** Helper class which is used to send events to RelativeAxisListeners.
+     */
     private class RelAxisAdapter implements MousePressListener, 
MouseDragListener {
-
-       int curx, cury;
+       /** The constant to scale the motion with.
+        */
        float multx, multy;
+       /** The listeners to call when dragged.
+        */
        RelativeAxisListener listx, listy;
 
+       /** The previous mouse position.
+        */
+       int curx, cury;
+
        public MouseDragListener pressed(int x, int y) { return this; }
 
        public void startDrag(int x, int y) {
@@ -61,18 +83,26 @@
 
     }
 
+    /** If dragging, the draglistener for the current drag.
+     * Otherwise null.
+     */
     MouseDragListener currentDrag;
+    /** If dragging, the mouse button number that started the drag.
+     * Otherwise null.
+     */
     int currentDragButton;
 
     //-- Public API
 
+    /** Set a listener for mouse presses (for starting drags).
+     */
     public void setListener(int button, int modifiers, String description, 
MousePressListener l) {
        mousePressListeners[ modifiers + MAXMASK * button ] = l;
     }
 
-    public void setListener(int button, int modifiers, String description, 
MouseClickListener l) {
-       mouseClickListeners[ modifiers + MAXMASK * button ] = l;
-    }
+    /** Set a listener for mouse drags, translating one of the axes of the drag
+     * to the RelativeAxisListener.
+     */
     public void setListener(int button, int modifiers, int dir, float 
multiplier,
                                String description, RelativeAxisListener l) {
        int ind = modifiers + MAXMASK * button;
@@ -88,11 +118,21 @@
        }
     }
 
+    /** Set a listener for mouse clicks.
+     */
+    public void setListener(int button, int modifiers, String description, 
MouseClickListener l) {
+       mouseClickListeners[ modifiers + MAXMASK * button ] = l;
+    }
+
+    /** Set a listener for the mouse wheel.
+     */
     public void setWheelListener(int modifiers, String description, 
RelativeAxisListener l) {
        wheelListeners[modifiers] = l;
     }
 
-
+    /** Send an event to the correct listener.
+     * @return true if the event was used by this multiplexer.
+     */
     public boolean deliverEvent(VobMouseEvent e) {
        if(e.getType() == e.MOUSE_PRESSED) {
            // Ignore second button while dragging




reply via email to

[Prev in Thread] Current Thread [Next in Thread]