author | Claus Gittinger <cg@exept.de> |
Thu, 06 Mar 1997 16:18:25 +0100 | |
changeset 497 | 6544ec670fe0 |
parent 479 | 8058c8296148 |
child 503 | 23faf6064747 |
permissions | -rw-r--r-- |
88 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
100 | 3 |
All Rights Reserved |
88 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
100 | 13 |
WindowBuilder subclass:#UIBuilder |
478 | 14 |
instanceVariableNames:'view currentMenuSelector menuAspect spec specStack composite |
15 |
lastComponent compositeView' |
|
223 | 16 |
classVariableNames:'Verbose' |
17 |
poolDictionaries:'' |
|
18 |
category:'Interface-Support-UI' |
|
66 | 19 |
! |
20 |
||
21 |
!UIBuilder class methodsFor:'documentation'! |
|
22 |
||
125 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
88 | 35 |
! |
36 |
||
66 | 37 |
documentation |
38 |
" |
|
39 |
this class will (eventually) allow parsing windowSpecs as |
|
40 |
created by ST-80's UIPainter, and thereby allow to run applications |
|
41 |
built with this tool. |
|
42 |
It was created to allow execution of PD applications which were |
|
43 |
written using that tool (and more and more are appearing ...). |
|
44 |
||
45 |
The class is not completed yet and certainly not bug free. |
|
46 |
Also, it is not quaranteed that all winSpecs are understood. |
|
223 | 47 |
|
373 | 48 |
Notice: |
49 |
this class was implemented using protocol information |
|
50 |
from alpha testers, literature and by read public domain code |
|
51 |
- it may not be complete or compatible to |
|
52 |
the corresponding ST-80 class. |
|
53 |
If you encounter any incompatibilities, please forward a note |
|
54 |
describing the incompatibility verbal (i.e. no code) to the ST/X team. |
|
55 |
||
223 | 56 |
[author:] |
57 |
Claus Gittinger |
|
66 | 58 |
" |
478 | 59 |
! |
60 |
||
61 |
examples |
|
62 |
" |
|
63 |
examples to be added. |
|
64 |
" |
|
65 |
! |
|
66 |
||
67 |
history |
|
68 |
"Created: 3.3.1997 / 19:33:13 / cg" |
|
66 | 69 |
! ! |
70 |
||
71 |
!UIBuilder class methodsFor:'initialization'! |
|
72 |
||
73 |
initialize |
|
74 |
Verbose := false "/ debugging flag |
|
75 |
! ! |
|
76 |
||
86 | 77 |
!UIBuilder methodsFor:'accessing'! |
78 |
||
79 |
menuAspect |
|
80 |
^ menuAspect |
|
81 |
! ! |
|
82 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
83 |
!UIBuilder methodsFor:'building'! |
66 | 84 |
|
367 | 85 |
add:aSpec |
478 | 86 |
|collectedComponents| |
87 |
||
88 |
composite notNil ifTrue:[ |
|
89 |
(collectedComponents := composite collection) isNil ifTrue:[ |
|
90 |
composite collection:(collectedComponents := OrderedCollection new). |
|
91 |
]. |
|
92 |
collectedComponents add:aSpec. |
|
93 |
view := aSpec buildViewWithLayoutFor:self in:compositeView. |
|
94 |
] ifFalse:[ |
|
95 |
spec isNil ifTrue:[ |
|
96 |
spec := FullSpec new. |
|
97 |
]. |
|
98 |
||
99 |
(aSpec isMemberOf:WindowSpec) ifTrue:[ |
|
100 |
spec window:aSpec |
|
101 |
] ifFalse:[ |
|
102 |
((aSpec isMemberOf:ComponentSpec) |
|
103 |
or:[(aSpec isMemberOf:SpecCollection)]) ifTrue:[ |
|
104 |
spec component:aSpec. |
|
105 |
||
106 |
window isNil ifTrue:[ |
|
479 | 107 |
window := windowView := View new. |
478 | 108 |
]. |
109 |
aSpec buildViewWithLayoutFor:self in:window. |
|
110 |
"/ builder window displayBox |
|
111 |
composite := aSpec. |
|
112 |
compositeView := window. |
|
113 |
] ifFalse:[ |
|
114 |
spec component isNil ifTrue:[ |
|
115 |
spec component:SpecCollection new. |
|
116 |
spec component collection:OrderedCollection new. |
|
117 |
composite := spec component. |
|
118 |
window isNil ifTrue:[ |
|
479 | 119 |
window := windowView := View new. |
478 | 120 |
]. |
121 |
compositeView := window. |
|
122 |
]. |
|
123 |
spec component collection add:aSpec. |
|
124 |
view := aSpec buildViewWithLayoutFor:self in:compositeView. |
|
125 |
]. |
|
126 |
] |
|
127 |
]. |
|
128 |
||
129 |
lastComponent := view. |
|
367 | 130 |
^ view |
131 |
||
479 | 132 |
"Modified: 3.3.1997 / 22:03:02 / cg" |
367 | 133 |
! |
134 |
||
474 | 135 |
buildFromSpec:aSpecOrSpecArray |
100 | 136 |
|m spec| |
137 |
||
474 | 138 |
window notNil ifTrue:[ |
139 |
^ self buildFromSpec:aSpecOrSpecArray in:window |
|
140 |
]. |
|
100 | 141 |
|
474 | 142 |
spec := UISpecification from:aSpecOrSpecArray. |
478 | 143 |
window := spec buildViewFor:self. |
100 | 144 |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
145 |
"/ menuAspect notNil ifTrue:[ |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
146 |
"/ m := self componentAt:menuAspect. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
147 |
"/ m notNil ifTrue:[ |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
148 |
"/ m := m value. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
149 |
"/ m notNil ifTrue:[ |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
150 |
"/ m receiver:application. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
151 |
"/ window add:m. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
152 |
"/ view topInset:(m heightIncludingBorder). |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
153 |
"/ ] |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
154 |
"/ ] |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
155 |
"/ ]. |
86 | 156 |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
367
diff
changeset
|
157 |
^ window |
66 | 158 |
|
100 | 159 |
"Modified: 5.9.1995 / 21:43:29 / claus" |
478 | 160 |
"Modified: 3.3.1997 / 18:43:50 / cg" |
125 | 161 |
! |
162 |
||
163 |
buildFromSpec:aSpecArray in:aView |
|
164 |
|m spec| |
|
165 |
||
166 |
spec := UISpecification from:aSpecArray. |
|
478 | 167 |
^ spec buildViewFor:self in:aView. |
125 | 168 |
|
478 | 169 |
"Modified: 3.3.1997 / 18:44:02 / cg" |
363
c7a26a5ebaba
doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
170 |
! |
c7a26a5ebaba
doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
171 |
|
c7a26a5ebaba
doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
172 |
doFinalHookup |
c7a26a5ebaba
doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
173 |
|
c7a26a5ebaba
doFinalHookup (ST-80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
344
diff
changeset
|
174 |
"Created: 14.2.1997 / 14:52:27 / cg" |
478 | 175 |
! |
176 |
||
177 |
endComposite |
|
178 |
|entry| |
|
179 |
||
497 | 180 |
(specStack notNil and:[specStack notEmpty]) ifTrue:[ |
478 | 181 |
entry := specStack removeLast. |
182 |
composite := entry key. |
|
183 |
compositeView := entry value. |
|
184 |
]. |
|
185 |
^ composite |
|
186 |
||
187 |
"Created: 3.3.1997 / 17:17:43 / cg" |
|
497 | 188 |
"Modified: 6.3.1997 / 16:18:05 / cg" |
478 | 189 |
! |
190 |
||
191 |
endCompositeLayout:layout |
|
192 |
composite compositeSpec:(CompositeSpec new layout:layout). |
|
479 | 193 |
compositeView layout:layout. |
478 | 194 |
self endComposite |
195 |
||
479 | 196 |
"Modified: 3.3.1997 / 20:54:35 / cg" |
197 |
! |
|
198 |
||
199 |
endCompositeLayout:layout properties:props |
|
200 |
self endCompositeLayout:layout |
|
201 |
||
202 |
"Created: 3.3.1997 / 22:15:17 / cg" |
|
478 | 203 |
! |
204 |
||
205 |
newComposite |
|
206 |
|newComposite| |
|
207 |
||
208 |
specStack isNil ifTrue:[ |
|
209 |
specStack := OrderedCollection new |
|
210 |
]. |
|
211 |
specStack addLast:(composite->compositeView). |
|
212 |
newComposite := CompositeSpecCollection new. |
|
213 |
newComposite compositeSpec:(CompositeSpec new). |
|
214 |
compositeView := self add:newComposite. |
|
215 |
composite := newComposite. |
|
216 |
^ compositeView |
|
217 |
||
218 |
"Created: 3.3.1997 / 17:15:36 / cg" |
|
219 |
"Modified: 3.3.1997 / 18:55:13 / cg" |
|
220 |
! |
|
221 |
||
222 |
wrapper |
|
223 |
^ view |
|
224 |
||
225 |
"Created: 3.3.1997 / 18:28:31 / cg" |
|
226 |
"Modified: 3.3.1997 / 18:44:12 / cg" |
|
100 | 227 |
! ! |
86 | 228 |
|
479 | 229 |
!UIBuilder methodsFor:'initialization'! |
230 |
||
231 |
setupWindowFor:aView |
|
232 |
|ext| |
|
233 |
||
234 |
window notNil ifTrue:[ |
|
235 |
ext := window extent. |
|
236 |
||
237 |
((window isMemberOf:View) |
|
238 |
or:[window isMemberOf:SimpleView]) ifTrue:[ |
|
239 |
windowView ~~ window ifTrue:[ |
|
240 |
windowView isNil ifTrue:[ |
|
241 |
self halt |
|
242 |
] |
|
243 |
]. |
|
244 |
aView addSubView:window. |
|
245 |
]. |
|
246 |
]. |
|
247 |
||
248 |
window := aView. |
|
249 |
||
250 |
aView container isNil ifTrue:[ |
|
251 |
spec notNil ifTrue:[ |
|
252 |
spec window setupView:window for:self |
|
253 |
] |
|
254 |
]. |
|
255 |
||
256 |
"Modified: 3.3.1997 / 22:05:37 / cg" |
|
257 |
! ! |
|
258 |
||
132 | 259 |
!UIBuilder class methodsFor:'documentation'! |
260 |
||
261 |
version |
|
497 | 262 |
^ '$Header: /cvs/stx/stx/libview2/UIBuilder.st,v 1.23 1997-03-06 15:18:25 cg Exp $' |
132 | 263 |
! ! |
100 | 264 |
UIBuilder initialize! |