uk.co.caprica.vlcj.runtime.windows
Class WindowsMouseHook

java.lang.Object
  extended by uk.co.caprica.vlcj.runtime.windows.WindowsMouseHook
All Implemented Interfaces:
com.sun.jna.AltCallingConvention, com.sun.jna.Callback, com.sun.jna.platform.win32.WinUser.HOOKPROC, com.sun.jna.win32.StdCall, com.sun.jna.win32.StdCallLibrary.StdCallCallback, LowLevelMouseProc

public class WindowsMouseHook
extends java.lang.Object
implements LowLevelMouseProc

Windows Mouse Hook implementation.

This implementation registers a Windows hook and translates the native mouse messages into Java mouse/mouse-motion events.

Not all events are supported, the events that are supported are:

Any listeners added must execute and return quickly since they will be executing as part of the native event queue.

There are several deficiencies that could be addressed:

The hook must be started after it has been created.

This class is experimental, unsupported and unstable in operation.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.sun.jna.Callback
com.sun.jna.Callback.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from interface uk.co.caprica.vlcj.runtime.windows.internal.LowLevelMouseProc
WM_LBUTTONDOWN, WM_LBUTTONUP, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MOUSEMOVE, WM_MOUSEWHEEL, WM_RBUTTONDOWN, WM_RBUTTONUP
 
Fields inherited from interface com.sun.jna.Callback
FORBIDDEN_NAMES, METHOD_NAME
 
Constructor Summary
WindowsMouseHook(java.awt.Component relativeTo)
          Create a new mouse hook.
 
Method Summary
 void addMouseListener(java.awt.event.MouseListener listener)
           
 void addMouseMotionListener(java.awt.event.MouseMotionListener listener)
           
 void addMouseWheelListener(java.awt.event.MouseWheelListener listener)
           
 com.sun.jna.platform.win32.WinDef.LRESULT callback(int nCode, com.sun.jna.platform.win32.WinDef.WPARAM wParam, MSLLHOOKSTRUCT lParam)
           
 void release()
           
 void removeMouseListener(java.awt.event.MouseListener listener)
           
 void removeMouseMotionListener(java.awt.event.MouseMotionListener listener)
           
 void removeMouseWheelListener(java.awt.event.MouseWheelListener listener)
           
 void start()
          Start the hook.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowsMouseHook

public WindowsMouseHook(java.awt.Component relativeTo)
Create a new mouse hook.

Parameters:
relativeTo - component to report mouse coordinates relative to
Method Detail

addMouseListener

public void addMouseListener(java.awt.event.MouseListener listener)
Parameters:
listener -

removeMouseListener

public void removeMouseListener(java.awt.event.MouseListener listener)
Parameters:
listener -

addMouseMotionListener

public void addMouseMotionListener(java.awt.event.MouseMotionListener listener)
Parameters:
listener -

removeMouseMotionListener

public void removeMouseMotionListener(java.awt.event.MouseMotionListener listener)
Parameters:
listener -

addMouseWheelListener

public void addMouseWheelListener(java.awt.event.MouseWheelListener listener)
Parameters:
listener -

removeMouseWheelListener

public void removeMouseWheelListener(java.awt.event.MouseWheelListener listener)
Parameters:
listener -

start

public void start()
Start the hook.


release

public void release()

callback

public com.sun.jna.platform.win32.WinDef.LRESULT callback(int nCode,
                                                          com.sun.jna.platform.win32.WinDef.WPARAM wParam,
                                                          MSLLHOOKSTRUCT lParam)
Specified by:
callback in interface LowLevelMouseProc
Returns:

(C)2010 Caprica Software Limited