# HG changeset patch # User ca # Date 854726549 -3600 # Node ID bd27655f43547f06ba1f2566197c437f70a22bb8 # Parent 0539d7b29aa7084baab38af49b0a7de28d72d7e4 intitial checkin diff -r 0539d7b29aa7 -r bd27655f4354 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 $' +! !