author | tz |
Mon, 29 Jun 1998 16:45:52 +0200 | |
changeset 988 | daebc00918d4 |
parent 981 | 6a9c975543ad |
child 1010 | 2bd1011586d9 |
permissions | -rw-r--r-- |
89 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
434 | 3 |
All Rights Reserved |
89 | 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 |
Object subclass:#WindowBuilder |
855
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
14 |
instanceVariableNames:'window application bindings visuals labels focusSequence |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
15 |
namedComponents helpKeys componentCreationHook applicationClass |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
16 |
keyboardProcessor subCanvasSpecs' |
717
b89142a61d05
#aspectAt: must also ask class.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
17 |
classVariableNames:'StopOnError' |
436 | 18 |
poolDictionaries:'' |
19 |
category:'Interface-Support-UI' |
|
66 | 20 |
! |
21 |
||
22 |
!WindowBuilder class methodsFor:'documentation'! |
|
23 |
||
89 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
434 | 27 |
All Rights Reserved |
89 | 28 |
|
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
66 | 38 |
documentation |
39 |
" |
|
69 | 40 |
a no-op class, for systems which do not use the UIBuilder. |
66 | 41 |
Concrete subclasses know how to create a view (with components) from |
848 | 42 |
some interface spec. |
43 |
||
44 |
The order of the lookup sequence to access an aspect is defined: |
|
45 |
application |
|
46 |
application class |
|
47 |
additional class (applicationClass). |
|
48 |
||
49 |
Methods to access any aspect are located in the category |
|
50 |
'spec creation aspect fetch'. |
|
51 |
||
735 | 52 |
Currently, an experimantal version of UIBuilder exists, |
66 | 53 |
and more may be added in the future (for example, to parse different UI |
735 | 54 |
specs - thinking of motifs UIL specs, Windows DialogSpecs etc.). |
223 | 55 |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
56 |
[instance variables:] |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
57 |
window <View> |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
58 |
the topView into which the components |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
59 |
are (have been) created from the specification |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
60 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
61 |
application <ApplicationModel> |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
62 |
the application object (typically an instance |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
63 |
of a subclass of ApplicationModel). |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
64 |
That one is usually supposed to provide |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
65 |
valueHolders for aspects, action methods |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
66 |
menuSpecs and possibly more windowSpecs. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
67 |
Usually means, that most of those can also be |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
68 |
provided to the builder via a set of bindings, |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
69 |
which overrides those. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
70 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
71 |
bindings <Dictionary> |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
72 |
can be set (or filled) with bindings for |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
73 |
aspects to be used when setting up the models |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
74 |
for components. Useful either to overwrite |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
75 |
corresponding appModel aspects or if the appModel |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
76 |
does not want to procide those. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
77 |
(for example, to open a dialog and provide the |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
78 |
bindings in a dictionary - as opposed to |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
79 |
providing them via aspect methods) |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
80 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
81 |
visuals not yet used - for compatibility |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
82 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
83 |
focusSequence <Collection> |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
84 |
maintained during the build process; |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
85 |
contains tabable components. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
86 |
This will be replaced by a more intelligent |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
87 |
mechanism in the near future. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
88 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
89 |
namedComponents <Dictionary> |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
90 |
contains name->component associations for |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
91 |
all components which have a non-nil component |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
92 |
name. Created during the build process. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
93 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
94 |
helpKeys not yet used - for compatibility |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
95 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
96 |
componentCreationHook <BlockOrNil> |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
97 |
can be set before the components are built |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
98 |
from the spec, to provide an arbitrary |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
99 |
callBacks-hook which will be invoked after |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
100 |
a component has been created from a spec. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
101 |
The UIPainter uses this to maintain its |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
102 |
component<->spec assiciations. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
103 |
Can be set by the app, to catch creation of |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
104 |
components and fiddle around during the |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
105 |
creation process (change extents, colors or whatever) |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
106 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
107 |
applicationClass <ClassOrNil> |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
108 |
can be set to provide an additional class which |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
109 |
is asked for aspects during the build process. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
110 |
If not set, the app is asked, which itself asks |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
111 |
its class. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
112 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
113 |
keyboardProcessor not yet used - for compatibility |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
114 |
Will eventually takeover the functionality |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
115 |
of the focusSequence, shortcuts & provide a hook |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
116 |
for the app. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
117 |
|
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
118 |
subCanvasSpecs <Dictionary> |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
119 |
can be set by the app to provide subcanvas |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
120 |
specs (much like the bindings dictionary) |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
121 |
|
223 | 122 |
[author:] |
123 |
Claus Gittinger |
|
66 | 124 |
" |
125 |
! ! |
|
126 |
||
974 | 127 |
!WindowBuilder methodsFor:'ST-80 compatibility'! |
128 |
||
129 |
source |
|
130 |
"same as #application, for ST-80 compatibility" |
|
131 |
||
132 |
^ application |
|
133 |
||
134 |
"Created: 17.1.1997 / 19:03:51 / cg" |
|
135 |
! |
|
136 |
||
137 |
source:anApplicationModel |
|
138 |
"same as #application:, for ST-80 compatibility" |
|
139 |
||
140 |
application := anApplicationModel |
|
141 |
||
142 |
"Modified: 17.1.1997 / 19:03:57 / cg" |
|
143 |
! ! |
|
144 |
||
66 | 145 |
!WindowBuilder methodsFor:'accessing'! |
146 |
||
463 | 147 |
addBindings:moreBindings |
148 |
"used with subDialogs, which provide local bindings. |
|
149 |
All bindings from moreBindings overwrite any local bindings." |
|
150 |
||
151 |
moreBindings notNil ifTrue:[ |
|
152 |
moreBindings keysAndValuesDo:[:aKey :aValue | |
|
153 |
bindings at:aKey put:aValue |
|
154 |
] |
|
155 |
] |
|
156 |
||
157 |
"Created: 28.2.1997 / 14:14:33 / cg" |
|
158 |
! |
|
159 |
||
100 | 160 |
application |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
161 |
"return the application (an ApplicationModel), |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
162 |
for which the view is built. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
163 |
This one is supposed to provide the aspects, menus etc." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
164 |
|
100 | 165 |
^ application |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
166 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
167 |
"Modified: 17.1.1997 / 19:04:40 / cg" |
66 | 168 |
! |
169 |
||
125 | 170 |
application:anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
171 |
"set the application (an ApplicationModel), |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
172 |
for which the view is built. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
173 |
This one is supposed to provide the aspects, menus etc." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
174 |
|
125 | 175 |
application := anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
176 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
177 |
"Modified: 17.1.1997 / 19:04:47 / cg" |
66 | 178 |
! |
179 |
||
422 | 180 |
applicationClass:something |
181 |
"set the value of the instance variable 'applicationClass' (automatically generated)" |
|
182 |
||
183 |
applicationClass := something.! |
|
184 |
||
66 | 185 |
aspectAt:aSymbol |
848 | 186 |
"return the aspect for a symbol or nil. |
187 |
" |
|
433 | 188 |
|b| |
189 |
||
473 | 190 |
aSymbol notNil ifTrue:[ |
191 |
bindings notNil ifTrue:[ |
|
192 |
b := bindings at:aSymbol ifAbsent:nil. |
|
193 |
b notNil ifTrue:[^ b]. |
|
194 |
]. |
|
434 | 195 |
|
473 | 196 |
application notNil ifTrue:[ |
577 | 197 |
Object messageNotUnderstoodSignal handle:[:ex | |
727 | 198 |
ex parameter selector == aSymbol ifFalse:[ |
199 |
ex reject |
|
200 |
] |
|
577 | 201 |
] do:[ |
473 | 202 |
^ application aspectFor:aSymbol |
717
b89142a61d05
#aspectAt: must also ask class.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
203 |
]. |
b89142a61d05
#aspectAt: must also ask class.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
204 |
Object messageNotUnderstoodSignal handle:[:ex | |
727 | 205 |
ex parameter selector == aSymbol ifFalse:[ |
206 |
ex reject |
|
207 |
] |
|
717
b89142a61d05
#aspectAt: must also ask class.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
208 |
] do:[ |
b89142a61d05
#aspectAt: must also ask class.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
209 |
^ application class aspectFor:aSymbol |
b89142a61d05
#aspectAt: must also ask class.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
210 |
]. |
848 | 211 |
self aspectNotFound:aSymbol error:'no aspect for:' |
212 |
] |
|
433 | 213 |
]. |
214 |
^ nil |
|
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
215 |
|
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
216 |
"Modified: / 18.6.1998 / 20:23:24 / cg" |
66 | 217 |
! |
218 |
||
125 | 219 |
aspectAt:aSymbol put:aModel |
848 | 220 |
"store an aspect identified by its symbol and its value |
221 |
" |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
222 |
bindings isNil ifTrue:[ |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
223 |
bindings := IdentityDictionary new |
125 | 224 |
]. |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
225 |
^ bindings at:aSymbol put:aModel |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
226 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
227 |
"Modified: 17.1.1997 / 19:28:37 / cg" |
100 | 228 |
! |
229 |
||
450 | 230 |
bindingAt:aSymbol |
848 | 231 |
"return the binding for a symbol or nil |
232 |
" |
|
450 | 233 |
bindings notNil ifTrue:[ |
234 |
^ bindings at:aSymbol ifAbsent:nil. |
|
235 |
]. |
|
236 |
^ nil |
|
237 |
! |
|
238 |
||
100 | 239 |
bindings |
848 | 240 |
"return my bindings |
241 |
" |
|
100 | 242 |
^ bindings |
243 |
! |
|
244 |
||
245 |
bindings:aDictionary |
|
848 | 246 |
"set bindings to a dictionary |
247 |
" |
|
100 | 248 |
bindings := aDictionary |
249 |
! |
|
250 |
||
125 | 251 |
componentAt:name |
848 | 252 |
"return a component identified by its name. |
253 |
" |
|
450 | 254 |
namedComponents isNil ifTrue:[^ nil]. |
255 |
^ namedComponents at:name asSymbol ifAbsent:nil |
|
125 | 256 |
! |
257 |
||
100 | 258 |
componentAt:name put:aComponent |
848 | 259 |
"store a component identified by its name. |
260 |
" |
|
450 | 261 |
namedComponents isNil ifTrue:[ |
262 |
namedComponents := IdentityDictionary new. |
|
100 | 263 |
]. |
450 | 264 |
namedComponents at:name asSymbol put:aComponent |
100 | 265 |
! |
266 |
||
410 | 267 |
componentCreationHook:something |
268 |
"set the value of the instance variable 'componentCreationHook' (automatically generated)" |
|
269 |
||
270 |
componentCreationHook := something.! |
|
271 |
||
125 | 272 |
focusSequence |
848 | 273 |
"return my focus sequence |
274 |
" |
|
125 | 275 |
^ focusSequence |
66 | 276 |
! |
277 |
||
600 | 278 |
helpKeyFor:aComponent |
848 | 279 |
"return the helpkey for a component or nil |
280 |
" |
|
600 | 281 |
|v key| |
282 |
||
283 |
helpKeys isNil ifTrue:[^ nil]. |
|
284 |
v := aComponent. |
|
285 |
[v notNil] whileTrue:[ |
|
286 |
(key := helpKeys at:v ifAbsent:nil) notNil ifTrue:[ |
|
287 |
^ key |
|
288 |
]. |
|
289 |
v := v superView |
|
290 |
]. |
|
595 | 291 |
^ nil |
600 | 292 |
! |
595 | 293 |
|
600 | 294 |
helpKeyFor:aComponent put:aKey |
848 | 295 |
"assign a key for a component which is used to access the help text |
296 |
from the application. |
|
297 |
" |
|
600 | 298 |
aKey isNil ifTrue:[ |
299 |
helpKeys isNil ifFalse:[ |
|
300 |
helpKeys removeKey:aComponent ifAbsent:nil |
|
301 |
] |
|
302 |
] ifFalse:[ |
|
303 |
helpKeys isNil ifTrue:[ |
|
304 |
helpKeys := IdentityDictionary new |
|
305 |
]. |
|
306 |
helpKeys at:aComponent put:aKey |
|
307 |
] |
|
595 | 308 |
|
309 |
! |
|
310 |
||
477 | 311 |
keyboardProcessor |
848 | 312 |
"return my keyboard processor |
313 |
" |
|
477 | 314 |
keyboardProcessor isNil ifTrue:[ |
315 |
keyboardProcessor := KeyboardProcessor new |
|
316 |
]. |
|
317 |
^ keyboardProcessor |
|
318 |
||
319 |
"Created: 3.3.1997 / 18:31:37 / cg" |
|
320 |
"Modified: 3.3.1997 / 18:32:27 / cg" |
|
321 |
! |
|
322 |
||
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
323 |
keyboardProcessor:aKeyboardProcessor |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
324 |
"set my keyboard processor |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
325 |
" |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
326 |
keyboardProcessor := aKeyboardProcessor |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
327 |
|
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
328 |
"Created: / 18.6.1998 / 19:59:38 / cg" |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
329 |
! |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
330 |
|
855
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
331 |
labelAt:name |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
332 |
labels isNil ifTrue:[^ nil]. |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
333 |
^ labels at:name asSymbol ifAbsent:nil |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
334 |
|
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
335 |
"Created: / 27.2.1998 / 13:52:28 / cg" |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
336 |
! |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
337 |
|
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
338 |
labelAt:name put:aLabelString |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
339 |
labels isNil ifTrue:[ |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
340 |
labels := IdentityDictionary new. |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
341 |
]. |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
342 |
labels at:name asSymbol put:aLabelString |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
343 |
|
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
344 |
"Created: / 27.2.1998 / 02:30:54 / cg" |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
345 |
! |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
346 |
|
848 | 347 |
menuAt:aKey |
348 |
"Find a binding for the menu named aKey, either in the bindings |
|
349 |
or from the source" |
|
350 |
||
351 |
^ self menuFor:aKey |
|
352 |
||
353 |
||
354 |
! |
|
355 |
||
356 |
menuAt:aSymbol put:someMenuOrHolder |
|
357 |
"add someMenuOrHolder as the binding for the menu named aSymbol to the bindings" |
|
358 |
||
359 |
^ self aspectAt:aSymbol put:someMenuOrHolder |
|
360 |
||
361 |
! |
|
362 |
||
86 | 363 |
namedComponents |
848 | 364 |
"return list of named components |
365 |
" |
|
450 | 366 |
^ namedComponents |
86 | 367 |
! |
368 |
||
502 | 369 |
subCanvasAt:majorKey at:minorKey |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
370 |
"get the subCanvas or subSpec specification from major and minor key. |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
371 |
Here, we first look for a spec in the private subCanvasSpecs dictionary, |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
372 |
which can be filled via #specificationAt:at:put: messages. |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
373 |
If not present, or none is found there, we bounce back trying |
824 | 374 |
#specificationFor: (if majorKey is nil) or by sending the minorKey |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
375 |
message to the class named as majorKey. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
376 |
Notice, that the class named majorKey is first searched in the |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
377 |
application classes namespace - allowing private classes as majorKey. |
586 | 378 |
" |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
379 |
|
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
380 |
|spec cls dict dkey| |
502 | 381 |
|
382 |
subCanvasSpecs notNil ifTrue:[ |
|
586 | 383 |
dkey := majorKey ? #NoMajorKey. |
384 |
dict := subCanvasSpecs at:dkey ifAbsent:nil. |
|
385 |
||
386 |
dict notNil ifTrue:[ |
|
387 |
spec := dict at:minorKey ifAbsent:nil. |
|
502 | 388 |
spec notNil ifTrue:[^ spec]. |
389 |
]. |
|
390 |
]. |
|
586 | 391 |
|
502 | 392 |
majorKey isNil ifTrue:[ |
848 | 393 |
^ self specificationFor:minorKey |
394 |
]. |
|
395 |
||
396 |
application notNil ifTrue:[ |
|
397 |
"/ look for class in applications namespace ... |
|
398 |
cls := application resolveName:majorKey. |
|
502 | 399 |
] ifFalse:[ |
848 | 400 |
"/ fallBack - use that global, if it exists |
401 |
cls := Smalltalk at:majorKey. |
|
402 |
cls isNil ifTrue:[ |
|
403 |
Transcript showCR:('WindowBuilder[warning]: missing application when fetching majorKey:' , majorKey). |
|
735 | 404 |
]. |
502 | 405 |
]. |
586 | 406 |
|
848 | 407 |
cls notNil ifTrue:[ |
408 |
Object messageNotUnderstoodSignal handle:[:ex|] do:[ |
|
409 |
^ cls specificationFor:minorKey |
|
410 |
]. |
|
411 |
Object messageNotUnderstoodSignal handle:[:ex|] do:[ |
|
412 |
^ cls perform:minorKey. |
|
413 |
] |
|
414 |
]. |
|
415 |
^ nil |
|
502 | 416 |
! |
417 |
||
418 |
subCanvasAt:majorKey at:minorKey put:aSpec |
|
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
419 |
"deposit an interfaceSpecification for major and minor key |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
420 |
in my private subCanvasSpecs dictionary. |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
421 |
This will be used later, when building, |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
422 |
to provide an interfaceSpec for a subcanvas or subSpecification |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
423 |
(or possibly override an application provided interfaceSpec). |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
424 |
See #subCanvasAt:at:." |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
425 |
|
502 | 426 |
|dict key| |
427 |
||
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
428 |
subCanvasSpecs isNil ifTrue:[ |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
429 |
"/ lazyly initialize |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
430 |
subCanvasSpecs := IdentityDictionary new |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
431 |
]. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
432 |
|
502 | 433 |
key := majorKey ? #NoMajorKey. |
434 |
dict := subCanvasSpecs at:key ifAbsent:nil. |
|
435 |
dict isNil ifTrue:[ |
|
436 |
dict := IdentityDictionary new. |
|
437 |
subCanvasSpecs at:key put:dict |
|
438 |
]. |
|
439 |
dict at:minorKey put:aSpec |
|
440 |
||
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
441 |
"Modified: / 27.1.1998 / 12:21:27 / cg" |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
442 |
"Modified: / 5.2.1998 / 12:05:32 / stefan" |
502 | 443 |
! |
444 |
||
475
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
445 |
visualAt:name |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
446 |
visuals isNil ifTrue:[^ nil]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
447 |
^ visuals at:name asSymbol ifAbsent:nil |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
448 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
449 |
"Created: 3.3.1997 / 16:24:17 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
450 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
451 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
452 |
visualAt:name put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
453 |
visuals isNil ifTrue:[ |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
454 |
visuals := IdentityDictionary new. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
455 |
]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
456 |
visuals at:name asSymbol put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
457 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
458 |
"Created: 3.3.1997 / 16:24:41 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
459 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
460 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
461 |
visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
462 |
^ visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
463 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
464 |
"Created: 3.3.1997 / 16:24:00 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
465 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
466 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
467 |
visuals:aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
468 |
visuals := aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
469 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
470 |
"Created: 3.3.1997 / 16:24:06 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
471 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
472 |
|
125 | 473 |
window |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
474 |
"return the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
475 |
is (being) built" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
476 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
477 |
^ window |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
478 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
479 |
"Modified: 17.1.1997 / 19:30:00 / cg" |
125 | 480 |
! |
481 |
||
482 |
window:aView |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
483 |
"set the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
484 |
is (being) built" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
485 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
486 |
window := aView |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
487 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
488 |
"Modified: 17.1.1997 / 19:30:22 / cg" |
66 | 489 |
! |
490 |
||
491 |
windowGroup |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
492 |
^ window windowGroup |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
493 |
|
608 | 494 |
"Modified: 17.6.1997 / 18:04:01 / cg" |
66 | 495 |
! ! |
496 |
||
673
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
497 |
!WindowBuilder methodsFor:'aspect access support'! |
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
498 |
|
675 | 499 |
booleanValueAspectFor:aKey |
674 | 500 |
"helper (common code) to generate a boolean aspect if required. |
501 |
If no binding exists for aKey, a valueHolder holding false is |
|
502 |
created and added to the bindings. |
|
503 |
Otherwise, the existing binding is returned." |
|
673
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
504 |
|
676 | 505 |
^ self valueAspectFor:aKey initialValue:false |
673
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
506 |
|
676 | 507 |
"Modified: 28.7.1997 / 12:53:57 / cg" |
675 | 508 |
! |
509 |
||
510 |
nilValueAspectFor:aKey |
|
511 |
"helper (common code) to generate a valueHolder aspect if required. |
|
512 |
If no binding exists for aKey, a valueHolder holding nil is |
|
513 |
created and added to the bindings. |
|
514 |
Otherwise, the existing binding is returned." |
|
515 |
||
676 | 516 |
^ self valueAspectFor:aKey initialValue:nil |
517 |
||
518 |
"Modified: 28.7.1997 / 12:54:06 / cg" |
|
519 |
! |
|
520 |
||
521 |
valueAspectFor:aKey initialValue:initialValue |
|
522 |
"helper (common code) to generate a valueHolder aspect if required. |
|
523 |
If no binding exists for aKey, a valueHolder holding initialValue is |
|
524 |
created and added to the bindings. |
|
525 |
Otherwise, the existing binding is returned." |
|
526 |
||
675 | 527 |
|holder| |
528 |
||
529 |
(holder := self bindingAt:aKey) isNil ifTrue:[ |
|
676 | 530 |
self aspectAt:aKey put:(holder := initialValue asValue). |
675 | 531 |
]. |
532 |
^ holder |
|
533 |
||
676 | 534 |
"Created: 28.7.1997 / 12:53:45 / cg" |
535 |
"Modified: 28.7.1997 / 12:54:13 / cg" |
|
673
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
536 |
! ! |
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
537 |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
538 |
!WindowBuilder methodsFor:'building'! |
66 | 539 |
|
125 | 540 |
buildFromSpec:aSpec |
176 | 541 |
^ self subclassResponsibility |
408 | 542 |
! |
543 |
||
544 |
makeTabable:aComponent |
|
735 | 545 |
"add a component to the list of tabable components" |
546 |
||
408 | 547 |
focusSequence isNil ifTrue:[ |
548 |
focusSequence := OrderedCollection new. |
|
549 |
]. |
|
550 |
focusSequence add:aComponent |
|
735 | 551 |
|
552 |
"Modified: / 31.10.1997 / 18:39:30 / cg" |
|
66 | 553 |
! ! |
100 | 554 |
|
848 | 555 |
!WindowBuilder methodsFor:'error handling'! |
556 |
||
557 |
aspectNotFound:anAspect error:aString |
|
558 |
"show error message on transcript |
|
559 |
" |
|
560 |
Transcript showCR:'WindowBuilder: ' |
|
561 |
, aString |
|
562 |
, ' aspect: <' |
|
563 |
, anAspect storeString |
|
564 |
, '>'. |
|
565 |
||
566 |
StopOnError == true ifTrue:[ |
|
567 |
self halt "/ avoids debugger in end-user apps |
|
568 |
]. |
|
569 |
! ! |
|
570 |
||
586 | 571 |
!WindowBuilder methodsFor:'message sending'! |
572 |
||
848 | 573 |
safelyPerform:aSelector ifNone:aBlock |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
574 |
"send the message aSelector to the application; |
586 | 575 |
the result returned from the send or nil is returned |
576 |
" |
|
848 | 577 |
|cls| |
586 | 578 |
|
848 | 579 |
aSelector notNil ifTrue:[ |
595 | 580 |
application notNil ifTrue:[ |
981
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
581 |
application messageNotUnderstoodSignal handle:[:ex| |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
582 |
(ex parameter selector ~~ aSelector) ifTrue:[ |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
583 |
ex reject |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
584 |
] |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
585 |
] do:[ |
848 | 586 |
^ application perform:aSelector |
587 |
]. |
|
588 |
cls := application class. |
|
589 |
||
981
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
590 |
cls messageNotUnderstoodSignal handle:[:ex| |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
591 |
(ex parameter selector ~~ aSelector) ifTrue:[ |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
592 |
ex reject |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
593 |
] |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
594 |
] do:[ |
848 | 595 |
^ cls perform:aSelector |
595 | 596 |
] |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
597 |
]. |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
598 |
applicationClass notNil ifTrue:[ |
981
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
599 |
applicationClass messageNotUnderstoodSignal handle:[:ex| |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
600 |
(ex parameter selector ~~ aSelector) ifTrue:[ |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
601 |
ex reject |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
602 |
] |
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
603 |
] do:[ |
848 | 604 |
^ applicationClass perform:aSelector |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
605 |
] |
586 | 606 |
] |
607 |
]. |
|
848 | 608 |
^ aBlock value |
981
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
609 |
|
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
610 |
"Modified: / 20.6.1998 / 11:52:19 / cg" |
586 | 611 |
! |
612 |
||
848 | 613 |
safelyPerform:aSelector with:anArgument ifNone:aBlock |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
614 |
"send the one-arg-message aSelector to the application; |
586 | 615 |
the result returned from the send or nil is returned |
616 |
" |
|
848 | 617 |
|cls| |
586 | 618 |
|
848 | 619 |
aSelector notNil ifTrue:[ |
595 | 620 |
application notNil ifTrue:[ |
961 | 621 |
application messageNotUnderstoodSignal handle:[:ex| |
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
622 |
(ex parameter selector ~~ aSelector |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
623 |
and:[ex parameter selector ~~ anArgument]) ifTrue:[ |
961 | 624 |
ex reject |
625 |
] |
|
626 |
] do:[ |
|
848 | 627 |
^ application perform:aSelector with:anArgument |
628 |
]. |
|
629 |
cls := application class. |
|
630 |
||
961 | 631 |
cls messageNotUnderstoodSignal handle:[:ex| |
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
632 |
(ex parameter selector ~~ aSelector |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
633 |
and:[ex parameter selector ~~ anArgument]) ifTrue:[ |
961 | 634 |
ex reject |
635 |
] |
|
636 |
] do:[ |
|
848 | 637 |
^ cls perform:aSelector with:anArgument |
595 | 638 |
] |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
639 |
]. |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
640 |
applicationClass notNil ifTrue:[ |
961 | 641 |
applicationClass messageNotUnderstoodSignal handle:[:ex| |
642 |
ex parameter selector ~~ aSelector ifTrue:[ |
|
643 |
ex reject |
|
644 |
] |
|
645 |
] do:[ |
|
848 | 646 |
^ applicationClass perform:aSelector with:anArgument |
647 |
]. |
|
648 |
] |
|
649 |
]. |
|
650 |
^ aBlock value |
|
961 | 651 |
|
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
652 |
"Modified: / 18.6.1998 / 20:35:32 / cg" |
848 | 653 |
! |
654 |
||
655 |
safelyPerform:aSelector with:arg1 with:arg2 ifNone:aBlock |
|
656 |
"send the two-arg-message aSelector to the application; |
|
657 |
the result returned from the send or nil is returned |
|
658 |
" |
|
659 |
|cls| |
|
660 |
||
661 |
aSelector notNil ifTrue:[ |
|
662 |
application notNil ifTrue:[ |
|
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
663 |
application messageNotUnderstoodSignal handle:[:ex| |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
664 |
(ex parameter selector ~~ aSelector |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
665 |
and:[ex parameter selector ~~ arg1]) ifTrue:[ |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
666 |
ex reject |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
667 |
] |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
668 |
] do:[ |
848 | 669 |
^ application perform:aSelector with:arg1 with:arg2 |
670 |
]. |
|
671 |
cls := application class. |
|
672 |
||
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
673 |
cls messageNotUnderstoodSignal handle:[:ex| |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
674 |
(ex parameter selector ~~ aSelector |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
675 |
and:[ex parameter selector ~~ arg1]) ifTrue:[ |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
676 |
ex reject |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
677 |
] |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
678 |
] do:[ |
848 | 679 |
^ cls perform:aSelector with:arg1 with:arg2 |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
680 |
] |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
681 |
]. |
848 | 682 |
applicationClass notNil ifTrue:[ |
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
683 |
applicationClass messageNotUnderstoodSignal handle:[:ex| |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
684 |
(ex parameter selector ~~ aSelector |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
685 |
and:[ex parameter selector ~~ arg1]) ifTrue:[ |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
686 |
ex reject |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
687 |
] |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
688 |
] do:[ |
848 | 689 |
^ applicationClass perform:aSelector with:arg1 with:arg2 |
690 |
]. |
|
691 |
] |
|
586 | 692 |
]. |
848 | 693 |
^ aBlock value |
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
694 |
|
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
695 |
"Modified: / 18.6.1998 / 21:40:13 / cg" |
586 | 696 |
! ! |
697 |
||
422 | 698 |
!WindowBuilder methodsFor:'spec creation aspect fetch'! |
100 | 699 |
|
374 | 700 |
actionFor:aKey |
450 | 701 |
"return an action for aKey. This is invoked during window building |
702 |
(by the builder) to ask for an ActionButtons actionBlock. |
|
703 |
Here, first the local bindings are searched, then the application and |
|
704 |
finally the applications class is asked for a corresponding action. |
|
705 |
The returned object is typically a block." |
|
706 |
||
434 | 707 |
|b| |
708 |
||
709 |
bindings notNil ifTrue:[ |
|
710 |
b := bindings at:aKey ifAbsent:nil. |
|
711 |
b notNil ifTrue:[^ b]. |
|
712 |
]. |
|
713 |
||
848 | 714 |
^ self safelyPerform:#actionFor: |
715 |
with:aKey |
|
716 |
ifNone:[ self aspectNotFound:aKey error:'no action for:'. [] ] |
|
374 | 717 |
! |
718 |
||
716 | 719 |
actionFor:aKey withValue:aValue |
720 |
"return an action for aKey/value combonation. |
|
721 |
This is invoked during window building |
|
722 |
(by the builder) to ask for an ActionButtons actionBlock if that button |
|
723 |
specified an action with an argument value. |
|
724 |
Here, first the local bindings are searched, then the application and |
|
725 |
finally the applications class is asked for a corresponding action. |
|
726 |
The returned object is typically a block." |
|
727 |
||
728 |
|b| |
|
729 |
||
730 |
bindings notNil ifTrue:[ |
|
731 |
b := bindings at:aKey ifAbsent:nil. |
|
732 |
b notNil ifTrue:[^ b]. |
|
733 |
]. |
|
734 |
||
848 | 735 |
^ self safelyPerform:#actionFor:withValue: |
736 |
with:aKey |
|
737 |
with:aValue |
|
738 |
ifNone:[ self aspectNotFound:aKey error:'no action for:'. [:dummy |] ] |
|
716 | 739 |
! |
740 |
||
374 | 741 |
aspectFor:aKey |
450 | 742 |
"return a model for aKey. This is invoked during window building |
743 |
(by the builder) to ask for an Editfields, a Toggles etc. model. |
|
744 |
Here, first the local bindings are searched, then the application and |
|
745 |
finally the applications class is asked for a corresponding action. |
|
746 |
The returned object is typically a valueHolder." |
|
747 |
||
434 | 748 |
|b| |
749 |
||
750 |
bindings notNil ifTrue:[ |
|
751 |
b := bindings at:aKey ifAbsent:nil. |
|
752 |
b notNil ifTrue:[^ b]. |
|
753 |
]. |
|
754 |
||
848 | 755 |
^ self safelyPerform:#aspectFor: |
756 |
with:aKey |
|
757 |
ifNone:[ self aspectAt:aKey ] |
|
374 | 758 |
! |
759 |
||
423 | 760 |
componentFor:aKey |
450 | 761 |
"return a component for aKey. This is invoked during window building |
762 |
(by the builder) to ask for an ArbitraryComponents view. |
|
763 |
Here, first the local bindings are searched, then the application and |
|
764 |
finally the applications class is asked for a corresponding action. |
|
765 |
The returned object is typically a view." |
|
766 |
||
848 | 767 |
^ self safelyPerform:#componentFor: |
768 |
with:aKey |
|
769 |
ifNone:[ self aspectAt:aKey ] |
|
423 | 770 |
! |
771 |
||
422 | 772 |
labelFor:aKey |
450 | 773 |
"return a label for aKey. This is invoked during window building |
774 |
(by the builder) to ask for a ???'s label. |
|
775 |
Here, first the local bindings are searched, then the application and |
|
776 |
finally the applications class is asked for a corresponding action. |
|
777 |
The returned object is typically a string." |
|
778 |
||
848 | 779 |
^ self safelyPerform:#labelFor: |
780 |
with:aKey |
|
781 |
ifNone:[ self aspectAt:aKey ] |
|
422 | 782 |
! |
783 |
||
784 |
listFor:aKey |
|
450 | 785 |
"return a list for aKey. This is invoked during window building |
786 |
(by the builder) to ask for a ???'s label. |
|
787 |
Here, first the local bindings are searched, then the application and |
|
788 |
finally the applications class is asked for a corresponding action. |
|
789 |
The returned object is typically a list." |
|
790 |
||
848 | 791 |
^ self safelyPerform:#listFor: |
792 |
with:aKey |
|
793 |
ifNone:[ self aspectAt:aKey ] |
|
794 |
! |
|
795 |
||
796 |
menuFor:aKey |
|
797 |
"Find a binding for the menu named aKey, either in the bindings |
|
798 |
or from the source" |
|
799 |
||
800 |
|menu| |
|
801 |
||
961 | 802 |
aKey isNil ifTrue:[^ nil]. |
803 |
||
848 | 804 |
(menu := self bindingAt:aKey) notNil ifTrue:[ |
805 |
^ menu |
|
806 |
]. |
|
807 |
||
808 |
menu := self safelyPerform:#menuFor: with:aKey ifNone:[ |
|
809 |
self safelyPerform:aKey ifNone:[ |
|
810 |
self aspectNotFound:aKey error:'no menu for:'. |
|
811 |
nil |
|
812 |
] |
|
813 |
]. |
|
814 |
||
862 | 815 |
menu isBlock ifFalse:[ |
816 |
((menu := menu value) notNil and:[application notNil]) ifTrue:[ |
|
817 |
menu isArray ifTrue:[ |
|
818 |
menu := Menu new fromLiteralArrayEncoding:menu. |
|
819 |
menu receiver:application. |
|
924
4680e2fe4728
must care for resource-label translation of a menu
Claus Gittinger <cg@exept.de>
parents:
862
diff
changeset
|
820 |
]. |
4680e2fe4728
must care for resource-label translation of a menu
Claus Gittinger <cg@exept.de>
parents:
862
diff
changeset
|
821 |
menu findGuiResourcesIn:application |
450 | 822 |
] |
422 | 823 |
]. |
848 | 824 |
^ menu |
717
b89142a61d05
#aspectAt: must also ask class.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
825 |
|
961 | 826 |
"Modified: / 18.6.1998 / 16:30:31 / cg" |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
827 |
! |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
828 |
|
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
829 |
specificationFor:aKey |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
830 |
"return a specification for aKey. This is invoked during window building |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
831 |
(by the builder) to ask for the interfaceSpec for a subCanvas or subSpecification. |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
832 |
Here, first the local bindings are searched, then the application and |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
833 |
finally the applications class is asked for a corresponding interfaceSPec. |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
834 |
The returned object is typically an interfaceSpec array." |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
835 |
|
848 | 836 |
^ self safelyPerform:#specificationFor: |
837 |
with:aKey |
|
838 |
ifNone:[ self aspectFor:aKey ] |
|
422 | 839 |
! ! |
840 |
||
841 |
!WindowBuilder methodsFor:'spec creation callbacks'! |
|
842 |
||
735 | 843 |
createdComponent:aView forSpec:spec named:name |
844 |
"callback from the UISpec after a view has been |
|
845 |
created for a spec. |
|
846 |
If it has a name, add it to the namedComponents dictionary; |
|
847 |
if I have a creationHook (application callBack), evaluate it." |
|
848 |
||
849 |
name notNil ifTrue:[ |
|
850 |
"/ self componentAt:name put:aView. |
|
851 |
namedComponents isNil ifTrue:[ |
|
852 |
namedComponents := IdentityDictionary new. |
|
853 |
]. |
|
854 |
namedComponents at:name asSymbol put:aView |
|
855 |
]. |
|
410 | 856 |
componentCreationHook notNil ifTrue:[ |
857 |
componentCreationHook value:aView value:spec value:self |
|
858 |
] |
|
100 | 859 |
|
735 | 860 |
"Modified: / 5.9.1995 / 21:42:54 / claus" |
861 |
"Created: / 31.10.1997 / 18:47:01 / cg" |
|
862 |
"Modified: / 31.10.1997 / 18:51:22 / cg" |
|
100 | 863 |
! ! |
864 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
865 |
!WindowBuilder methodsFor:'startup'! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
866 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
867 |
closeRequest |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
868 |
window destroy |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
869 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
870 |
"Modified: 17.1.1997 / 19:30:32 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
871 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
872 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
873 |
open |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
874 |
"open my topView, as previously created" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
875 |
|
477 | 876 |
|type| |
877 |
||
878 |
application isNil ifTrue:[ |
|
879 |
type := #normal |
|
880 |
] ifFalse:[ |
|
881 |
type := application defaultWindowType |
|
882 |
]. |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
883 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
884 |
openWithExtent:nil |
477 | 885 |
andType:type |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
886 |
|
477 | 887 |
"Modified: 3.3.1997 / 19:43:57 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
888 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
889 |
|
428 | 890 |
openAt:aPoint |
891 |
"open my topView at some location" |
|
892 |
||
893 |
self |
|
467 | 894 |
openAt:aPoint |
895 |
withExtent:nil |
|
428 | 896 |
andType:(application defaultWindowType) |
897 |
||
898 |
"Created: 14.2.1997 / 20:21:57 / cg" |
|
467 | 899 |
"Modified: 28.2.1997 / 22:50:29 / cg" |
428 | 900 |
! |
901 |
||
436 | 902 |
openAt:origin withExtent:ext andType:type |
428 | 903 |
"open my window, as previously created, optionally defining the |
904 |
windows origin and/or extent. |
|
905 |
The type argument may be #dialog or #normal, and specifies if the view |
|
906 |
should be opened as a modal view, blocking interaction to the currently |
|
907 |
active view, or as a normal view." |
|
908 |
||
909 |
origin notNil ifTrue:[ |
|
910 |
window origin:origin |
|
911 |
]. |
|
912 |
ext notNil ifTrue:[ |
|
480 | 913 |
window extent:ext. |
914 |
] ifFalse:[ |
|
915 |
type == #dialog ifTrue:[ |
|
916 |
window fixSize |
|
917 |
] |
|
918 |
]. |
|
919 |
||
428 | 920 |
type == #dialog ifTrue:[ |
467 | 921 |
window fixPosition:(window device pointerPosition - window positionOffset). |
428 | 922 |
window openModal. |
923 |
^ self |
|
924 |
]. |
|
925 |
||
926 |
type == #normal ifTrue:[ |
|
480 | 927 |
window isNil ifTrue:[ |
965
04cadbd21aac
use new ApplicationWindow (instead of StandardSystemView)
Claus Gittinger <cg@exept.de>
parents:
961
diff
changeset
|
928 |
self setupWindowFor:(ApplicationWindow new). |
480 | 929 |
]. |
930 |
||
428 | 931 |
window open. |
932 |
^ self |
|
933 |
]. |
|
934 |
||
935 |
type == #popUp ifTrue:[ |
|
467 | 936 |
window fixPosition:(window device pointerPosition). |
937 |
window openAsPopUp. |
|
428 | 938 |
^ self |
939 |
]. |
|
940 |
||
941 |
" |
|
942 |
if ST-80 supports more types - these may be added later |
|
943 |
" |
|
944 |
self halt:'unimplemented' |
|
945 |
||
735 | 946 |
"Created: / 14.2.1997 / 20:22:24 / cg" |
965
04cadbd21aac
use new ApplicationWindow (instead of StandardSystemView)
Claus Gittinger <cg@exept.de>
parents:
961
diff
changeset
|
947 |
"Modified: / 18.6.1998 / 19:10:07 / cg" |
428 | 948 |
! |
949 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
950 |
openDialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
951 |
"open my topView, as previously created as a modal view, |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
952 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
953 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
954 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
955 |
openWithExtent:nil |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
956 |
andType:#dialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
957 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
958 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
959 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
960 |
|
428 | 961 |
openDialogAt:aPoint withExtent:ext |
962 |
"open my topView, as previously created as a modal view, |
|
963 |
blocking interaction to the currently active view." |
|
964 |
||
965 |
self |
|
966 |
openAt:aPoint withExtent:ext |
|
967 |
andType:#dialog |
|
968 |
||
969 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
|
970 |
"Created: 14.2.1997 / 20:24:19 / cg" |
|
971 |
! |
|
972 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
973 |
openDialogWithExtent:ext |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
974 |
"open my topView, as previously created as a modal view, |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
975 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
976 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
977 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
978 |
openWithExtent:ext |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
979 |
andType:#dialog |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
980 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
981 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
982 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
983 |
|
664 | 984 |
openModal |
985 |
"open my topView, as previously created" |
|
986 |
||
987 |
self |
|
988 |
openWithExtent:nil |
|
989 |
andType:#dialog |
|
990 |
||
991 |
"Modified: 3.3.1997 / 19:43:57 / cg" |
|
992 |
! |
|
993 |
||
428 | 994 |
openPopUpAt:aPoint |
995 |
"open my topView, as previously created as a popUp view, |
|
996 |
blocking interaction to the currently active view." |
|
997 |
||
998 |
self |
|
999 |
openAt:aPoint withExtent:nil |
|
1000 |
andType:#popUp |
|
1001 |
||
1002 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
|
1003 |
"Created: 14.2.1997 / 20:24:38 / cg" |
|
1004 |
! |
|
1005 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1006 |
openPopUpIn:aRectangle |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1007 |
"open my topView, as previously created as a popUp view, |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1008 |
blocking interaction to the currently active view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1009 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1010 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1011 |
openWithExtent:nil |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1012 |
andType:#popUp |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1013 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1014 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1015 |
"Created: 17.1.1997 / 20:01:24 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1016 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1017 |
|
587 | 1018 |
openWindowAt:aPoint |
1019 |
"open my topView at some location" |
|
1020 |
||
1021 |
self openAt:aPoint |
|
1022 |
! |
|
1023 |
||
1024 |
openWindowAt:origin withExtent:ext andType:type |
|
1025 |
"open my window, as previously created, optionally defining the |
|
1026 |
windows origin and/or extent. |
|
1027 |
The type argument may be #dialog or #normal, and specifies if the view |
|
1028 |
should be opened as a modal view, blocking interaction to the currently |
|
1029 |
active view, or as a normal view." |
|
1030 |
||
1031 |
^ self openAt:origin withExtent:ext andType:type |
|
1032 |
! |
|
1033 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1034 |
openWithExtent:aPoint |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1035 |
"open my topView, as previously created, but override |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1036 |
the extent." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1037 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1038 |
self |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1039 |
openWithExtent:aPoint |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1040 |
andType:(application defaultWindowType) |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1041 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1042 |
"Modified: 17.1.1997 / 19:58:48 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1043 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1044 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1045 |
openWithExtent:ext andType:type |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1046 |
"open my window, as previously created. The type argument |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1047 |
may be #dialog or #normal, and specifies if the view should |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1048 |
be opened as a modal view, blocking interaction to the currently |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1049 |
active view, or as a normal view." |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1050 |
|
428 | 1051 |
^ self openAt:nil withExtent:ext andType:type |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1052 |
|
428 | 1053 |
"Modified: 14.2.1997 / 20:22:47 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1054 |
! ! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1055 |
|
132 | 1056 |
!WindowBuilder class methodsFor:'documentation'! |
1057 |
||
1058 |
version |
|
981
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
1059 |
^ '$Header: /cvs/stx/stx/libview2/Attic/WinBuilder.st,v 1.68 1998-06-20 12:31:31 cg Exp $' |
132 | 1060 |
! ! |