author | Claus Gittinger <cg@exept.de> |
Thu, 03 Mar 2011 20:24:01 +0100 | |
changeset 2896 | 96d5a0b6fc56 |
parent 2894 | 4380670e758e |
child 2897 | ea76bd971a64 |
permissions | -rw-r--r-- |
89 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
2870 | 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 |
" |
|
1395 | 12 |
"{ Package: 'stx:libview2' }" |
13 |
||
100 | 14 |
Object subclass:#WindowBuilder |
2288 | 15 |
instanceVariableNames:'window application bindings visuals labels namedComponents |
16 |
helpKeys componentCreationHook applicationClass keyboardProcessor |
|
2460 | 17 |
subCanvasSpecs componentToSpecMapping' |
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
18 |
classVariableNames:'StopOnError Verbose' |
436 | 19 |
poolDictionaries:'' |
2362 | 20 |
category:'Interface-Framework' |
66 | 21 |
! |
22 |
||
23 |
!WindowBuilder class methodsFor:'documentation'! |
|
24 |
||
89 | 25 |
copyright |
26 |
" |
|
27 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
2870 | 28 |
All Rights Reserved |
89 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
66 | 39 |
documentation |
40 |
" |
|
69 | 41 |
a no-op class, for systems which do not use the UIBuilder. |
66 | 42 |
Concrete subclasses know how to create a view (with components) from |
848 | 43 |
some interface spec. |
44 |
||
45 |
The order of the lookup sequence to access an aspect is defined: |
|
2870 | 46 |
application |
47 |
application class |
|
48 |
additional class (applicationClass). |
|
848 | 49 |
|
50 |
Methods to access any aspect are located in the category |
|
51 |
'spec creation aspect fetch'. |
|
52 |
||
735 | 53 |
Currently, an experimantal version of UIBuilder exists, |
66 | 54 |
and more may be added in the future (for example, to parse different UI |
735 | 55 |
specs - thinking of motifs UIL specs, Windows DialogSpecs etc.). |
223 | 56 |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
57 |
[instance variables:] |
2870 | 58 |
window <View> |
59 |
the topView into which the components |
|
60 |
are (have been) created from the specification |
|
61 |
||
62 |
application <ApplicationModel> |
|
63 |
the application object (typically an instance |
|
64 |
of a subclass of ApplicationModel). |
|
65 |
That one is usually supposed to provide |
|
66 |
valueHolders for aspects, action methods |
|
67 |
menuSpecs and possibly more windowSpecs. |
|
68 |
Usually means, that most of those can also be |
|
69 |
provided to the builder via a set of bindings, |
|
70 |
which overrides those. |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
71 |
|
2870 | 72 |
bindings <Dictionary> |
73 |
can be set (or filled) with bindings for |
|
74 |
aspects to be used when setting up the models |
|
75 |
for components. Useful either to overwrite |
|
76 |
corresponding appModel aspects or if the appModel |
|
77 |
does not want to procide those. |
|
78 |
(for example, to open a dialog and provide the |
|
79 |
bindings in a dictionary - as opposed to |
|
80 |
providing them via aspect methods) |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
81 |
|
2870 | 82 |
visuals not yet used - for compatibility |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
83 |
|
2870 | 84 |
focusSequence <Collection> |
85 |
maintained during the build process; |
|
86 |
contains tabable components. |
|
87 |
This will be replaced by a more intelligent |
|
88 |
mechanism in the near future. |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
89 |
|
2870 | 90 |
namedComponents <Dictionary> |
91 |
contains name->component associations for |
|
92 |
all components which have a non-nil component |
|
93 |
name. Created during the build process. |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
94 |
|
2870 | 95 |
helpKeys not yet used - for compatibility |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
96 |
|
2870 | 97 |
componentCreationHook <BlockOrNil> |
98 |
can be set before the components are built |
|
99 |
from the spec, to provide an arbitrary |
|
100 |
callBacks-hook which will be invoked after |
|
101 |
a component has been created from a spec. |
|
102 |
The UIPainter uses this to maintain its |
|
103 |
component<->spec assiciations. |
|
104 |
Can be set by the app, to catch creation of |
|
105 |
components and fiddle around during the |
|
106 |
creation process (change extents, colors or whatever) |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
107 |
|
2870 | 108 |
applicationClass <ClassOrNil> |
109 |
can be set to provide an additional class which |
|
110 |
is asked for aspects during the build process. |
|
111 |
If not set, the app is asked, which itself asks |
|
112 |
its class. |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
113 |
|
2870 | 114 |
keyboardProcessor not yet used - for compatibility |
115 |
Will eventually takeover the functionality |
|
116 |
of the focusSequence, shortcuts & provide a hook |
|
117 |
for the app. |
|
118 |
||
119 |
subCanvasSpecs <Dictionary> |
|
120 |
can be set by the app to provide subcanvas |
|
121 |
specs (much like the bindings dictionary) |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
122 |
|
223 | 123 |
[author:] |
2870 | 124 |
Claus Gittinger |
66 | 125 |
" |
126 |
! ! |
|
127 |
||
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
128 |
!WindowBuilder class methodsFor:'debugging'! |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
129 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
130 |
stopOnError:aBoolean |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
131 |
"enable/disable debug halt when aspects are missing. |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
132 |
Useful during development, to detect missing aspects. |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
133 |
The default is off." |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
134 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
135 |
StopOnError := aBoolean |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
136 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
137 |
"Modified: / 4.8.1998 / 19:40:09 / cg" |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
138 |
! |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
139 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
140 |
verbose:aBoolean |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
141 |
"enable/disable debug messages on the Transcript. |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
142 |
Useful during development, to detect missing aspects. |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
143 |
The default is off." |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
144 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
145 |
Verbose := aBoolean |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
146 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
147 |
"Created: / 4.8.1998 / 19:39:37 / cg" |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
148 |
"Modified: / 4.8.1998 / 19:40:14 / cg" |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
149 |
! ! |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
150 |
|
1763 | 151 |
!WindowBuilder methodsFor:'Compatibility-VW'! |
974 | 152 |
|
153 |
source |
|
154 |
"same as #application, for ST-80 compatibility" |
|
155 |
||
156 |
^ application |
|
157 |
||
158 |
"Created: 17.1.1997 / 19:03:51 / cg" |
|
159 |
! |
|
160 |
||
161 |
source:anApplicationModel |
|
162 |
"same as #application:, for ST-80 compatibility" |
|
163 |
||
164 |
application := anApplicationModel |
|
165 |
||
166 |
"Modified: 17.1.1997 / 19:03:57 / cg" |
|
167 |
! ! |
|
168 |
||
66 | 169 |
!WindowBuilder methodsFor:'accessing'! |
170 |
||
463 | 171 |
addBindings:moreBindings |
172 |
"used with subDialogs, which provide local bindings. |
|
173 |
All bindings from moreBindings overwrite any local bindings." |
|
174 |
||
175 |
moreBindings notNil ifTrue:[ |
|
2870 | 176 |
bindings isNil ifTrue:[ |
177 |
bindings := IdentityDictionary new |
|
178 |
]. |
|
179 |
bindings addAll:moreBindings |
|
463 | 180 |
] |
181 |
||
182 |
"Created: 28.2.1997 / 14:14:33 / cg" |
|
183 |
! |
|
184 |
||
100 | 185 |
application |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
186 |
"return the application (an ApplicationModel), |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
187 |
for which the view is built. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
188 |
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
|
189 |
|
100 | 190 |
^ application |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
191 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
192 |
"Modified: 17.1.1997 / 19:04:40 / cg" |
66 | 193 |
! |
194 |
||
125 | 195 |
application:anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
196 |
"set the application (an ApplicationModel), |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
197 |
for which the view is built. |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
198 |
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
|
199 |
|
125 | 200 |
application := anApplicationModel |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
201 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
202 |
"Modified: 17.1.1997 / 19:04:47 / cg" |
66 | 203 |
! |
204 |
||
1155 | 205 |
applicationClass |
206 |
"return the value of the instance variable 'applicationClass' (automatically generated). |
|
1585 | 207 |
WARNING: |
2870 | 208 |
This is a private interface for the UIPainter to pass down the app-class |
209 |
to the specs when editing." |
|
1155 | 210 |
|
2870 | 211 |
^ applicationClass |
1155 | 212 |
! |
213 |
||
422 | 214 |
applicationClass:something |
1155 | 215 |
"set the value of the instance variable 'applicationClass' (automatically generated). |
1585 | 216 |
WARNING: |
2870 | 217 |
This is a private interface for the UIPainter to pass down the app-class |
218 |
to the specs when editing." |
|
422 | 219 |
|
1155 | 220 |
applicationClass := something. |
221 |
! |
|
422 | 222 |
|
66 | 223 |
aspectAt:aSymbol |
2005 | 224 |
"return the aspect for a symbol or nil." |
225 |
||
2870 | 226 |
^ self |
227 |
aspectAt:aSymbol |
|
228 |
ifAbsent:[self aspectNotFound:aSymbol error:'no aspect for:'] |
|
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
229 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
230 |
"Modified: / 4.8.1998 / 19:29:36 / cg" |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
231 |
! |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
232 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
233 |
aspectAt:aSymbol ifAbsent:exceptionBlock |
2005 | 234 |
"return the aspect for a symbol or the value from exceptionBlock." |
235 |
||
433 | 236 |
|b| |
237 |
||
473 | 238 |
aSymbol notNil ifTrue:[ |
2870 | 239 |
bindings notNil ifTrue:[ |
240 |
b := bindings at:aSymbol ifAbsent:nil. |
|
241 |
b notNil ifTrue:[^ b]. |
|
242 |
]. |
|
434 | 243 |
|
2870 | 244 |
application notNil ifTrue:[ |
245 |
MessageNotUnderstood |
|
246 |
ignoreNotUnderstoodOf:aSymbol |
|
247 |
in:[ |
|
248 |
^ application aspectFor:aSymbol |
|
249 |
]. |
|
250 |
MessageNotUnderstood |
|
251 |
ignoreNotUnderstoodOf:aSymbol |
|
252 |
in:[ |
|
253 |
^ application class aspectFor:aSymbol |
|
254 |
]. |
|
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
255 |
|
2870 | 256 |
^ exceptionBlock value. |
257 |
] |
|
433 | 258 |
]. |
259 |
^ nil |
|
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
260 |
|
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
261 |
"Created: / 4.8.1998 / 19:28:30 / cg" |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
262 |
"Modified: / 4.8.1998 / 19:37:02 / cg" |
66 | 263 |
! |
264 |
||
125 | 265 |
aspectAt:aSymbol put:aModel |
2499 | 266 |
"store an aspect identified by its symbol and its value. |
267 |
Returns the stored aspect !!" |
|
2005 | 268 |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
269 |
bindings isNil ifTrue:[ |
2870 | 270 |
bindings := IdentityDictionary new |
125 | 271 |
]. |
2499 | 272 |
bindings at:aSymbol put:aModel. |
273 |
^ aModel |
|
100 | 274 |
! |
275 |
||
450 | 276 |
bindingAt:aSymbol |
2005 | 277 |
"return the binding for a symbol or nil if there is none" |
278 |
||
450 | 279 |
bindings notNil ifTrue:[ |
2870 | 280 |
^ bindings at:aSymbol ifAbsent:nil. |
450 | 281 |
]. |
282 |
^ nil |
|
283 |
! |
|
284 |
||
100 | 285 |
bindings |
2005 | 286 |
"return my bindings" |
287 |
||
2744 | 288 |
bindings isNil ifTrue:[ bindings := Dictionary new ]. |
100 | 289 |
^ bindings |
2744 | 290 |
|
291 |
"Modified: / 20-04-2005 / 18:59:28 / janfrog" |
|
100 | 292 |
! |
293 |
||
294 |
bindings:aDictionary |
|
2005 | 295 |
"set bindings to a dictionary" |
296 |
||
100 | 297 |
bindings := aDictionary |
298 |
! |
|
299 |
||
125 | 300 |
componentAt:name |
1673 | 301 |
"return a component identified by its name" |
1208 | 302 |
|
1673 | 303 |
|widget| |
1208 | 304 |
|
305 |
namedComponents notNil ifTrue:[ |
|
2870 | 306 |
widget := namedComponents at:name asSymbol ifAbsent:nil. |
307 |
widget notNil ifTrue:[^ widget]. |
|
1208 | 308 |
]. |
309 |
||
310 |
"/ cg the following code looks in any application- |
|
311 |
"/ or master applications builder for the component. |
|
1357
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
312 |
"/ This has an effect, if a subcanvases builder is asked for |
1208 | 313 |
"/ a component, which is actually held by the real-apps builder |
314 |
"/ (in case they have different builders). |
|
315 |
"/ For now, this code is disabled, since I dont know what effect this |
|
316 |
"/ has to existing code ... |
|
317 |
||
318 |
"/ application notNil ifTrue:[ |
|
1673 | 319 |
"/ |appBuilder masterApplication masterBuilder| |
320 |
"/ |
|
1208 | 321 |
"/ (appBuilder := application builder) notNil ifTrue:[ |
2870 | 322 |
"/ appBuilder ~~ self ifTrue:[ |
1208 | 323 |
"/ ^ appBuilder componentAt:name |
324 |
"/ ] |
|
325 |
"/ ]. |
|
326 |
"/ |
|
327 |
"/ (masterApplication := application masterApplication) notNil ifTrue:[ |
|
328 |
"/ (masterBuilder := masterApplication builder) notNil ifTrue:[ |
|
2870 | 329 |
"/ masterBuilder ~~ self ifTrue:[ |
1208 | 330 |
"/ ^ masterBuilder componentAt:name |
331 |
"/ ] |
|
332 |
"/ ] |
|
333 |
"/ ] |
|
334 |
"/ ]. |
|
335 |
^ nil |
|
125 | 336 |
! |
337 |
||
100 | 338 |
componentAt:name put:aComponent |
2005 | 339 |
"store a component identified by its name." |
340 |
||
450 | 341 |
namedComponents isNil ifTrue:[ |
2870 | 342 |
namedComponents := IdentityDictionary new. |
100 | 343 |
]. |
450 | 344 |
namedComponents at:name asSymbol put:aComponent |
100 | 345 |
! |
346 |
||
410 | 347 |
componentCreationHook:something |
348 |
"set the value of the instance variable 'componentCreationHook' (automatically generated)" |
|
349 |
||
1447 | 350 |
componentCreationHook := something. |
351 |
! |
|
410 | 352 |
|
2460 | 353 |
componentToSpecMappingAt:aView |
354 |
componentToSpecMapping isNil ifTrue:[^ nil]. |
|
355 |
^ componentToSpecMapping at:aView ifAbsent:nil |
|
356 |
! |
|
357 |
||
358 |
componentToSpecMappingAt:aView put:aSpec |
|
2462 | 359 |
|
360 |
"/ self assert:(aSpec isKindOf:UISpecification). |
|
361 |
||
2460 | 362 |
componentToSpecMapping isNil ifTrue:[ |
2870 | 363 |
componentToSpecMapping := IdentityDictionary new. |
2460 | 364 |
]. |
365 |
componentToSpecMapping at:aView put:aSpec |
|
366 |
! |
|
367 |
||
1357
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
368 |
findComponentAt:name |
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
369 |
"recursively search for a component identified by its name in myself |
2005 | 370 |
and all of my subApplications." |
1357
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
371 |
|
2870 | 372 |
^ self |
373 |
findComponentAt:name |
|
374 |
forWhichViewConformsTo:[:v | true] |
|
375 |
ignoringViews:(IdentitySet new). |
|
1563
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
376 |
! |
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
377 |
|
1992 | 378 |
findComponentAt:name forWhichViewConformsTo:viewCheck ignoringViews:triedViews |
379 |
"recursively search for a visible component identified by its name in myself |
|
1563
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
380 |
and all of my subApplications. |
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
381 |
As a builders applications view might be different from the builders view, |
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
382 |
we must be careful to avoid endless recursion if a subview refers to the topviews builder, |
2005 | 383 |
(sigh)" |
1563
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
384 |
|
1992 | 385 |
|comp "window" app b| |
386 |
||
387 |
(comp := self componentAt:name) notNil ifTrue:[ |
|
2870 | 388 |
^ comp |
1992 | 389 |
]. |
1357
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
390 |
|
1992 | 391 |
window isNil ifTrue:[ |
2870 | 392 |
^ self |
1992 | 393 |
]. |
394 |
"/ window := self application window. |
|
1563
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
395 |
|
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
396 |
(triedViews includes:window) ifTrue:[^ nil]. |
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
397 |
triedViews add:window. |
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
398 |
|
166f840701bf
avoid endless recursion in #findComponentAt:
Claus Gittinger <cg@exept.de>
parents:
1533
diff
changeset
|
399 |
window allSubViewsDo:[:v | |
2870 | 400 |
(triedViews includes:v) ifFalse:[ |
401 |
triedViews add:v. |
|
402 |
(viewCheck value:v) ifTrue:[ |
|
403 |
((app := v application) notNil |
|
404 |
and:[(b := app builder) notNil |
|
405 |
and:[b ~~ self]]) |
|
406 |
ifTrue:[ |
|
407 |
comp := b findComponentAt:name forWhichViewConformsTo:viewCheck ignoringViews:triedViews. |
|
408 |
comp notNil ifTrue:[ |
|
409 |
^ comp |
|
410 |
] |
|
411 |
] |
|
412 |
] |
|
413 |
] |
|
1357
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
414 |
]. |
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
415 |
^ nil |
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
416 |
! |
facab5c393b9
added #findComponentAt: - recursive search for a named component
Claus Gittinger <cg@exept.de>
parents:
1351
diff
changeset
|
417 |
|
1992 | 418 |
findVisibleComponentAt:name |
419 |
"recursively search for a visible component identified by its name in myself |
|
420 |
and all of my subApplications. |
|
2005 | 421 |
Be careful: this also searches for components in unmapped canvases." |
1992 | 422 |
|
2870 | 423 |
^ self |
424 |
findComponentAt:name |
|
425 |
forWhichViewConformsTo:[:v | v shown] |
|
426 |
ignoringViews:(IdentitySet new). |
|
1992 | 427 |
! |
428 |
||
600 | 429 |
helpKeyFor:aComponent |
2005 | 430 |
"return the helpkey for a component or nil" |
431 |
||
600 | 432 |
|v key| |
433 |
||
434 |
v := aComponent. |
|
435 |
[v notNil] whileTrue:[ |
|
2870 | 436 |
(key := v helpKey) notNil ifTrue:[ |
437 |
^ key |
|
438 |
]. |
|
2077 | 439 |
"/ helpKeys notNil ifTrue:[ |
440 |
"/ (key := helpKeys at:v ifAbsent:nil) notNil ifTrue:[ |
|
441 |
"/ ^ key |
|
442 |
"/ ]. |
|
443 |
"/ ]. |
|
2870 | 444 |
v := v superView |
600 | 445 |
]. |
595 | 446 |
^ nil |
600 | 447 |
! |
595 | 448 |
|
600 | 449 |
helpKeyFor:aComponent put:aKey |
848 | 450 |
"assign a key for a component which is used to access the help text |
2005 | 451 |
from the application." |
452 |
||
2077 | 453 |
aComponent helpKey:aKey. |
454 |
||
455 |
"/ aKey isNil ifTrue:[ |
|
456 |
"/ helpKeys isNil ifFalse:[ |
|
457 |
"/ helpKeys removeKey:aComponent ifAbsent:nil |
|
458 |
"/ ] |
|
459 |
"/ ] ifFalse:[ |
|
460 |
"/ helpKeys isNil ifTrue:[ |
|
461 |
"/ helpKeys := IdentityDictionary new |
|
462 |
"/ ]. |
|
463 |
"/ helpKeys at:aComponent put:aKey |
|
464 |
"/ ] |
|
595 | 465 |
! |
466 |
||
477 | 467 |
keyboardProcessor |
2005 | 468 |
"return my keyboard processor" |
469 |
||
477 | 470 |
keyboardProcessor isNil ifTrue:[ |
2870 | 471 |
keyboardProcessor := KeyboardProcessor new |
477 | 472 |
]. |
473 |
^ keyboardProcessor |
|
474 |
||
475 |
"Created: 3.3.1997 / 18:31:37 / cg" |
|
476 |
"Modified: 3.3.1997 / 18:32:27 / cg" |
|
477 |
! |
|
478 |
||
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
479 |
keyboardProcessor:aKeyboardProcessor |
2005 | 480 |
"set my keyboard processor" |
481 |
||
970
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
482 |
keyboardProcessor := aKeyboardProcessor |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
483 |
|
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
484 |
"Created: / 18.6.1998 / 19:59:38 / cg" |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
485 |
! |
d8920428eb28
undid some exception handling stuff;
Claus Gittinger <cg@exept.de>
parents:
965
diff
changeset
|
486 |
|
855
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
487 |
labelAt:name |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
488 |
labels isNil ifTrue:[^ nil]. |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
489 |
^ labels at:name asSymbol ifAbsent:nil |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
490 |
|
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
491 |
"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
|
492 |
! |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
493 |
|
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
494 |
labelAt:name put:aLabelString |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
495 |
labels isNil ifTrue:[ |
2870 | 496 |
labels := IdentityDictionary new. |
855
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
497 |
]. |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
498 |
labels at:name asSymbol put:aLabelString |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
499 |
|
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
500 |
"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
|
501 |
! |
baf65c4e2bed
added #labelAt: / labelAt:put: for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents:
848
diff
changeset
|
502 |
|
848 | 503 |
menuAt:aKey |
2870 | 504 |
"Find a binding for the menu named aKey, either in the bindings |
848 | 505 |
or from the source" |
506 |
||
507 |
^ self menuFor:aKey |
|
508 |
||
509 |
||
510 |
! |
|
511 |
||
512 |
menuAt:aSymbol put:someMenuOrHolder |
|
513 |
"add someMenuOrHolder as the binding for the menu named aSymbol to the bindings" |
|
514 |
||
515 |
^ self aspectAt:aSymbol put:someMenuOrHolder |
|
516 |
||
517 |
! |
|
518 |
||
86 | 519 |
namedComponents |
2005 | 520 |
"return a list of named components" |
521 |
||
450 | 522 |
^ namedComponents |
86 | 523 |
! |
524 |
||
1971 | 525 |
namedComponentsDo: aBlock |
526 |
namedComponents notNil ifTrue:[ |
|
2870 | 527 |
namedComponents do:[:aView| |
528 |
aBlock value: aView |
|
529 |
] |
|
1971 | 530 |
] |
531 |
! |
|
532 |
||
1585 | 533 |
resources |
2870 | 534 |
"return the applications resources - |
2610 | 535 |
that's a ResourcePack containing national language strings" |
536 |
||
1585 | 537 |
application notNil ifTrue:[ |
2870 | 538 |
^ application resources |
1585 | 539 |
]. |
540 |
^ Dialog classResources. |
|
541 |
! |
|
542 |
||
502 | 543 |
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
|
544 |
"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
|
545 |
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
|
546 |
which can be filled via #specificationAt:at:put: messages. |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
547 |
If not present, or none is found there, we bounce back trying |
824 | 548 |
#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
|
549 |
message to the class named as majorKey. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
550 |
Notice, that the class named majorKey is first searched in the |
2005 | 551 |
application classes namespace - allowing private classes as majorKey." |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
552 |
|
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
553 |
|spec cls dict dkey| |
502 | 554 |
|
1351
42d9de8818bf
care for nil minorKey in #subCanvasAt:at:
Claus Gittinger <cg@exept.de>
parents:
1344
diff
changeset
|
555 |
minorKey isNil ifTrue:[^ nil]. |
42d9de8818bf
care for nil minorKey in #subCanvasAt:at:
Claus Gittinger <cg@exept.de>
parents:
1344
diff
changeset
|
556 |
|
502 | 557 |
subCanvasSpecs notNil ifTrue:[ |
2870 | 558 |
dkey := majorKey ? #NoMajorKey. |
559 |
dict := subCanvasSpecs at:dkey ifAbsent:nil. |
|
586 | 560 |
|
2870 | 561 |
dict notNil ifTrue:[ |
562 |
spec := dict at:minorKey ifAbsent:nil. |
|
563 |
spec notNil ifTrue:[^ spec]. |
|
564 |
]. |
|
502 | 565 |
]. |
586 | 566 |
|
502 | 567 |
majorKey isNil ifTrue:[ |
2870 | 568 |
spec := self specificationFor:minorKey. |
569 |
spec isNil ifTrue:[ |
|
570 |
"fallback for UIPainter" |
|
571 |
MessageNotUnderstood catch:[ |
|
572 |
spec := applicationClass perform:minorKey. |
|
573 |
]. |
|
574 |
]. |
|
575 |
^ spec |
|
848 | 576 |
]. |
577 |
||
578 |
application notNil ifTrue:[ |
|
2870 | 579 |
"/ look for class in applications namespace ... |
580 |
cls := application resolveName:majorKey. |
|
502 | 581 |
] ifFalse:[ |
2870 | 582 |
"/ fallBack - use that global, if it exists |
583 |
cls := Smalltalk at:majorKey. |
|
584 |
cls isNil ifTrue:[ |
|
585 |
Transcript showCR:('WindowBuilder[warning]: missing application when fetching majorKey:' , majorKey). |
|
586 |
]. |
|
502 | 587 |
]. |
586 | 588 |
|
848 | 589 |
cls notNil ifTrue:[ |
2870 | 590 |
MessageNotUnderstood catch:[ |
591 |
^ cls specificationFor:minorKey |
|
592 |
]. |
|
593 |
MessageNotUnderstood catch:[ |
|
594 |
^ cls perform:minorKey. |
|
595 |
] |
|
848 | 596 |
]. |
597 |
^ nil |
|
502 | 598 |
! |
599 |
||
600 |
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
|
601 |
"deposit an interfaceSpecification for major and minor key |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
602 |
in my private subCanvasSpecs dictionary. |
2870 | 603 |
This will be used later, when building, |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
604 |
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
|
605 |
(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
|
606 |
See #subCanvasAt:at:." |
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
607 |
|
502 | 608 |
|dict key| |
609 |
||
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
610 |
subCanvasSpecs isNil ifTrue:[ |
2870 | 611 |
"/ lazyly initialize |
612 |
subCanvasSpecs := IdentityDictionary new |
|
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
613 |
]. |
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
614 |
|
502 | 615 |
key := majorKey ? #NoMajorKey. |
616 |
dict := subCanvasSpecs at:key ifAbsent:nil. |
|
617 |
dict isNil ifTrue:[ |
|
2870 | 618 |
dict := IdentityDictionary new. |
619 |
subCanvasSpecs at:key put:dict |
|
502 | 620 |
]. |
621 |
dict at:minorKey put:aSpec |
|
622 |
||
774
fb8810086f95
removed unused instVar windowView;
Claus Gittinger <cg@exept.de>
parents:
735
diff
changeset
|
623 |
"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
|
624 |
"Modified: / 5.2.1998 / 12:05:32 / stefan" |
502 | 625 |
! |
626 |
||
475
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
627 |
visualAt:name |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
628 |
visuals isNil ifTrue:[^ nil]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
629 |
^ visuals at:name asSymbol ifAbsent:nil |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
630 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
631 |
"Created: 3.3.1997 / 16:24:17 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
632 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
633 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
634 |
visualAt:name put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
635 |
visuals isNil ifTrue:[ |
2870 | 636 |
visuals := IdentityDictionary new. |
475
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
637 |
]. |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
638 |
visuals at:name asSymbol put:aVisual |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
639 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
640 |
"Created: 3.3.1997 / 16:24:41 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
641 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
642 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
643 |
visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
644 |
^ visuals |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
645 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
646 |
"Created: 3.3.1997 / 16:24:00 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
647 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
648 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
649 |
visuals:aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
650 |
visuals := aDictionary |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
651 |
|
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
652 |
"Created: 3.3.1997 / 16:24:06 / cg" |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
653 |
! |
fd94f2bc8b9e
added #visuals, #visualAt: and #visualAt:put:
Claus Gittinger <cg@exept.de>
parents:
473
diff
changeset
|
654 |
|
125 | 655 |
window |
1995 | 656 |
"return the top window (view), for which an interface is (being) built" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
657 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
658 |
^ window |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
659 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
660 |
"Modified: 17.1.1997 / 19:30:00 / cg" |
125 | 661 |
! |
662 |
||
663 |
window:aView |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
664 |
"set the top window (view), for which an interface |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
665 |
is (being) built" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
666 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
667 |
window := aView |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
668 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
669 |
"Modified: 17.1.1997 / 19:30:22 / cg" |
66 | 670 |
! |
671 |
||
672 |
windowGroup |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
673 |
^ window windowGroup |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
674 |
|
608 | 675 |
"Modified: 17.6.1997 / 18:04:01 / cg" |
66 | 676 |
! ! |
677 |
||
673
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
678 |
!WindowBuilder methodsFor:'aspect access support'! |
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
679 |
|
675 | 680 |
booleanValueAspectFor:aKey |
674 | 681 |
"helper (common code) to generate a boolean aspect if required. |
682 |
If no binding exists for aKey, a valueHolder holding false is |
|
683 |
created and added to the bindings. |
|
684 |
Otherwise, the existing binding is returned." |
|
673
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
685 |
|
676 | 686 |
^ self valueAspectFor:aKey initialValue:false |
673
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
687 |
|
676 | 688 |
"Modified: 28.7.1997 / 12:53:57 / cg" |
675 | 689 |
! |
690 |
||
1198
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
691 |
listAspectFor:aKey |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
692 |
"helper (common code) to generate a list model aspect if required. |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
693 |
If no binding exists for aKey, a new List is |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
694 |
created and added to the bindings. |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
695 |
Otherwise, the existing binding is returned." |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
696 |
|
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
697 |
|list| |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
698 |
|
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
699 |
(list := self bindingAt:aKey) isNil ifTrue:[ |
2870 | 700 |
self aspectAt:aKey put:(list := List new). |
1198
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
701 |
]. |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
702 |
^ list |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
703 |
|
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
704 |
"Created: 28.7.1997 / 12:53:45 / cg" |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
705 |
"Modified: 28.7.1997 / 12:54:13 / cg" |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
706 |
! |
b10129322a0c
another convenient method: #listAspectFor:
Claus Gittinger <cg@exept.de>
parents:
1155
diff
changeset
|
707 |
|
675 | 708 |
nilValueAspectFor:aKey |
709 |
"helper (common code) to generate a valueHolder aspect if required. |
|
710 |
If no binding exists for aKey, a valueHolder holding nil is |
|
711 |
created and added to the bindings. |
|
712 |
Otherwise, the existing binding is returned." |
|
713 |
||
676 | 714 |
^ self valueAspectFor:aKey initialValue:nil |
715 |
||
716 |
"Modified: 28.7.1997 / 12:54:06 / cg" |
|
717 |
! |
|
718 |
||
2403
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
719 |
valueAspectFor:aKey computeInitialValueWith:initialValueBlock |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
720 |
"helper (common code) to generate a valueHolder aspect if required. |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
721 |
If no binding exists for aKey, a valueHolder holding initialValue is |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
722 |
created and added to the bindings. |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
723 |
Otherwise, the existing binding is returned. |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
724 |
The initial value is computed by evaluating initialValueBlock" |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
725 |
|
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
726 |
|holder| |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
727 |
|
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
728 |
(holder := self bindingAt:aKey) isNil ifTrue:[ |
2870 | 729 |
self aspectAt:aKey put:(holder := initialValueBlock value asValue). |
2403
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
730 |
]. |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
731 |
^ holder |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
732 |
! |
e9733679fa92
changed #valueAspectFor:computeInitialValueWith:
Claus Gittinger <cg@exept.de>
parents:
2389
diff
changeset
|
733 |
|
676 | 734 |
valueAspectFor:aKey initialValue:initialValue |
735 |
"helper (common code) to generate a valueHolder aspect if required. |
|
736 |
If no binding exists for aKey, a valueHolder holding initialValue is |
|
737 |
created and added to the bindings. |
|
738 |
Otherwise, the existing binding is returned." |
|
739 |
||
675 | 740 |
|holder| |
741 |
||
742 |
(holder := self bindingAt:aKey) isNil ifTrue:[ |
|
2870 | 743 |
self aspectAt:aKey put:(holder := initialValue asValue). |
675 | 744 |
]. |
745 |
^ holder |
|
746 |
||
676 | 747 |
"Created: 28.7.1997 / 12:53:45 / cg" |
748 |
"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
|
749 |
! ! |
5e342b1ebe45
added #booleanAspectFor: as a code-saver
Claus Gittinger <cg@exept.de>
parents:
664
diff
changeset
|
750 |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
751 |
!WindowBuilder methodsFor:'building'! |
66 | 752 |
|
125 | 753 |
buildFromSpec:aSpec |
176 | 754 |
^ self subclassResponsibility |
408 | 755 |
! |
756 |
||
757 |
makeTabable:aComponent |
|
735 | 758 |
"add a component to the list of tabable components" |
759 |
||
1315 | 760 |
aComponent canTab:true |
735 | 761 |
|
1123 | 762 |
! |
763 |
||
764 |
setupWindowFor:aWindow |
|
765 |
self subclassResponsibility |
|
66 | 766 |
! ! |
100 | 767 |
|
848 | 768 |
!WindowBuilder methodsFor:'error handling'! |
769 |
||
770 |
aspectNotFound:anAspect error:aString |
|
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
771 |
"show error message on transcript (if Verbose is true) |
1825 | 772 |
and/or stop (if StopOnError) is true" |
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
773 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
774 |
Verbose == true ifTrue:[ |
2870 | 775 |
Transcript showCR:('WindowBuilder: %1 aspect: <%2>' bindWith:aString with:anAspect storeString). |
776 |
application notNil ifTrue:[ |
|
777 |
Transcript showCR:('WindowBuilder: (while building for %1)' bindWith:application class name). |
|
778 |
]. |
|
1028
4f3401b606bd
better warning when no aspect is found.
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
779 |
]. |
848 | 780 |
|
781 |
StopOnError == true ifTrue:[ |
|
2870 | 782 |
self halt:'aspect not found' "/ set StopOnError to true to debug end-user apps |
848 | 783 |
]. |
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
784 |
^ nil |
1028
4f3401b606bd
better warning when no aspect is found.
Claus Gittinger <cg@exept.de>
parents:
1010
diff
changeset
|
785 |
|
1395 | 786 |
"Modified: / 18.8.2000 / 14:10:59 / cg" |
848 | 787 |
! ! |
788 |
||
586 | 789 |
!WindowBuilder methodsFor:'message sending'! |
790 |
||
848 | 791 |
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
|
792 |
"send the message aSelector to the application; |
2558 | 793 |
the result returned from the send or nil is returned" |
794 |
||
2363 | 795 |
|handlerBlock| |
586 | 796 |
|
848 | 797 |
aSelector notNil ifTrue:[ |
2870 | 798 |
handlerBlock := [:ex| |
799 |
(ex selector ~~ aSelector) ifTrue:[ |
|
800 |
ex reject |
|
801 |
] |
|
802 |
]. |
|
1096
14a4fdeecd02
avoid generation of multiple handlerBlocks in savelyPerform:
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
803 |
|
2870 | 804 |
application notNil ifTrue:[ |
805 |
MessageNotUnderstood handle:handlerBlock do:[ |
|
806 |
^ application perform:aSelector |
|
807 |
]. |
|
808 |
MessageNotUnderstood handle:handlerBlock do:[ |
|
809 |
^ application class perform:aSelector |
|
810 |
] |
|
811 |
]. |
|
812 |
" |
|
813 |
WARNING: |
|
814 |
This is a private interface for the UIPainter to pass down the app-class |
|
815 |
" |
|
816 |
applicationClass notNil ifTrue:[ |
|
817 |
MessageNotUnderstood handle:handlerBlock do:[ |
|
818 |
^ applicationClass perform:aSelector |
|
819 |
] |
|
820 |
] |
|
586 | 821 |
]. |
2363 | 822 |
^ aBlock value |
981
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
823 |
|
6a9c975543ad
also reject non-selector errors in #safelyPerform: without arg.
Claus Gittinger <cg@exept.de>
parents:
974
diff
changeset
|
824 |
"Modified: / 20.6.1998 / 11:52:19 / cg" |
586 | 825 |
! |
826 |
||
848 | 827 |
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
|
828 |
"send the one-arg-message aSelector to the application; |
2005 | 829 |
the result returned from the send or nil is returned" |
830 |
||
2870 | 831 |
^ self |
832 |
safelyPerform:aSelector |
|
833 |
withArguments:(Array with:anArgument) |
|
834 |
ifNone:aBlock |
|
2363 | 835 |
! |
836 |
||
837 |
safelyPerform:aSelector with:arg1 with:arg2 ifNone:aBlock |
|
838 |
"send the two-arg-message aSelector to the application; |
|
839 |
the result returned from the send or nil is returned" |
|
840 |
||
2870 | 841 |
^ self |
842 |
safelyPerform:aSelector |
|
843 |
withArguments:(Array with:arg1 with:arg2) |
|
844 |
ifNone:aBlock |
|
2363 | 845 |
! |
846 |
||
847 |
safelyPerform:aSelector with:arg1 with:arg2 with:arg3 ifNone:aBlock |
|
848 |
"send the 3-arg-message aSelector to the application; |
|
849 |
the result returned from the send or nil is returned" |
|
850 |
||
2870 | 851 |
^ self |
852 |
safelyPerform:aSelector |
|
853 |
withArguments:(Array with:arg1 with:arg2 with:arg3) |
|
854 |
ifNone:aBlock |
|
2363 | 855 |
! |
856 |
||
857 |
safelyPerform:aSelector withArguments:arguments ifNone:aBlock |
|
858 |
"send the one-arg-message aSelector to the application; |
|
859 |
the result returned from the send or nil is returned" |
|
860 |
||
1587 | 861 |
|handlerBlock| |
586 | 862 |
|
848 | 863 |
aSelector notNil ifTrue:[ |
2870 | 864 |
handlerBlock := [:ex| |badSel| |
865 |
badSel := ex selector. |
|
866 |
(badSel ~~ aSelector and:[badSel ~~ arguments first]) ifTrue:[ |
|
867 |
ex reject |
|
868 |
] |
|
869 |
]. |
|
1096
14a4fdeecd02
avoid generation of multiple handlerBlocks in savelyPerform:
Claus Gittinger <cg@exept.de>
parents:
1092
diff
changeset
|
870 |
|
2870 | 871 |
application notNil ifTrue:[ |
872 |
MessageNotUnderstood handle:handlerBlock do:[ |
|
873 |
^ application perform:aSelector withArguments:arguments |
|
874 |
]. |
|
875 |
MessageNotUnderstood handle:handlerBlock do:[ |
|
876 |
^ application class perform:aSelector withArguments:arguments |
|
877 |
] |
|
878 |
]. |
|
879 |
" |
|
880 |
WARNING: |
|
881 |
This is a private interface for the UIPainter to pass down the app-class |
|
882 |
" |
|
883 |
applicationClass notNil ifTrue:[ |
|
884 |
MessageNotUnderstood handle:handlerBlock do:[ |
|
885 |
^ applicationClass perform:aSelector withArguments:arguments |
|
886 |
]. |
|
887 |
] |
|
848 | 888 |
]. |
1587 | 889 |
^ aBlock value |
961 | 890 |
|
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
891 |
"Modified: / 4.8.1998 / 19:33:52 / cg" |
586 | 892 |
! ! |
893 |
||
2369 | 894 |
!WindowBuilder methodsFor:'queries'! |
895 |
||
896 |
isEditing |
|
897 |
"true if building from a GUI builder resource ( UIPainter, ... ), |
|
898 |
false if building for the real thing. |
|
899 |
If true, no models or actions should be set (no application is running)" |
|
900 |
||
901 |
^ false |
|
902 |
! ! |
|
903 |
||
2546
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
904 |
!WindowBuilder methodsFor:'resolving fonts'! |
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
905 |
|
2870 | 906 |
resolveFont:fontOrSymbolOrStyle |
2546
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
907 |
"resolve fontOrSymbol to a real font" |
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
908 |
|
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
909 |
|font txtAttribs charAttribs| |
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
910 |
|
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
911 |
fontOrSymbolOrStyle isSymbol ifTrue:[ |
2870 | 912 |
self isEditing ifTrue:[ |
913 |
"special for UIPainter setup: check class for color" |
|
914 |
applicationClass notNil ifTrue:[ |
|
915 |
font := applicationClass fontFor:fontOrSymbolOrStyle. |
|
916 |
]. |
|
917 |
] ifFalse:[ |
|
918 |
font := application fontFor:fontOrSymbolOrStyle. |
|
919 |
]. |
|
920 |
font notNil ifTrue:[ |
|
921 |
^ font. |
|
922 |
]. |
|
2546
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
923 |
|
2870 | 924 |
"/ ST80 style textAttributes |
925 |
(TextAttributes notNil and:[TextAttributes isLoaded]) ifTrue:[ |
|
926 |
txtAttribs := TextAttributes styleNamed:fontOrSymbolOrStyle ifAbsent:nil. |
|
927 |
txtAttribs notNil ifTrue:[ |
|
928 |
charAttribs := txtAttribs characterAttributes. |
|
929 |
charAttribs notNil ifTrue:[ |
|
930 |
font := charAttribs defaultFont. |
|
931 |
] |
|
932 |
]. |
|
933 |
]. |
|
2546
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
934 |
|
2870 | 935 |
font isNil ifTrue:[ |
936 |
fontOrSymbolOrStyle == #labelFont ifTrue:[ |
|
937 |
^ Label defaultFont |
|
938 |
]. |
|
939 |
fontOrSymbolOrStyle == #buttonFont ifTrue:[ |
|
940 |
^ Button defaultFont |
|
941 |
]. |
|
942 |
fontOrSymbolOrStyle == #listFont ifTrue:[ |
|
943 |
^ SelectionInListView defaultFont |
|
944 |
]. |
|
945 |
fontOrSymbolOrStyle == #menuFont ifTrue:[ |
|
946 |
^ MenuView defaultFont |
|
947 |
]. |
|
948 |
fontOrSymbolOrStyle == #textFont ifTrue:[ |
|
949 |
^ TextView defaultFont |
|
950 |
]. |
|
951 |
fontOrSymbolOrStyle == #inputFont ifTrue:[ |
|
952 |
^ EditField defaultFont |
|
953 |
]. |
|
954 |
]. |
|
2546
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
955 |
|
2870 | 956 |
font isNil ifTrue:[ |
957 |
('Missing font <1p> in <2p>' expandMacrosWith:fontOrSymbolOrStyle with:application class) errorPrintCR. |
|
958 |
]. |
|
959 |
^ font. |
|
2546
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
960 |
]. |
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
961 |
|
2870 | 962 |
^ Font |
963 |
family:(fontOrSymbolOrStyle family) |
|
964 |
face:(fontOrSymbolOrStyle face) |
|
965 |
style:(fontOrSymbolOrStyle style) |
|
966 |
size:(fontOrSymbolOrStyle size) |
|
967 |
encoding:(fontOrSymbolOrStyle encoding) |
|
2546
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
968 |
! ! |
eba039ef14ba
Resolve symbolic fonts - now in WindowBuilder
Stefan Vogel <sv@exept.de>
parents:
2529
diff
changeset
|
969 |
|
422 | 970 |
!WindowBuilder methodsFor:'spec creation aspect fetch'! |
100 | 971 |
|
374 | 972 |
actionFor:aKey |
450 | 973 |
"return an action for aKey. This is invoked during window building |
974 |
(by the builder) to ask for an ActionButtons actionBlock. |
|
975 |
Here, first the local bindings are searched, then the application and |
|
976 |
finally the applications class is asked for a corresponding action. |
|
977 |
The returned object is typically a block." |
|
978 |
||
434 | 979 |
|b| |
980 |
||
981 |
bindings notNil ifTrue:[ |
|
2870 | 982 |
b := bindings at:aKey ifAbsent:nil. |
983 |
b notNil ifTrue:[^ b]. |
|
434 | 984 |
]. |
985 |
||
848 | 986 |
^ self safelyPerform:#actionFor: |
2870 | 987 |
with:aKey |
988 |
ifNone:[ self aspectNotFound:aKey error:'no action for:'. [] ] |
|
374 | 989 |
! |
990 |
||
716 | 991 |
actionFor:aKey withValue:aValue |
2870 | 992 |
"return an action for aKey/value combonation. |
716 | 993 |
This is invoked during window building |
994 |
(by the builder) to ask for an ActionButtons actionBlock if that button |
|
995 |
specified an action with an argument value. |
|
996 |
Here, first the local bindings are searched, then the application and |
|
997 |
finally the applications class is asked for a corresponding action. |
|
998 |
The returned object is typically a block." |
|
999 |
||
1000 |
|b| |
|
1001 |
||
1002 |
bindings notNil ifTrue:[ |
|
2870 | 1003 |
b := bindings at:aKey ifAbsent:nil. |
1004 |
b notNil ifTrue:[ |
|
1005 |
(b isBlock and:[b numArgs == 1]) ifTrue:[ |
|
1006 |
^ [b value:aValue] |
|
1007 |
]. |
|
1008 |
^ b |
|
1009 |
]. |
|
716 | 1010 |
]. |
1011 |
||
2870 | 1012 |
^ self |
1013 |
safelyPerform:#actionFor:withValue: |
|
1014 |
withArguments:(Array with:aKey with:aValue) |
|
1015 |
ifNone:[ self aspectNotFound:aKey error:'no action for:'. |
|
1016 |
[] |
|
1017 |
] |
|
2363 | 1018 |
! |
1019 |
||
1020 |
actionFor:aKey withValue:arg1 withValue:arg2 |
|
2870 | 1021 |
"return an action for aKey/value combination. |
2363 | 1022 |
This is invoked during window building |
1023 |
(by the builder) to ask for an ActionButtons actionBlock if that button |
|
1024 |
specified an action with an argument value. |
|
1025 |
Here, first the local bindings are searched, then the application and |
|
1026 |
finally the applications class is asked for a corresponding action. |
|
1027 |
The returned object is typically a block." |
|
1028 |
||
1029 |
|b| |
|
1030 |
||
1031 |
bindings notNil ifTrue:[ |
|
2870 | 1032 |
b := bindings at:aKey ifAbsent:nil. |
1033 |
b notNil ifTrue:[ |
|
1034 |
(b isBlock and:[b numArgs == 2]) ifTrue:[ |
|
1035 |
^ [b value:arg1 value:arg2] |
|
1036 |
]. |
|
1037 |
^ b |
|
1038 |
]. |
|
2363 | 1039 |
]. |
1040 |
||
2870 | 1041 |
^ self |
1042 |
safelyPerform:#actionFor:withValue:withValue: |
|
1043 |
withArguments:(Array with:aKey with:arg1 with:arg2) |
|
1044 |
ifNone:[ self aspectNotFound:aKey error:'no action for:'. ] |
|
716 | 1045 |
! |
1046 |
||
374 | 1047 |
aspectFor:aKey |
450 | 1048 |
"return a model for aKey. This is invoked during window building |
1049 |
(by the builder) to ask for an Editfields, a Toggles etc. model. |
|
1050 |
Here, first the local bindings are searched, then the application and |
|
1051 |
finally the applications class is asked for a corresponding action. |
|
1052 |
The returned object is typically a valueHolder." |
|
1053 |
||
434 | 1054 |
|b| |
1055 |
||
1056 |
bindings notNil ifTrue:[ |
|
2870 | 1057 |
b := bindings at:aKey ifAbsent:nil. |
1058 |
b notNil ifTrue:[^ b]. |
|
434 | 1059 |
]. |
1060 |
||
2870 | 1061 |
^ self |
1062 |
safelyPerform:#aspectFor: |
|
1063 |
with:aKey |
|
1064 |
ifNone:[ self aspectAt:aKey ] |
|
374 | 1065 |
! |
1066 |
||
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1067 |
aspectFor:aKey ifAbsent:exceptionBlock |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1068 |
"return a model for aKey. This is invoked during window building |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1069 |
(by the builder) to ask for an Editfields, a Toggles etc. model. |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1070 |
Here, first the local bindings are searched, then the application and |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1071 |
finally the applications class is asked for a corresponding action. |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1072 |
The returned object is typically a valueHolder." |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1073 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1074 |
|b| |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1075 |
|
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1076 |
bindings notNil ifTrue:[ |
2870 | 1077 |
b := bindings at:aKey ifAbsent:nil. |
1078 |
b notNil ifTrue:[^ b]. |
|
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1079 |
]. |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1080 |
|
2870 | 1081 |
^ self |
1082 |
safelyPerform:#aspectFor: |
|
1083 |
with:aKey |
|
1084 |
ifNone:[ self aspectAt:aKey ifAbsent:exceptionBlock ] |
|
1031
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1085 |
! |
0f80a655cf09
allow suppress of warnings if spec thinks the aspect is
Claus Gittinger <cg@exept.de>
parents:
1028
diff
changeset
|
1086 |
|
423 | 1087 |
componentFor:aKey |
450 | 1088 |
"return a component for aKey. This is invoked during window building |
1089 |
(by the builder) to ask for an ArbitraryComponents view. |
|
1090 |
Here, first the local bindings are searched, then the application and |
|
1091 |
finally the applications class is asked for a corresponding action. |
|
1092 |
The returned object is typically a view." |
|
1093 |
||
848 | 1094 |
^ self safelyPerform:#componentFor: |
2870 | 1095 |
with:aKey |
1096 |
ifNone:[ self aspectAt:aKey ] |
|
423 | 1097 |
! |
1098 |
||
2870 | 1099 |
labelFor:aKey |
450 | 1100 |
"return a label for aKey. This is invoked during window building |
1101 |
(by the builder) to ask for a ???'s label. |
|
1102 |
Here, first the local bindings are searched, then the application and |
|
1103 |
finally the applications class is asked for a corresponding action. |
|
1104 |
The returned object is typically a string." |
|
2870 | 1105 |
|
1106 |
^ self |
|
1107 |
safelyPerform:#labelFor: |
|
1108 |
with:aKey |
|
1109 |
ifNone:[ self aspectAt:aKey ] |
|
422 | 1110 |
! |
1111 |
||
1112 |
listFor:aKey |
|
450 | 1113 |
"return a list for aKey. This is invoked during window building |
1114 |
(by the builder) to ask for a ???'s label. |
|
1115 |
Here, first the local bindings are searched, then the application and |
|
1116 |
finally the applications class is asked for a corresponding action. |
|
1117 |
The returned object is typically a list." |
|
1118 |
||
848 | 1119 |
^ self safelyPerform:#listFor: |
2870 | 1120 |
with:aKey |
1121 |
ifNone:[ self aspectAt:aKey ] |
|
848 | 1122 |
! |
1123 |
||
1124 |
menuFor:aKey |
|
2870 | 1125 |
"Find a binding for the menu named aKey, either in the bindings |
848 | 1126 |
or from the source" |
1127 |
||
1128 |
|menu| |
|
1129 |
||
961 | 1130 |
aKey isNil ifTrue:[^ nil]. |
1131 |
||
848 | 1132 |
(menu := self bindingAt:aKey) notNil ifTrue:[ |
2870 | 1133 |
^ menu |
848 | 1134 |
]. |
1135 |
||
1136 |
menu := self safelyPerform:#menuFor: with:aKey ifNone:[ |
|
2870 | 1137 |
self safelyPerform:aKey ifNone:[ |
1138 |
self aspectNotFound:aKey error:'no menu for:'. |
|
1139 |
nil |
|
1140 |
] |
|
1141 |
]. |
|
848 | 1142 |
|
862 | 1143 |
menu isBlock ifFalse:[ |
2870 | 1144 |
((menu := menu value) notNil and:[application notNil]) ifTrue:[ |
1145 |
menu isCollection ifTrue:[ |
|
1146 |
menu := Menu decodeFromLiteralArray:menu. |
|
1147 |
"/ menu receiver:application. -- now done in findGuiResources ... |
|
1148 |
]. |
|
1149 |
menu findGuiResourcesIn:application |
|
1150 |
] |
|
422 | 1151 |
]. |
848 | 1152 |
^ menu |
717
b89142a61d05
#aspectAt: must also ask class.
Claus Gittinger <cg@exept.de>
parents:
716
diff
changeset
|
1153 |
|
2291 | 1154 |
"Modified: / 27-03-2007 / 11:17:22 / cg" |
829
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
1155 |
! |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
1156 |
|
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
1157 |
specificationFor:aKey |
d4cd3635d64e
Fix #subcanvasAt:at to be consistent with other binding access methods.
Stefan Vogel <sv@exept.de>
parents:
824
diff
changeset
|
1158 |
"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
|
1159 |
(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
|
1160 |
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
|
1161 |
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
|
1162 |
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
|
1163 |
|
2870 | 1164 |
^ self |
1165 |
safelyPerform:#specificationFor: |
|
1166 |
with:aKey |
|
1167 |
ifNone:[ self aspectFor:aKey ] |
|
2690 | 1168 |
! |
1169 |
||
1170 |
visualFor:aKey |
|
1171 |
"return a visual (icon, image) for aKey. This is invoked during window building |
|
1172 |
(by the builder) to ask for some graphical labels. |
|
1173 |
Here, first the local bindings are searched, then the application and |
|
1174 |
finally the applications class is asked for a corresponding action. |
|
1175 |
The returned object is typically an image or form." |
|
1176 |
||
1177 |
^ self safelyPerform:#visualFor: |
|
2870 | 1178 |
with:aKey |
1179 |
ifNone:[ self aspectAt:aKey ] |
|
422 | 1180 |
! ! |
1181 |
||
1182 |
!WindowBuilder methodsFor:'spec creation callbacks'! |
|
1183 |
||
735 | 1184 |
createdComponent:aView forSpec:spec named:name |
1185 |
"callback from the UISpec after a view has been |
|
1186 |
created for a spec. |
|
1187 |
If it has a name, add it to the namedComponents dictionary; |
|
1188 |
if I have a creationHook (application callBack), evaluate it." |
|
1189 |
||
2369 | 1190 |
|createCallBackSelector app| |
1191 |
||
735 | 1192 |
name notNil ifTrue:[ |
1993 | 1193 |
"/ "/ debugging ... |
1194 |
"/ (namedComponents notNil and:[namedComponents includesKey:name asSymbol]) ifTrue:[ |
|
1195 |
"/ Transcript showCR:'WARNING multiple UI-build of: ',name asSymbol |
|
1196 |
"/ ]. |
|
2870 | 1197 |
self componentAt:name put:aView. |
735 | 1198 |
]. |
2462 | 1199 |
spec addView:aView toMappingOfBuilder:self. |
410 | 1200 |
componentCreationHook notNil ifTrue:[ |
2870 | 1201 |
componentCreationHook value:aView value:spec value:self |
2369 | 1202 |
]. |
1203 |
||
1204 |
self isEditing ifFalse:[ |
|
2870 | 1205 |
(createCallBackSelector := spec postBuildCallback) notNil ifTrue:[ |
1206 |
app := self application. |
|
1207 |
app |
|
1208 |
perform:createCallBackSelector |
|
1209 |
withOptionalArgument:aView |
|
1210 |
and:spec |
|
1211 |
and:self. |
|
1212 |
]. |
|
2369 | 1213 |
]. |
100 | 1214 |
|
735 | 1215 |
"Modified: / 5.9.1995 / 21:42:54 / claus" |
1216 |
"Created: / 31.10.1997 / 18:47:01 / cg" |
|
1217 |
"Modified: / 31.10.1997 / 18:51:22 / cg" |
|
100 | 1218 |
! ! |
1219 |
||
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1220 |
!WindowBuilder methodsFor:'startup'! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1221 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1222 |
closeRequest |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1223 |
window destroy |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1224 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1225 |
"Modified: 17.1.1997 / 19:30:32 / cg" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1226 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1227 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1228 |
open |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1229 |
"open my topView, as previously created" |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1230 |
|
477 | 1231 |
|type| |
1232 |
||
1233 |
application isNil ifTrue:[ |
|
2870 | 1234 |
type := #normal |
477 | 1235 |
] ifFalse:[ |
2870 | 1236 |
type := application defaultWindowType |
477 | 1237 |
]. |
2870 | 1238 |
^ self |
1239 |
openAt:nil |
|
1240 |
withExtent:nil |
|
1241 |
andType:type |
|
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1242 |
|
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1243 |
! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1244 |
|
428 | 1245 |
openAt:aPoint |
1246 |
"open my topView at some location" |
|
1247 |
||
2870 | 1248 |
^ self |
1249 |
openAt:aPoint |
|
1250 |
withExtent:nil |
|
1251 |
andType:(application defaultWindowType) |
|
428 | 1252 |
|
1253 |
"Created: 14.2.1997 / 20:21:57 / cg" |
|
467 | 1254 |
"Modified: 28.2.1997 / 22:50:29 / cg" |
428 | 1255 |
! |
1256 |
||
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1257 |
openDialog |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1258 |
"open my topView, as previously created as a modal view, |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1259 |
blocking interaction to the currently active view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1260 |
|
2870 | 1261 |
^ self |
1262 |
openAt:nil |
|
1263 |
withExtent:nil |
|
1264 |
andType:#dialog |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1265 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1266 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1267 |
openDialogAt:aPoint |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1268 |
"open my topView, as previously created as a modal view, |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1269 |
blocking interaction to the currently active view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1270 |
|
2870 | 1271 |
^ self |
1272 |
openAt:aPoint |
|
1273 |
withExtent:nil |
|
1274 |
andType:#dialog |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1275 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1276 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1277 |
"Created: 14.2.1997 / 20:24:19 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1278 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1279 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1280 |
openDialogAt:aPoint withExtent:ext |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1281 |
"open my topView, as previously created as a modal view, |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1282 |
blocking interaction to the currently active view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1283 |
|
2870 | 1284 |
^ self |
1285 |
openAt:aPoint |
|
1286 |
withExtent:ext |
|
1287 |
andType:#dialog |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1288 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1289 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1290 |
"Created: 14.2.1997 / 20:24:19 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1291 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1292 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1293 |
openDialogWithExtent:ext |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1294 |
"open my topView, as previously created as a modal view, |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1295 |
blocking interaction to the currently active view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1296 |
|
2870 | 1297 |
^ self |
1298 |
openAt:nil |
|
1299 |
withExtent:ext |
|
1300 |
andType:#dialog |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1301 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1302 |
"Modified: 17.1.1997 / 19:59:36 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1303 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1304 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1305 |
openModal |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1306 |
"open my topView as a modal dialog, as previously created, |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1307 |
blocking interaction to the currently active view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1308 |
|
2870 | 1309 |
^ self |
1310 |
openAt:nil |
|
1311 |
withExtent:nil |
|
1312 |
andType:#dialog |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1313 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1314 |
"Modified: 3.3.1997 / 19:43:57 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1315 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1316 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1317 |
openPopUpAt:aPoint |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1318 |
"open my topView, as previously created as a popUp view, |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1319 |
blocking interaction to the currently active view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1320 |
|
2870 | 1321 |
^ self |
1322 |
openAt:aPoint |
|
1323 |
withExtent:nil |
|
1324 |
andType:#popUp |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1325 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1326 |
"Modified: 17.1.1997 / 19:59:29 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1327 |
"Created: 14.2.1997 / 20:24:38 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1328 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1329 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1330 |
openPopUpIn:aRectangle |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1331 |
"open my topView, as previously created as a popUp view, |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1332 |
blocking interaction to the currently active view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1333 |
|
2870 | 1334 |
^ self |
1335 |
openAt:aRectangle origin |
|
1336 |
withExtent:aRectangle extent |
|
1337 |
andType:#popUp |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1338 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1339 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1340 |
openWindow |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1341 |
"open my topView" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1342 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1343 |
^ self |
2870 | 1344 |
openAt:nil |
1345 |
withExtent:nil |
|
1346 |
andType:(application defaultWindowType) |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1347 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1348 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1349 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1350 |
openWindowAt:aPoint |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1351 |
"open my topView at some location" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1352 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1353 |
^ self |
2870 | 1354 |
openAt:aPoint |
1355 |
withExtent:nil |
|
1356 |
andType:(application defaultWindowType) |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1357 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1358 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1359 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1360 |
openWindowAt:origin withExtent:ext andType:type |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1361 |
"open my window, as previously created, optionally defining the |
2870 | 1362 |
windows origin and/or extent. |
1363 |
The type argument may be #dialog or #normal, and specifies if the view |
|
1364 |
should be opened as a modal view, blocking interaction to the currently |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1365 |
active view, or as a normal view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1366 |
|
2870 | 1367 |
^ self |
1368 |
openAt:origin |
|
1369 |
withExtent:ext |
|
1370 |
andType:type |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1371 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1372 |
|
1118
67eb0839e703
added hooks to allow openAtCenter.
Claus Gittinger <cg@exept.de>
parents:
1096
diff
changeset
|
1373 |
openWindowCenter |
67eb0839e703
added hooks to allow openAtCenter.
Claus Gittinger <cg@exept.de>
parents:
1096
diff
changeset
|
1374 |
"open my topView centered on the screen (dialog & normal only)" |
67eb0839e703
added hooks to allow openAtCenter.
Claus Gittinger <cg@exept.de>
parents:
1096
diff
changeset
|
1375 |
|
67eb0839e703
added hooks to allow openAtCenter.
Claus Gittinger <cg@exept.de>
parents:
1096
diff
changeset
|
1376 |
^ self |
2870 | 1377 |
openAt:#center |
1378 |
withExtent:nil |
|
1379 |
andType:(application defaultWindowType) |
|
1118
67eb0839e703
added hooks to allow openAtCenter.
Claus Gittinger <cg@exept.de>
parents:
1096
diff
changeset
|
1380 |
|
67eb0839e703
added hooks to allow openAtCenter.
Claus Gittinger <cg@exept.de>
parents:
1096
diff
changeset
|
1381 |
! |
67eb0839e703
added hooks to allow openAtCenter.
Claus Gittinger <cg@exept.de>
parents:
1096
diff
changeset
|
1382 |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1383 |
openWithExtent:aPoint |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1384 |
"open my topView, as previously created, but override |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1385 |
the extent." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1386 |
|
2870 | 1387 |
^ self |
1388 |
openAt:nil |
|
1389 |
withExtent:aPoint |
|
1390 |
andType:(application defaultWindowType) |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1391 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1392 |
"Modified: 17.1.1997 / 19:58:48 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1393 |
! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1394 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1395 |
openWithExtent:ext andType:type |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1396 |
"open my window, as previously created. The type argument |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1397 |
may be #dialog or #normal, and specifies if the view should |
2870 | 1398 |
be opened as a modal view, blocking interaction to the currently |
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1399 |
active view, or as a normal view." |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1400 |
|
2870 | 1401 |
^ self |
1402 |
openAt:nil |
|
1403 |
withExtent:ext |
|
1404 |
andType:type |
|
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1405 |
|
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1406 |
"Modified: 14.2.1997 / 20:22:47 / cg" |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1407 |
! ! |
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1408 |
|
1766 | 1409 |
!WindowBuilder methodsFor:'startup-basic'! |
1092
20104ea94915
cleaned up all #openWindow* methods
Claus Gittinger <cg@exept.de>
parents:
1031
diff
changeset
|
1410 |
|
436 | 1411 |
openAt:origin withExtent:ext andType:type |
428 | 1412 |
"open my window, as previously created, optionally defining the |
2870 | 1413 |
windows origin and/or extent. |
1414 |
The type argument may be #dialog, #popup or #normal, |
|
1415 |
and specifies if the view should be opened as a |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1416 |
modal view (blocking interaction to the currently active view), |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1417 |
as popUp (also blocking) |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1418 |
or as a normal view." |
428 | 1419 |
|
2870 | 1420 |
|appWinClass device wg mainWin x y monitorBounds| |
1359
f40bfb94f862
allow for application to decide what type of
Claus Gittinger <cg@exept.de>
parents:
1357
diff
changeset
|
1421 |
|
1672 | 1422 |
device := window device. |
2870 | 1423 |
|
2873
835095080d19
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2871
diff
changeset
|
1424 |
"/ ********* MULTI SCREEN |
2870 | 1425 |
|
1426 |
wg := WindowGroup activeGroup. |
|
1427 |
wg notNil ifTrue:[ |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1428 |
|mainGroup focusView| |
2870 | 1429 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1430 |
mainGroup := wg mainGroup ? wg. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1431 |
focusView := mainGroup focusView. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1432 |
focusView notNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1433 |
mainWin := focusView topView |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1434 |
] ifFalse:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1435 |
mainGroup notNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1436 |
mainWin := (mainGroup topViews ? #()) firstIfEmpty:nil |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1437 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1438 |
]. |
428 | 1439 |
]. |
2870 | 1440 |
|
1441 |
origin isPoint ifTrue:[ |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1442 |
monitorBounds := device monitorBoundsAt:origin. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1443 |
window origin:origin. |
480 | 1444 |
] ifFalse:[ |
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1445 |
mainWin isNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1446 |
monitorBounds := device monitorBoundsAt:(device pointerPosition). |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1447 |
] ifFalse:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1448 |
monitorBounds := device monitorBoundsAt:(mainWin origin). |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1449 |
]. |
2870 | 1450 |
]. |
1451 |
||
1452 |
ext notNil ifTrue:[ |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1453 |
window extent:ext. |
2870 | 1454 |
] ifFalse:[ |
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1455 |
((type == #dialog) or:[type == #toolDialog]) ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1456 |
window fixSize |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1457 |
] |
480 | 1458 |
]. |
1459 |
||
2896
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1460 |
((type == #dialog) or:[type == #toolDialog or:[ type == #popUp or:[type == #popUpWithFrame]] ]) ifTrue:[ |
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1461 |
|newOrigin| |
2822
dcd1b265990e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2784
diff
changeset
|
1462 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1463 |
((origin isNil and:[window class forceModalBoxesToOpenAtCenter]) |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1464 |
or:[origin == #center]) ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1465 |
newOrigin := nil. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1466 |
] ifFalse:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1467 |
origin isPoint ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1468 |
newOrigin := origin |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1469 |
] ifFalse:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1470 |
mainWin notNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1471 |
newOrigin := mainWin bounds center rounded - (window extent // 2). |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1472 |
] |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1473 |
] |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1474 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1475 |
newOrigin isNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1476 |
newOrigin := monitorBounds center rounded - (window extent // 2). |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1477 |
]. |
2873
835095080d19
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2871
diff
changeset
|
1478 |
|
835095080d19
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2871
diff
changeset
|
1479 |
UserPreferences current forceWindowsIntoMonitorBounds ifTrue:[ |
835095080d19
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2871
diff
changeset
|
1480 |
window corner y > monitorBounds bottom ifTrue:[ |
835095080d19
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2871
diff
changeset
|
1481 |
y := monitorBounds bottom - window height. |
835095080d19
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2871
diff
changeset
|
1482 |
newOrigin := (newOrigin x @ y). |
835095080d19
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2871
diff
changeset
|
1483 |
]. |
835095080d19
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2871
diff
changeset
|
1484 |
]. |
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1485 |
window origin:newOrigin. |
2894
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1486 |
type == #toolDialog ifTrue:[ |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1487 |
window beToolDialog |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1488 |
] ifFalse:[ |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1489 |
type == #popUp ifTrue:[ |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1490 |
window bePopUpView. |
2896
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1491 |
] ifFalse:[ |
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1492 |
type == #popUpWithFrame ifTrue:[ |
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1493 |
"/ window windowType:type. |
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1494 |
window beUndecorated. |
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1495 |
] |
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1496 |
]. |
2894
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1497 |
]. |
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1498 |
^ window openModal. |
428 | 1499 |
]. |
1500 |
||
2896
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1501 |
(type == #normal or:[type = #slave or:[type = #partner or:[type = #popUpNotModal or:[type = #undecorated]]]]) ifTrue:[ |
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1502 |
window isNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1503 |
application notNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1504 |
appWinClass := application applicationWindowClass |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1505 |
] ifFalse:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1506 |
appWinClass := ApplicationWindow |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1507 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1508 |
self setupWindowFor:appWinClass new. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1509 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1510 |
origin isPoint ifFalse:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1511 |
|windowExtent newOrg| |
2870 | 1512 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1513 |
windowExtent := window extent. |
480 | 1514 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1515 |
mainWin notNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1516 |
(windowExtent x > mainWin extent x or:[windowExtent y > mainWin extent y]) ifFalse:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1517 |
newOrg := mainWin bounds center - (windowExtent // 2). |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1518 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1519 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1520 |
newOrg isNil ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1521 |
newOrg := monitorBounds center - (windowExtent // 2). |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1522 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1523 |
window origin:newOrg rounded. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1524 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1525 |
y := window origin y. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1526 |
x := window origin x. |
2870 | 1527 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1528 |
window corner y > monitorBounds bottom ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1529 |
y := (monitorBounds bottom - window height) max:(monitorBounds top). |
2870 | 1530 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1531 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1532 |
window corner x > monitorBounds right ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1533 |
x := (monitorBounds right - window width) max:(monitorBounds left). |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1534 |
]. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1535 |
window origin:(x @ y ). |
2870 | 1536 |
|
1537 |
||
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1538 |
"/ the following code creates a master-slave relationship, if |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1539 |
"/ the masterApplication is not nil. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1540 |
"/ Disabled, because: the masterApplication is used to fulfill missing aspects, |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1541 |
"/ which has nothing to do with a window master-slave relationship. |
2870 | 1542 |
|
1543 |
"/ application masterApplication notNil ifTrue:[ |
|
1634 | 1544 |
"/ masterWindow := application masterApplication window. |
1545 |
"/ (masterWindow isMaster or:[masterWindow isSlave or:[masterWindow isPartner]]) |
|
1546 |
"/ ifFalse:[ |
|
1547 |
"/ "/ master is neutral - make him a master |
|
1548 |
"/ masterWindow beMaster |
|
1549 |
"/ ]. |
|
1550 |
"/ window beSlave. |
|
1551 |
"/ ]. |
|
1552 |
||
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1553 |
"/ must be done explicit, by passing an appropriate windowType |
1722 | 1554 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1555 |
type = #slave ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1556 |
window beSlave. |
2894
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1557 |
] ifFalse:[ |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1558 |
type = #partner ifTrue:[ |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1559 |
window bePartner. |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1560 |
] ifFalse:[ |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1561 |
type == #popUpNotModal ifTrue:[ |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1562 |
window bePopUpView. |
2896
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1563 |
] ifFalse:[ |
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1564 |
type == #undecorated ifTrue:[ |
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1565 |
window beUndecorated. |
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1566 |
] |
2894
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1567 |
] |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1568 |
]. |
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1569 |
]. |
1722 | 1570 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1571 |
((type = #slave or:[type = #partner]) |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1572 |
and:[ window windowGroup isNil ]) |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1573 |
ifTrue:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1574 |
window openInGroup:(WindowGroup activeGroup). |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1575 |
] ifFalse:[ |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1576 |
window open. |
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1577 |
]. |
1725
a9945722dab2
openAsSlave makes view a slave, but NOT the current view a master
Claus Gittinger <cg@exept.de>
parents:
1723
diff
changeset
|
1578 |
|
a9945722dab2
openAsSlave makes view a slave, but NOT the current view a master
Claus Gittinger <cg@exept.de>
parents:
1723
diff
changeset
|
1579 |
"/ the following automatism is probably too cryptic and has too much of a side effect. |
1722 | 1580 |
"/ I prefer to leave things as they are: i.e. enforce the programmer to |
1581 |
"/ do thinks explicit. |
|
1582 |
||
1583 |
"/ type = #slave ifTrue:[ |
|
1584 |
"/ window windowGroup topViews first beMaster |
|
1585 |
"/ ]. |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1586 |
^ self |
428 | 1587 |
]. |
1588 |
||
2894
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1589 |
"/ type == #popUp ifTrue:[ |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1590 |
"/ window fixPosition:(device pointerPosition). |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1591 |
"/ ^ window openAsPopUp. |
4380670e758e
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2873
diff
changeset
|
1592 |
"/ ]. |
428 | 1593 |
|
1594 |
" |
|
1595 |
if ST-80 supports more types - these may be added later |
|
1596 |
" |
|
1825 | 1597 |
self shouldImplement |
428 | 1598 |
|
2871
e9df4227a57d
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2870
diff
changeset
|
1599 |
"Created: / 14-02-1997 / 20:22:24 / cg" |
2896
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1600 |
"Modified: / 03-03-2011 / 20:23:50 / cg" |
372
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1601 |
! ! |
6d7718f3d298
more ST-80 compatibility stuff
Claus Gittinger <cg@exept.de>
parents:
223
diff
changeset
|
1602 |
|
2529
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1603 |
!WindowBuilder methodsFor:'translating'! |
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1604 |
|
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1605 |
translateString:aString |
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1606 |
"translate aString to the current language. |
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1607 |
If there is an application, it knows best what to do" |
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1608 |
|
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1609 |
application isNil ifTrue:[ |
2870 | 1610 |
^ self resources string:aString |
2529
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1611 |
]. |
2608 | 1612 |
^ application translateString:aString |
2529
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1613 |
! ! |
c22b95752b7b
New: let the Application do the string translation
Stefan Vogel <sv@exept.de>
parents:
2499
diff
changeset
|
1614 |
|
132 | 1615 |
!WindowBuilder class methodsFor:'documentation'! |
1616 |
||
1617 |
version |
|
2896
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1618 |
^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.147 2011-03-03 19:24:01 cg Exp $' |
2784
a0cdac50e04b
comment/format in: #labelFor:
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1619 |
! |
a0cdac50e04b
comment/format in: #labelFor:
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1620 |
|
a0cdac50e04b
comment/format in: #labelFor:
Claus Gittinger <cg@exept.de>
parents:
2744
diff
changeset
|
1621 |
version_CVS |
2896
96d5a0b6fc56
changed: #openAt:withExtent:andType:
Claus Gittinger <cg@exept.de>
parents:
2894
diff
changeset
|
1622 |
^ '$Header: /cvs/stx/stx/libview2/WindowBuilder.st,v 1.147 2011-03-03 19:24:01 cg Exp $' |
132 | 1623 |
! ! |