author | Claus Gittinger <cg@exept.de> |
Wed, 26 Jul 2000 15:13:36 +0200 | |
changeset 1381 | 1035403e302e |
parent 1375 | 6d04ebef6836 |
child 1397 | 47ac1d3e1df1 |
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 |
" |
|
43 |
Since many ST-80 classes are subclasses of SompleDialog, this class |
|
44 |
is provided here to allow easier porting of ST-80 code. |
|
45 |
||
46 |
It does not (currently) provide much functionality and is NOT |
|
47 |
compatible to the corresponding ST80 class; therefore, manual |
|
48 |
changes have to be made to get those applications to run under ST/X. |
|
49 |
(but at least, this enables you to fileIn that code and have a superclass |
|
50 |
for them) |
|
51 |
||
52 |
However, as time goes by, ST/X applications may be converted to use the |
|
53 |
ApplicationModel / SimpleDialog framework as well. |
|
54 |
||
55 |
Notice: this class was implemented using protocol information |
|
56 |
from alpha testers and PD code - it may not be complete or compatible to |
|
57 |
the corresponding ST-80 class. If you encounter any incompatibilities, |
|
58 |
please forward a note to the ST/X team. |
|
59 |
||
60 |
||
61 |
[author:] |
|
62 |
Claus Gittinger |
|
63 |
||
64 |
[see also:] |
|
65 |
StandardSystemView |
|
66 |
WindowGroup DeviceWorkstation DialogBox |
|
67 |
" |
|
68 |
||
69 |
! ! |
|
70 |
||
906 | 71 |
!SimpleDialog class methodsFor:'queries'! |
72 |
||
73 |
isVisualStartable |
|
74 |
"returns whether this application class can be started via #open" |
|
75 |
||
76 |
self == SimpleDialog ifTrue:[^false]. |
|
77 |
^super isVisualStartable |
|
78 |
||
79 |
||
80 |
||
81 |
! ! |
|
82 |
||
976
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
83 |
!SimpleDialog methodsFor:'Refactoring Browser'! |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
84 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
85 |
addMultiList: model lines: maxLines validation: valid |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
86 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
87 |
| height layout field grid font scrollW max fullMax | |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
88 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
89 |
height := builder window displayBox height. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
90 |
layout := LayoutFrame new. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
91 |
layout leftOffset: 16. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
92 |
layout rightFraction: 1 offset: -16. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
93 |
layout topOffset: height. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
94 |
field := SequenceViewSpec model: model menu: nil layout: layout. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
95 |
field multipleSelections: true. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
96 |
builder add: field. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
97 |
builder wrapper widget controller setDispatcher: |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
98 |
(UIDispatcher new doubleClick: [valid value ifTrue: [accept value: true]]). |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
99 |
"builder wrapper widget setValidTargetIndex: model selectionIndex." |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
100 |
scrollW := builder wrapper decorator scrollerComponent. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
101 |
scrollW preferredBoundsBlock: |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
102 |
[:sw | | rect | |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
103 |
rect := sw component preferredBounds |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
104 |
translatedBy: sw translation. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
105 |
rect height: maxLines*sw scrollGrid y. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
106 |
rect]. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
107 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
108 |
font := builder wrapper widget textStyle defaultFont. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
109 |
font := Screen default defaultFontPolicy findFont: font. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
110 |
max := model list inject: 0 into: [:i :str | i max: str size]. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
111 |
"Instead of exactly measuring every string, we |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
112 |
assume that $o will be a fairly representative |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
113 |
character. Actually, $o will probably be wider |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
114 |
than the average, but this will usually be OK." |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
115 |
max := (font widthOf: $o) * max. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
116 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
117 |
"Don't let the dialog get too wide." |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
118 |
fullMax := 350. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
119 |
max > fullMax |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
120 |
ifTrue: |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
121 |
[max := fullMax. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
122 |
builder wrapper decorator useHorizontalScrollBar. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
123 |
builder wrapper widget measureWidth: true]. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
124 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
125 |
grid := builder wrapper preferredBounds height. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
126 |
layout bottomOffset: height+grid. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
127 |
self addGap: grid. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
128 |
self minWidth: max + 48. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
129 |
^builder wrapper! |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
130 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
131 |
chooseMultiple: messageString fromList: list values: listValues buttons: buttons values: buttonValues lines: maxLines cancel: cancelBlock |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
132 |
^self |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
133 |
chooseMultiple: messageString |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
134 |
fromList: list |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
135 |
values: listValues |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
136 |
buttons: buttons |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
137 |
values: buttonValues |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
138 |
lines: maxLines |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
139 |
cancel: cancelBlock |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
140 |
for: nil! |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
141 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
142 |
chooseMultiple: messageString fromList: list values: listValues buttons: buttons values: buttonValues lines: maxLines cancel: cancelBlock for: aVisualOrNil |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
143 |
"Ask the user a question. Let the user pick from a row of buttons made up |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
144 |
to match the labels collection. Return the response from the corresponding |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
145 |
item from the values collection." |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
146 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
147 |
"aVisualOrNil, if not nil, may be either a VisualPart or a |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
148 |
ScheduledWindow. It controls the look and feel and color choices |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
149 |
used by the dialog, and supplies the dialog's master window, which |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
150 |
is used by some window systems to create a visual connection between |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
151 |
the dialog and the window that created it." |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
152 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
153 |
"SimpleDialog new |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
154 |
chooseMultiple: 'Which one do you want?' |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
155 |
fromList: #('first' 'second' 'third' 'fourth') values: #(1 2 3 4) |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
156 |
buttons: #() values: #() |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
157 |
lines: 8 |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
158 |
cancel: [#noChoice] |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
159 |
for: Dialog defaultParentWindow" |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
160 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
161 |
| result spec okValue sequence wrappers listW | |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
162 |
wrappers := OrderedCollection new. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
163 |
result := ValueHolder new. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
164 |
sequence := MultiSelectionInList new. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
165 |
sequence list: list. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
166 |
spec := (self class interfaceSpecFor: #emptySpec). |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
167 |
okValue := Object new. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
168 |
self initializeBuilderFor: aVisualOrNil. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
169 |
builder add: spec window. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
170 |
builder add: spec component. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
171 |
self initializeWindowFor: aVisualOrNil. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
172 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
173 |
self setInitialGap. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
174 |
self addMessage: messageString centered: false. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
175 |
self addGap: 8. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
176 |
listW := self |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
177 |
addMultiList: sequence |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
178 |
lines: (maxLines min: list size+2) |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
179 |
validation: [true]. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
180 |
self addGap: 4. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
181 |
wrappers add: (self addOK: [sequence selectionIndex ~= 0]). |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
182 |
buttons isEmpty |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
183 |
ifFalse: |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
184 |
[self addGap: 4. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
185 |
wrappers add: (self addDivider). |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
186 |
self addGap: 4. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
187 |
wrappers add: |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
188 |
(self addLabels: buttons |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
189 |
values: buttonValues |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
190 |
default: okValue |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
191 |
storeInto: result |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
192 |
takeKeyboard: true |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
193 |
equalize: true)]. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
194 |
self addGap: 6. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
195 |
self bottomAlignLowerEdge: listW. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
196 |
self bottomAlign: wrappers. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
197 |
|
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
198 |
self preOpen. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
199 |
builder openDialogWithExtent: builder window displayBox extent. |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
200 |
^accept value |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
201 |
ifTrue: [sequence selectionIndexes collect: [:each | listValues at: each]] |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
202 |
ifFalse: [cancel value ifTrue: [cancelBlock value] ifFalse: [result value]]! ! |
dd0045c9fdd7
must create the builder ... (sigh)
Claus Gittinger <cg@exept.de>
parents:
935
diff
changeset
|
203 |
|
431 | 204 |
!SimpleDialog methodsFor:'accessing'! |
205 |
||
206 |
accept |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
207 |
"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
|
208 |
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
|
209 |
dialog is closed." |
431 | 210 |
|
211 |
^ accept |
|
605 | 212 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
213 |
"Modified: / 20.5.1998 / 20:51:05 / cg" |
431 | 214 |
! |
215 |
||
1381 | 216 |
accepted |
217 |
"after the box has closed: |
|
218 |
return true if accepted, false if canceled" |
|
219 |
||
220 |
^ self accept value |
|
221 |
||
222 |
! |
|
223 |
||
431 | 224 |
bindings |
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
225 |
"return my builders bindings" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
226 |
|
431 | 227 |
^ builder bindings |
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
228 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
229 |
"Modified: / 20.5.1998 / 20:51:15 / cg" |
431 | 230 |
! |
231 |
||
232 |
cancel |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
233 |
"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
|
234 |
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
|
235 |
dialog is closed." |
431 | 236 |
|
237 |
^ cancel |
|
605 | 238 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
239 |
"Modified: / 20.5.1998 / 20:51:02 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
240 |
! |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
241 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
242 |
closeAllowedChannel |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
243 |
"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
|
244 |
This is initialized to true." |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
245 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
246 |
^ closeAllowedChannel |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
247 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
248 |
"Created: / 20.5.1998 / 21:52:32 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
249 |
"Modified: / 20.5.1998 / 21:53:18 / cg" |
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 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
252 |
closeAllowedChannel:aValueHolderOrBlock |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
253 |
"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
|
254 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
255 |
^ closeAllowedChannel |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
256 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
257 |
"Created: / 20.5.1998 / 21:52:53 / cg" |
431 | 258 |
! |
259 |
||
260 |
closeChannel |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
261 |
"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
|
262 |
I will close myself." |
431 | 263 |
|
264 |
^ close |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
265 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
266 |
"Modified: / 20.5.1998 / 20:52:29 / cg" |
431 | 267 |
! |
268 |
||
269 |
escapeIsCancel |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
270 |
"return the escapeIsCancel setting" |
431 | 271 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
272 |
^ escapeIsCancel |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
273 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
274 |
"Modified: / 20.5.1998 / 20:52:44 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
275 |
! |
431 | 276 |
|
277 |
escapeIsCancel:something |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
278 |
"set/clear the escapeIsCancel option. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
279 |
If on, an ESC-key will be treated like a cancel action." |
431 | 280 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
281 |
escapeIsCancel := something. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
282 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
283 |
"Modified: / 20.5.1998 / 20:53:23 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
284 |
! |
431 | 285 |
|
286 |
postBuildBlock:something |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
287 |
"set postBuildBlock; if non-nil, this is evaluated after the build process" |
431 | 288 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
289 |
postBuildBlock := something. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
290 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
291 |
"Modified: / 20.5.1998 / 20:54:06 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
292 |
! |
431 | 293 |
|
294 |
postOpenBlock:something |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
295 |
"set the postBuildBlock; if non-nil, this is evaluated after the view is opened" |
431 | 296 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
297 |
postOpenBlock := something. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
298 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
299 |
"Modified: / 20.5.1998 / 20:54:23 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
300 |
! |
431 | 301 |
|
302 |
preBuildBlock:something |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
303 |
"set the preBuildBlock; if non-nil, this is evaluated before the view is constructed" |
431 | 304 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
305 |
preBuildBlock := something. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
306 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
307 |
"Modified: / 20.5.1998 / 20:54:41 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
308 |
! |
431 | 309 |
|
310 |
source:anApplication |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
311 |
"define the application which provides resources, aspects etc." |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
312 |
|
1067
5b39cef366fe
also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
313 |
builder source:anApplication. |
5b39cef366fe
also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
314 |
masterApplication isNil ifTrue:[ |
5b39cef366fe
also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
315 |
masterApplication := anApplication |
5b39cef366fe
also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
316 |
]. |
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
317 |
|
1067
5b39cef366fe
also set the masterApplication when a simpleDialogs source
Claus Gittinger <cg@exept.de>
parents:
1053
diff
changeset
|
318 |
"Modified: / 8.9.1998 / 01:46:06 / cg" |
431 | 319 |
! ! |
320 |
||
481 | 321 |
!SimpleDialog methodsFor:'accessing - window'! |
322 |
||
323 |
minWidth:nPixels |
|
324 |
|w box | |
|
325 |
||
326 |
w := builder window width. |
|
327 |
builder window width:(w max:nPixels). |
|
328 |
||
329 |
"/ box := builder window displayBox. |
|
330 |
"/ box width: (box width max: nPixels). |
|
331 |
"/ builder window displayBox: box |
|
332 |
||
333 |
"Modified: 3.3.1997 / 21:56:27 / cg" |
|
334 |
! ! |
|
335 |
||
431 | 336 |
!SimpleDialog methodsFor:'events'! |
337 |
||
338 |
closeAccept |
|
605 | 339 |
"accept was pressed. close the dialog" |
340 |
||
431 | 341 |
self requestForWindowClose ifTrue:[ |
1129 | 342 |
builder keyboardProcessor requestGlobalAutoAccept ifTrue:[ |
343 |
self closeWindow |
|
344 |
] |
|
431 | 345 |
] |
605 | 346 |
|
347 |
"Modified: 17.6.1997 / 14:10:23 / cg" |
|
431 | 348 |
! |
349 |
||
350 |
closeCancel |
|
605 | 351 |
"cancel was pressed. close the dialog" |
352 |
||
431 | 353 |
self requestForWindowClose ifTrue:[ |
354 |
self closeWindow |
|
355 |
] |
|
605 | 356 |
|
357 |
"Modified: 17.6.1997 / 14:10:29 / cg" |
|
431 | 358 |
! |
359 |
||
360 |
closeWindow |
|
605 | 361 |
"close the dialog" |
362 |
||
1053 | 363 |
|c| |
364 |
||
365 |
c := self closeChannel. |
|
366 |
c retractInterestsFor:self. |
|
367 |
c value:true. |
|
903 | 368 |
"/ must destroy - otherwise there is no #release to |
369 |
"/ the controllers (onChangeSend-dependency problem) |
|
902 | 370 |
builder window destroy. "/ hide |
605 | 371 |
|
1053 | 372 |
"Modified: / 24.8.1998 / 17:45:56 / cg" |
431 | 373 |
! |
374 |
||
375 |
requestForWindowClose |
|
1373 | 376 |
"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
|
377 |
return false to suppress the close. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
378 |
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
|
379 |
set to true initially. |
1373 | 380 |
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
|
381 |
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
|
382 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
383 |
^ closeAllowedChannel value |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
384 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
385 |
"Modified: / 20.5.1998 / 21:52:25 / cg" |
431 | 386 |
! ! |
387 |
||
713 | 388 |
!SimpleDialog methodsFor:'forced actions'! |
389 |
||
390 |
doAccept |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
391 |
"force accept" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
392 |
|
713 | 393 |
accept value:true |
394 |
||
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
395 |
"Created: / 18.10.1997 / 05:18:09 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
396 |
"Modified: / 20.5.1998 / 21:53:35 / cg" |
713 | 397 |
! |
398 |
||
399 |
doCancel |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
400 |
"force cancel" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
401 |
|
713 | 402 |
cancel value:true |
403 |
||
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
404 |
"Created: / 18.10.1997 / 05:18:22 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
405 |
"Modified: / 20.5.1998 / 21:53:40 / cg" |
713 | 406 |
! ! |
407 |
||
431 | 408 |
!SimpleDialog methodsFor:'initialization'! |
409 |
||
410 |
initialize |
|
935 | 411 |
accept := (ValueHolder with:false). |
412 |
close := (ValueHolder with:false). |
|
413 |
cancel := (ValueHolder with:false). |
|
978 | 414 |
self createBuilder. |
431 | 415 |
builder aspectAt:#accept put:accept. |
416 |
builder aspectAt:#close put:close. |
|
417 |
builder aspectAt:#cancel put:cancel. |
|
418 |
escapeIsCancel := true. |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
419 |
closeAllowedChannel := true |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
420 |
|
978 | 421 |
"Modified: / 19.6.1998 / 03:35:48 / cg" |
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
422 |
! |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
423 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
424 |
initializeBuilderFor:aView |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
425 |
aView notNil ifTrue:[ |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
426 |
builder window:aView. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
427 |
] |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
428 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
429 |
"Created: 3.3.1997 / 16:23:04 / cg" |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
430 |
! |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
431 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
432 |
initializeWindowFor:aView |
679 | 433 |
|v| |
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
434 |
|
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
435 |
(v := aView) isNil ifTrue:[ |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
436 |
v := ModalBox new. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
437 |
]. |
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
438 |
|
481 | 439 |
builder setupWindowFor:v. |
476
628766c580c3
added dummy #initializeBuilderFor: and #initializeWindowFor:
Claus Gittinger <cg@exept.de>
parents:
466
diff
changeset
|
440 |
|
481 | 441 |
"Modified: 3.3.1997 / 20:39:46 / cg" |
431 | 442 |
! ! |
443 |
||
429 | 444 |
!SimpleDialog methodsFor:'interface opening'! |
445 |
||
431 | 446 |
allButOpenFrom:aSpec |
447 |
"create my views but do not open the main window" |
|
448 |
||
449 |
super allButOpenFrom:aSpec. |
|
450 |
self preOpen |
|
451 |
! |
|
452 |
||
429 | 453 |
openFor:anApplication interface:aSelector |
465 | 454 |
"open the dialog for some appModel from a given spec; |
455 |
Return true if accepted, false if canceled" |
|
456 |
||
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
457 |
^ 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
|
458 |
|
465 | 459 |
"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
|
460 |
! |
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
461 |
|
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
462 |
openFor:anApplication interface:aSelector withBindings:bindings |
713 | 463 |
"open the dialog for some appModel from a given specSymbol; |
464 |
the application must provide an interfaceSpec for that symbol. |
|
465 |
The bindings argument may provide overwriting bindings for the |
|
466 |
dialog. |
|
467 |
Return true if accepted, false if canceled" |
|
468 |
||
469 |
^ self |
|
470 |
openFor:anApplication |
|
471 |
interfaceSpec:(anApplication class interfaceSpecFor:aSelector) |
|
472 |
withBindings:bindings |
|
473 |
||
474 |
"Modified: 18.10.1997 / 04:43:13 / cg" |
|
475 |
! |
|
476 |
||
477 |
openFor:anApplication interfaceSpec:aSpec withBindings:bindings |
|
465 | 478 |
"open the dialog for some appModel from a given spec; |
479 |
the bindings argument may provide overwriting bindings for the |
|
480 |
dialog. |
|
481 |
Return true if accepted, false if canceled" |
|
482 |
||
464
25e6380399c6
allow additional bindings to be passed with #openDialogInterface
Claus Gittinger <cg@exept.de>
parents:
462
diff
changeset
|
483 |
builder addBindings:bindings. |
1346 | 484 |
self source:(anApplication ifNil:[ApplicationModel new]). |
713 | 485 |
^ self openFrom:aSpec |
429 | 486 |
|
465 | 487 |
"Modified: 28.2.1997 / 16:22:00 / cg" |
713 | 488 |
"Created: 18.10.1997 / 04:41:29 / cg" |
429 | 489 |
! |
490 |
||
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
491 |
openFor:anApplication spec:aSpec withBindings:bindings |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
492 |
"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
|
493 |
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
|
494 |
dialog. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
495 |
Return true if accepted, false if canceled" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
496 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
497 |
^ self |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
498 |
openFor:anApplication |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
499 |
interfaceSpec:aSpec |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
500 |
withBindings:bindings |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
501 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
502 |
"Modified: / 18.10.1997 / 04:43:13 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
503 |
"Created: / 20.5.1998 / 20:28:29 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
504 |
! |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
505 |
|
429 | 506 |
openFrom:anInterfaceSpec |
466 | 507 |
"open the dialog from a given spec; |
508 |
return true if accepted, false if canceled" |
|
509 |
||
429 | 510 |
self allButOpenFrom:anInterfaceSpec. |
511 |
self openDialog. |
|
431 | 512 |
^ accept value |
513 |
||
466 | 514 |
"Modified: 28.2.1997 / 16:40:36 / cg" |
431 | 515 |
! |
516 |
||
713 | 517 |
postBuildWith:aBuilder |
518 |
"this is sent after the dialogs widgets have been created |
|
519 |
(but before the dialog is opened). |
|
520 |
If a postBuildBlock was set, evaluate it here." |
|
521 |
||
522 |
postBuildBlock notNil ifTrue:[ |
|
523 |
postBuildBlock numArgs == 0 ifTrue:[ |
|
524 |
postBuildBlock value |
|
525 |
] ifFalse:[ |
|
526 |
postBuildBlock value:aBuilder |
|
527 |
] |
|
528 |
]. |
|
529 |
super postBuildWith:aBuilder |
|
530 |
||
531 |
"Created: 18.10.1997 / 05:17:12 / cg" |
|
532 |
! |
|
533 |
||
534 |
postOpenWith:aBuilder |
|
535 |
"this is sent after the dialogs main window is opened. |
|
536 |
If a postOpenBlock was set, evaluate it here." |
|
537 |
||
538 |
postOpenBlock notNil ifTrue:[ |
|
539 |
postOpenBlock numArgs == 0 ifTrue:[ |
|
540 |
postOpenBlock value |
|
541 |
] ifFalse:[ |
|
542 |
postOpenBlock value:aBuilder |
|
543 |
] |
|
544 |
]. |
|
545 |
super postOpenWith:aBuilder |
|
546 |
||
547 |
"Created: 18.10.1997 / 05:15:48 / cg" |
|
548 |
! |
|
549 |
||
550 |
preBuildWith:aBuilder |
|
551 |
"this is sent before the dialogs widgets are created. |
|
552 |
If a preBuildBlock was set, evaluate it here." |
|
553 |
||
554 |
preBuildBlock notNil ifTrue:[ |
|
555 |
preBuildBlock numArgs == 0 ifTrue:[ |
|
556 |
preBuildBlock value |
|
557 |
] ifFalse:[ |
|
558 |
preBuildBlock value:aBuilder |
|
559 |
] |
|
560 |
]. |
|
561 |
super preBuildWith:aBuilder |
|
562 |
||
563 |
"Created: 18.10.1997 / 15:02:27 / cg" |
|
564 |
! |
|
565 |
||
431 | 566 |
preOpen |
605 | 567 |
"arrange for #closeAccept & #closeCancel to be invoked when |
568 |
either accept or close is triggered |
|
569 |
(usually the models of corresponding buttons)" |
|
570 |
||
431 | 571 |
accept onChangeSend:#closeAccept to:self. |
572 |
cancel onChangeSend:#closeCancel to:self. |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
573 |
close onChangeSend:#closeWindow to:self. |
429 | 574 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
575 |
"Modified: / 20.5.1998 / 20:49:26 / cg" |
429 | 576 |
! ! |
577 |
||
366 | 578 |
!SimpleDialog methodsFor:'queries'! |
579 |
||
580 |
defaultWindowType |
|
581 |
"SimpleDialogs come up modal, by default" |
|
582 |
||
583 |
^ #dialog |
|
584 |
||
585 |
"Modified: 14.2.1997 / 22:17:20 / cg" |
|
586 |
! ! |
|
587 |
||
766
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
588 |
!SimpleDialog methodsFor:'startup'! |
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
589 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
590 |
openInterface:aSymbol |
766
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
591 |
"open a standard interface. |
1375 | 592 |
Redefined to return the accept value instead of the builder." |
766
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
593 |
|
932
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
594 |
super openInterfaceModal:aSymbol. |
766
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
595 |
^ accept value. |
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
596 |
|
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
597 |
"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
|
598 |
"Modified: / 20.5.1998 / 20:21:28 / cg" |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
599 |
! |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
600 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
601 |
openSpec:aWindowSpec |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
602 |
"open a window spec. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
603 |
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
|
604 |
of the builder." |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
605 |
|
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
606 |
super openSpecModal:aWindowSpec. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
607 |
^ accept value. |
f7b0ce4cc1d1
allow opening an interface by spec.
Claus Gittinger <cg@exept.de>
parents:
906
diff
changeset
|
608 |
|
905
f2a0bb5b147c
default for SimpleDialogs is to open modal
Claus Gittinger <cg@exept.de>
parents:
903
diff
changeset
|
609 |
"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
|
610 |
"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
|
611 |
! ! |
67d7a6bc6780
simpledialog open - returns the accept-value
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
612 |
|
366 | 613 |
!SimpleDialog class methodsFor:'documentation'! |
614 |
||
615 |
version |
|
1381 | 616 |
^ '$Header: /cvs/stx/stx/libview2/SimpleDialog.st,v 1.31 2000-07-26 13:13:36 cg Exp $' |
366 | 617 |
! ! |