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