author | Claus Gittinger <cg@exept.de> |
Fri, 15 Dec 1995 21:37:23 +0100 | |
changeset 323 | 619085d52522 |
parent 319 | 859aed03abc0 |
child 324 | aad84e8ca802 |
permissions | -rw-r--r-- |
26 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 3 |
All Rights Reserved |
26 | 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 |
" |
|
11 | 12 |
|
13 |
Object subclass:#WindowGroup |
|
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
14 |
instanceVariableNames:'views topViews myProcess mySensor isModal previousGroup focusView |
302
b12e58238233
manually resolved conflict (docu only)
Claus Gittinger <cg@exept.de>
parents:
301
diff
changeset
|
15 |
focusSequence preEventHook postEventHook' |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
16 |
classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal' |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
17 |
poolDictionaries:'' |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
18 |
category:'Interface-Support' |
11 | 19 |
! |
20 |
||
46 | 21 |
!WindowGroup class methodsFor:'documentation'! |
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 26 |
All Rights Reserved |
46 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
103 | 39 |
In Smalltalk/X, the known (ST-80) concept of a controller has been |
297 | 40 |
extended (split) into a WindowGroup which handles process related stuff, |
41 |
and the Controller, which only handles events for a view and defines the user interaction. |
|
42 |
All interaction is via event queues - there is no polling in controllers (not even conceptionally). |
|
103 | 43 |
|
44 |
WindowGroups are responsible to wait for and forward events for a group of |
|
297 | 45 |
windows. All views in a windowGroup share a single windowSensor which holds the |
144 | 46 |
event queue (therefore views all share the same input event queue). |
47 |
||
297 | 48 |
The event queues are filled with incoming events as arriving from the physical display. |
49 |
This is done by a separate process (so called event-dispatcher) which runs at a higher |
|
50 |
priority. The event dispatcher determines the queue into which an event has to be placed |
|
51 |
by the view for which the event is destined (via the views sensor). |
|
52 |
There may be multiple event dispatchers running (to support multiple displays); |
|
53 |
see the documentation/examples in DeviceWorkstation/XWorkstation on how this is done. |
|
54 |
||
103 | 55 |
Except for modal boxes, a separate process is created for each windowGroup |
297 | 56 |
which waits for events to arrive and processes them, by sending corresponding |
144 | 57 |
event messages to the views controller or the view (*). |
297 | 58 |
The controller is determined by asking the view (for which the event is destined); |
59 |
if the returned controller is nil, the event is sent directly to the view. |
|
60 |
This allows for simple views to work without a controller. |
|
61 |
(all of this is actually done in a WindowEvent method) |
|
62 |
||
63 |
Therefore, multiple applications run pseudo parallel. |
|
64 |
Even if some window performs a long time computation, events are still received |
|
65 |
and entered into the corresponding event queues (because the event dispatcher process |
|
66 |
runs at a higher priority). However, the actual processing of the event is only |
|
67 |
possibly if no other process is busy at the same or a higher priority. |
|
68 |
It is possible to change a windowProcesses priority in order to give other windows |
|
69 |
a chance to execute (some views do this while performing longtime actions). |
|
70 |
||
103 | 71 |
Modal boxes create an extra window group for the components of the modal |
297 | 72 |
box, but execute the event-processing loop for this new group in the original process - |
144 | 73 |
therefore, the original windowgroup is blocked for the duration of the modal |
297 | 74 |
interaction. |
75 |
However, the modal-event processing loop peeks into the original groups event queue |
|
76 |
from time to time, and handles expose events. Thus, even while blocked for user input, |
|
77 |
the original group continues to get update/redraw events. |
|
103 | 78 |
|
79 |
Normally, one windowgroup is associated to each topview (StandardSystemView) |
|
144 | 80 |
and all of its subviews. However, this is not strictly required; |
81 |
it is possible to create extra windowgroups for subviews, which will let them |
|
82 |
run in parallel |
|
313 | 83 |
(for example, the FileBrowsers kill-Button is created that |
84 |
way, to allow a kill of an executing unix command, while the browser |
|
85 |
itself reads the pipeStream for incoming text. |
|
86 |
Even if the fileBrowser is busy reading the pipe, the killButton is still |
|
87 |
working and allows terminating the pipe-read action). |
|
144 | 88 |
|
89 |
On the other hand, multiple topviews can be placed into the same windowGroup; |
|
90 |
which allows for multiview applications, of which only one communicates with |
|
103 | 91 |
the user at a time. |
109 | 92 |
|
297 | 93 |
Multiple topviews within a windowGropup can be configured to behave like one |
94 |
unit with respect to iconification, deiconification and termination. |
|
95 |
This is done by creating multiple topViews in one group, and setting up a master/slave |
|
96 |
or partner relation among them (see TopView>>beSlave and TopView>>bePartner). |
|
103 | 97 |
|
109 | 98 |
WindowGroups also support a focus window: this is the one that gets the |
103 | 99 |
keyboard input - even if the cursor is located in another subview. |
297 | 100 |
(this is a brand new feature and not yet fully released for public use) |
103 | 101 |
|
102 |
Finally, windowgroups are the perfect place for things like defining a |
|
103 |
cursor for all associated views, flushing all input, waiting for expose |
|
104 |
events etc. |
|
105 |
||
297 | 106 |
Dont get confused: |
313 | 107 |
You dont have to care for details in the normal case, a windowgroup is |
108 |
created for you automatically, when a view is opened. |
|
109 |
All of the internals are not required to be known for most applications. |
|
297 | 110 |
|
103 | 111 |
|
112 |
instance variables: |
|
144 | 113 |
|
313 | 114 |
views collection of views of this group |
103 | 115 |
|
313 | 116 |
topViews collection of topviews of this group |
103 | 117 |
|
313 | 118 |
myProcess the process executing the events |
103 | 119 |
|
313 | 120 |
mySensor my input sensor |
103 | 121 |
|
313 | 122 |
isModal true if this is for a modal box |
103 | 123 |
|
313 | 124 |
previousGroup if modal, the group that started this one |
103 | 125 |
|
313 | 126 |
focusView the one that has the focus (or nil) |
103 | 127 |
|
313 | 128 |
focusSequence defines the focus sequence |
103 | 129 |
|
130 |
||
131 |
clas variables: |
|
313 | 132 |
LeaveSignal if raised, a modal box leaves (closes) |
103 | 133 |
|
134 |
||
144 | 135 |
(*) |
313 | 136 |
due to historic reasons, many views have the controller functionality |
137 |
integrated, and handle events themself. The windowSensor takes care |
|
138 |
of this, by checking if a view has a controller, and, if so, forwarding |
|
139 |
the events to it. Otherwise, events are sent directly to the view. |
|
144 | 140 |
|
313 | 141 |
In the future, all views will be rewritten to actually use a controller. |
142 |
Currently (being in the middle of this migration), only some views |
|
143 |
(buttons, toggles and subclasses) do so. |
|
144 | 144 |
|
103 | 145 |
|
302
b12e58238233
manually resolved conflict (docu only)
Claus Gittinger <cg@exept.de>
parents:
301
diff
changeset
|
146 |
|
b12e58238233
manually resolved conflict (docu only)
Claus Gittinger <cg@exept.de>
parents:
301
diff
changeset
|
147 |
|
b12e58238233
manually resolved conflict (docu only)
Claus Gittinger <cg@exept.de>
parents:
301
diff
changeset
|
148 |
|
b12e58238233
manually resolved conflict (docu only)
Claus Gittinger <cg@exept.de>
parents:
301
diff
changeset
|
149 |
|
103 | 150 |
For more information, read 'introduction to view programming' in the |
151 |
doc/online directory. |
|
46 | 152 |
" |
302
b12e58238233
manually resolved conflict (docu only)
Claus Gittinger <cg@exept.de>
parents:
301
diff
changeset
|
153 |
|
46 | 154 |
! ! |
155 |
||
54 | 156 |
!WindowGroup class methodsFor:'initialization'! |
46 | 157 |
|
158 |
initialize |
|
159 |
LeaveSignal isNil ifTrue:[ |
|
72 | 160 |
LeaveSignal := (Signal new) mayProceed:true. |
161 |
LeaveSignal nameClass:self message:#leaveSignal. |
|
162 |
LeaveSignal notifierString:'unhandled leave signal'. |
|
54 | 163 |
]. |
46 | 164 |
|
165 |
"WindowGroup initialize" |
|
166 |
! ! |
|
167 |
||
244 | 168 |
!WindowGroup class methodsFor:'instance creation'! |
169 |
||
170 |
new |
|
171 |
"create and return a new WindowGroup object" |
|
172 |
||
173 |
^ self basicNew initialize |
|
174 |
! ! |
|
175 |
||
144 | 176 |
!WindowGroup class methodsFor:'Signal constants'! |
72 | 177 |
|
178 |
leaveSignal |
|
109 | 179 |
"return the signal which is used to exit a modal loop. |
144 | 180 |
This private signal, is always cought while a modalbox is active. |
181 |
Raising it will exit the modal loop and return from the views #openModal |
|
182 |
method." |
|
109 | 183 |
|
72 | 184 |
^ LeaveSignal |
185 |
! ! |
|
186 |
||
26 | 187 |
!WindowGroup class methodsFor:'accessing'! |
188 |
||
189 |
activeGroup |
|
180 | 190 |
"return the currently active windowGroup. |
191 |
The returned value may not be fully correct, in case the current process |
|
192 |
handles multiple windowGroups simulaniously. In this case, |
|
193 |
the first group is returned (prefering a modal if there is one). |
|
194 |
(maybe we should return a collection of windowGroups here). |
|
195 |
||
196 |
This method is required to simulate the historic ST-80 single display |
|
197 |
behavior for Cursor>>show / Cursor>>showWhile and some others (raising the |
|
198 |
activeGroups topView when modalBoxes appear) on multiple display screens. |
|
199 |
These methods should change the cursor for the currently |
|
200 |
active windowGroup ONLY, instead of globally affecting the display or |
|
201 |
all views |
|
202 |
(since, depending on the priority, other views could be unaffacted by this |
|
203 |
and an overall cursor change does not make sense.)" |
|
204 |
||
205 |
|activeProcess groups wg| |
|
206 |
||
207 |
Processor isNil ifTrue:[^ nil]. "/ only during very early init phase |
|
26 | 208 |
|
180 | 209 |
activeProcess := Processor activeProcess. |
210 |
" caching the last value ..." |
|
211 |
activeProcess == LastActive ifTrue:[ |
|
212 |
LastActiveGroup process == LastActive ifTrue:[ |
|
213 |
^ LastActiveGroup |
|
214 |
] |
|
215 |
]. |
|
216 |
groups := self scheduledWindowGroups |
|
217 |
select:[:wg | wg process == activeProcess]. |
|
218 |
groups size == 1 ifTrue:[ |
|
219 |
wg := groups anElement |
|
220 |
] ifFalse:[ |
|
221 |
wg := groups detect:[:wg | wg isModal] ifNone:nil. |
|
222 |
wg isNil ifTrue:[ |
|
223 |
wg := groups anElement |
|
224 |
] |
|
225 |
]. |
|
226 |
wg notNil ifTrue:[ |
|
227 |
LastActiveProcess := activeProcess. |
|
228 |
LastActiveGroup := wg. |
|
229 |
]. |
|
230 |
^ wg |
|
231 |
||
232 |
" |
|
233 |
WindowGroup activeGroup |
|
234 |
" |
|
235 |
||
236 |
"Modified: 3.9.1995 / 14:49:53 / claus" |
|
54 | 237 |
! |
238 |
||
239 |
scheduledWindowGroups |
|
180 | 240 |
"return a collection of all windowGroups (possibly for different |
241 |
display devices) which are scheduled (i.e. which have a process |
|
242 |
running, handling events)." |
|
243 |
||
244 |
|set screens| |
|
245 |
||
246 |
screens := Screen allScreens. |
|
247 |
screens isNil ifTrue:[^ #()]. |
|
248 |
||
249 |
set := IdentitySet new. |
|
250 |
screens do:[:aDevice | |
|
251 |
aDevice allViewsDo:[:aView | |
|
252 |
|wg| |
|
109 | 253 |
|
180 | 254 |
(wg := aView windowGroup) notNil ifTrue:[ |
255 |
wg process notNil ifTrue:[ |
|
256 |
set add:wg |
|
257 |
] |
|
258 |
]. |
|
259 |
]. |
|
260 |
]. |
|
261 |
^ set asArray |
|
262 |
||
263 |
" |
|
264 |
WindowGroup scheduledWindowGroups |
|
265 |
" |
|
266 |
||
267 |
"Modified: 1.9.1995 / 13:43:09 / claus" |
|
244 | 268 |
! |
269 |
||
270 |
setActiveGroup:aGroup |
|
271 |
"set the currently active windowGroup. |
|
272 |
Temporary; do not use this interface, it will vanish." |
|
273 |
||
274 |
LastActiveProcess := Processor activeProcess. |
|
275 |
LastActiveGroup := aGroup |
|
26 | 276 |
! ! |
277 |
||
11 | 278 |
!WindowGroup methodsFor:'accessing'! |
279 |
||
244 | 280 |
addTopView:aView |
281 |
"add a topview to the group" |
|
26 | 282 |
|
244 | 283 |
topViews isNil ifTrue:[ |
284 |
topViews := OrderedCollection new. |
|
285 |
]. |
|
286 |
topViews add:aView |
|
26 | 287 |
! |
288 |
||
11 | 289 |
addView:aView |
26 | 290 |
"add aView to the windowGroup" |
291 |
||
11 | 292 |
views isNil ifTrue:[ |
72 | 293 |
views := OrderedCollection new. |
11 | 294 |
]. |
295 |
views add:aView |
|
296 |
! |
|
297 |
||
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
298 |
device |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
299 |
"return the device, we receive our events from" |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
300 |
|
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
301 |
"/ mhmh - how about mySensor device ? |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
302 |
|
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
303 |
(views notNil and:[views isEmpty not]) ifTrue:[ |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
304 |
^ views first device |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
305 |
]. |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
306 |
^ nil |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
307 |
|
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
308 |
"Created: 13.12.1995 / 14:00:45 / stefan" |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
309 |
"Modified: 13.12.1995 / 14:18:11 / stefan" |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
310 |
! |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
311 |
|
244 | 312 |
isModal |
313 |
"return true, if I am in a modal mode" |
|
314 |
||
315 |
^ isModal |
|
316 |
! |
|
317 |
||
318 |
mainGroup |
|
319 |
"return the main windowgroup |
|
320 |
(that is the top one, which is not modal). |
|
321 |
There is one exception to this: the debugger (which is sort of modal) |
|
322 |
returns itself as mainGroup (not its debuggee)." |
|
323 |
||
324 |
|g prev| |
|
325 |
||
326 |
g := self. |
|
327 |
[g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[ |
|
328 |
g := prev |
|
329 |
]. |
|
330 |
^ g |
|
331 |
||
332 |
"Modified: 3.9.1995 / 14:57:20 / claus" |
|
333 |
! |
|
54 | 334 |
|
244 | 335 |
postEventHook:anObject |
336 |
"set the postEventHook - this one will get all events |
|
337 |
passed after being processed here (via #processEvent:)." |
|
338 |
||
339 |
postEventHook := anObject |
|
340 |
! |
|
341 |
||
342 |
preEventHook:anObject |
|
343 |
"set the preEventHook - this one will get all events |
|
344 |
passed before being processed here (via #processEvent:). |
|
345 |
If this returns true, the event is supposed to be already |
|
346 |
processed and ignored here. |
|
347 |
Otherwise, it is processed as usual." |
|
348 |
||
349 |
preEventHook := anObject |
|
350 |
! |
|
351 |
||
352 |
previousGroup |
|
353 |
"return the windowgroup that started this group. |
|
354 |
(for modal groups only)" |
|
355 |
||
356 |
^ previousGroup |
|
357 |
! |
|
358 |
||
359 |
process |
|
360 |
"return the windowGroups process" |
|
361 |
||
362 |
^ myProcess |
|
54 | 363 |
! |
364 |
||
26 | 365 |
removeView:aView |
366 |
"remove aView from the windowGroup; |
|
367 |
if this was the last view in this group, |
|
81 | 368 |
also shut down the corresponding process |
369 |
(actually, only wake it up here - it will terminate itself |
|
370 |
when finding out that all views are gone)" |
|
11 | 371 |
|
263 | 372 |
|sema| |
373 |
||
11 | 374 |
views notNil ifTrue:[ |
72 | 375 |
views remove:aView ifAbsent:[]. |
376 |
views isEmpty ifTrue:[ |
|
377 |
views := nil |
|
378 |
] |
|
11 | 379 |
]. |
380 |
topViews notNil ifTrue:[ |
|
72 | 381 |
topViews remove:aView ifAbsent:[]. |
382 |
topViews isEmpty ifTrue:[ |
|
383 |
topViews := nil |
|
384 |
] |
|
11 | 385 |
]. |
54 | 386 |
" |
387 |
wakeup my process to look if last view has been |
|
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
388 |
removed (modalBoxes terminate their modalLoop if so) |
54 | 389 |
" |
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
390 |
mySensor notNil ifTrue:[ |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
391 |
(sema := mySensor eventSemaphore) notNil ifTrue:[ |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
392 |
sema signal |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
393 |
] |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
394 |
] |
11 | 395 |
! |
396 |
||
244 | 397 |
sensor |
398 |
"return the windowGroups sensor" |
|
103 | 399 |
|
244 | 400 |
^ mySensor |
54 | 401 |
! |
402 |
||
11 | 403 |
sensor:aSensor |
26 | 404 |
"set the windowGroups sensor" |
405 |
||
11 | 406 |
mySensor := aSensor |
172 | 407 |
! |
408 |
||
244 | 409 |
topViews |
410 |
"return the topviews accociated to this windowGroup" |
|
172 | 411 |
|
244 | 412 |
^ topViews |
172 | 413 |
! |
414 |
||
244 | 415 |
views |
416 |
"return the views accociated to this windowGroup" |
|
172 | 417 |
|
244 | 418 |
^ views |
54 | 419 |
! ! |
420 |
||
244 | 421 |
!WindowGroup methodsFor:'activation / deactivation'! |
422 |
||
423 |
closeDownViews |
|
424 |
"destroy all views associated to this window group" |
|
425 |
||
426 |
topViews notNil ifTrue:[ |
|
427 |
topViews do:[:aTopView | aTopView destroy] |
|
428 |
]. |
|
429 |
views := nil. |
|
430 |
topViews := nil. |
|
431 |
mySensor := nil. |
|
432 |
! |
|
433 |
||
434 |
realizeTopViews:isRestart |
|
435 |
"realize all topViews associated to this windowGroup. |
|
436 |
If this is a restart, tell topViews about it." |
|
437 |
||
438 |
topViews notNil ifTrue:[ |
|
439 |
topViews do:[:aView | |
|
440 |
aView realize. |
|
441 |
isRestart ifTrue:[ |
|
442 |
aView restarted |
|
443 |
] |
|
444 |
]. |
|
445 |
]. |
|
446 |
! |
|
180 | 447 |
|
244 | 448 |
restart |
449 |
"restart after a snapin." |
|
180 | 450 |
|
244 | 451 |
topViews notNil ifTrue:[ |
452 |
" |
|
453 |
need a new semaphore, since obsolete processes |
|
454 |
(from our previous live) may still sit on the current semaphore |
|
455 |
" |
|
456 |
mySensor eventSemaphore:Semaphore new. |
|
457 |
isModal ifFalse:[ |
|
458 |
self startup:true |
|
459 |
] |
|
460 |
] |
|
461 |
! |
|
180 | 462 |
|
244 | 463 |
shutdown |
464 |
"shutdow the window group; close all views and |
|
465 |
terminate process" |
|
466 |
||
467 |
|p| |
|
468 |
||
469 |
self closeDownViews. |
|
470 |
myProcess notNil ifTrue:[ |
|
471 |
p := myProcess. |
|
472 |
myProcess := nil. |
|
473 |
p terminate. |
|
474 |
] |
|
180 | 475 |
! |
476 |
||
244 | 477 |
startup:isRestart |
478 |
"startup the window-group; |
|
479 |
this creates a new window group process, which |
|
480 |
does the event processing." |
|
481 |
||
482 |
|top nm dev devNm| |
|
483 |
||
484 |
previousGroup := nil. |
|
485 |
myProcess isNil ifTrue:[ |
|
486 |
isModal := false. |
|
487 |
myProcess := [ |
|
488 |
self realizeTopViews:isRestart. |
|
489 |
self eventLoopWhile:[true] onLeave:[] |
|
490 |
] forkAt:Processor userSchedulingPriority. |
|
180 | 491 |
|
244 | 492 |
(topViews notNil and:[topViews isEmpty not]) ifTrue:[ |
493 |
" |
|
494 |
give the handler process a user friendly name |
|
495 |
" |
|
496 |
top := topViews first. |
|
497 |
nm := top processName. |
|
498 |
(dev := top device) notNil ifTrue:[ |
|
499 |
devNm := dev displayName. |
|
500 |
(devNm notNil and:[devNm ~= Display displayName]) ifTrue:[ |
|
501 |
nm := nm , ' (' , devNm , ')' |
|
502 |
] |
|
503 |
] |
|
504 |
] ifFalse:[ |
|
505 |
nm := 'window handler'. |
|
506 |
]. |
|
507 |
myProcess name:nm. |
|
180 | 508 |
|
313 | 509 |
" |
510 |
when the process gets suspended, there maybe still buffered draw requests. |
|
511 |
Flush them. |
|
512 |
" |
|
513 |
myProcess suspendAction:[ |
|
514 |
|dev| |
|
318 | 515 |
dev := self device. |
313 | 516 |
dev notNil ifTrue:[dev flush]. |
517 |
]. |
|
518 |
||
244 | 519 |
"when the process dies, we have to close-down |
520 |
the views as well |
|
521 |
" |
|
522 |
myProcess exitAction:[self closeDownViews] |
|
523 |
] |
|
313 | 524 |
|
525 |
"Modified: 13.12.1995 / 14:04:53 / stefan" |
|
180 | 526 |
! |
527 |
||
244 | 528 |
startupModal:checkBlock |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
529 |
"startup the window-group in a modal loop |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
530 |
(i.e. under the currently running process); |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
531 |
checkBlock is evaluated and the modal loop is left, whenever false is returned." |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
532 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
533 |
^ self startupModal:checkBlock forGroup:WindowGroup activeGroup. |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
534 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
535 |
"Created: 10.12.1995 / 14:15:11 / cg" |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
536 |
! |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
537 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
538 |
startupModal:checkBlock forGroup:mainGroup |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
539 |
"startup the window-group in a modal loop |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
540 |
(i.e. under the currently running process); |
244 | 541 |
checkBlock is evaluated and loop is left, when false is |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
542 |
returned. |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
543 |
The mainGroup info is required to allow peeking into its |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
544 |
event queue in order for its expose/redraws to be handled." |
244 | 545 |
|
546 |
"set previousGroup to the main (non-modal) group" |
|
180 | 547 |
|
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
548 |
previousGroup := mainGroup. |
244 | 549 |
isModal := true. |
550 |
self realizeTopViews:false. |
|
551 |
self |
|
313 | 552 |
eventLoopWhile:checkBlock |
553 |
onLeave:[ |
|
554 |
" |
|
555 |
cleanup, in case of a terminate |
|
556 |
" |
|
557 |
previousGroup := nil. |
|
558 |
topViews := nil. |
|
559 |
views := nil. |
|
560 |
" |
|
561 |
the following is rubbish; |
|
562 |
the views could be reused .. |
|
563 |
" |
|
244 | 564 |
" |
313 | 565 |
topViews notNil ifTrue:[ |
566 |
topViews do:[:aView | |
|
567 |
aView destroy |
|
568 |
]. |
|
569 |
topViews := nil. |
|
570 |
]. |
|
571 |
views notNil ifTrue:[ |
|
572 |
views do:[:aView | |
|
573 |
aView destroy |
|
574 |
]. |
|
575 |
views := nil. |
|
576 |
]. |
|
244 | 577 |
" |
313 | 578 |
] |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
579 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
580 |
"Created: 10.12.1995 / 14:14:26 / cg" |
180 | 581 |
! ! |
582 |
||
90 | 583 |
!WindowGroup methodsFor:'enumerating'! |
54 | 584 |
|
585 |
allTopViewsExcept:aView do:aBlock |
|
157 | 586 |
"evaluate aBlock for all topviews except aView in this group. |
587 |
This works on a copy of the view collection, to allow for |
|
158 | 588 |
destroy and other collection changing operations to be done." |
157 | 589 |
|
590 |
topViews notNil ifTrue:[ |
|
591 |
topViews copy do:[:v | |
|
592 |
v ~~ aView ifTrue:[aBlock value:v] |
|
593 |
] |
|
594 |
]. |
|
595 |
! |
|
596 |
||
244 | 597 |
allViewsDo:aBlock |
598 |
"evaluate aBlock for all views & topviews in this group. |
|
599 |
This works on a copy of the view collection, to allow for |
|
600 |
destroy and other collection changing operations to be done." |
|
601 |
||
602 |
topViews notNil ifTrue:[topViews copy do:aBlock]. |
|
603 |
views notNil ifTrue:[views copy do:aBlock] |
|
604 |
! |
|
605 |
||
606 |
partnersDo:aBlock |
|
607 |
"evaluate aBlock for all partnerViews. |
|
608 |
This works on a copy of the view collection, to allow for |
|
609 |
destroy and other collection changing operations to be done." |
|
610 |
||
611 |
topViews notNil ifTrue:[ |
|
612 |
topViews copy do:[:v | |
|
613 |
v notNil ifTrue:[ |
|
614 |
v type == #partner ifTrue:[aBlock value:v]. |
|
615 |
] |
|
616 |
] |
|
617 |
]. |
|
618 |
! |
|
619 |
||
157 | 620 |
slavesDo:aBlock |
621 |
"evaluate aBlock for all slaveViews. |
|
622 |
This works on a copy of the view collection, to allow for |
|
158 | 623 |
destroy and other collection changing operations to be done." |
54 | 624 |
|
625 |
topViews notNil ifTrue:[ |
|
157 | 626 |
topViews copy do:[:v | |
627 |
v notNil ifTrue:[ |
|
628 |
v type == #slave ifTrue:[aBlock value:v]. |
|
629 |
] |
|
630 |
] |
|
631 |
]. |
|
11 | 632 |
! ! |
633 |
||
19 | 634 |
!WindowGroup methodsFor:'event handling'! |
11 | 635 |
|
244 | 636 |
eventLoop |
637 |
"loop executed by windowGroup process; |
|
638 |
wait-for and process events forever" |
|
639 |
||
640 |
self eventLoopWhile:[true] onLeave:[] |
|
641 |
! |
|
642 |
||
643 |
eventLoopWhile:aBlock onLeave:cleanupActions |
|
644 |
"wait-for and process events. |
|
645 |
Stay in this loop while there are still any views to dispatch for, |
|
646 |
and aBlock evaluates to true." |
|
647 |
||
648 |
|thisProcess| |
|
649 |
||
650 |
thisProcess := Processor activeProcess. |
|
651 |
||
652 |
[ |
|
653 |
"/ |
|
654 |
"/ on leave, exit the event loop |
|
655 |
"/ |
|
656 |
LeaveSignal handle:[:ex | |
|
657 |
ex return |
|
658 |
] do:[ |
|
659 |
|p g mainGroup| |
|
660 |
||
661 |
isModal ifTrue:[ |
|
662 |
mainGroup := self mainGroup. |
|
275 | 663 |
mainGroup == self ifTrue:[ |
664 |
mainGroup := nil |
|
665 |
] |
|
244 | 666 |
]. |
667 |
||
668 |
aBlock whileTrue:[ |
|
669 |
LastActiveGroup := self. |
|
670 |
LastActiveProcess := thisProcess. |
|
671 |
||
672 |
(views isNil and:[topViews isNil]) ifTrue:[ |
|
673 |
myProcess notNil ifTrue:[ |
|
674 |
p := myProcess. |
|
675 |
myProcess := nil. |
|
676 |
p terminate. |
|
313 | 677 |
"not reached - at least here, there is no life after death" |
244 | 678 |
]. |
679 |
" |
|
680 |
this is the end of a modal loop |
|
681 |
(not having a private process ...) |
|
682 |
" |
|
683 |
^ self |
|
684 |
]. |
|
685 |
||
686 |
"/ |
|
687 |
"/ on abort, stay in the event loop |
|
688 |
"/ |
|
689 |
AbortSignal handle:[:ex | |
|
690 |
ex return |
|
691 |
] do:[ |
|
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
692 |
|dev| |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
693 |
|
313 | 694 |
"/ no more events. Flush device output. This may produce more events. |
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
695 |
(dev := self device) notNil ifTrue:[dev flush]. |
313 | 696 |
|
244 | 697 |
" |
698 |
if modal, break out of the wait after some time |
|
699 |
to allow servicing update-events of the blocked |
|
700 |
windowgroup. |
|
701 |
" |
|
702 |
thisProcess setStateTo:#eventWait if:#active. |
|
275 | 703 |
mainGroup notNil ifTrue:[ |
244 | 704 |
mySensor eventSemaphore waitWithTimeout:0.2. |
705 |
] ifFalse:[ |
|
706 |
mySensor eventSemaphore wait. |
|
707 |
]. |
|
708 |
LastActiveGroup := self. |
|
709 |
LastActiveProcess := thisProcess. |
|
710 |
self processEvents. |
|
711 |
]. |
|
712 |
||
713 |
" |
|
714 |
if modal, also check for redraw events in my maingroup |
|
715 |
(we arrive here after every event for myself or after the |
|
716 |
above timeout) |
|
717 |
" |
|
718 |
mainGroup notNil ifTrue:[ |
|
719 |
mainGroup processExposeEvents. |
|
720 |
] |
|
721 |
]. |
|
722 |
]. |
|
723 |
] valueNowOrOnUnwindDo:[ |
|
724 |
cleanupActions notNil ifTrue:[cleanupActions value] |
|
725 |
] |
|
313 | 726 |
|
727 |
"Modified: 13.12.1995 / 13:07:02 / stefan" |
|
244 | 728 |
! |
729 |
||
730 |
leaveEventLoop |
|
731 |
"immediately leave the event loop, returning way back. |
|
732 |
This can be used to leave (and closedown) a modal group. |
|
733 |
(for normal views, this does not make sense)" |
|
734 |
||
735 |
^ LeaveSignal raise |
|
736 |
! |
|
737 |
||
103 | 738 |
processEvents |
739 |
"process events from either the damage- or user input queues. |
|
740 |
Abort is assumed to be handled elsewhere." |
|
19 | 741 |
|
90 | 742 |
|event ignore| |
11 | 743 |
|
72 | 744 |
self processExposeEvents. |
180 | 745 |
|
72 | 746 |
[mySensor hasEvents] whileTrue:[ |
747 |
event := mySensor nextEvent. |
|
90 | 748 |
event notNil ifTrue:[ |
112 | 749 |
(views notNil or:[topViews notNil]) ifTrue:[ |
90 | 750 |
ignore := false. |
172 | 751 |
|
752 |
(preEventHook notNil |
|
753 |
and:[preEventHook processEvent:event]) ifTrue:[ |
|
754 |
ignore := true. |
|
90 | 755 |
]. |
756 |
ignore ifFalse:[ |
|
103 | 757 |
"/ |
172 | 758 |
"/ FocusStepping is done right here |
103 | 759 |
"/ |
172 | 760 |
event isKeyPressEvent ifTrue:[ |
761 |
event key == #FocusNext ifTrue:[ |
|
762 |
self focusNext. |
|
763 |
ignore := true |
|
764 |
]. |
|
765 |
event key == #FocusPrevious ifTrue:[ |
|
766 |
self focusPrevious. |
|
767 |
ignore := true |
|
768 |
]. |
|
103 | 769 |
]. |
172 | 770 |
ignore ifFalse:[ |
771 |
"/ |
|
772 |
"/ button events turn off explicit focus, and revert |
|
773 |
"/ to implicit focus control |
|
774 |
"/ |
|
775 |
(focusView notNil |
|
776 |
and:[event isButtonEvent]) ifTrue:[ |
|
777 |
self focusView:nil |
|
778 |
]. |
|
779 |
"/ |
|
780 |
"/ let the event forward itself |
|
781 |
"/ |
|
180 | 782 |
LastActiveGroup := self. |
783 |
LastActiveProcess := Processor activeProcess. |
|
172 | 784 |
event sendEventWithFocusOn:focusView. |
785 |
] |
|
786 |
]. |
|
787 |
postEventHook notNil ifTrue:[ |
|
788 |
postEventHook processEvent:event |
|
90 | 789 |
] |
790 |
] |
|
72 | 791 |
]. |
792 |
] |
|
48 | 793 |
! |
794 |
||
795 |
processExposeEvents |
|
103 | 796 |
"process only expose events from the damage queue" |
48 | 797 |
|
180 | 798 |
|event view rect x y w h sensor thisProcess| |
109 | 799 |
|
800 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
|
48 | 801 |
|
180 | 802 |
thisProcess := Processor activeProcess. |
803 |
||
804 |
[sensor hasDamage] whileTrue:[ |
|
805 |
LastActiveGroup := self. |
|
806 |
LastActiveProcess := thisProcess. |
|
807 |
||
808 |
event := sensor nextDamage. |
|
809 |
event notNil ifTrue:[ |
|
810 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
811 |
(preEventHook notNil |
|
812 |
and:[preEventHook processEvent:event]) ifFalse:[ |
|
813 |
event isDamage ifTrue:[ |
|
814 |
view := event view. |
|
815 |
"/ |
|
816 |
"/ if the view is no longer shown (iconified or closed), |
|
817 |
"/ this is a leftover event and ignored. |
|
818 |
"/ |
|
819 |
view shown ifTrue:[ |
|
820 |
rect := event rectangle. |
|
821 |
x := rect left. |
|
822 |
y := rect top. |
|
823 |
w := rect width. |
|
824 |
h := rect height. |
|
825 |
LastActiveGroup := self. |
|
826 |
LastActiveProcess := thisProcess. |
|
827 |
view transformation notNil ifTrue:[ |
|
828 |
view deviceExposeX:x y:y width:w height:h |
|
829 |
] ifFalse:[ |
|
830 |
view exposeX:x y:y width:w height:h |
|
172 | 831 |
] |
81 | 832 |
] |
180 | 833 |
] ifFalse:[ |
834 |
" |
|
835 |
mhmh - could we possibly arrive here ? |
|
836 |
" |
|
837 |
LastActiveGroup := self. |
|
838 |
LastActiveProcess := thisProcess. |
|
839 |
event sendEvent. |
|
78 | 840 |
] |
180 | 841 |
]. |
842 |
postEventHook notNil ifTrue:[ |
|
843 |
postEventHook processEvent:event |
|
72 | 844 |
] |
845 |
] |
|
846 |
] |
|
90 | 847 |
] |
11 | 848 |
! |
849 |
||
28 | 850 |
waitForExposeFor:aView |
851 |
"wait for a noExpose on aView, then process all exposes. |
|
852 |
To be used after a scroll" |
|
853 |
||
854 |
mySensor waitForExposeFor:aView. |
|
90 | 855 |
AbortSignal catch:[ |
856 |
self processExposeEvents |
|
857 |
] |
|
11 | 858 |
! ! |
19 | 859 |
|
90 | 860 |
!WindowGroup methodsFor:'focus control'! |
861 |
||
244 | 862 |
focusNext |
863 |
"give focus to next view in focusSequence" |
|
864 |
||
865 |
|index| |
|
866 |
||
867 |
focusSequence size == 0 ifTrue:[^ self]. |
|
868 |
focusView notNil ifTrue:[ |
|
869 |
index := (focusSequence indexOf:focusView) + 1. |
|
870 |
index > focusSequence size ifTrue:[index := 1]. |
|
871 |
] ifFalse:[ |
|
872 |
index := 1. |
|
873 |
]. |
|
874 |
self focusView:(focusSequence at:index) |
|
875 |
||
876 |
" |
|
877 |
|top v1 v2| |
|
878 |
||
879 |
top := StandardSystemView new. |
|
880 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
881 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
882 |
top open. |
|
883 |
top windowGroup focusSequence:(Array with:v1 with:v2). |
|
884 |
top windowGroup focusOn:v1. |
|
885 |
(Delay forSeconds:10) wait. |
|
886 |
top windowGroup focusNext. |
|
887 |
" |
|
888 |
! |
|
889 |
||
890 |
focusPrevious |
|
891 |
"give focus to previous view in focusSequence" |
|
892 |
||
893 |
|index| |
|
894 |
||
895 |
focusSequence size == 0 ifTrue:[^ self]. |
|
896 |
focusView notNil ifTrue:[ |
|
897 |
index := (focusSequence indexOf:focusView) - 1. |
|
898 |
index < 1 ifTrue:[index := focusSequence size]. |
|
899 |
] ifFalse:[ |
|
900 |
index := focusSequence size. |
|
901 |
]. |
|
902 |
self focusView:(focusSequence at:index) |
|
903 |
! |
|
904 |
||
135 | 905 |
focusSequence |
906 |
"return the focus sequence for focusNext/focusPrevious. |
|
907 |
Focus is stepped in the order in which subviews occur in |
|
908 |
the sequence" |
|
909 |
||
910 |
^ focusSequence |
|
911 |
! |
|
912 |
||
90 | 913 |
focusSequence:aSequenceableCollection |
914 |
"define the focus sequence for focusNext/focusPrevious. |
|
915 |
Focus is stepped in the order in which subviews occur in |
|
916 |
the sequence" |
|
917 |
||
918 |
focusSequence := aSequenceableCollection |
|
919 |
! |
|
920 |
||
921 |
focusView |
|
135 | 922 |
"return the view which currently has the focus" |
90 | 923 |
|
924 |
^ focusView |
|
925 |
! |
|
926 |
||
927 |
focusView:aViewOrNil |
|
928 |
"give focus to aViewOrNil" |
|
929 |
||
930 |
focusView notNil ifTrue:[ |
|
931 |
focusView focusOut. |
|
932 |
]. |
|
933 |
focusView := aViewOrNil. |
|
934 |
focusView notNil ifTrue:[ |
|
935 |
focusView focusIn |
|
936 |
]. |
|
937 |
||
938 |
" |
|
939 |
|top v1 v2| |
|
940 |
||
941 |
top := StandardSystemView new. |
|
942 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
943 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
944 |
top open. |
|
945 |
top windowGroup focusView:v1. |
|
946 |
" |
|
244 | 947 |
! ! |
948 |
||
949 |
!WindowGroup methodsFor:'initialization'! |
|
950 |
||
951 |
initialize |
|
952 |
"setup the windowgroup, by creating a new sensor |
|
953 |
and an event semaphore" |
|
954 |
||
955 |
mySensor := WindowSensor new. |
|
956 |
mySensor eventSemaphore:Semaphore new. |
|
957 |
isModal := false. |
|
90 | 958 |
! |
959 |
||
244 | 960 |
reinitialize |
961 |
"reinitialize the windowgroup after an image restart" |
|
90 | 962 |
|
244 | 963 |
"throw away old (zombie) process" |
964 |
myProcess notNil ifTrue:[ |
|
965 |
"careful: the old processes exitaction must be cleared |
|
966 |
otherwise, it might do destroy or other actions when it |
|
967 |
gets finalized ... |
|
968 |
" |
|
969 |
myProcess exitAction:nil. |
|
313 | 970 |
myProcess suspendAction:nil. |
244 | 971 |
myProcess := nil. |
972 |
]. |
|
90 | 973 |
|
244 | 974 |
"throw away old events" |
975 |
mySensor reinitialize |
|
313 | 976 |
|
977 |
"Modified: 13.12.1995 / 13:45:35 / stefan" |
|
90 | 978 |
! ! |
979 |
||
19 | 980 |
!WindowGroup methodsFor:'printing'! |
981 |
||
90 | 982 |
printOn:aStream |
19 | 983 |
"return a printed representation; |
144 | 984 |
just for more user friendlyness: add name of process." |
19 | 985 |
|
90 | 986 |
myProcess isNil ifTrue:[ |
987 |
(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[ |
|
988 |
aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')'). |
|
989 |
^ self. |
|
990 |
]. |
|
991 |
^ super printOn:aStream |
|
992 |
]. |
|
993 |
aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')') |
|
19 | 994 |
! ! |
244 | 995 |
|
996 |
!WindowGroup methodsFor:'special'! |
|
997 |
||
998 |
restoreCursors |
|
999 |
"restore the original cursors in all of my views" |
|
1000 |
||
1001 |
|c| |
|
1002 |
||
1003 |
self allViewsDo:[:aView | |
|
1004 |
c := aView cursor on:(aView device). |
|
1005 |
aView device setCursor:(c id) in:(aView id). |
|
1006 |
]. |
|
1007 |
! |
|
1008 |
||
1009 |
showCursor:aCursor |
|
1010 |
"change the cursor to aCursor in all of my views." |
|
1011 |
||
1012 |
|c| |
|
1013 |
||
1014 |
c := aCursor. |
|
1015 |
self allViewsDo:[:aView | |
|
1016 |
c := c on:(aView device). |
|
1017 |
aView device setCursor:c id in:aView id. |
|
1018 |
]. |
|
1019 |
! |
|
1020 |
||
1021 |
withCursor:aCursor do:aBlock |
|
1022 |
"evaluate aBlock while showing aCursor in all |
|
1023 |
my views (used to show wait-cursor while doing something). |
|
1024 |
Return the result as returned by aBlock." |
|
1025 |
||
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1026 |
|oldCursors dev| |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1027 |
|
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1028 |
dev := self device. |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1029 |
dev isNil ifTrue:[ |
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1030 |
^ aBlock value |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1031 |
]. |
244 | 1032 |
|
1033 |
" |
|
1034 |
get mapping of view->cursor for all of my subviews |
|
1035 |
" |
|
1036 |
oldCursors := IdentityDictionary new. |
|
1037 |
self allViewsDo:[:aView | |
|
318 | 1038 |
oldCursors at:aView put:(aView cursor). |
1039 |
aView cursor:aCursor now:false |
|
244 | 1040 |
]. |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1041 |
dev flush. "/sync. |
244 | 1042 |
|
1043 |
^ aBlock valueNowOrOnUnwindDo:[ |
|
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1044 |
" |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1045 |
restore cursors from the mapping |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1046 |
" |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1047 |
oldCursors keysAndValuesDo:[:view :cursor | |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1048 |
view cursor:cursor now:false. |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1049 |
]. |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1050 |
dev flush "/ sync. |
244 | 1051 |
] |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1052 |
|
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1053 |
"Modified: 14.12.1995 / 21:39:39 / cg" |
244 | 1054 |
! ! |
1055 |
||
1056 |
!WindowGroup methodsFor:'special accessing'! |
|
1057 |
||
1058 |
setModal:aBoolean |
|
1059 |
"special entry for debugger: set the modal flag. |
|
1060 |
Not for public use" |
|
1061 |
||
1062 |
isModal := aBoolean |
|
1063 |
||
1064 |
"Modified: 3.9.1995 / 14:51:04 / claus" |
|
1065 |
! |
|
1066 |
||
1067 |
setPreviousGroup:aGroup |
|
1068 |
"special entry for debugger: |
|
1069 |
set the windowgroup that started this group (for modal groups only). |
|
1070 |
This is not a public interface." |
|
1071 |
||
1072 |
previousGroup := aGroup |
|
1073 |
||
1074 |
"Modified: 3.9.1995 / 14:55:40 / claus" |
|
1075 |
! |
|
1076 |
||
1077 |
setProcess:aProcess |
|
1078 |
"special entry for debugger: set the windowGroups process. |
|
1079 |
Not for public use." |
|
1080 |
||
1081 |
myProcess := aProcess |
|
1082 |
||
1083 |
"Modified: 3.9.1995 / 14:25:38 / claus" |
|
1084 |
! ! |
|
1085 |
||
251 | 1086 |
!WindowGroup class methodsFor:'documentation'! |
1087 |
||
1088 |
version |
|
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1089 |
^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.48 1995-12-15 20:37:23 cg Exp $' |
251 | 1090 |
! ! |
244 | 1091 |
WindowGroup initialize! |