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