ewe.ui
Class DragContext

java.lang.Object
  extended byewe.ui.DragContext
Direct Known Subclasses:
ImageDragContext

public class DragContext
extends Object


Nested Class Summary
static class DragContext.ImageDragInWindow
           
 
Field Summary
 boolean cancelled
           
 Point curPoint
           
 Object dataToDrag
          Used for Drag and Drop - this is any data to be dragged.
 boolean didDrag
           
 int dragCursor
          Used for Drag and Drop - if this is not 0 then it will be used as the special drag and drop mouse pointer.
 Object dragData
          You can use this for attaching custom data to your drag.
 String dropAction
           
 MenuItem[] dropOptions
          Used for Drag and Drop - these are options to display when the data is dropped.
 boolean isCopy
          Used for Drag and Drop - this indicates that a copy of the data should be dragged.
 boolean isMultiple
          Used for Drag and Drop - this indicates that any data being dragged should be considered multiple data.
 int lastDragTime
           
 int modifiers
           
static MenuItem[] moveOrCopyOptions
           
static int NoDragOver
          This is a possible modifier.
 PenEvent penEvent
           
 Point point1
           
 Point point2
           
 Point prevPoint
           
 int rate
           
 int resolution
           
 Point start
           
 
Constructor Summary
DragContext()
           
DragContext(PenEvent ev)
           
 
Method Summary
 void clearPendingDrags()
          This clears all pending drag messages to this window.
 DragContext.ImageDragInWindow getImageDrag()
          Get the current ImageDragInWindow if there is one.
 boolean hasDragged(Point newPoint)
           
 void imageDrag()
          Call this within the dragged(DragContext dc) to continue dragging the same image.
 void imageDrag(IImage newImage, Point cursorInImage)
          Call this within the dragged(DragContext dc) to drag a new Image.
 void set(PenEvent ev)
           
 void set(PenEvent ev, Point where)
           
 void setDropOptions(boolean alwaysShow, boolean showIfNoMouse)
          Sets up the standard Copy, Move, Cancel DragAndDrop popup menu.
 void setDropOptions(MenuItem[] options, boolean alwaysShow, boolean showIfNoMouse)
          Sets up the drag and drop menu options.
 DragContext.ImageDragInWindow startImageDrag(DragContext.ImageDragInWindow dw)
          Start dragging an Image around the window.
 DragContext.ImageDragInWindow startImageDrag(IImage drag, Point cursorInImage, Control c)
          Start dragging an Image around the window.
 void stopImageDrag()
          Stop dragging the image.
 void stopImageDrag(boolean freeImage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, toString
 

Field Detail

NoDragOver

public static final int NoDragOver
This is a possible modifier.

See Also:
Constant Field Values

dataToDrag

public Object dataToDrag
Used for Drag and Drop - this is any data to be dragged.


isMultiple

public boolean isMultiple
Used for Drag and Drop - this indicates that any data being dragged should be considered multiple data.


isCopy

public boolean isCopy
Used for Drag and Drop - this indicates that a copy of the data should be dragged.


dropOptions

public MenuItem[] dropOptions
Used for Drag and Drop - these are options to display when the data is dropped. If this is null then no menu will be displayed when the pen/mouse is released.


dragCursor

public int dragCursor
Used for Drag and Drop - if this is not 0 then it will be used as the special drag and drop mouse pointer.


dragData

public Object dragData
You can use this for attaching custom data to your drag.


modifiers

public int modifiers

start

public Point start

prevPoint

public Point prevPoint

curPoint

public Point curPoint

point1

public Point point1

point2

public Point point2

didDrag

public boolean didDrag

resolution

public int resolution

rate

public int rate

lastDragTime

public int lastDragTime

penEvent

public PenEvent penEvent

cancelled

public boolean cancelled

moveOrCopyOptions

public static MenuItem[] moveOrCopyOptions

dropAction

public String dropAction
Constructor Detail

DragContext

public DragContext()

DragContext

public DragContext(PenEvent ev)
Method Detail

setDropOptions

public void setDropOptions(MenuItem[] options,
                           boolean alwaysShow,
                           boolean showIfNoMouse)
Sets up the drag and drop menu options.

Parameters:
alwaysShow - true if you want the menu to show unconditionally. If it is false the menu will only show if the right mouse button is used to drag the data.
showIfNoMouse - true if you want the menu to show if the system is pen based.

setDropOptions

public void setDropOptions(boolean alwaysShow,
                           boolean showIfNoMouse)
Sets up the standard Copy, Move, Cancel DragAndDrop popup menu.

Parameters:
alwaysShow - true if you want the menu to show unconditionally. If it is false the menu will only show if the right mouse button is used to drag the data.
showIfNoMouse - true if you want the menu to show if the system is pen based.

set

public void set(PenEvent ev,
                Point where)

set

public void set(PenEvent ev)

hasDragged

public boolean hasDragged(Point newPoint)

getImageDrag

public DragContext.ImageDragInWindow getImageDrag()
Get the current ImageDragInWindow if there is one.


startImageDrag

public DragContext.ImageDragInWindow startImageDrag(IImage drag,
                                                    Point cursorInImage,
                                                    Control c)
Start dragging an Image around the window. This should be called from the startDragging() method of the calling control.

Parameters:
drag - The image to drag.
cursorInImage - The location in pixels of the cursor point within the image.
c - The control from which the image is being dragged.
Returns:
An ImageDragInWindow context which the DragContext will be using for the drag.

startImageDrag

public DragContext.ImageDragInWindow startImageDrag(DragContext.ImageDragInWindow dw)
Start dragging an Image around the window. This should be called from the startDragging() method of the calling control.

Parameters:
dw - The ImageDragInWindow object used for dragging the image.
Returns:
The dw parameter.

imageDrag

public void imageDrag()
Call this within the dragged(DragContext dc) to continue dragging the same image.


imageDrag

public void imageDrag(IImage newImage,
                      Point cursorInImage)
Call this within the dragged(DragContext dc) to drag a new Image. If newImage is null or the same as the previous image this will have the same effect as imageDrag().

Parameters:
newImage - The new image to drag.
cursorInImage - The position of the mouse pointer within the new image.

stopImageDrag

public void stopImageDrag()
Stop dragging the image. The area under the image is repainted and dragging resources are freed. The image will also be freed.


stopImageDrag

public void stopImageDrag(boolean freeImage)

clearPendingDrags

public void clearPendingDrags()
This clears all pending drag messages to this window. This prevents the drag operation lagging behind the actual drag messages.