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