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