author | Claus Gittinger <cg@exept.de> |
Sat, 16 Dec 1995 01:58:14 +0100 | |
changeset 324 | aad84e8ca802 |
parent 323 | 619085d52522 |
child 325 | b24d9a1c74dc |
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 |
(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
|
302 |
^ views first device |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
303 |
]. |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
304 |
^ nil |
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 |
"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
|
307 |
"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
|
308 |
! |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
309 |
|
244 | 310 |
isModal |
311 |
"return true, if I am in a modal mode" |
|
312 |
||
313 |
^ isModal |
|
314 |
! |
|
315 |
||
316 |
mainGroup |
|
317 |
"return the main windowgroup |
|
318 |
(that is the top one, which is not modal). |
|
319 |
There is one exception to this: the debugger (which is sort of modal) |
|
320 |
returns itself as mainGroup (not its debuggee)." |
|
321 |
||
322 |
|g prev| |
|
323 |
||
324 |
g := self. |
|
325 |
[g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[ |
|
326 |
g := prev |
|
327 |
]. |
|
328 |
^ g |
|
329 |
||
330 |
"Modified: 3.9.1995 / 14:57:20 / claus" |
|
331 |
! |
|
54 | 332 |
|
244 | 333 |
postEventHook:anObject |
334 |
"set the postEventHook - this one will get all events |
|
335 |
passed after being processed here (via #processEvent:)." |
|
336 |
||
337 |
postEventHook := anObject |
|
338 |
! |
|
339 |
||
340 |
preEventHook:anObject |
|
341 |
"set the preEventHook - this one will get all events |
|
342 |
passed before being processed here (via #processEvent:). |
|
343 |
If this returns true, the event is supposed to be already |
|
344 |
processed and ignored here. |
|
345 |
Otherwise, it is processed as usual." |
|
346 |
||
347 |
preEventHook := anObject |
|
348 |
! |
|
349 |
||
350 |
previousGroup |
|
351 |
"return the windowgroup that started this group. |
|
352 |
(for modal groups only)" |
|
353 |
||
354 |
^ previousGroup |
|
355 |
! |
|
356 |
||
357 |
process |
|
358 |
"return the windowGroups process" |
|
359 |
||
360 |
^ myProcess |
|
54 | 361 |
! |
362 |
||
26 | 363 |
removeView:aView |
364 |
"remove aView from the windowGroup; |
|
365 |
if this was the last view in this group, |
|
81 | 366 |
also shut down the corresponding process |
367 |
(actually, only wake it up here - it will terminate itself |
|
368 |
when finding out that all views are gone)" |
|
11 | 369 |
|
263 | 370 |
|sema| |
371 |
||
11 | 372 |
views notNil ifTrue:[ |
72 | 373 |
views remove:aView ifAbsent:[]. |
374 |
views isEmpty ifTrue:[ |
|
375 |
views := nil |
|
376 |
] |
|
11 | 377 |
]. |
378 |
topViews notNil ifTrue:[ |
|
72 | 379 |
topViews remove:aView ifAbsent:[]. |
380 |
topViews isEmpty ifTrue:[ |
|
381 |
topViews := nil |
|
382 |
] |
|
11 | 383 |
]. |
54 | 384 |
" |
385 |
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
|
386 |
removed (modalBoxes terminate their modalLoop if so) |
54 | 387 |
" |
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
388 |
mySensor notNil ifTrue:[ |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
389 |
(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
|
390 |
sema signal |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
391 |
] |
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
392 |
] |
11 | 393 |
! |
394 |
||
244 | 395 |
sensor |
396 |
"return the windowGroups sensor" |
|
103 | 397 |
|
244 | 398 |
^ mySensor |
54 | 399 |
! |
400 |
||
11 | 401 |
sensor:aSensor |
26 | 402 |
"set the windowGroups sensor" |
403 |
||
11 | 404 |
mySensor := aSensor |
172 | 405 |
! |
406 |
||
244 | 407 |
topViews |
408 |
"return the topviews accociated to this windowGroup" |
|
172 | 409 |
|
244 | 410 |
^ topViews |
172 | 411 |
! |
412 |
||
244 | 413 |
views |
414 |
"return the views accociated to this windowGroup" |
|
172 | 415 |
|
244 | 416 |
^ views |
54 | 417 |
! ! |
418 |
||
244 | 419 |
!WindowGroup methodsFor:'activation / deactivation'! |
420 |
||
421 |
closeDownViews |
|
422 |
"destroy all views associated to this window group" |
|
423 |
||
424 |
topViews notNil ifTrue:[ |
|
425 |
topViews do:[:aTopView | aTopView destroy] |
|
426 |
]. |
|
427 |
views := nil. |
|
428 |
topViews := nil. |
|
429 |
mySensor := nil. |
|
430 |
! |
|
431 |
||
432 |
realizeTopViews:isRestart |
|
433 |
"realize all topViews associated to this windowGroup. |
|
434 |
If this is a restart, tell topViews about it." |
|
435 |
||
436 |
topViews notNil ifTrue:[ |
|
437 |
topViews do:[:aView | |
|
438 |
aView realize. |
|
439 |
isRestart ifTrue:[ |
|
440 |
aView restarted |
|
441 |
] |
|
442 |
]. |
|
443 |
]. |
|
444 |
! |
|
180 | 445 |
|
244 | 446 |
restart |
447 |
"restart after a snapin." |
|
180 | 448 |
|
244 | 449 |
topViews notNil ifTrue:[ |
450 |
" |
|
451 |
need a new semaphore, since obsolete processes |
|
452 |
(from our previous live) may still sit on the current semaphore |
|
453 |
" |
|
454 |
mySensor eventSemaphore:Semaphore new. |
|
455 |
isModal ifFalse:[ |
|
456 |
self startup:true |
|
457 |
] |
|
458 |
] |
|
459 |
! |
|
180 | 460 |
|
244 | 461 |
shutdown |
462 |
"shutdow the window group; close all views and |
|
463 |
terminate process" |
|
464 |
||
465 |
|p| |
|
466 |
||
467 |
self closeDownViews. |
|
468 |
myProcess notNil ifTrue:[ |
|
469 |
p := myProcess. |
|
470 |
myProcess := nil. |
|
471 |
p terminate. |
|
472 |
] |
|
180 | 473 |
! |
474 |
||
244 | 475 |
startup:isRestart |
476 |
"startup the window-group; |
|
477 |
this creates a new window group process, which |
|
478 |
does the event processing." |
|
479 |
||
480 |
|top nm dev devNm| |
|
481 |
||
482 |
previousGroup := nil. |
|
483 |
myProcess isNil ifTrue:[ |
|
484 |
isModal := false. |
|
485 |
myProcess := [ |
|
486 |
self realizeTopViews:isRestart. |
|
487 |
self eventLoopWhile:[true] onLeave:[] |
|
488 |
] forkAt:Processor userSchedulingPriority. |
|
180 | 489 |
|
244 | 490 |
(topViews notNil and:[topViews isEmpty not]) ifTrue:[ |
491 |
" |
|
492 |
give the handler process a user friendly name |
|
493 |
" |
|
494 |
top := topViews first. |
|
495 |
nm := top processName. |
|
496 |
(dev := top device) notNil ifTrue:[ |
|
497 |
devNm := dev displayName. |
|
498 |
(devNm notNil and:[devNm ~= Display displayName]) ifTrue:[ |
|
499 |
nm := nm , ' (' , devNm , ')' |
|
500 |
] |
|
501 |
] |
|
502 |
] ifFalse:[ |
|
503 |
nm := 'window handler'. |
|
504 |
]. |
|
505 |
myProcess name:nm. |
|
180 | 506 |
|
313 | 507 |
" |
508 |
when the process gets suspended, there maybe still buffered draw requests. |
|
509 |
Flush them. |
|
510 |
" |
|
511 |
myProcess suspendAction:[ |
|
512 |
|dev| |
|
318 | 513 |
dev := self device. |
313 | 514 |
dev notNil ifTrue:[dev flush]. |
515 |
]. |
|
516 |
||
244 | 517 |
"when the process dies, we have to close-down |
518 |
the views as well |
|
519 |
" |
|
520 |
myProcess exitAction:[self closeDownViews] |
|
521 |
] |
|
313 | 522 |
|
523 |
"Modified: 13.12.1995 / 14:04:53 / stefan" |
|
180 | 524 |
! |
525 |
||
244 | 526 |
startupModal:checkBlock |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
527 |
"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
|
528 |
(i.e. under the currently running process); |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
529 |
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
|
530 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
531 |
^ self startupModal:checkBlock forGroup:WindowGroup activeGroup. |
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 |
"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
|
534 |
! |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
535 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
536 |
startupModal:checkBlock forGroup:mainGroup |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
537 |
"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
|
538 |
(i.e. under the currently running process); |
244 | 539 |
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
|
540 |
returned. |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
541 |
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
|
542 |
event queue in order for its expose/redraws to be handled." |
244 | 543 |
|
544 |
"set previousGroup to the main (non-modal) group" |
|
180 | 545 |
|
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
546 |
previousGroup := mainGroup. |
244 | 547 |
isModal := true. |
548 |
self realizeTopViews:false. |
|
549 |
self |
|
313 | 550 |
eventLoopWhile:checkBlock |
551 |
onLeave:[ |
|
552 |
" |
|
553 |
cleanup, in case of a terminate |
|
554 |
" |
|
555 |
previousGroup := nil. |
|
556 |
topViews := nil. |
|
557 |
views := nil. |
|
558 |
" |
|
559 |
the following is rubbish; |
|
560 |
the views could be reused .. |
|
561 |
" |
|
244 | 562 |
" |
313 | 563 |
topViews notNil ifTrue:[ |
564 |
topViews do:[:aView | |
|
565 |
aView destroy |
|
566 |
]. |
|
567 |
topViews := nil. |
|
568 |
]. |
|
569 |
views notNil ifTrue:[ |
|
570 |
views do:[:aView | |
|
571 |
aView destroy |
|
572 |
]. |
|
573 |
views := nil. |
|
574 |
]. |
|
244 | 575 |
" |
313 | 576 |
] |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
577 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
578 |
"Created: 10.12.1995 / 14:14:26 / cg" |
180 | 579 |
! ! |
580 |
||
90 | 581 |
!WindowGroup methodsFor:'enumerating'! |
54 | 582 |
|
583 |
allTopViewsExcept:aView do:aBlock |
|
157 | 584 |
"evaluate aBlock for all topviews except aView in this group. |
585 |
This works on a copy of the view collection, to allow for |
|
158 | 586 |
destroy and other collection changing operations to be done." |
157 | 587 |
|
588 |
topViews notNil ifTrue:[ |
|
589 |
topViews copy do:[:v | |
|
590 |
v ~~ aView ifTrue:[aBlock value:v] |
|
591 |
] |
|
592 |
]. |
|
593 |
! |
|
594 |
||
244 | 595 |
allViewsDo:aBlock |
596 |
"evaluate aBlock for all views & topviews in this group. |
|
597 |
This works on a copy of the view collection, to allow for |
|
598 |
destroy and other collection changing operations to be done." |
|
599 |
||
600 |
topViews notNil ifTrue:[topViews copy do:aBlock]. |
|
601 |
views notNil ifTrue:[views copy do:aBlock] |
|
602 |
! |
|
603 |
||
604 |
partnersDo:aBlock |
|
605 |
"evaluate aBlock for all partnerViews. |
|
606 |
This works on a copy of the view collection, to allow for |
|
607 |
destroy and other collection changing operations to be done." |
|
608 |
||
609 |
topViews notNil ifTrue:[ |
|
610 |
topViews copy do:[:v | |
|
611 |
v notNil ifTrue:[ |
|
612 |
v type == #partner ifTrue:[aBlock value:v]. |
|
613 |
] |
|
614 |
] |
|
615 |
]. |
|
616 |
! |
|
617 |
||
157 | 618 |
slavesDo:aBlock |
619 |
"evaluate aBlock for all slaveViews. |
|
620 |
This works on a copy of the view collection, to allow for |
|
158 | 621 |
destroy and other collection changing operations to be done." |
54 | 622 |
|
623 |
topViews notNil ifTrue:[ |
|
157 | 624 |
topViews copy do:[:v | |
625 |
v notNil ifTrue:[ |
|
626 |
v type == #slave ifTrue:[aBlock value:v]. |
|
627 |
] |
|
628 |
] |
|
629 |
]. |
|
11 | 630 |
! ! |
631 |
||
19 | 632 |
!WindowGroup methodsFor:'event handling'! |
11 | 633 |
|
244 | 634 |
eventLoop |
635 |
"loop executed by windowGroup process; |
|
636 |
wait-for and process events forever" |
|
637 |
||
638 |
self eventLoopWhile:[true] onLeave:[] |
|
639 |
! |
|
640 |
||
641 |
eventLoopWhile:aBlock onLeave:cleanupActions |
|
642 |
"wait-for and process events. |
|
643 |
Stay in this loop while there are still any views to dispatch for, |
|
644 |
and aBlock evaluates to true." |
|
645 |
||
646 |
|thisProcess| |
|
647 |
||
648 |
thisProcess := Processor activeProcess. |
|
649 |
||
650 |
[ |
|
651 |
"/ |
|
652 |
"/ on leave, exit the event loop |
|
653 |
"/ |
|
654 |
LeaveSignal handle:[:ex | |
|
655 |
ex return |
|
656 |
] do:[ |
|
657 |
|p g mainGroup| |
|
658 |
||
659 |
isModal ifTrue:[ |
|
660 |
mainGroup := self mainGroup. |
|
275 | 661 |
mainGroup == self ifTrue:[ |
662 |
mainGroup := nil |
|
663 |
] |
|
244 | 664 |
]. |
665 |
||
666 |
aBlock whileTrue:[ |
|
667 |
LastActiveGroup := self. |
|
668 |
LastActiveProcess := thisProcess. |
|
669 |
||
670 |
(views isNil and:[topViews isNil]) ifTrue:[ |
|
671 |
myProcess notNil ifTrue:[ |
|
672 |
p := myProcess. |
|
673 |
myProcess := nil. |
|
674 |
p terminate. |
|
313 | 675 |
"not reached - at least here, there is no life after death" |
244 | 676 |
]. |
677 |
" |
|
678 |
this is the end of a modal loop |
|
679 |
(not having a private process ...) |
|
680 |
" |
|
681 |
^ self |
|
682 |
]. |
|
683 |
||
684 |
"/ |
|
685 |
"/ on abort, stay in the event loop |
|
686 |
"/ |
|
687 |
AbortSignal handle:[:ex | |
|
688 |
ex return |
|
689 |
] do:[ |
|
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
690 |
|dev| |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
691 |
|
313 | 692 |
"/ 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
|
693 |
(dev := self device) notNil ifTrue:[dev flush]. |
313 | 694 |
|
244 | 695 |
" |
696 |
if modal, break out of the wait after some time |
|
697 |
to allow servicing update-events of the blocked |
|
698 |
windowgroup. |
|
699 |
" |
|
700 |
thisProcess setStateTo:#eventWait if:#active. |
|
275 | 701 |
mainGroup notNil ifTrue:[ |
244 | 702 |
mySensor eventSemaphore waitWithTimeout:0.2. |
703 |
] ifFalse:[ |
|
704 |
mySensor eventSemaphore wait. |
|
705 |
]. |
|
706 |
LastActiveGroup := self. |
|
707 |
LastActiveProcess := thisProcess. |
|
708 |
self processEvents. |
|
709 |
]. |
|
710 |
||
711 |
" |
|
712 |
if modal, also check for redraw events in my maingroup |
|
713 |
(we arrive here after every event for myself or after the |
|
714 |
above timeout) |
|
715 |
" |
|
716 |
mainGroup notNil ifTrue:[ |
|
717 |
mainGroup processExposeEvents. |
|
718 |
] |
|
719 |
]. |
|
720 |
]. |
|
721 |
] valueNowOrOnUnwindDo:[ |
|
722 |
cleanupActions notNil ifTrue:[cleanupActions value] |
|
723 |
] |
|
313 | 724 |
|
725 |
"Modified: 13.12.1995 / 13:07:02 / stefan" |
|
244 | 726 |
! |
727 |
||
728 |
leaveEventLoop |
|
729 |
"immediately leave the event loop, returning way back. |
|
730 |
This can be used to leave (and closedown) a modal group. |
|
731 |
(for normal views, this does not make sense)" |
|
732 |
||
733 |
^ LeaveSignal raise |
|
734 |
! |
|
735 |
||
103 | 736 |
processEvents |
737 |
"process events from either the damage- or user input queues. |
|
738 |
Abort is assumed to be handled elsewhere." |
|
19 | 739 |
|
90 | 740 |
|event ignore| |
11 | 741 |
|
72 | 742 |
self processExposeEvents. |
180 | 743 |
|
72 | 744 |
[mySensor hasEvents] whileTrue:[ |
745 |
event := mySensor nextEvent. |
|
90 | 746 |
event notNil ifTrue:[ |
112 | 747 |
(views notNil or:[topViews notNil]) ifTrue:[ |
90 | 748 |
ignore := false. |
172 | 749 |
|
750 |
(preEventHook notNil |
|
751 |
and:[preEventHook processEvent:event]) ifTrue:[ |
|
752 |
ignore := true. |
|
90 | 753 |
]. |
754 |
ignore ifFalse:[ |
|
103 | 755 |
"/ |
172 | 756 |
"/ FocusStepping is done right here |
103 | 757 |
"/ |
172 | 758 |
event isKeyPressEvent ifTrue:[ |
759 |
event key == #FocusNext ifTrue:[ |
|
760 |
self focusNext. |
|
761 |
ignore := true |
|
762 |
]. |
|
763 |
event key == #FocusPrevious ifTrue:[ |
|
764 |
self focusPrevious. |
|
765 |
ignore := true |
|
766 |
]. |
|
103 | 767 |
]. |
172 | 768 |
ignore ifFalse:[ |
769 |
"/ |
|
770 |
"/ button events turn off explicit focus, and revert |
|
771 |
"/ to implicit focus control |
|
772 |
"/ |
|
773 |
(focusView notNil |
|
774 |
and:[event isButtonEvent]) ifTrue:[ |
|
775 |
self focusView:nil |
|
776 |
]. |
|
777 |
"/ |
|
778 |
"/ let the event forward itself |
|
779 |
"/ |
|
180 | 780 |
LastActiveGroup := self. |
781 |
LastActiveProcess := Processor activeProcess. |
|
172 | 782 |
event sendEventWithFocusOn:focusView. |
783 |
] |
|
784 |
]. |
|
785 |
postEventHook notNil ifTrue:[ |
|
786 |
postEventHook processEvent:event |
|
90 | 787 |
] |
788 |
] |
|
72 | 789 |
]. |
790 |
] |
|
48 | 791 |
! |
792 |
||
793 |
processExposeEvents |
|
103 | 794 |
"process only expose events from the damage queue" |
48 | 795 |
|
180 | 796 |
|event view rect x y w h sensor thisProcess| |
109 | 797 |
|
798 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
|
48 | 799 |
|
180 | 800 |
thisProcess := Processor activeProcess. |
801 |
||
802 |
[sensor hasDamage] whileTrue:[ |
|
803 |
LastActiveGroup := self. |
|
804 |
LastActiveProcess := thisProcess. |
|
805 |
||
806 |
event := sensor nextDamage. |
|
807 |
event notNil ifTrue:[ |
|
808 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
809 |
(preEventHook notNil |
|
810 |
and:[preEventHook processEvent:event]) ifFalse:[ |
|
811 |
event isDamage ifTrue:[ |
|
812 |
view := event view. |
|
813 |
"/ |
|
814 |
"/ if the view is no longer shown (iconified or closed), |
|
815 |
"/ this is a leftover event and ignored. |
|
816 |
"/ |
|
817 |
view shown ifTrue:[ |
|
818 |
rect := event rectangle. |
|
819 |
x := rect left. |
|
820 |
y := rect top. |
|
821 |
w := rect width. |
|
822 |
h := rect height. |
|
823 |
LastActiveGroup := self. |
|
824 |
LastActiveProcess := thisProcess. |
|
825 |
view transformation notNil ifTrue:[ |
|
826 |
view deviceExposeX:x y:y width:w height:h |
|
827 |
] ifFalse:[ |
|
828 |
view exposeX:x y:y width:w height:h |
|
172 | 829 |
] |
81 | 830 |
] |
180 | 831 |
] ifFalse:[ |
832 |
" |
|
833 |
mhmh - could we possibly arrive here ? |
|
834 |
" |
|
835 |
LastActiveGroup := self. |
|
836 |
LastActiveProcess := thisProcess. |
|
837 |
event sendEvent. |
|
78 | 838 |
] |
180 | 839 |
]. |
840 |
postEventHook notNil ifTrue:[ |
|
841 |
postEventHook processEvent:event |
|
72 | 842 |
] |
843 |
] |
|
844 |
] |
|
90 | 845 |
] |
11 | 846 |
! |
847 |
||
28 | 848 |
waitForExposeFor:aView |
849 |
"wait for a noExpose on aView, then process all exposes. |
|
850 |
To be used after a scroll" |
|
851 |
||
852 |
mySensor waitForExposeFor:aView. |
|
90 | 853 |
AbortSignal catch:[ |
854 |
self processExposeEvents |
|
855 |
] |
|
11 | 856 |
! ! |
19 | 857 |
|
90 | 858 |
!WindowGroup methodsFor:'focus control'! |
859 |
||
244 | 860 |
focusNext |
861 |
"give focus to next view in focusSequence" |
|
862 |
||
863 |
|index| |
|
864 |
||
865 |
focusSequence size == 0 ifTrue:[^ self]. |
|
866 |
focusView notNil ifTrue:[ |
|
867 |
index := (focusSequence indexOf:focusView) + 1. |
|
868 |
index > focusSequence size ifTrue:[index := 1]. |
|
869 |
] ifFalse:[ |
|
870 |
index := 1. |
|
871 |
]. |
|
872 |
self focusView:(focusSequence at:index) |
|
873 |
||
874 |
" |
|
875 |
|top v1 v2| |
|
876 |
||
877 |
top := StandardSystemView new. |
|
878 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
879 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
880 |
top open. |
|
881 |
top windowGroup focusSequence:(Array with:v1 with:v2). |
|
882 |
top windowGroup focusOn:v1. |
|
883 |
(Delay forSeconds:10) wait. |
|
884 |
top windowGroup focusNext. |
|
885 |
" |
|
886 |
! |
|
887 |
||
888 |
focusPrevious |
|
889 |
"give focus to previous view in focusSequence" |
|
890 |
||
891 |
|index| |
|
892 |
||
893 |
focusSequence size == 0 ifTrue:[^ self]. |
|
894 |
focusView notNil ifTrue:[ |
|
895 |
index := (focusSequence indexOf:focusView) - 1. |
|
896 |
index < 1 ifTrue:[index := focusSequence size]. |
|
897 |
] ifFalse:[ |
|
898 |
index := focusSequence size. |
|
899 |
]. |
|
900 |
self focusView:(focusSequence at:index) |
|
901 |
! |
|
902 |
||
135 | 903 |
focusSequence |
904 |
"return the focus sequence for focusNext/focusPrevious. |
|
905 |
Focus is stepped in the order in which subviews occur in |
|
906 |
the sequence" |
|
907 |
||
908 |
^ focusSequence |
|
909 |
! |
|
910 |
||
90 | 911 |
focusSequence:aSequenceableCollection |
912 |
"define the focus sequence for focusNext/focusPrevious. |
|
913 |
Focus is stepped in the order in which subviews occur in |
|
914 |
the sequence" |
|
915 |
||
916 |
focusSequence := aSequenceableCollection |
|
917 |
! |
|
918 |
||
919 |
focusView |
|
135 | 920 |
"return the view which currently has the focus" |
90 | 921 |
|
922 |
^ focusView |
|
923 |
! |
|
924 |
||
925 |
focusView:aViewOrNil |
|
926 |
"give focus to aViewOrNil" |
|
927 |
||
928 |
focusView notNil ifTrue:[ |
|
929 |
focusView focusOut. |
|
930 |
]. |
|
931 |
focusView := aViewOrNil. |
|
932 |
focusView notNil ifTrue:[ |
|
933 |
focusView focusIn |
|
934 |
]. |
|
935 |
||
936 |
" |
|
937 |
|top v1 v2| |
|
938 |
||
939 |
top := StandardSystemView new. |
|
940 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
941 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
942 |
top open. |
|
943 |
top windowGroup focusView:v1. |
|
944 |
" |
|
244 | 945 |
! ! |
946 |
||
947 |
!WindowGroup methodsFor:'initialization'! |
|
948 |
||
949 |
initialize |
|
950 |
"setup the windowgroup, by creating a new sensor |
|
951 |
and an event semaphore" |
|
952 |
||
953 |
mySensor := WindowSensor new. |
|
954 |
mySensor eventSemaphore:Semaphore new. |
|
955 |
isModal := false. |
|
90 | 956 |
! |
957 |
||
244 | 958 |
reinitialize |
959 |
"reinitialize the windowgroup after an image restart" |
|
90 | 960 |
|
244 | 961 |
"throw away old (zombie) process" |
962 |
myProcess notNil ifTrue:[ |
|
963 |
"careful: the old processes exitaction must be cleared |
|
964 |
otherwise, it might do destroy or other actions when it |
|
965 |
gets finalized ... |
|
966 |
" |
|
967 |
myProcess exitAction:nil. |
|
313 | 968 |
myProcess suspendAction:nil. |
244 | 969 |
myProcess := nil. |
970 |
]. |
|
90 | 971 |
|
244 | 972 |
"throw away old events" |
973 |
mySensor reinitialize |
|
313 | 974 |
|
975 |
"Modified: 13.12.1995 / 13:45:35 / stefan" |
|
90 | 976 |
! ! |
977 |
||
19 | 978 |
!WindowGroup methodsFor:'printing'! |
979 |
||
90 | 980 |
printOn:aStream |
19 | 981 |
"return a printed representation; |
144 | 982 |
just for more user friendlyness: add name of process." |
19 | 983 |
|
90 | 984 |
myProcess isNil ifTrue:[ |
985 |
(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[ |
|
986 |
aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')'). |
|
987 |
^ self. |
|
988 |
]. |
|
989 |
^ super printOn:aStream |
|
990 |
]. |
|
991 |
aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')') |
|
19 | 992 |
! ! |
244 | 993 |
|
994 |
!WindowGroup methodsFor:'special'! |
|
995 |
||
996 |
restoreCursors |
|
997 |
"restore the original cursors in all of my views" |
|
998 |
||
999 |
|c| |
|
1000 |
||
1001 |
self allViewsDo:[:aView | |
|
1002 |
c := aView cursor on:(aView device). |
|
1003 |
aView device setCursor:(c id) in:(aView id). |
|
1004 |
]. |
|
1005 |
! |
|
1006 |
||
1007 |
showCursor:aCursor |
|
1008 |
"change the cursor to aCursor in all of my views." |
|
1009 |
||
1010 |
|c| |
|
1011 |
||
1012 |
c := aCursor. |
|
1013 |
self allViewsDo:[:aView | |
|
1014 |
c := c on:(aView device). |
|
1015 |
aView device setCursor:c id in:aView id. |
|
1016 |
]. |
|
1017 |
! |
|
1018 |
||
1019 |
withCursor:aCursor do:aBlock |
|
1020 |
"evaluate aBlock while showing aCursor in all |
|
1021 |
my views (used to show wait-cursor while doing something). |
|
1022 |
Return the result as returned by aBlock." |
|
1023 |
||
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1024 |
|oldCursors dev| |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1025 |
|
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1026 |
dev := self device. |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1027 |
dev isNil ifTrue:[ |
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1028 |
^ aBlock value |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1029 |
]. |
244 | 1030 |
|
1031 |
" |
|
1032 |
get mapping of view->cursor for all of my subviews |
|
1033 |
" |
|
1034 |
oldCursors := IdentityDictionary new. |
|
1035 |
self allViewsDo:[:aView | |
|
318 | 1036 |
oldCursors at:aView put:(aView cursor). |
1037 |
aView cursor:aCursor now:false |
|
244 | 1038 |
]. |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1039 |
dev flush. "/sync. |
244 | 1040 |
|
1041 |
^ aBlock valueNowOrOnUnwindDo:[ |
|
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1042 |
" |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1043 |
restore cursors from the mapping |
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 |
oldCursors keysAndValuesDo:[:view :cursor | |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1046 |
view cursor:cursor now:false. |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1047 |
]. |
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1048 |
dev flush "/ sync. |
244 | 1049 |
] |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1050 |
|
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1051 |
"Modified: 14.12.1995 / 21:39:39 / cg" |
244 | 1052 |
! ! |
1053 |
||
1054 |
!WindowGroup methodsFor:'special accessing'! |
|
1055 |
||
1056 |
setModal:aBoolean |
|
1057 |
"special entry for debugger: set the modal flag. |
|
1058 |
Not for public use" |
|
1059 |
||
1060 |
isModal := aBoolean |
|
1061 |
||
1062 |
"Modified: 3.9.1995 / 14:51:04 / claus" |
|
1063 |
! |
|
1064 |
||
1065 |
setPreviousGroup:aGroup |
|
1066 |
"special entry for debugger: |
|
1067 |
set the windowgroup that started this group (for modal groups only). |
|
1068 |
This is not a public interface." |
|
1069 |
||
1070 |
previousGroup := aGroup |
|
1071 |
||
1072 |
"Modified: 3.9.1995 / 14:55:40 / claus" |
|
1073 |
! |
|
1074 |
||
1075 |
setProcess:aProcess |
|
1076 |
"special entry for debugger: set the windowGroups process. |
|
1077 |
Not for public use." |
|
1078 |
||
1079 |
myProcess := aProcess |
|
1080 |
||
1081 |
"Modified: 3.9.1995 / 14:25:38 / claus" |
|
1082 |
! ! |
|
1083 |
||
251 | 1084 |
!WindowGroup class methodsFor:'documentation'! |
1085 |
||
1086 |
version |
|
324 | 1087 |
^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.49 1995-12-16 00:58:14 cg Exp $' |
251 | 1088 |
! ! |
244 | 1089 |
WindowGroup initialize! |