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