Object subclass:#DropObject
instanceVariableNames:'theObject'
classVariableNames:''
poolDictionaries:''
category:'Interface-Support'
!
DropObject subclass:#Color
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
privateIn:DropObject
!
DropObject subclass:#Text
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
privateIn:DropObject
!
DropObject subclass:#Image
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
privateIn:DropObject
!
DropObject subclass:#File
instanceVariableNames:'type'
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:'queries'!
displayObject
"return my graphical representation - here a default is returned"
^ Smalltalk::Image fromFile:'bitmaps/SBrowser.xbm'
! !
!DropObject methodsFor:'testing'!
isColorObject
^ false
!
isFileObject
^ false
!
isImageObject
^ false
!
isTextObject
^ false
! !
!DropObject::Color methodsFor:'testing'!
isColorObject
^ true
! !
!DropObject::Text methodsFor:'testing'!
isTextObject
^ true
! !
!DropObject::Image methodsFor:'testing'!
isImageObject
^ true
! !
!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 class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview2/DropObject.st,v 1.2 1997-01-31 17:57:46 ca Exp $'
! !