--- a/DropObject.st Fri Feb 26 13:01:50 1999 +0100
+++ b/DropObject.st Fri Feb 26 13:25:27 1999 +0100
@@ -91,20 +91,24 @@
!DropObject class methodsFor:'instance creation'!
+dropObjectClassFor:someThing
+ "given something to drag&drop, return an appropriate
+ dropObject class for it."
+
+ someThing isColor ifTrue:[^ DropObject::Color].
+ someThing isImageOrForm ifTrue:[^ DropObject::Image].
+ (someThing isKindOf:Filename) ifTrue:[^ DropObject::File].
+ someThing isString ifTrue:[^ DropObject::Text].
+ ^ self
+!
+
new:someThing
"create an instance on something
"
|cls|
- someThing isColor ifTrue:[cls := Color
- ] ifFalse:[someThing isImageOrForm ifTrue:[cls := Image
- ] ifFalse:[(someThing isKindOf:Filename) ifTrue:[cls := File
- ] ifFalse:[cls isString ifTrue:[cls := Text
- ] ifFalse:[
- cls := DropObject
- ]]]].
-
- ^ cls new theObject:someThing
+ cls := self dropObjectClassFor:someThing.
+ ^ cls new theObject:someThing
"Modified: 19.4.1997 / 17:19:55 / cg"
!
@@ -112,7 +116,7 @@
newColor:aColor
"create an instance for a color"
- ^ Color new theObject:aColor
+ ^ DropObject::Color new theObject:aColor
"Modified: 19.4.1997 / 17:20:17 / cg"
!
@@ -120,7 +124,7 @@
newFile:aFilename
"create an instance for a file or directory"
- ^ File new theObject:aFilename
+ ^ DropObject::File new theObject:aFilename
"Modified: 19.4.1997 / 17:20:28 / cg"
!
@@ -128,7 +132,7 @@
newImage:anImageOrForm
"create an instance for an image"
- ^ Image new theObject:anImageOrForm
+ ^ DropObject::Image new theObject:anImageOrForm
"Modified: 19.4.1997 / 17:20:37 / cg"
!
@@ -136,7 +140,7 @@
newText:aTextOrString
"create an instance for some text"
- ^ Text new theObject:aTextOrString
+ ^ DropObject::Text new theObject:aTextOrString
"Modified: 19.4.1997 / 17:20:46 / cg"
! !
@@ -424,5 +428,5 @@
!DropObject class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/DropObject.st,v 1.7 1998-03-30 12:02:50 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/DropObject.st,v 1.8 1999-02-26 12:25:27 cg Exp $'
! !