intitial checkin
authorca
Fri, 31 Jan 1997 17:02:29 +0100
changeset 395 bd27655f4354
parent 394 0539d7b29aa7
child 396 77043c4aca02
intitial checkin
DropObject.st
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DropObject.st	Fri Jan 31 17:02:29 1997 +0100
@@ -0,0 +1,149 @@
+Object subclass:#DropObject
+	instanceVariableNames:'theObject'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Interface-Support'
+!
+
+DropObject subclass:#File
+	instanceVariableNames:'type'
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:DropObject
+!
+
+DropObject subclass:#Text
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:DropObject
+!
+
+DropObject subclass:#Image
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:DropObject
+!
+
+DropObject subclass:#Color
+	instanceVariableNames:''
+	classVariableNames:''
+	poolDictionaries:''
+	privateIn:DropObject
+!
+
+
+!DropObject class methodsFor:'instance creation'!
+
+new:someThing
+    "create an instance dependant 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
+!
+
+newColor:aColor
+    ^ Color new theObject:aColor
+!
+
+newFile:aFilename
+    ^ File new theObject:aFilename
+!
+
+newImage:anImageOrForm
+    ^ Image new theObject:anImageOrForm
+!
+
+newText:aTextOrString
+    ^ Text new theObject:aTextOrString
+! !
+
+!DropObject methodsFor:'accessing'!
+
+theObject
+    "return the value of the instance variable 'theObject' (automatically generated)"
+
+    ^ theObject!
+
+theObject:something
+    "set the value of the instance variable 'theObject' (automatically generated)"
+
+    theObject := something.! !
+
+!DropObject methodsFor:'testing'!
+
+isColorObject
+    ^ false
+!
+
+isFileObject
+    ^ false
+!
+
+isImageObject
+    ^ false
+!
+
+isTextObject
+    ^ false
+! !
+
+!DropObject::File methodsFor:'accessing'!
+
+theObject:aPathname
+    |file|
+
+    aPathname notNil ifTrue:[
+        file := aPathname asFilename.
+        type := OperatingSystem typeOf:(file asString).
+    ].
+    super theObject:file
+! !
+
+!DropObject::File methodsFor:'testing'!
+
+isDirectory
+    ^ type == #directory
+!
+
+isFileObject
+    ^ true
+! !
+
+!DropObject::Text methodsFor:'testing'!
+
+isTextObject
+    ^ true
+
+
+! !
+
+!DropObject::Image methodsFor:'testing'!
+
+isImageObject
+    ^ true
+
+
+! !
+
+!DropObject::Color methodsFor:'testing'!
+
+isColorObject
+    ^ true
+! !
+
+!DropObject class methodsFor:'documentation'!
+
+version
+    ^ '$Header: /cvs/stx/stx/libview2/DropObject.st,v 1.1 1997-01-31 16:02:29 ca Exp $'
+! !