author | Claus Gittinger <cg@exept.de> |
Wed, 17 Jul 2019 10:31:26 +0200 | |
changeset 8734 | de0c9b4d22b9 |
parent 8697 | 8c2c702ff12c |
child 8917 | 5942dc35f0e4 |
permissions | -rw-r--r-- |
8284 | 1 |
"{ Encoding: utf8 }" |
2 |
||
0 | 3 |
" |
6 | 4 |
COPYRIGHT (c) 1989 by Claus Gittinger |
72 | 5 |
All Rights Reserved |
0 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
3204
ed184af034d3
Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents:
3170
diff
changeset
|
14 |
"{ Package: 'stx:libview' }" |
ed184af034d3
Remove dependents on various channels when destroying.
Stefan Vogel <sv@exept.de>
parents:
3170
diff
changeset
|
15 |
|
6722 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
135 | 18 |
SimpleView subclass:#View |
2548 | 19 |
instanceVariableNames:'model aspectMsg changeMsg menuMsg menuHolder menuPerformer |
3365
a76614b953c7
lifted visibilityChannel stuff to superclass
Claus Gittinger <cg@exept.de>
parents:
3355
diff
changeset
|
20 |
enableChannel foregroundChannel backgroundChannel' |
616 | 21 |
classVariableNames:'' |
22 |
poolDictionaries:'' |
|
23 |
category:'Views-Basic' |
|
0 | 24 |
! |
25 |
||
2 | 26 |
!View class methodsFor:'documentation'! |
41 | 27 |
|
46 | 28 |
copyright |
29 |
" |
|
30 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
72 | 31 |
All Rights Reserved |
46 | 32 |
|
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
! |
|
41 |
||
41 | 42 |
documentation |
2 | 43 |
" |
135 | 44 |
this class adds provisions for views which show or work on a model. |
45 |
This functionality used to be in View, but has been extracted into SimpleView and |
|
46 |
this new View class, to take some of the stuff out of views which do not need |
|
47 |
this functionality (i.e. all views which do only geometry management). |
|
82 | 48 |
Instances of View are seldom used, most views in the system inherit |
49 |
from this class. |
|
41 | 50 |
|
616 | 51 |
[Instance variables:] |
52 |
model <nil | any> the model (if any) |
|
41 | 53 |
|
616 | 54 |
aspectMsg <nil | Symbol> the aspect; typically |
55 |
dependentViews react on changes |
|
56 |
of this aspect and update their contents. |
|
57 |
||
58 |
changeMsg <nil | Symbol> the changeMessage; typically |
|
59 |
dependentViews send this message to |
|
60 |
the model to tell it about changes. |
|
140 | 61 |
|
616 | 62 |
menuMsg <nil | Symbol> the menuMessage; typically |
63 |
dependentViews send this message to |
|
64 |
the model to ask for a popup menu. |
|
1151
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
65 |
|
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
66 |
|
1152
21c666e130dd
menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents:
1151
diff
changeset
|
67 |
menuHolder <any> who has a menu |
21c666e130dd
menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents:
1151
diff
changeset
|
68 |
(default: nil i.e. model has menu) |
21c666e130dd
menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents:
1151
diff
changeset
|
69 |
|
21c666e130dd
menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents:
1151
diff
changeset
|
70 |
menuPerformer <any> who performs menu actions |
21c666e130dd
menuHolder/menuPerformer stuff.
Stefan Vogel <sv@exept.de>
parents:
1151
diff
changeset
|
71 |
(default: nil i.e. model has menu) |
616 | 72 |
|
73 |
[see also:] |
|
621 | 74 |
StandardSystemView TopView DialogBox |
616 | 75 |
WindowGroup |
621 | 76 |
Model ValueHolder |
616 | 77 |
( introduction to view programming :html: programming/viewintro.html ) |
78 |
||
140 | 79 |
|
616 | 80 |
[author:] |
81 |
Claus Gittinger |
|
82 |
" |
|
83 |
! |
|
84 |
||
85 |
examples |
|
86 |
" |
|
87 |
a subView in a topView: |
|
621 | 88 |
[exBegin] |
616 | 89 |
|top v| |
140 | 90 |
|
2134 | 91 |
top := StandardSystemView new. |
616 | 92 |
v := View new. |
93 |
v origin:0.25 @ 0.25 corner:0.75 @ 0.75. |
|
94 |
top addSubView:v. |
|
95 |
top open |
|
621 | 96 |
[exEnd] |
616 | 97 |
|
98 |
||
99 |
the same, a bit more compact: |
|
621 | 100 |
[exBegin] |
616 | 101 |
|top v| |
102 |
||
2134 | 103 |
top := StandardSystemView new. |
104 |
v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top. |
|
105 |
top open |
|
106 |
[exEnd] |
|
107 |
||
108 |
menuHolder |
|
109 |
[exBegin] |
|
110 |
|top mh| |
|
111 |
||
112 |
mh := (PopUpMenu itemList:#( ('foo' foo) (#'bar' bar)) resources:nil) asValue. |
|
113 |
||
114 |
top := StandardSystemView extent:200@200. |
|
115 |
top menuHolder:mh. |
|
116 |
top open |
|
117 |
[exEnd] |
|
118 |
||
119 |
||
120 |
menuHolder |
|
121 |
[exBegin] |
|
122 |
|top mh| |
|
123 |
||
124 |
mh := (PopUpMenu itemList:#( ('foo' foo) (#'bar' bar)) resources:nil) asValue. |
|
125 |
[ |
|
126 |
Delay waitForSeconds:5. |
|
127 |
mh value: (PopUpMenu itemList:#( ('waboo' foo) (#'baz' bar)) resources:nil) |
|
128 |
] fork. |
|
129 |
||
130 |
top := StandardSystemView extent:200@200. |
|
131 |
top menuHolder:mh. |
|
616 | 132 |
top open |
621 | 133 |
[exEnd] |
134 |
||
2 | 135 |
" |
136 |
! ! |
|
0 | 137 |
|
118 | 138 |
!View class methodsFor:'instance creation'! |
139 |
||
140 | 140 |
on:aModel aspect:aspectMsg |
141 |
"st-80 style view creation: create a new view, set its model |
|
142 |
and selectors for aspect" |
|
143 |
||
144 |
^ self new |
|
145 |
on:aModel |
|
146 |
aspect:aspectMsg |
|
147 |
! |
|
148 |
||
149 |
on:aModel aspect:aspectMsg change:changeMsg |
|
150 |
"st-80 style view creation: create a new view, set its model |
|
151 |
and selectors for aspect and change" |
|
152 |
||
153 |
^ self new |
|
154 |
on:aModel |
|
155 |
aspect:aspectMsg |
|
156 |
change:changeMsg |
|
157 |
! |
|
158 |
||
135 | 159 |
on:aModel aspect:aspectMsg change:changeMsg menu:menuMsg |
118 | 160 |
"st-80 style view creation: create a new view, set its model |
140 | 161 |
and selectors for aspect, change and menu" |
118 | 162 |
|
135 | 163 |
^ self new |
164 |
on:aModel |
|
165 |
aspect:aspectMsg |
|
166 |
change:changeMsg |
|
167 |
menu:menuMsg |
|
118 | 168 |
! |
169 |
||
269 | 170 |
on:aModel aspect:aspectMsg menu:menuMsg |
171 |
"st-80 style view creation: create a new view, set its model |
|
172 |
and selectors for aspect and menu" |
|
118 | 173 |
|
269 | 174 |
^ self new |
175 |
on:aModel |
|
176 |
aspect:aspectMsg |
|
177 |
menu:menuMsg |
|
118 | 178 |
! ! |
179 |
||
123 | 180 |
!View class methodsFor:'defaults'! |
181 |
||
140 | 182 |
defaultAspectMessage |
135 | 183 |
"subclasses which by default do NOT want to be informed about changed |
184 |
models should redefine this to return nil" |
|
118 | 185 |
|
135 | 186 |
^ #value |
0 | 187 |
! |
188 |
||
140 | 189 |
defaultChangeMessage |
135 | 190 |
"subclasses which by default do NOT want to inform the model |
191 |
should redefine this to return nil" |
|
0 | 192 |
|
135 | 193 |
^ #value: |
1151
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
194 |
! |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
195 |
|
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
196 |
defaultMenuMessage |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
197 |
"subclasses which by default do NOT want to send menu messages |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
198 |
should return nil" |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
199 |
|
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
200 |
^ nil |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
201 |
|
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
202 |
"Created: 3.1.1997 / 01:50:36 / stefan" |
0 | 203 |
! ! |
204 |
||
3355
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
205 |
!View methodsFor:'accessing-bg & border'! |
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
206 |
|
4957 | 207 |
allViewBackground:something if:condition |
3355
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
208 |
"set the viewBackground to something, a color, image or form, |
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
209 |
in myself and recursively in all of my subviews. |
6605 | 210 |
However, if I have a backgroundChannel, don't change my own bg." |
3355
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
211 |
|
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
212 |
backgroundChannel isNil ifTrue:[ |
4957 | 213 |
^ super allViewBackground:something if:condition |
3355
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
214 |
]. |
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
215 |
|
4957 | 216 |
self allSubViewsBackground:something if:condition |
3355
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
217 |
! ! |
2ec13d9b93ca
in allViewBackground: do not change the bg, if I have a bg-channel
Claus Gittinger <cg@exept.de>
parents:
3204
diff
changeset
|
218 |
|
170 | 219 |
!View methodsFor:'accessing-channels'! |
220 |
||
2548 | 221 |
backgroundChannel |
222 |
"return a valueHolder for background color" |
|
223 |
||
224 |
^ backgroundChannel |
|
225 |
||
226 |
"Modified: / 30.3.1999 / 13:49:28 / stefan" |
|
227 |
"Created: / 30.3.1999 / 13:50:55 / stefan" |
|
228 |
! |
|
229 |
||
230 |
backgroundChannel:aValueHolder |
|
4985 | 231 |
"set the backgroundChannel - a valueHolder holding a color" |
2548 | 232 |
|
233 |
|prev| |
|
234 |
||
235 |
prev := backgroundChannel. |
|
236 |
backgroundChannel := aValueHolder. |
|
4926 | 237 |
self setupChannel:aValueHolder for:#backgroundColorChanged withOld:prev |
2548 | 238 |
|
239 |
"Modified: / 31.10.1997 / 14:38:38 / cg" |
|
240 |
"Created: / 30.3.1999 / 13:48:42 / stefan" |
|
241 |
! |
|
242 |
||
243 |
enableChannel |
|
244 |
"return a valueHolder for enable/disable" |
|
245 |
||
246 |
^ enableChannel |
|
247 |
||
248 |
"Created: / 30.3.1999 / 13:46:43 / stefan" |
|
249 |
! |
|
250 |
||
251 |
enableChannel:aValueHolder |
|
252 |
"set the valueHolder, which holds the enable boolean value" |
|
253 |
||
254 |
|prev| |
|
255 |
||
256 |
prev := enableChannel. |
|
257 |
enableChannel := aValueHolder. |
|
2950
705ddb097eec
Fix visibilityChannel and enableChannel stuff
Claus Gittinger <cg@exept.de>
parents:
2573
diff
changeset
|
258 |
self setupChannel:aValueHolder for:#enableStateChanged withOld:prev |
2548 | 259 |
|
260 |
"Modified: / 14.11.1997 / 13:52:44 / cg" |
|
261 |
"Modified: / 30.3.1999 / 13:50:15 / stefan" |
|
262 |
! |
|
263 |
||
264 |
foregroundChannel |
|
265 |
"return a valueHolder for foreground color" |
|
266 |
||
267 |
^ foregroundChannel |
|
268 |
||
269 |
"Modified: / 30.3.1999 / 13:49:28 / stefan" |
|
270 |
! |
|
271 |
||
272 |
foregroundChannel:aValueHolder |
|
273 |
"set the foregroundChannel - a valueHolder holding a color" |
|
274 |
||
275 |
|prev| |
|
276 |
||
277 |
prev := foregroundChannel. |
|
278 |
foregroundChannel := aValueHolder. |
|
4926 | 279 |
self setupChannel:aValueHolder for:#foregroundColorChanged withOld:prev |
2548 | 280 |
|
281 |
"Modified: / 31.10.1997 / 14:38:38 / cg" |
|
282 |
"Modified: / 30.3.1999 / 13:50:08 / stefan" |
|
170 | 283 |
! ! |
284 |
||
269 | 285 |
!View methodsFor:'accessing-menus'! |
286 |
||
8671 | 287 |
defaultMenuPerformer |
288 |
"the stuff below tries to make for a reasonable |
|
289 |
default, in case the menuPerformer was NOT set explicitely |
|
290 |
(you should not depend on this in your application)" |
|
291 |
||
292 |
(model isNil |
|
293 |
or:[model isValueModel |
|
294 |
or:[model isBlock |
|
295 |
or:[model isString]]] |
|
296 |
) ifTrue:[ |
|
297 |
"/ a simple holder-model. Do not send menuMessages to it |
|
298 |
^ self application ? self |
|
299 |
]. |
|
300 |
^ model |
|
301 |
||
302 |
"Created: / 03-04-2019 / 09:42:37 / Claus Gittinger" |
|
303 |
! |
|
304 |
||
269 | 305 |
menuHolder |
306 |
"who has the menu ? |
|
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
307 |
If no explicit menuHolder was defined, its the model if I have one. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
308 |
Otherwise, its the menuHolder (if nonNil) or mySelf. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
309 |
The menuHolder is supposed to return a popUpMenu when asked via the |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
310 |
menuMessage." |
269 | 311 |
|
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
312 |
menuHolder notNil ifTrue:[^ menuHolder]. |
269 | 313 |
model notNil ifTrue:[^ model]. |
314 |
^ self |
|
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
315 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
316 |
"Modified: 23.12.1996 / 13:56:55 / cg" |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
317 |
! |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
318 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
319 |
menuHolder:anObject |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
320 |
"change the one that provides the menu (via menuMsg)." |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
321 |
|
2134 | 322 |
menuHolder := anObject. |
323 |
menuMsg isNil ifTrue:[menuMsg := #value]. |
|
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
324 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
325 |
"Created: 23.12.1996 / 13:54:33 / cg" |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
326 |
! |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
327 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
328 |
menuMessage |
7408 | 329 |
"Return the symbol sent to the model to acquire the menu" |
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
330 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
331 |
^ menuMsg |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
332 |
! |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
333 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
334 |
menuMessage:aSymbol |
8150 | 335 |
"ST-80 style menus: If a view's menuSymbol is nonNil, it |
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
336 |
will send it to its model when the middleButton is pressed. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
337 |
That method should return nil or the menu to be shown. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
338 |
This is useful for very dynamic menus, where it does not |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
339 |
make sense to define an initial menu. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
340 |
This is the same as #menu: which was added for ST-80 compatibility." |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
341 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
342 |
menuMsg := aSymbol |
8150 | 343 |
|
344 |
"Modified (comment): / 31-08-2017 / 20:18:40 / cg" |
|
269 | 345 |
! |
346 |
||
347 |
menuPerformer |
|
8046 | 348 |
"who should perform the menu actions? |
349 |
If no menuPerformer was defined, it is the model if I have one. |
|
350 |
Otherwise it is the menuPerformer (if nonNil), or myself. |
|
351 |
The menuPerformer gets messages from the menu" |
|
269 | 352 |
|
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
353 |
menuPerformer notNil ifTrue:[^ menuPerformer]. |
8671 | 354 |
^ self defaultMenuPerformer |
8046 | 355 |
|
356 |
"Modified (format): / 29-06-2017 / 12:08:58 / mawalch" |
|
8671 | 357 |
"Modified: / 03-04-2019 / 09:43:34 / Claus Gittinger" |
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
358 |
! |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
359 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
360 |
menuPerformer:anObject |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
361 |
"change the one that does the menu actions. |
8671 | 362 |
See the comment in SimpleView>>activateMenu on who gets the menu's |
1147
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
363 |
message." |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
364 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
365 |
menuPerformer := anObject |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
366 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
367 |
" |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
368 |
|top textV plug| |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
369 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
370 |
plug := Plug new. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
371 |
plug respondTo:#textMenu |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
372 |
with:[ |m| |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
373 |
m := PopUpMenu |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
374 |
labels:#('copy' 'foo' '-' 'others') |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
375 |
selectors:#(copySelection foo nil others). |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
376 |
m subMenuAt:#others |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
377 |
put:(PopUpMenu |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
378 |
labels:#('bar' 'goto') |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
379 |
selectors:#(bar gotoLine)) |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
380 |
]. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
381 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
382 |
top := StandardSystemView new. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
383 |
top extent:300@300. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
384 |
|
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
385 |
textV := TextView origin:0.0@0.0 corner:1.0@1.0 in:top. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
386 |
textV menuHolder:plug; menuMessage:#textMenu; menuPerformer:plug. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
387 |
textV contents:'hello world'. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
388 |
top open. |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
389 |
" |
83ed804938e7
moved menuHolder/menuPerformer stuff up in the hierarchy
Claus Gittinger <cg@exept.de>
parents:
1146
diff
changeset
|
390 |
|
8671 | 391 |
"Created: / 23-12-1996 / 13:57:28 / cg" |
392 |
"Modified (comment): / 03-04-2019 / 08:54:30 / Claus Gittinger" |
|
2166
d6e05def4f83
added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2134
diff
changeset
|
393 |
! |
d6e05def4f83
added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2134
diff
changeset
|
394 |
|
d6e05def4f83
added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2134
diff
changeset
|
395 |
performer:anObject |
d6e05def4f83
added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2134
diff
changeset
|
396 |
"same as #menuPerformer - ST80 compatibility" |
d6e05def4f83
added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2134
diff
changeset
|
397 |
|
d6e05def4f83
added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2134
diff
changeset
|
398 |
self menuPerformer:anObject |
d6e05def4f83
added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2134
diff
changeset
|
399 |
|
d6e05def4f83
added #performer: (dummy - ST80 compatibility)
Claus Gittinger <cg@exept.de>
parents:
2134
diff
changeset
|
400 |
"Created: / 6.7.1998 / 13:38:32 / cg" |
269 | 401 |
! ! |
402 |
||
118 | 403 |
!View methodsFor:'accessing-mvc'! |
404 |
||
269 | 405 |
addModelInterfaceTo:aDictionary |
406 |
"this adds entries for all messages sent to my model |
|
407 |
to aDictionary" |
|
408 |
||
409 |
aDictionary at:#aspectMessage put:aspectMsg. |
|
410 |
aDictionary at:#changeMessage put:changeMsg. |
|
411 |
aDictionary at:#menuMessage put:menuMsg. |
|
412 |
||
413 |
" |
|
414 |
Button new modelInterface |
|
415 |
" |
|
416 |
! |
|
135 | 417 |
|
269 | 418 |
aspect |
419 |
"Return the aspect used with changes from/to the model" |
|
420 |
||
421 |
^ aspectMsg |
|
422 |
! |
|
423 |
||
424 |
aspectMessage |
|
425 |
"Return the aspect used with changes from/to the model" |
|
426 |
||
427 |
^ aspectMsg |
|
428 |
! |
|
429 |
||
430 |
aspectMessage:aspectSymbol |
|
8150 | 431 |
"ST-80 style updating: If a view's aspectSymbol is nonNil, |
269 | 432 |
it will respond to changes of this aspect from the model." |
433 |
||
434 |
aspectMsg := aspectSymbol |
|
8150 | 435 |
|
436 |
"Modified (comment): / 31-08-2017 / 20:18:12 / cg" |
|
135 | 437 |
! |
438 |
||
269 | 439 |
change:changeSymbol |
8150 | 440 |
"ST-80 style change notification: If a view's changeSymbol is nonNil, |
269 | 441 |
it will send it to its model when something changes. |
442 |
Alias for changeMessage: for ST-80 compatibility." |
|
443 |
||
444 |
self changeMessage:changeSymbol |
|
8150 | 445 |
|
446 |
"Modified (comment): / 31-08-2017 / 20:18:15 / cg" |
|
269 | 447 |
! |
448 |
||
449 |
changeMessage |
|
450 |
"Return the symbol sent to the model if nonNil when something changes." |
|
135 | 451 |
|
269 | 452 |
^ changeMsg |
453 |
! |
|
454 |
||
455 |
changeMessage:aSymbol |
|
8150 | 456 |
"ST-80 style change notification: If a view's changeSymbol is nonNil, |
269 | 457 |
it will send it to its model when something changes. |
458 |
This is the same as change: which was added for ST-80 compatibility." |
|
459 |
||
460 |
changeMsg := aSymbol |
|
8150 | 461 |
|
462 |
"Modified (comment): / 31-08-2017 / 20:18:18 / cg" |
|
269 | 463 |
! |
464 |
||
465 |
controller:aController |
|
466 |
"set the controller" |
|
118 | 467 |
|
269 | 468 |
super controller:aController. |
469 |
controller notNil ifTrue:[ |
|
470 |
controller model:model |
|
0 | 471 |
] |
472 |
! |
|
473 |
||
269 | 474 |
menu:menuSymbol |
8150 | 475 |
"ST-80 style menus: If a view's menuSymbol is nonNil, it |
269 | 476 |
will send it to its model when the middleButton is pressed. |
477 |
That method should return nil or the menu to be shown. |
|
478 |
This is useful for very dynamic menus, where it does not |
|
479 |
make sense to define an initial menu. |
|
480 |
Alias for #menuMessage:, for ST-80 compatibility." |
|
481 |
||
482 |
menuMsg := menuSymbol |
|
8150 | 483 |
|
484 |
"Modified (comment): / 31-08-2017 / 20:18:24 / cg" |
|
269 | 485 |
! |
486 |
||
118 | 487 |
model |
488 |
"return the model, for non-MVC views, |
|
489 |
this is nil or the receiver" |
|
490 |
||
491 |
^ model |
|
492 |
! |
|
493 |
||
494 |
model:aModel |
|
1151
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
495 |
"Set the model. |
1149
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
496 |
Here, if I am my own menuPerformer/menuHolder, |
1151
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
497 |
set the menuHolder and menuPerformer to the model. |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
498 |
This is a compatibility kludge, |
1149
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
499 |
since typically, ST-80 code expects the model to provide a menu |
1151
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
500 |
and perform it. If the model does not support a menu message, |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
501 |
it will be forwarded to the view. |
1149
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
502 |
Those apps which want the view to provide the (default) menu have to reset |
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
503 |
this by sending #menuHolder: message (again)" |
118 | 504 |
|
505 |
model notNil ifTrue:[ |
|
1149
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
506 |
model removeDependent:self |
89 | 507 |
]. |
118 | 508 |
model := aModel. |
2524
6a32a348aaa4
relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents:
2166
diff
changeset
|
509 |
|
6a32a348aaa4
relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents:
2166
diff
changeset
|
510 |
"/ ST80 kludge start |
6a32a348aaa4
relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents:
2166
diff
changeset
|
511 |
(menuPerformer == self |
8671 | 512 |
and:[menuHolder == self |
513 |
and:[model isValueModel not |
|
514 |
and:[model isString not |
|
515 |
]]]) ifTrue:[ |
|
516 |
self menuPerformer:model. |
|
517 |
self menuHolder:model. |
|
1149
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
518 |
]. |
2524
6a32a348aaa4
relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents:
2166
diff
changeset
|
519 |
"/ ST80 kludge end. |
6a32a348aaa4
relaxed setting of menuPerformer to model,
Claus Gittinger <cg@exept.de>
parents:
2166
diff
changeset
|
520 |
|
118 | 521 |
model notNil ifTrue:[ |
1149
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
522 |
aModel addDependent:self |
118 | 523 |
]. |
524 |
controller notNil ifTrue:[ |
|
1149
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
525 |
controller model:aModel |
1395
7218ca27d752
moved class>.model to superClass.
Claus Gittinger <cg@exept.de>
parents:
1152
diff
changeset
|
526 |
]. |
1149
a3a75ffb29ce
Set meuPerformer also, when model is set.
Stefan Vogel <sv@exept.de>
parents:
1147
diff
changeset
|
527 |
|
8671 | 528 |
"Modified: / 28-02-1997 / 19:23:06 / cg" |
529 |
"Modified: / 03-04-2019 / 09:44:19 / Claus Gittinger" |
|
118 | 530 |
! |
531 |
||
140 | 532 |
modelInterface |
533 |
"this returns a dictionary of messages sent to my model. |
|
534 |
It can be used for builders and wrappers to get information |
|
535 |
about the messages sent to my model. |
|
536 |
The returned dictionary contains one entry for each get-Msg, |
|
7234 | 537 |
and the receiver will implement corresponding messages (with a colon) |
140 | 538 |
to set the message symbol." |
539 |
||
540 |
|d| |
|
541 |
||
542 |
d := IdentityDictionary new. |
|
543 |
self addModelInterfaceTo:d. |
|
544 |
^ d |
|
545 |
||
546 |
" |
|
547 |
Button new modelInterface |
|
548 |
Label new modelInterface |
|
549 |
" |
|
550 |
||
551 |
" |
|
552 |
does the view support setting the menuMessage ? |
|
553 |
||
554 |
SelectionInListView new modelInterface includesKey:#menuMessage |
|
555 |
" |
|
556 |
||
557 |
" |
|
558 |
turn off all interaction to the model: |
|
559 |
||
560 |
|m v if| |
|
561 |
||
562 |
m := SelectionInList new. |
|
563 |
m list:#('one' 'two' 'tree' 'four') asValue. |
|
564 |
m selection:1 asValue. |
|
565 |
v := SelectionInListView on:m. |
|
566 |
v open. |
|
567 |
v inspect. |
|
568 |
||
569 |
if := v modelInterface. |
|
570 |
if inspect. |
|
571 |
||
572 |
if keysAndValuesDo:[:what :msg | |
|
7234 | 573 |
v perform:(what , ':') asSymbol with:nil. |
140 | 574 |
]. |
575 |
" |
|
269 | 576 |
! |
577 |
||
578 |
on:aModel aspect:aspectSymbol |
|
579 |
"ST-80 compatibility: set model and aspect |
|
580 |
messages - needs a view which uses these" |
|
581 |
||
582 |
aspectMsg := aspectSymbol. |
|
583 |
self model:aModel. |
|
584 |
! |
|
585 |
||
586 |
on:aModel aspect:aspectSymbol change:changeSymbol |
|
587 |
"ST-80 compatibility: set model, aspect and change |
|
588 |
messages - needs a view which uses these" |
|
589 |
||
590 |
aspectMsg := aspectSymbol. |
|
591 |
changeMsg := changeSymbol. |
|
592 |
self model:aModel. |
|
593 |
! |
|
594 |
||
595 |
on:aModel aspect:aspectSymbol change:changeSymbol menu:menuSymbol |
|
596 |
"ST-80 compatibility: set model, aspect, change and menu |
|
597 |
messages - needs a view which uses these" |
|
598 |
||
599 |
aspectMsg := aspectSymbol. |
|
600 |
changeMsg := changeSymbol. |
|
601 |
menuMsg := menuSymbol. |
|
602 |
self model:aModel. |
|
603 |
! |
|
604 |
||
605 |
on:aModel aspect:aspectSymbol menu:menuSymbol |
|
606 |
"ST-80 compatibility: set model, aspect and menu |
|
607 |
messages - needs a view which uses these" |
|
608 |
||
609 |
aspectMsg := aspectSymbol. |
|
610 |
menuMsg := menuSymbol. |
|
611 |
self model:aModel. |
|
612 |
! |
|
613 |
||
614 |
sendChangeMessage:aSelector with:arg |
|
615 |
"tell the model about a change" |
|
616 |
||
617 |
"/ |
|
618 |
"/ MVC way of doing it: |
|
619 |
"/ if the model is a block, evaluate it, optionally |
|
620 |
"/ passing the arg and the receiver as arguments. |
|
621 |
"/ |
|
622 |
"/ otherwise (the common case) send it a changeMsg message |
|
623 |
"/ also with arg and the receiver (depending on the number of arguments |
|
624 |
"/ as defined by the selector). |
|
625 |
"/ |
|
626 |
(model notNil and:[aSelector notNil]) ifTrue:[ |
|
3170 | 627 |
model isBlock ifTrue:[ |
7674 | 628 |
model valueWithOptionalArgument:aSelector and:arg and:self. |
3170 | 629 |
] ifFalse:[ |
7674 | 630 |
model perform:aSelector withOptionalArgument:arg and:self. |
3170 | 631 |
] |
269 | 632 |
] |
633 |
! |
|
634 |
||
635 |
sendChangeMessageWith:arg |
|
636 |
"tell the model about a change" |
|
637 |
||
638 |
self sendChangeMessage:changeMsg with:arg |
|
72 | 639 |
! ! |
640 |
||
2548 | 641 |
!View methodsFor:'change & update'! |
642 |
||
643 |
update:something with:aParameter from:changedObject |
|
644 |
||
645 |
changedObject == backgroundChannel ifTrue:[ |
|
646 |
self backgroundColor:(backgroundChannel value). |
|
647 |
^ self |
|
648 |
]. |
|
649 |
changedObject == foregroundChannel ifTrue:[ |
|
650 |
self foregroundColor:(foregroundChannel value). |
|
651 |
^ self |
|
652 |
]. |
|
3731 | 653 |
changedObject == model ifTrue:[ |
654 |
self updateFromModel. |
|
655 |
^ self |
|
656 |
]. |
|
2548 | 657 |
super update:something with:aParameter from:changedObject |
658 |
||
659 |
"Created: / 14.1.1998 / 17:10:11 / stefan" |
|
660 |
"Modified: / 30.3.1999 / 13:52:31 / stefan" |
|
3731 | 661 |
! |
662 |
||
663 |
updateFromModel |
|
664 |
"to be redefined in subclasses" |
|
2548 | 665 |
! ! |
666 |
||
269 | 667 |
!View methodsFor:'drawing'! |
118 | 668 |
|
269 | 669 |
redraw |
670 |
"redraw myself |
|
671 |
if there is a model, this one shall redraw itself, |
|
672 |
otherwise we cannot do much here - has to be redefined in subclasses" |
|
118 | 673 |
|
269 | 674 |
model notNil ifTrue:[ |
675 |
model update:self |
|
676 |
] |
|
118 | 677 |
! ! |
678 |
||
2548 | 679 |
!View methodsFor:'event handling'! |
680 |
||
4926 | 681 |
backgroundColorChanged |
682 |
"called to update the background color" |
|
683 |
||
684 |
|color| |
|
685 |
||
686 |
color := backgroundChannel value. |
|
687 |
self backgroundColor:color. |
|
688 |
! |
|
689 |
||
2556
27e9e1cc8cb3
renambe #enableStateChange and #visibilityStateChange
Claus Gittinger <cg@exept.de>
parents:
2548
diff
changeset
|
690 |
enableStateChanged |
2548 | 691 |
"called to update enable/disable state" |
692 |
||
693 |
self enabled:(enableChannel value) |
|
694 |
||
695 |
"Modified: / 30.3.1999 / 16:07:08 / stefan" |
|
4926 | 696 |
! |
697 |
||
698 |
foregroundColorChanged |
|
4977 | 699 |
"called to update the foreground color" |
4926 | 700 |
|
4977 | 701 |
self foregroundColor:(foregroundChannel value) |
2548 | 702 |
! ! |
703 |
||
3095 | 704 |
!View methodsFor:'focus handling'! |
705 |
||
706 |
wantsFocusWithButtonPress |
|
707 |
"views which do not like to take the keyboard focus |
|
708 |
with buttonPress can do so by redefining this |
|
709 |
to return false" |
|
710 |
||
711 |
(self class == View) ifTrue:[ |
|
712 |
"/ a pure filler/geometric layout view |
|
713 |
^ false |
|
714 |
]. |
|
715 |
^ super wantsFocusWithButtonPress |
|
716 |
||
717 |
||
718 |
! ! |
|
719 |
||
3170 | 720 |
!View methodsFor:'initialization & release'! |
2573 | 721 |
|
118 | 722 |
initialize |
7846 | 723 |
<modifier: #super> "must be called if redefined" |
724 |
||
118 | 725 |
super initialize. |
140 | 726 |
|
727 |
aspectMsg := self class defaultAspectMessage. |
|
728 |
changeMsg := self class defaultChangeMessage. |
|
1151
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
729 |
menuMsg := self class defaultMenuMessage. |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
730 |
|
135 | 731 |
model notNil ifTrue:[ |
1151
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
732 |
controller notNil ifTrue:[ |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
733 |
controller model:model |
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
734 |
] |
81 | 735 |
]. |
1151
1a3682212ea9
Move rest of menuHolder/menuPerformer stuff to view.
Stefan Vogel <sv@exept.de>
parents:
1149
diff
changeset
|
736 |
|
7846 | 737 |
"Modified: / 03-01-1997 / 02:11:15 / stefan" |
738 |
"Modified: / 08-02-2017 / 00:26:46 / cg" |
|
3707 | 739 |
! |
740 |
||
741 |
release |
|
742 |
model notNil ifTrue:[ |
|
743 |
model removeDependent:self. |
|
744 |
model := nil. |
|
745 |
]. |
|
4979
649eaf7aecd3
must retract interests - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
746 |
visibilityChannel notNil ifTrue:[ |
8697 | 747 |
visibilityChannel removeDependentAndRetractInterestsFor:self. |
748 |
visibilityChannel := nil |
|
4979
649eaf7aecd3
must retract interests - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
749 |
]. |
649eaf7aecd3
must retract interests - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
750 |
enableChannel notNil ifTrue:[ |
8697 | 751 |
enableChannel removeDependentAndRetractInterestsFor:self. |
752 |
enableChannel := nil |
|
4979
649eaf7aecd3
must retract interests - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
753 |
]. |
649eaf7aecd3
must retract interests - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
754 |
foregroundChannel notNil ifTrue:[ |
8697 | 755 |
foregroundChannel removeDependentAndRetractInterestsFor:self. |
756 |
foregroundChannel := nil |
|
4979
649eaf7aecd3
must retract interests - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
757 |
]. |
649eaf7aecd3
must retract interests - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
758 |
backgroundChannel notNil ifTrue:[ |
8697 | 759 |
backgroundChannel removeDependentAndRetractInterestsFor:self. |
760 |
backgroundChannel := nil |
|
4979
649eaf7aecd3
must retract interests - not remove dependent
Claus Gittinger <cg@exept.de>
parents:
4977
diff
changeset
|
761 |
]. |
3707 | 762 |
super release. |
8697 | 763 |
|
764 |
"Modified: / 30-05-2019 / 11:17:21 / Claus Gittinger" |
|
118 | 765 |
! ! |
766 |
||
8284 | 767 |
!View methodsFor:'printing & storing'! |
768 |
||
769 |
displayOn:aStreamOrGC |
|
770 |
"redefined to also give a hint of where I am" |
|
771 |
||
772 |
|topView| |
|
773 |
||
774 |
aStreamOrGC isStream ifFalse:[^ super displayOn:aStreamOrGC]. |
|
775 |
||
776 |
super displayOn:aStreamOrGC. |
|
777 |
(topView := self topView) notNil ifTrue:[ |
|
778 |
(topView ~~ self) ifTrue:[ |
|
779 |
aStreamOrGC nextPutAll:' [in '. |
|
780 |
topView application notNil ifTrue:[ |
|
781 |
topView application displayOn:aStreamOrGC |
|
782 |
] ifFalse:[ |
|
783 |
topView displayOn:aStreamOrGC |
|
784 |
]. |
|
785 |
aStreamOrGC nextPutAll:']'. |
|
786 |
]. |
|
787 |
]. |
|
788 |
! ! |
|
789 |
||
269 | 790 |
!View class methodsFor:'documentation'! |
791 |
||
792 |
version |
|
7234 | 793 |
^ '$Header$' |
6743 | 794 |
! |
795 |
||
796 |
version_CVS |
|
7234 | 797 |
^ '$Header$' |
269 | 798 |
! ! |
6034
a4e78ef00042
moved assignKeyboardFocus stuff from topView
Claus Gittinger <cg@exept.de>
parents:
4985
diff
changeset
|
799 |