author | ca |
Fri, 05 Sep 1997 11:59:23 +0200 | |
changeset 688 | b95c0e8c9573 |
parent 679 | 0f94c493751c |
child 713 | 548898fdd1dc |
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 |
16 |
preBuildBlock' |
|
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 |
||
431 | 69 |
!SimpleDialog methodsFor:'accessing'! |
70 |
||
71 |
accept |
|
605 | 72 |
"return the valueholder which gets set by the accept button" |
431 | 73 |
|
74 |
^ accept |
|
605 | 75 |
|
76 |
"Modified: 17.6.1997 / 14:09:48 / cg" |
|
431 | 77 |
! |
78 |
||
79 |
bindings |
|
80 |
^ builder bindings |
|
81 |
! |
|
82 |
||
83 |
cancel |
|
605 | 84 |
"return the valueholder which gets set by the cancel button" |
431 | 85 |
|
86 |
^ cancel |
|
605 | 87 |
|
88 |
"Modified: 17.6.1997 / 14:09:55 / cg" |
|
431 | 89 |
! |
90 |
||
91 |
closeChannel |
|
92 |
"return the value of the instance variable 'close' (automatically generated)" |
|
93 |
||
94 |
^ close |
|
95 |
! |
|
96 |
||
97 |
escapeIsCancel |
|
98 |
"return the value of the instance variable 'escapeIsCancel' (automatically generated)" |
|
99 |
||
100 |
^ escapeIsCancel! |
|
101 |
||
102 |
escapeIsCancel:something |
|
103 |
"set the value of the instance variable 'escapeIsCancel' (automatically generated)" |
|
104 |
||
105 |
escapeIsCancel := something.! |
|
106 |
||
107 |
postBuildBlock:something |
|
108 |
"set the value of the instance variable 'postBuildBlock' (automatically generated)" |
|
109 |
||
110 |
postBuildBlock := something.! |
|
111 |
||
112 |
postOpenBlock:something |
|
113 |
"set the value of the instance variable 'postOpenBlock' (automatically generated)" |
|
114 |
||
115 |
postOpenBlock := something.! |
|
116 |
||
117 |
preBuildBlock:something |
|
118 |
"set the value of the instance variable 'preBuildBlock' (automatically generated)" |
|
119 |
||
120 |
preBuildBlock := something.! |
|
121 |
||
122 |
source:anApplication |
|
123 |
builder source:anApplication |
|
124 |
! ! |
|
125 |
||
481 | 126 |
!SimpleDialog methodsFor:'accessing - window'! |
127 |
||
128 |
minWidth:nPixels |
|
129 |
|w box | |
|
130 |
||
131 |
w := builder window width. |
|
132 |
builder window width:(w max:nPixels). |
|
133 |
||
134 |
"/ box := builder window displayBox. |
|
135 |
"/ box width: (box width max: nPixels). |
|
136 |
"/ builder window displayBox: box |
|
137 |
||
138 |
"Modified: 3.3.1997 / 21:56:27 / cg" |
|
139 |
! ! |
|
140 |
||
431 | 141 |
!SimpleDialog methodsFor:'events'! |
142 |
||
143 |
closeAccept |
|
605 | 144 |
"accept was pressed. close the dialog" |
145 |
||
431 | 146 |
self requestForWindowClose ifTrue:[ |
147 |
self closeWindow |
|
148 |
] |
|
605 | 149 |
|
150 |
"Modified: 17.6.1997 / 14:10:23 / cg" |
|
431 | 151 |
! |
152 |
||
153 |
closeCancel |
|
605 | 154 |
"cancel was pressed. close the dialog" |
155 |
||
431 | 156 |
self requestForWindowClose ifTrue:[ |
157 |
self closeWindow |
|
158 |
] |
|
605 | 159 |
|
160 |
"Modified: 17.6.1997 / 14:10:29 / cg" |
|
431 | 161 |
! |
162 |
||
163 |
closeWindow |
|
605 | 164 |
"close the dialog" |
165 |
||
431 | 166 |
self closeChannel value:true. |
167 |
builder window hide |
|
605 | 168 |
|
169 |
"Modified: 17.6.1997 / 14:10:38 / cg" |
|
431 | 170 |
! |
171 |
||
172 |
requestForWindowClose |
|
173 |
^ true |
|
174 |
! ! |
|
175 |
||
176 |
!SimpleDialog methodsFor:'initialization'! |
|
177 |
||
178 |
initialize |
|
179 |
accept := false asValue. |
|
180 |
close := false asValue. |
|
181 |
cancel := false asValue. |
|
182 |
builder aspectAt:#accept put:accept. |
|
183 |
builder aspectAt:#close put:close. |
|
184 |
builder aspectAt:#cancel put:cancel. |
|
185 |
escapeIsCancel := true. |
|
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
186 |
! |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
187 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
188 |
initializeBuilderFor:aView |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
189 |
aView notNil ifTrue:[ |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
190 |
builder window:aView. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
191 |
] |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
192 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
193 |
"Created: 3.3.1997 / 16:23:04 / cg" |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
194 |
! |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
195 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
196 |
initializeWindowFor:aView |
679 | 197 |
|v| |
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
198 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
199 |
(v := aView) isNil ifTrue:[ |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
200 |
v := ModalBox new. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
201 |
]. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
202 |
|
481 | 203 |
builder setupWindowFor:v. |
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
204 |
|
481 | 205 |
"Modified: 3.3.1997 / 20:39:46 / cg" |
431 | 206 |
! ! |
207 |
||
429 | 208 |
!SimpleDialog methodsFor:'interface opening'! |
209 |
||
431 | 210 |
allButOpenFrom:aSpec |
211 |
"create my views but do not open the main window" |
|
212 |
||
213 |
super allButOpenFrom:aSpec. |
|
214 |
self preOpen |
|
215 |
! |
|
216 |
||
429 | 217 |
openFor:anApplication interface:aSelector |
465 | 218 |
"open the dialog for some appModel from a given spec; |
219 |
Return true if accepted, false if canceled" |
|
220 |
||
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
221 |
^ 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
|
222 |
|
465 | 223 |
"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
|
224 |
! |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
225 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
226 |
openFor:anApplication interface:aSelector withBindings:bindings |
465 | 227 |
"open the dialog for some appModel from a given spec; |
228 |
the bindings argument may provide overwriting bindings for the |
|
229 |
dialog. |
|
230 |
Return true if accepted, false if canceled" |
|
231 |
||
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
232 |
builder addBindings:bindings. |
431 | 233 |
self source:anApplication. |
234 |
^ self openFrom:(anApplication class interfaceSpecFor:aSelector) |
|
429 | 235 |
|
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
236 |
"Created: 28.2.1997 / 14:09:06 / cg" |
465 | 237 |
"Modified: 28.2.1997 / 16:22:00 / cg" |
429 | 238 |
! |
239 |
||
240 |
openFrom:anInterfaceSpec |
|
466 | 241 |
"open the dialog from a given spec; |
242 |
return true if accepted, false if canceled" |
|
243 |
||
429 | 244 |
self allButOpenFrom:anInterfaceSpec. |
245 |
self openDialog. |
|
431 | 246 |
^ accept value |
247 |
||
466 | 248 |
"Modified: 28.2.1997 / 16:40:36 / cg" |
431 | 249 |
! |
250 |
||
251 |
preOpen |
|
605 | 252 |
"arrange for #closeAccept & #closeCancel to be invoked when |
253 |
either accept or close is triggered |
|
254 |
(usually the models of corresponding buttons)" |
|
255 |
||
431 | 256 |
accept onChangeSend:#closeAccept to:self. |
257 |
cancel onChangeSend:#closeCancel to:self. |
|
429 | 258 |
|
605 | 259 |
"Modified: 17.6.1997 / 14:13:16 / cg" |
429 | 260 |
! ! |
261 |
||
366 | 262 |
!SimpleDialog methodsFor:'queries'! |
263 |
||
264 |
defaultWindowType |
|
265 |
"SimpleDialogs come up modal, by default" |
|
266 |
||
267 |
^ #dialog |
|
268 |
||
269 |
"Modified: 14.2.1997 / 22:17:20 / cg" |
|
270 |
! ! |
|
271 |
||
272 |
!SimpleDialog class methodsFor:'documentation'! |
|
273 |
||
274 |
version |
|
679 | 275 |
^ '$Header: /cvs/stx/stx/libview2/SimpleDialog.st,v 1.12 1997-07-28 11:19:13 cg Exp $' |
366 | 276 |
! ! |