395
|
1 |
Object subclass:#DropObject
|
|
2 |
instanceVariableNames:'theObject'
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'Interface-Support'
|
|
6 |
!
|
|
7 |
|
|
8 |
DropObject subclass:#File
|
|
9 |
instanceVariableNames:'type'
|
|
10 |
classVariableNames:''
|
|
11 |
poolDictionaries:''
|
|
12 |
privateIn:DropObject
|
|
13 |
!
|
|
14 |
|
|
15 |
DropObject subclass:#Text
|
|
16 |
instanceVariableNames:''
|
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
privateIn:DropObject
|
|
20 |
!
|
|
21 |
|
|
22 |
DropObject subclass:#Image
|
|
23 |
instanceVariableNames:''
|
|
24 |
classVariableNames:''
|
|
25 |
poolDictionaries:''
|
|
26 |
privateIn:DropObject
|
|
27 |
!
|
|
28 |
|
|
29 |
DropObject subclass:#Color
|
|
30 |
instanceVariableNames:''
|
|
31 |
classVariableNames:''
|
|
32 |
poolDictionaries:''
|
|
33 |
privateIn:DropObject
|
|
34 |
!
|
|
35 |
|
|
36 |
|
|
37 |
!DropObject class methodsFor:'instance creation'!
|
|
38 |
|
|
39 |
new:someThing
|
|
40 |
"create an instance dependant on something
|
|
41 |
"
|
|
42 |
|cls|
|
|
43 |
|
|
44 |
someThing isColor ifTrue:[cls := Color
|
|
45 |
] ifFalse:[someThing isImageOrForm ifTrue:[cls := Image
|
|
46 |
] ifFalse:[(someThing isKindOf:Filename) ifTrue:[cls := File
|
|
47 |
] ifFalse:[cls isString ifTrue:[cls := Text
|
|
48 |
] ifFalse:[
|
|
49 |
cls := DropObject
|
|
50 |
]]]].
|
|
51 |
|
|
52 |
^ cls new theObject:someThing
|
|
53 |
!
|
|
54 |
|
|
55 |
newColor:aColor
|
|
56 |
^ Color new theObject:aColor
|
|
57 |
!
|
|
58 |
|
|
59 |
newFile:aFilename
|
|
60 |
^ File new theObject:aFilename
|
|
61 |
!
|
|
62 |
|
|
63 |
newImage:anImageOrForm
|
|
64 |
^ Image new theObject:anImageOrForm
|
|
65 |
!
|
|
66 |
|
|
67 |
newText:aTextOrString
|
|
68 |
^ Text new theObject:aTextOrString
|
|
69 |
! !
|
|
70 |
|
|
71 |
!DropObject methodsFor:'accessing'!
|
|
72 |
|
|
73 |
theObject
|
|
74 |
"return the value of the instance variable 'theObject' (automatically generated)"
|
|
75 |
|
|
76 |
^ theObject!
|
|
77 |
|
|
78 |
theObject:something
|
|
79 |
"set the value of the instance variable 'theObject' (automatically generated)"
|
|
80 |
|
|
81 |
theObject := something.! !
|
|
82 |
|
|
83 |
!DropObject methodsFor:'testing'!
|
|
84 |
|
|
85 |
isColorObject
|
|
86 |
^ false
|
|
87 |
!
|
|
88 |
|
|
89 |
isFileObject
|
|
90 |
^ false
|
|
91 |
!
|
|
92 |
|
|
93 |
isImageObject
|
|
94 |
^ false
|
|
95 |
!
|
|
96 |
|
|
97 |
isTextObject
|
|
98 |
^ false
|
|
99 |
! !
|
|
100 |
|
|
101 |
!DropObject::File methodsFor:'accessing'!
|
|
102 |
|
|
103 |
theObject:aPathname
|
|
104 |
|file|
|
|
105 |
|
|
106 |
aPathname notNil ifTrue:[
|
|
107 |
file := aPathname asFilename.
|
|
108 |
type := OperatingSystem typeOf:(file asString).
|
|
109 |
].
|
|
110 |
super theObject:file
|
|
111 |
! !
|
|
112 |
|
|
113 |
!DropObject::File methodsFor:'testing'!
|
|
114 |
|
|
115 |
isDirectory
|
|
116 |
^ type == #directory
|
|
117 |
!
|
|
118 |
|
|
119 |
isFileObject
|
|
120 |
^ true
|
|
121 |
! !
|
|
122 |
|
|
123 |
!DropObject::Text methodsFor:'testing'!
|
|
124 |
|
|
125 |
isTextObject
|
|
126 |
^ true
|
|
127 |
|
|
128 |
|
|
129 |
! !
|
|
130 |
|
|
131 |
!DropObject::Image methodsFor:'testing'!
|
|
132 |
|
|
133 |
isImageObject
|
|
134 |
^ true
|
|
135 |
|
|
136 |
|
|
137 |
! !
|
|
138 |
|
|
139 |
!DropObject::Color methodsFor:'testing'!
|
|
140 |
|
|
141 |
isColorObject
|
|
142 |
^ true
|
|
143 |
! !
|
|
144 |
|
|
145 |
!DropObject class methodsFor:'documentation'!
|
|
146 |
|
|
147 |
version
|
|
148 |
^ '$Header: /cvs/stx/stx/libview2/DropObject.st,v 1.1 1997-01-31 16:02:29 ca Exp $'
|
|
149 |
! !
|