author | Claus Gittinger <cg@exept.de> |
Tue, 26 May 1998 16:10:55 +0200 | |
changeset 947 | a5325410e4fd |
parent 935 | ccb6caad1da0 |
child 976 | dd0045c9fdd7 |
permissions | -rw-r--r-- |
366 | 1 |
" |
2 |
COPYRIGHT (c) 1996 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
ApplicationModel subclass:#SimpleDialog |
|
431 | 15 |
instanceVariableNames:'accept cancel close escapeIsCancel postBuildBlock postOpenBlock |
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
16 |
preBuildBlock closeAllowedChannel' |
366 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-Framework' |
|
20 |
! |
|
21 |
||
22 |
!SimpleDialog class methodsFor:'documentation'! |
|
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1996 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
||
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
Since many ST-80 classes are subclasses of SompleDialog, this class |
|
42 |
is provided here to allow easier porting of ST-80 code. |
|
43 |
||
44 |
It does not (currently) provide much functionality and is NOT |
|
45 |
compatible to the corresponding ST80 class; therefore, manual |
|
46 |
changes have to be made to get those applications to run under ST/X. |
|
47 |
(but at least, this enables you to fileIn that code and have a superclass |
|
48 |
for them) |
|
49 |
||
50 |
However, as time goes by, ST/X applications may be converted to use the |
|
51 |
ApplicationModel / SimpleDialog framework as well. |
|
52 |
||
53 |
Notice: this class was implemented using protocol information |
|
54 |
from alpha testers and PD code - it may not be complete or compatible to |
|
55 |
the corresponding ST-80 class. If you encounter any incompatibilities, |
|
56 |
please forward a note to the ST/X team. |
|
57 |
||
58 |
||
59 |
[author:] |
|
60 |
Claus Gittinger |
|
61 |
||
62 |
[see also:] |
|
63 |
StandardSystemView |
|
64 |
WindowGroup DeviceWorkstation DialogBox |
|
65 |
" |
|
66 |
||
67 |
! ! |
|
68 |
||
906 | 69 |
!SimpleDialog class methodsFor:'queries'! |
70 |
||
71 |
isVisualStartable |
|
72 |
"returns whether this application class can be started via #open" |
|
73 |
||
74 |
self == SimpleDialog ifTrue:[^false]. |
|
75 |
^super isVisualStartable |
|
76 |
||
77 |
||
78 |
||
79 |
! ! |
|
80 |
||
431 | 81 |
!SimpleDialog methodsFor:'accessing'! |
82 |
||
83 |
accept |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
84 |
"return the valueholder which gets set by the accept button. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
85 |
Also, when this valueHolder gets a true stuffed into it, the |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
86 |
dialog is closed." |
431 | 87 |
|
88 |
^ accept |
|
605 | 89 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
90 |
"Modified: / 20.5.1998 / 20:51:05 / cg" |
431 | 91 |
! |
92 |
||
93 |
bindings |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
94 |
"return my builders bindings" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
95 |
|
431 | 96 |
^ builder bindings |
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
97 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
98 |
"Modified: / 20.5.1998 / 20:51:15 / cg" |
431 | 99 |
! |
100 |
||
101 |
cancel |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
102 |
"return the valueholder which gets set by the cancel button. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
103 |
Also, when this valueHolder gets a true stuffed into it, the |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
104 |
dialog is closed." |
431 | 105 |
|
106 |
^ cancel |
|
605 | 107 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
108 |
"Modified: / 20.5.1998 / 20:51:02 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
109 |
! |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
110 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
111 |
closeAllowedChannel |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
112 |
"return the value-provider which controls if close is allowed. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
113 |
This is initialized to true." |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
114 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
115 |
^ closeAllowedChannel |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
116 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
117 |
"Created: / 20.5.1998 / 21:52:32 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
118 |
"Modified: / 20.5.1998 / 21:53:18 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
119 |
! |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
120 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
121 |
closeAllowedChannel:aValueHolderOrBlock |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
122 |
"set a value-provider which controls if close is allowed." |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
123 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
124 |
^ closeAllowedChannel |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
125 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
126 |
"Created: / 20.5.1998 / 21:52:53 / cg" |
431 | 127 |
! |
128 |
||
129 |
closeChannel |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
130 |
"return the closeChannel; If a true is stuffed into this valueHolder, |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
131 |
I will close myself." |
431 | 132 |
|
133 |
^ close |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
134 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
135 |
"Modified: / 20.5.1998 / 20:52:29 / cg" |
431 | 136 |
! |
137 |
||
138 |
escapeIsCancel |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
139 |
"return the escapeIsCancel setting" |
431 | 140 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
141 |
^ escapeIsCancel |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
142 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
143 |
"Modified: / 20.5.1998 / 20:52:44 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
144 |
! |
431 | 145 |
|
146 |
escapeIsCancel:something |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
147 |
"set/clear the escapeIsCancel option. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
148 |
If on, an ESC-key will be treated like a cancel action." |
431 | 149 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
150 |
escapeIsCancel := something. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
151 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
152 |
"Modified: / 20.5.1998 / 20:53:23 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
153 |
! |
431 | 154 |
|
155 |
postBuildBlock:something |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
156 |
"set postBuildBlock; if non-nil, this is evaluated after the build process" |
431 | 157 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
158 |
postBuildBlock := something. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
159 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
160 |
"Modified: / 20.5.1998 / 20:54:06 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
161 |
! |
431 | 162 |
|
163 |
postOpenBlock:something |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
164 |
"set the postBuildBlock; if non-nil, this is evaluated after the view is opened" |
431 | 165 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
166 |
postOpenBlock := something. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
167 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
168 |
"Modified: / 20.5.1998 / 20:54:23 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
169 |
! |
431 | 170 |
|
171 |
preBuildBlock:something |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
172 |
"set the preBuildBlock; if non-nil, this is evaluated before the view is constructed" |
431 | 173 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
174 |
preBuildBlock := something. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
175 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
176 |
"Modified: / 20.5.1998 / 20:54:41 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
177 |
! |
431 | 178 |
|
179 |
source:anApplication |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
180 |
"define the application which provides resources, aspects etc." |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
181 |
|
431 | 182 |
builder source:anApplication |
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
183 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
184 |
"Modified: / 20.5.1998 / 20:55:07 / cg" |
431 | 185 |
! ! |
186 |
||
481 | 187 |
!SimpleDialog methodsFor:'accessing - window'! |
188 |
||
189 |
minWidth:nPixels |
|
190 |
|w box | |
|
191 |
||
192 |
w := builder window width. |
|
193 |
builder window width:(w max:nPixels). |
|
194 |
||
195 |
"/ box := builder window displayBox. |
|
196 |
"/ box width: (box width max: nPixels). |
|
197 |
"/ builder window displayBox: box |
|
198 |
||
199 |
"Modified: 3.3.1997 / 21:56:27 / cg" |
|
200 |
! ! |
|
201 |
||
431 | 202 |
!SimpleDialog methodsFor:'events'! |
203 |
||
204 |
closeAccept |
|
605 | 205 |
"accept was pressed. close the dialog" |
206 |
||
431 | 207 |
self requestForWindowClose ifTrue:[ |
208 |
self closeWindow |
|
209 |
] |
|
605 | 210 |
|
211 |
"Modified: 17.6.1997 / 14:10:23 / cg" |
|
431 | 212 |
! |
213 |
||
214 |
closeCancel |
|
605 | 215 |
"cancel was pressed. close the dialog" |
216 |
||
431 | 217 |
self requestForWindowClose ifTrue:[ |
218 |
self closeWindow |
|
219 |
] |
|
605 | 220 |
|
221 |
"Modified: 17.6.1997 / 14:10:29 / cg" |
|
431 | 222 |
! |
223 |
||
224 |
closeWindow |
|
605 | 225 |
"close the dialog" |
226 |
||
431 | 227 |
self closeChannel value:true. |
903 | 228 |
"/ must destroy - otherwise there is no #release to |
229 |
"/ the controllers (onChangeSend-dependency problem) |
|
902 | 230 |
builder window destroy. "/ hide |
605 | 231 |
|
232 |
"Modified: 17.6.1997 / 14:10:38 / cg" |
|
431 | 233 |
! |
234 |
||
235 |
requestForWindowClose |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
236 |
"the dialog is about to be closed - this method is ivoked and may |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
237 |
return false to suppress the close. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
238 |
Here the value of closeAllowedChannel is returned, which is |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
239 |
set to true initially. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
240 |
You may redefined this in a special dialog, and/or provide a boolden |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
241 |
valueHolder or a boolean block via the #closeAllowedChannel: method." |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
242 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
243 |
^ closeAllowedChannel value |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
244 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
245 |
"Modified: / 20.5.1998 / 21:52:25 / cg" |
431 | 246 |
! ! |
247 |
||
713 | 248 |
!SimpleDialog methodsFor:'forced actions'! |
249 |
||
250 |
doAccept |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
251 |
"force accept" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
252 |
|
713 | 253 |
accept value:true |
254 |
||
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
255 |
"Created: / 18.10.1997 / 05:18:09 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
256 |
"Modified: / 20.5.1998 / 21:53:35 / cg" |
713 | 257 |
! |
258 |
||
259 |
doCancel |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
260 |
"force cancel" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
261 |
|
713 | 262 |
cancel value:true |
263 |
||
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
264 |
"Created: / 18.10.1997 / 05:18:22 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
265 |
"Modified: / 20.5.1998 / 21:53:40 / cg" |
713 | 266 |
! ! |
267 |
||
431 | 268 |
!SimpleDialog methodsFor:'initialization'! |
269 |
||
270 |
initialize |
|
935 | 271 |
accept := (ValueHolder with:false). |
272 |
close := (ValueHolder with:false). |
|
273 |
cancel := (ValueHolder with:false). |
|
431 | 274 |
builder aspectAt:#accept put:accept. |
275 |
builder aspectAt:#close put:close. |
|
276 |
builder aspectAt:#cancel put:cancel. |
|
277 |
escapeIsCancel := true. |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
278 |
closeAllowedChannel := true |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
279 |
|
935 | 280 |
"Modified: / 21.5.1998 / 03:18:40 / cg" |
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
281 |
! |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
282 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
283 |
initializeBuilderFor:aView |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
284 |
aView notNil ifTrue:[ |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
285 |
builder window:aView. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
286 |
] |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
287 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
288 |
"Created: 3.3.1997 / 16:23:04 / cg" |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
289 |
! |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
290 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
291 |
initializeWindowFor:aView |
679 | 292 |
|v| |
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
293 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
294 |
(v := aView) isNil ifTrue:[ |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
295 |
v := ModalBox new. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
296 |
]. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
297 |
|
481 | 298 |
builder setupWindowFor:v. |
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
299 |
|
481 | 300 |
"Modified: 3.3.1997 / 20:39:46 / cg" |
431 | 301 |
! ! |
302 |
||
429 | 303 |
!SimpleDialog methodsFor:'interface opening'! |
304 |
||
431 | 305 |
allButOpenFrom:aSpec |
306 |
"create my views but do not open the main window" |
|
307 |
||
308 |
super allButOpenFrom:aSpec. |
|
309 |
self preOpen |
|
310 |
! |
|
311 |
||
429 | 312 |
openFor:anApplication interface:aSelector |
465 | 313 |
"open the dialog for some appModel from a given spec; |
314 |
Return true if accepted, false if canceled" |
|
315 |
||
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
316 |
^ self openFor:anApplication interface:aSelector withBindings:nil |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
317 |
|
465 | 318 |
"Modified: 28.2.1997 / 16:22:08 / cg" |
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
319 |
! |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
320 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
321 |
openFor:anApplication interface:aSelector withBindings:bindings |
713 | 322 |
"open the dialog for some appModel from a given specSymbol; |
323 |
the application must provide an interfaceSpec for that symbol. |
|
324 |
The bindings argument may provide overwriting bindings for the |
|
325 |
dialog. |
|
326 |
Return true if accepted, false if canceled" |
|
327 |
||
328 |
^ self |
|
329 |
openFor:anApplication |
|
330 |
interfaceSpec:(anApplication class interfaceSpecFor:aSelector) |
|
331 |
withBindings:bindings |
|
332 |
||
333 |
"Modified: 18.10.1997 / 04:43:13 / cg" |
|
334 |
! |
|
335 |
||
336 |
openFor:anApplication interfaceSpec:aSpec withBindings:bindings |
|
465 | 337 |
"open the dialog for some appModel from a given spec; |
338 |
the bindings argument may provide overwriting bindings for the |
|
339 |
dialog. |
|
340 |
Return true if accepted, false if canceled" |
|
341 |
||
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
342 |
builder addBindings:bindings. |
431 | 343 |
self source:anApplication. |
713 | 344 |
^ self openFrom:aSpec |
429 | 345 |
|
465 | 346 |
"Modified: 28.2.1997 / 16:22:00 / cg" |
713 | 347 |
"Created: 18.10.1997 / 04:41:29 / cg" |
429 | 348 |
! |
349 |
||
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
350 |
openFor:anApplication spec:aSpec withBindings:bindings |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
351 |
"open the dialog for some appModel from a given spec. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
352 |
The bindings argument may provide overwriting bindings for the |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
353 |
dialog. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
354 |
Return true if accepted, false if canceled" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
355 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
356 |
^ self |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
357 |
openFor:anApplication |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
358 |
interfaceSpec:aSpec |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
359 |
withBindings:bindings |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
360 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
361 |
"Modified: / 18.10.1997 / 04:43:13 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
362 |
"Created: / 20.5.1998 / 20:28:29 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
363 |
! |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
364 |
|
429 | 365 |
openFrom:anInterfaceSpec |
466 | 366 |
"open the dialog from a given spec; |
367 |
return true if accepted, false if canceled" |
|
368 |
||
429 | 369 |
self allButOpenFrom:anInterfaceSpec. |
370 |
self openDialog. |
|
431 | 371 |
^ accept value |
372 |
||
466 | 373 |
"Modified: 28.2.1997 / 16:40:36 / cg" |
431 | 374 |
! |
375 |
||
713 | 376 |
postBuildWith:aBuilder |
377 |
"this is sent after the dialogs widgets have been created |
|
378 |
(but before the dialog is opened). |
|
379 |
If a postBuildBlock was set, evaluate it here." |
|
380 |
||
381 |
postBuildBlock notNil ifTrue:[ |
|
382 |
postBuildBlock numArgs == 0 ifTrue:[ |
|
383 |
postBuildBlock value |
|
384 |
] ifFalse:[ |
|
385 |
postBuildBlock value:aBuilder |
|
386 |
] |
|
387 |
]. |
|
388 |
super postBuildWith:aBuilder |
|
389 |
||
390 |
"Created: 18.10.1997 / 05:17:12 / cg" |
|
391 |
! |
|
392 |
||
393 |
postOpenWith:aBuilder |
|
394 |
"this is sent after the dialogs main window is opened. |
|
395 |
If a postOpenBlock was set, evaluate it here." |
|
396 |
||
397 |
postOpenBlock notNil ifTrue:[ |
|
398 |
postOpenBlock numArgs == 0 ifTrue:[ |
|
399 |
postOpenBlock value |
|
400 |
] ifFalse:[ |
|
401 |
postOpenBlock value:aBuilder |
|
402 |
] |
|
403 |
]. |
|
404 |
super postOpenWith:aBuilder |
|
405 |
||
406 |
"Created: 18.10.1997 / 05:15:48 / cg" |
|
407 |
! |
|
408 |
||
409 |
preBuildWith:aBuilder |
|
410 |
"this is sent before the dialogs widgets are created. |
|
411 |
If a preBuildBlock was set, evaluate it here." |
|
412 |
||
413 |
preBuildBlock notNil ifTrue:[ |
|
414 |
preBuildBlock numArgs == 0 ifTrue:[ |
|
415 |
preBuildBlock value |
|
416 |
] ifFalse:[ |
|
417 |
preBuildBlock value:aBuilder |
|
418 |
] |
|
419 |
]. |
|
420 |
super preBuildWith:aBuilder |
|
421 |
||
422 |
"Created: 18.10.1997 / 15:02:27 / cg" |
|
423 |
! |
|
424 |
||
431 | 425 |
preOpen |
605 | 426 |
"arrange for #closeAccept & #closeCancel to be invoked when |
427 |
either accept or close is triggered |
|
428 |
(usually the models of corresponding buttons)" |
|
429 |
||
431 | 430 |
accept onChangeSend:#closeAccept to:self. |
431 |
cancel onChangeSend:#closeCancel to:self. |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
432 |
close onChangeSend:#closeWindow to:self. |
429 | 433 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
434 |
"Modified: / 20.5.1998 / 20:49:26 / cg" |
429 | 435 |
! ! |
436 |
||
366 | 437 |
!SimpleDialog methodsFor:'queries'! |
438 |
||
439 |
defaultWindowType |
|
440 |
"SimpleDialogs come up modal, by default" |
|
441 |
||
442 |
^ #dialog |
|
443 |
||
444 |
"Modified: 14.2.1997 / 22:17:20 / cg" |
|
445 |
! ! |
|
446 |
||
766
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
447 |
!SimpleDialog methodsFor:'startup'! |
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
448 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
449 |
openInterface:aSymbol |
766
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
450 |
"open a standard interface. |
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
451 |
Redefned to return the accept value instead of the builder." |
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
452 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
453 |
super openInterfaceModal:aSymbol. |
766
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
454 |
^ accept value. |
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
455 |
|
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
456 |
"Created: / 23.1.1998 / 18:19:57 / cg" |
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
457 |
"Modified: / 20.5.1998 / 20:21:28 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
458 |
! |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
459 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
460 |
openSpec:aWindowSpec |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
461 |
"open a window spec. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
462 |
Redefned to open modal and to return the accept value instead |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
463 |
of the builder." |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
464 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
465 |
super openSpecModal:aWindowSpec. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
466 |
^ accept value. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
467 |
|
905
f2a0bb5b147c
default for SimpleDialogs is to open modal
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
468 |
"Modified: / 22.4.1998 / 11:59:05 / cg" |
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
469 |
"Created: / 20.5.1998 / 20:21:17 / cg" |
766
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
470 |
! ! |
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
471 |
|
366 | 472 |
!SimpleDialog class methodsFor:'documentation'! |
473 |
||
474 |
version |
|
935 | 475 |
^ '$Header: /cvs/stx/stx/libview2/SimpleDialog.st,v 1.20 1998-05-21 01:18:47 cg Exp $' |
366 | 476 |
! ! |