net.xoetrope.swt
Class XHotspotImage

java.lang.Object
  extended by org.eclipse.swt.widgets.Widget
      extended by org.eclipse.swt.widgets.Control
          extended by org.eclipse.swt.widgets.Scrollable
              extended by org.eclipse.swt.widgets.Composite
                  extended by org.eclipse.swt.widgets.Canvas
                      extended by net.xoetrope.swt.XImage
                          extended by net.xoetrope.swt.XHotspotImage
All Implemented Interfaces:
java.util.EventListener, XAttributedComponent, XImageHolder, org.eclipse.swt.events.MouseMoveListener, org.eclipse.swt.graphics.Drawable, org.eclipse.swt.internal.SWTEventListener
Direct Known Subclasses:
XImageMap

public class XHotspotImage
extends XImage
implements org.eclipse.swt.events.MouseMoveListener

A widget for displaying an image and associating hotspots at coordinates specified in an external file

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt


Field Summary
protected  int currentHotspotIdx
          true to draw the hotspots as highlighted areas
protected static org.eclipse.swt.graphics.Cursor defaultCursor
          The default cursor
protected static org.eclipse.swt.graphics.Cursor handCursor
          The default pointer - the hand cursor
protected  java.util.Vector hotspots
          The hotspots
protected  java.util.Vector names
          The hotspot names
protected  java.util.Vector tooltips
          The hotspot tooltiptexts
 
Fields inherited from class net.xoetrope.swt.XImage
currentProject
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
XHotspotImage(java.lang.Object parent)
          Constructor.
 
Method Summary
protected  void addCustomHotspot(XmlElement ele)
          Add a custom hotspot
 int checkHotspot(org.eclipse.swt.events.MouseEvent e)
          Check the mouse event with the hotspots
 java.lang.String getName(int i)
          Get the name of a hotspot
 void mouseMove(org.eclipse.swt.events.MouseEvent e)
          Refresh the display when the mouse moves
 void read(java.io.Reader r)
          Read a file to store the hotspots
 
Methods inherited from class net.xoetrope.swt.XImage
checkSubclass, paint, setAttribute, setImage
 
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, scroll, setCaret, setFont
 
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, computeSize, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

currentHotspotIdx

protected int currentHotspotIdx
true to draw the hotspots as highlighted areas


handCursor

protected static org.eclipse.swt.graphics.Cursor handCursor
The default pointer - the hand cursor


defaultCursor

protected static org.eclipse.swt.graphics.Cursor defaultCursor
The default cursor


hotspots

protected java.util.Vector hotspots
The hotspots


names

protected java.util.Vector names
The hotspot names


tooltips

protected java.util.Vector tooltips
The hotspot tooltiptexts

Constructor Detail

XHotspotImage

public XHotspotImage(java.lang.Object parent)
Constructor. Sets cursors and creates the Vector which stores the hotspots. Adds a new MouseListener to the image

Parameters:
parent - parent object
Method Detail

mouseMove

public void mouseMove(org.eclipse.swt.events.MouseEvent e)
Refresh the display when the mouse moves

Specified by:
mouseMove in interface org.eclipse.swt.events.MouseMoveListener

checkHotspot

public int checkHotspot(org.eclipse.swt.events.MouseEvent e)
Check the mouse event with the hotspots

Parameters:
e - MouseEvent
Returns:
index of the hotspot

read

public void read(java.io.Reader r)
Read a file to store the hotspots

Parameters:
r - Reader

addCustomHotspot

protected void addCustomHotspot(XmlElement ele)
Add a custom hotspot

Parameters:
ele - XmlElement

getName

public java.lang.String getName(int i)
Get the name of a hotspot

Parameters:
i - index of the hotspot
Returns:
name