diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-11-04 18:55:49 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2006-11-04 18:55:49 +0000 |
commit | 237bdd93058f891ae4567cf4e051c5831bd4646b (patch) | |
tree | 61bf13ecf1942efef4ef00642e2ff0f4318a9fb7 /java/awt/dnd/DragSourceContext.java | |
parent | e36d2a50b5a1a677c7ecaf926e73a5dac386c1ef (diff) | |
download | classpath-237bdd93058f891ae4567cf4e051c5831bd4646b.tar.gz |
2006-11-04 Andrew John Hughes <gnu_andrew@member.fsf.org>
* Merge of HEAD-->generics-branch for 2006/10/29 to 2006/11/04.
Diffstat (limited to 'java/awt/dnd/DragSourceContext.java')
-rw-r--r-- | java/awt/dnd/DragSourceContext.java | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/java/awt/dnd/DragSourceContext.java b/java/awt/dnd/DragSourceContext.java index 1fee5c0c3..ed1cbaa44 100644 --- a/java/awt/dnd/DragSourceContext.java +++ b/java/awt/dnd/DragSourceContext.java @@ -38,8 +38,6 @@ exception statement from your version. */ package java.awt.dnd; -import gnu.classpath.NotImplementedException; - import java.awt.Component; import java.awt.Cursor; import java.awt.Image; @@ -268,7 +266,8 @@ public class DragSourceContext for (int i = 0; i < dsl.length; i++) dsl[i].dragExit(e); - updateCurrentCursor(0, 0, DEFAULT); + updateCurrentCursor(DnDConstants.ACTION_NONE, DnDConstants.ACTION_NONE, + DEFAULT); } /** @@ -340,26 +339,45 @@ public class DragSourceContext * @param status - the status of the cursor (constant). */ protected void updateCurrentCursor(int dropOp, int targetAct, int status) - throws NotImplementedException { - // FIXME: Not implemented fully - if (!useCustomCursor) + if (! useCustomCursor) { - Cursor cursor = null; + Cursor newCursor = null; switch (status) { + default: + targetAct = DnDConstants.ACTION_NONE; case ENTER: - break; case CHANGED: - break; case OVER: - break; - default: - break; + int action = dropOp & targetAct; + if (action == DnDConstants.ACTION_NONE) + { + if ((dropOp & DnDConstants.ACTION_LINK) != 0) + newCursor = DragSource.DefaultLinkNoDrop; + else if ((dropOp & DnDConstants.ACTION_MOVE) != 0) + newCursor = DragSource.DefaultMoveNoDrop; + else + newCursor = DragSource.DefaultCopyNoDrop; + } + else + { + if ((dropOp & DnDConstants.ACTION_LINK) != 0) + newCursor = DragSource.DefaultLinkDrop; + else if ((dropOp & DnDConstants.ACTION_MOVE) != 0) + newCursor = DragSource.DefaultMoveDrop; + else + newCursor = DragSource.DefaultCopyDrop; + } } - this.cursor = cursor; - peer.setCursor(cursor); + if (cursor == null || ! cursor.equals(newCursor)) + { + cursor = newCursor; + DragSourceContextPeer p = peer; + if (p != null) + p.setCursor(cursor); + } } } } // class DragSourceContext |