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
|
90
|
14 |
instanceVariableNames:'views topViews myProcess mySensor isModal previousGroup
|
|
15 |
focusView focusSequence'
|
72
|
16 |
classVariableNames:'ActiveGroup ScheduledWindowGroups LeaveSignal'
|
|
17 |
poolDictionaries:''
|
|
18 |
category:'Interface-Support'
|
11
|
19 |
!
|
|
20 |
|
54
|
21 |
WindowGroup comment:'
|
|
22 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
72
|
23 |
All Rights Reserved
|
54
|
24 |
|
90
|
25 |
$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.17 1995-02-06 00:39:42 claus Exp $
|
54
|
26 |
'!
|
|
27 |
|
46
|
28 |
!WindowGroup class methodsFor:'documentation'!
|
|
29 |
|
|
30 |
copyright
|
|
31 |
"
|
|
32 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
72
|
33 |
All Rights Reserved
|
46
|
34 |
|
|
35 |
This software is furnished under a license and may be used
|
|
36 |
only in accordance with the terms of that license and with the
|
|
37 |
inclusion of the above copyright notice. This software may not
|
|
38 |
be provided or otherwise made available to, or used by, any
|
|
39 |
other person. No title to or ownership of the software is
|
|
40 |
hereby transferred.
|
|
41 |
"
|
|
42 |
!
|
|
43 |
|
|
44 |
version
|
|
45 |
"
|
90
|
46 |
$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.17 1995-02-06 00:39:42 claus Exp $
|
46
|
47 |
"
|
|
48 |
!
|
|
49 |
|
|
50 |
documentation
|
|
51 |
"
|
|
52 |
"
|
|
53 |
! !
|
|
54 |
|
54
|
55 |
!WindowGroup class methodsFor:'initialization'!
|
46
|
56 |
|
|
57 |
initialize
|
|
58 |
LeaveSignal isNil ifTrue:[
|
72
|
59 |
LeaveSignal := (Signal new) mayProceed:true.
|
|
60 |
LeaveSignal nameClass:self message:#leaveSignal.
|
|
61 |
LeaveSignal notifierString:'unhandled leave signal'.
|
|
62 |
"/ ScheduledWindowGroups := IdentitySet new.
|
54
|
63 |
].
|
46
|
64 |
|
|
65 |
"WindowGroup initialize"
|
|
66 |
! !
|
|
67 |
|
72
|
68 |
!WindowGroup class methodsFor:'signal access'!
|
|
69 |
|
|
70 |
leaveSignal
|
|
71 |
^ LeaveSignal
|
|
72 |
! !
|
|
73 |
|
11
|
74 |
!WindowGroup class methodsFor:'instance creation'!
|
|
75 |
|
|
76 |
new
|
26
|
77 |
"create and return a new WindowGroup object"
|
|
78 |
|
11
|
79 |
^ self basicNew initialize
|
|
80 |
! !
|
|
81 |
|
26
|
82 |
!WindowGroup class methodsFor:'accessing'!
|
|
83 |
|
|
84 |
activeGroup
|
|
85 |
"return the currently active windowGroup"
|
|
86 |
|
|
87 |
^ ActiveGroup
|
54
|
88 |
!
|
|
89 |
|
|
90 |
scheduledWindowGroups
|
|
91 |
^ ScheduledWindowGroups
|
26
|
92 |
! !
|
|
93 |
|
11
|
94 |
!WindowGroup methodsFor:'accessing'!
|
|
95 |
|
26
|
96 |
sensor
|
|
97 |
"return the windowGroups sensor"
|
|
98 |
|
|
99 |
^ mySensor
|
|
100 |
!
|
|
101 |
|
11
|
102 |
addView:aView
|
26
|
103 |
"add aView to the windowGroup"
|
|
104 |
|
11
|
105 |
views isNil ifTrue:[
|
72
|
106 |
views := OrderedCollection new.
|
11
|
107 |
].
|
|
108 |
views add:aView
|
|
109 |
!
|
|
110 |
|
54
|
111 |
addTopView:aView
|
|
112 |
"add a topview to the group"
|
|
113 |
|
|
114 |
topViews isNil ifTrue:[
|
72
|
115 |
topViews := OrderedCollection new.
|
54
|
116 |
].
|
|
117 |
topViews add:aView
|
|
118 |
!
|
|
119 |
|
26
|
120 |
removeView:aView
|
|
121 |
"remove aView from the windowGroup;
|
|
122 |
if this was the last view in this group,
|
81
|
123 |
also shut down the corresponding process
|
|
124 |
(actually, only wake it up here - it will terminate itself
|
|
125 |
when finding out that all views are gone)"
|
11
|
126 |
|
|
127 |
views notNil ifTrue:[
|
72
|
128 |
views remove:aView ifAbsent:[].
|
|
129 |
views isEmpty ifTrue:[
|
|
130 |
views := nil
|
|
131 |
]
|
11
|
132 |
].
|
|
133 |
topViews notNil ifTrue:[
|
72
|
134 |
topViews remove:aView ifAbsent:[].
|
|
135 |
topViews isEmpty ifTrue:[
|
|
136 |
topViews := nil
|
|
137 |
]
|
11
|
138 |
].
|
54
|
139 |
"
|
|
140 |
wakeup my process to look if last view has been
|
|
141 |
removed (and terminate if so)
|
|
142 |
"
|
81
|
143 |
mySensor notNil ifTrue:[mySensor eventSemaphore signal]
|
11
|
144 |
!
|
|
145 |
|
|
146 |
views
|
26
|
147 |
"return the views accociated to this windowGroup"
|
|
148 |
|
11
|
149 |
^ views
|
|
150 |
!
|
|
151 |
|
46
|
152 |
topViews
|
|
153 |
"return the topviews accociated to this windowGroup"
|
|
154 |
|
|
155 |
^ topViews
|
|
156 |
!
|
|
157 |
|
11
|
158 |
process
|
26
|
159 |
"return the windowGroups process"
|
|
160 |
|
11
|
161 |
^ myProcess
|
|
162 |
!
|
|
163 |
|
54
|
164 |
isModal
|
|
165 |
^ isModal
|
|
166 |
!
|
|
167 |
|
|
168 |
previousGroup
|
|
169 |
"return the windowgroup that started this group.
|
|
170 |
(for modal groups only)"
|
|
171 |
|
|
172 |
^ previousGroup
|
|
173 |
!
|
|
174 |
|
|
175 |
mainGroup
|
|
176 |
"return the main windowgroup (that is the top one,
|
|
177 |
which is not modal)"
|
|
178 |
|
|
179 |
|g|
|
|
180 |
|
|
181 |
g := self.
|
|
182 |
[g notNil and:[g isModal]] whileTrue:[
|
72
|
183 |
g := g previousGroup
|
54
|
184 |
].
|
|
185 |
^ g
|
|
186 |
!
|
|
187 |
|
11
|
188 |
sensor:aSensor
|
26
|
189 |
"set the windowGroups sensor"
|
|
190 |
|
11
|
191 |
mySensor := aSensor
|
54
|
192 |
! !
|
|
193 |
|
90
|
194 |
!WindowGroup methodsFor:'enumerating'!
|
54
|
195 |
|
|
196 |
allViewsDo:aBlock
|
|
197 |
"evaluate aBlock for all views & topviews in this group"
|
|
198 |
|
|
199 |
topViews notNil ifTrue:[topViews do:aBlock].
|
|
200 |
views notNil ifTrue:[views do:aBlock]
|
|
201 |
!
|
|
202 |
|
|
203 |
allTopViewsExcept:aView do:aBlock
|
|
204 |
"evaluate aBlock for all topviews except aView in this group"
|
|
205 |
|
|
206 |
topViews notNil ifTrue:[
|
72
|
207 |
topViews do:[:v |
|
|
208 |
v ~~ aView ifTrue:[aBlock value:v]
|
|
209 |
]
|
54
|
210 |
].
|
|
211 |
! !
|
|
212 |
|
|
213 |
!WindowGroup methodsFor:'special'!
|
|
214 |
|
|
215 |
showCursor:aCursor
|
|
216 |
"change the cursor to aCursor in all of my views"
|
|
217 |
|
|
218 |
|c|
|
|
219 |
|
|
220 |
c := aCursor.
|
|
221 |
self allViewsDo:[:aView |
|
72
|
222 |
c := c on:(aView device).
|
|
223 |
aView device setCursor:c id in:aView id.
|
54
|
224 |
].
|
11
|
225 |
!
|
|
226 |
|
54
|
227 |
restoreCursors
|
|
228 |
"restore the original cursors in all of my views"
|
|
229 |
|
|
230 |
|c|
|
|
231 |
|
|
232 |
self allViewsDo:[:aView |
|
72
|
233 |
c := aView cursor on:(aView device).
|
|
234 |
aView device setCursor:(c id) in:(aView id).
|
11
|
235 |
].
|
54
|
236 |
!
|
|
237 |
|
|
238 |
withCursor:aCursor do:aBlock
|
|
239 |
"evaluate aBlock while showing aCursor in all
|
|
240 |
my views (used to show wait-cursor while doing something)"
|
|
241 |
|
|
242 |
|oldCursors|
|
|
243 |
|
72
|
244 |
"
|
|
245 |
get mapping of view->cursor for all of my subviews
|
|
246 |
"
|
54
|
247 |
oldCursors := IdentityDictionary new.
|
|
248 |
self allViewsDo:[:aView |
|
72
|
249 |
oldCursors at:aView put:(aView cursor).
|
|
250 |
aView cursor:aCursor
|
54
|
251 |
].
|
|
252 |
|
|
253 |
aBlock valueNowOrOnUnwindDo:[
|
72
|
254 |
"
|
|
255 |
restore cursors
|
|
256 |
"
|
|
257 |
oldCursors keysAndValuesDo:[:view :cursor |
|
|
258 |
view cursor:cursor
|
|
259 |
]
|
54
|
260 |
]
|
11
|
261 |
! !
|
|
262 |
|
19
|
263 |
!WindowGroup methodsFor:'event handling'!
|
11
|
264 |
|
19
|
265 |
processEvent
|
46
|
266 |
"process a single event from either the damage- or user input queues.
|
|
267 |
Debugger abort brings us back here."
|
19
|
268 |
|
90
|
269 |
|event ignore|
|
11
|
270 |
|
72
|
271 |
self processExposeEvents.
|
|
272 |
[mySensor hasEvents] whileTrue:[
|
|
273 |
event := mySensor nextEvent.
|
90
|
274 |
event notNil ifTrue:[
|
|
275 |
(views isNil and:[topViews isNil]) ifFalse:[
|
|
276 |
|
|
277 |
ignore := false.
|
|
278 |
event isKeyPressEvent ifTrue:[
|
|
279 |
event key == #FocusNext ifTrue:[
|
|
280 |
self focusNext.
|
|
281 |
ignore := true
|
|
282 |
].
|
|
283 |
event key == #FocusPrevious ifTrue:[
|
|
284 |
self focusPrevious.
|
|
285 |
ignore := true
|
|
286 |
].
|
|
287 |
].
|
|
288 |
"
|
|
289 |
button events turn off explicit focus, and revert
|
|
290 |
to implicit focus control
|
|
291 |
"
|
|
292 |
(focusView notNil
|
|
293 |
and:[event isButtonEvent]) ifTrue:[
|
|
294 |
self focusView:nil
|
|
295 |
].
|
|
296 |
|
|
297 |
ignore ifFalse:[
|
|
298 |
AbortSignal catch:[
|
|
299 |
event sendEventWithFocusOn:focusView.
|
|
300 |
]
|
|
301 |
]
|
|
302 |
]
|
72
|
303 |
].
|
|
304 |
]
|
48
|
305 |
!
|
|
306 |
|
|
307 |
processExposeEvents
|
|
308 |
"process all expose events from the damage queue"
|
|
309 |
|
90
|
310 |
|event view rect oldActive x y w h|
|
48
|
311 |
|
|
312 |
oldActive := ActiveGroup.
|
90
|
313 |
[
|
|
314 |
[mySensor notNil and:[mySensor hasDamage]] whileTrue:[
|
|
315 |
ActiveGroup := self.
|
|
316 |
event := mySensor nextDamage.
|
|
317 |
event notNil ifTrue:[
|
|
318 |
(views isNil and:[topViews isNil]) ifFalse:[
|
|
319 |
event isDamage ifTrue:[
|
|
320 |
view := event view.
|
|
321 |
rect := event rectangle.
|
|
322 |
view shown ifTrue:[
|
|
323 |
rect := event rectangle.
|
|
324 |
x := rect left.
|
|
325 |
y := rect top.
|
|
326 |
w := rect width.
|
|
327 |
h := rect height.
|
|
328 |
view transformation notNil ifTrue:[
|
|
329 |
view deviceExposeX:x y:y width:w height:h
|
|
330 |
] ifFalse:[
|
|
331 |
view exposeX:x y:y width:w height:h
|
|
332 |
]
|
81
|
333 |
]
|
90
|
334 |
] ifFalse:[
|
|
335 |
"
|
|
336 |
mhmh - could we possibly arrive here ?
|
|
337 |
"
|
|
338 |
event sendEvent.
|
78
|
339 |
]
|
72
|
340 |
]
|
|
341 |
]
|
|
342 |
]
|
90
|
343 |
] valueNowOrOnUnwindDo:[
|
|
344 |
ActiveGroup := oldActive.
|
|
345 |
oldActive := nil
|
|
346 |
]
|
11
|
347 |
!
|
|
348 |
|
19
|
349 |
eventLoop
|
|
350 |
"loop executed by windowGroup process;
|
|
351 |
wait-for and process events forever"
|
|
352 |
|
23
|
353 |
self eventLoopWhile:[true]
|
|
354 |
!
|
|
355 |
|
|
356 |
eventLoopWhile:aBlock
|
90
|
357 |
"wait-for and process events.
|
|
358 |
Stay in this loop while there are still any views to dispatch for,
|
|
359 |
and aBlock evaluates to true."
|
78
|
360 |
|
90
|
361 |
|oldActive|
|
78
|
362 |
|
90
|
363 |
oldActive := ActiveGroup.
|
|
364 |
"/ ScheduledWindowGroups add:self.
|
78
|
365 |
|
90
|
366 |
[
|
|
367 |
(SignalSet with:LeaveSignal with:AbortSignal)
|
|
368 |
handle:[:ex |
|
|
369 |
"/ ActiveGroup := oldActive.
|
|
370 |
"/ oldActive := nil.
|
|
371 |
ex return
|
|
372 |
] do:[
|
|
373 |
|p g mainGroup|
|
54
|
374 |
|
90
|
375 |
isModal ifTrue:[
|
|
376 |
mainGroup := self mainGroup.
|
72
|
377 |
].
|
90
|
378 |
|
|
379 |
aBlock whileTrue:[
|
|
380 |
(views isNil and:[topViews isNil]) ifTrue:[
|
|
381 |
"/ ScheduledWindowGroups remove:self ifAbsent:[].
|
|
382 |
myProcess notNil ifTrue:[
|
|
383 |
p := myProcess.
|
|
384 |
myProcess := nil.
|
|
385 |
p terminate.
|
|
386 |
"not reached - there is no life after death"
|
|
387 |
].
|
|
388 |
"
|
|
389 |
this is the end of a modal loop
|
|
390 |
(not having a private process ...)
|
|
391 |
"
|
|
392 |
^ self
|
72
|
393 |
].
|
|
394 |
|
90
|
395 |
AbortSignal handle:[:ex |
|
|
396 |
"/ ActiveGroup := oldActive.
|
|
397 |
"/ oldActive := nil.
|
|
398 |
ex return
|
|
399 |
] do:[
|
|
400 |
"
|
|
401 |
if modal, break out of the wait after some time
|
|
402 |
to allow servicing update-events of the blocked
|
|
403 |
windowgroup.
|
|
404 |
"
|
|
405 |
Processor activeProcess setStateTo:#eventWait if:#active.
|
|
406 |
isModal ifTrue:[
|
|
407 |
mySensor eventSemaphore waitWithTimeout:0.2.
|
|
408 |
] ifFalse:[
|
|
409 |
mySensor eventSemaphore wait.
|
|
410 |
].
|
|
411 |
ActiveGroup := self.
|
|
412 |
self processEvent
|
|
413 |
].
|
|
414 |
"/ ActiveGroup := oldActive.
|
|
415 |
|
|
416 |
"
|
|
417 |
if modal, also check for redraw events in my maingroup
|
|
418 |
(we arrive here after every event for myself or after the
|
|
419 |
above timeout)
|
|
420 |
"
|
|
421 |
mainGroup notNil ifTrue:[
|
|
422 |
mainGroup processExposeEvents.
|
|
423 |
]
|
72
|
424 |
]
|
90
|
425 |
].
|
|
426 |
] valueNowOrOnUnwindDo:[
|
|
427 |
"/ ScheduledWindowGroups remove:self ifAbsent:[].
|
|
428 |
ActiveGroup := oldActive.
|
|
429 |
oldActive := nil.
|
54
|
430 |
].
|
28
|
431 |
!
|
|
432 |
|
|
433 |
waitForExposeFor:aView
|
|
434 |
"wait for a noExpose on aView, then process all exposes.
|
|
435 |
To be used after a scroll"
|
|
436 |
|
|
437 |
mySensor waitForExposeFor:aView.
|
90
|
438 |
AbortSignal catch:[
|
|
439 |
self processExposeEvents
|
|
440 |
]
|
46
|
441 |
!
|
|
442 |
|
|
443 |
leaveEventLoop
|
65
|
444 |
^ LeaveSignal raise
|
19
|
445 |
! !
|
|
446 |
|
|
447 |
!WindowGroup methodsFor:'activation / deactivation'!
|
|
448 |
|
46
|
449 |
restart
|
54
|
450 |
"restart after a snapin."
|
46
|
451 |
|
48
|
452 |
topViews notNil ifTrue:[
|
72
|
453 |
"
|
|
454 |
need a new semaphore, since obsolete processes
|
|
455 |
(from our previous live) may still sit on the current semaphore
|
|
456 |
"
|
|
457 |
mySensor eventSemaphore:Semaphore new.
|
|
458 |
isModal ifFalse:[
|
|
459 |
self startup
|
|
460 |
]
|
48
|
461 |
]
|
46
|
462 |
!
|
|
463 |
|
11
|
464 |
startup
|
19
|
465 |
"startup the window-group;
|
|
466 |
this creates a new window group process, which
|
|
467 |
does the event processing."
|
|
468 |
|
23
|
469 |
|nm|
|
|
470 |
|
54
|
471 |
previousGroup := nil.
|
11
|
472 |
myProcess isNil ifTrue:[
|
72
|
473 |
isModal := false.
|
|
474 |
myProcess := [
|
|
475 |
topViews notNil ifTrue:[
|
|
476 |
topViews do:[:aView |
|
|
477 |
aView realize
|
|
478 |
].
|
|
479 |
].
|
|
480 |
self eventLoopWhile:[true]
|
|
481 |
] forkAt:Processor userSchedulingPriority.
|
19
|
482 |
|
72
|
483 |
(topViews notNil and:[topViews isEmpty not]) ifTrue:[
|
|
484 |
"give the handler process a user friendly name"
|
|
485 |
nm := topViews first name.
|
|
486 |
nm isNil ifTrue:[
|
|
487 |
nm := topViews first label.
|
|
488 |
].
|
|
489 |
myProcess name:(topViews first name)
|
|
490 |
] ifFalse:[
|
|
491 |
myProcess name:'window handler'.
|
|
492 |
].
|
19
|
493 |
|
72
|
494 |
"when the process dies, we have to close-down
|
|
495 |
the views as well
|
|
496 |
"
|
|
497 |
myProcess exitAction:[self closeDownViews]
|
11
|
498 |
]
|
|
499 |
!
|
|
500 |
|
48
|
501 |
startupModal:checkBlock
|
|
502 |
"startup the window-group in a modal loop (i.e. under the
|
|
503 |
currently running process);
|
|
504 |
checkBlock is evaluated and loop is left, when false is
|
|
505 |
returned."
|
|
506 |
|
54
|
507 |
"set previousGroup to the main (non-modal) group"
|
|
508 |
|
|
509 |
previousGroup := WindowGroup activeGroup.
|
|
510 |
isModal := true.
|
48
|
511 |
topViews do:[:aView |
|
72
|
512 |
aView realize.
|
48
|
513 |
].
|
81
|
514 |
[
|
|
515 |
self eventLoopWhile:checkBlock.
|
|
516 |
] valueNowOrOnUnwindDo:[
|
|
517 |
"
|
|
518 |
cleanup, in case of a terminate
|
|
519 |
"
|
|
520 |
previousGroup := nil.
|
|
521 |
topViews := nil.
|
|
522 |
views := nil.
|
86
|
523 |
"
|
|
524 |
the following is rubbish;
|
|
525 |
the views could be reused ..
|
|
526 |
"
|
|
527 |
"
|
81
|
528 |
topViews notNil ifTrue:[
|
|
529 |
topViews do:[:aView |
|
|
530 |
aView destroy
|
|
531 |
].
|
86
|
532 |
topViews := nil.
|
81
|
533 |
].
|
|
534 |
views notNil ifTrue:[
|
|
535 |
views do:[:aView |
|
|
536 |
aView destroy
|
86
|
537 |
].
|
|
538 |
views := nil.
|
81
|
539 |
].
|
86
|
540 |
"
|
81
|
541 |
].
|
48
|
542 |
!
|
|
543 |
|
19
|
544 |
closeDownViews
|
|
545 |
"destroy all views associated to this window group"
|
|
546 |
|
11
|
547 |
topViews notNil ifTrue:[
|
72
|
548 |
topViews do:[:aTopView | aTopView destroy]
|
11
|
549 |
].
|
|
550 |
views := nil.
|
|
551 |
topViews := nil.
|
90
|
552 |
"/ ScheduledWindowGroups remove:self ifAbsent:[].
|
19
|
553 |
!
|
|
554 |
|
|
555 |
shutdown
|
|
556 |
"shutdow the window group; close all views and
|
|
557 |
terminate process"
|
|
558 |
|
46
|
559 |
|p|
|
|
560 |
|
19
|
561 |
self closeDownViews.
|
11
|
562 |
myProcess notNil ifTrue:[
|
72
|
563 |
p := myProcess.
|
|
564 |
myProcess := nil.
|
90
|
565 |
"/ ScheduledWindowGroups remove:self ifAbsent:[].
|
72
|
566 |
p terminate.
|
11
|
567 |
]
|
|
568 |
! !
|
|
569 |
|
|
570 |
!WindowGroup methodsFor:'initialization'!
|
|
571 |
|
|
572 |
reinitialize
|
72
|
573 |
"reinitialize the windowgroup after an image restart"
|
|
574 |
|
19
|
575 |
"throw away old (zombie) process"
|
72
|
576 |
myProcess notNil ifTrue:[
|
|
577 |
"careful: the old processes exitaction must be cleared
|
|
578 |
otherwise, it might do destroy or other actions when it
|
|
579 |
gets finalized ...
|
|
580 |
"
|
|
581 |
myProcess exitAction:nil.
|
|
582 |
myProcess := nil.
|
|
583 |
].
|
19
|
584 |
|
11
|
585 |
"throw away old events"
|
54
|
586 |
mySensor reinitialize
|
11
|
587 |
!
|
|
588 |
|
|
589 |
initialize
|
19
|
590 |
"setup the windowgroup, by creating a new sensor
|
|
591 |
and an event semaphore"
|
|
592 |
|
11
|
593 |
mySensor := WindowSensor new.
|
72
|
594 |
mySensor eventSemaphore:Semaphore new.
|
|
595 |
isModal := false.
|
11
|
596 |
! !
|
19
|
597 |
|
90
|
598 |
!WindowGroup methodsFor:'focus control'!
|
|
599 |
|
|
600 |
focusSequence:aSequenceableCollection
|
|
601 |
"define the focus sequence for focusNext/focusPrevious.
|
|
602 |
Focus is stepped in the order in which subviews occur in
|
|
603 |
the sequence"
|
|
604 |
|
|
605 |
focusSequence := aSequenceableCollection
|
|
606 |
!
|
|
607 |
|
|
608 |
focusView
|
|
609 |
"return the view which has the focus"
|
|
610 |
|
|
611 |
^ focusView
|
|
612 |
!
|
|
613 |
|
|
614 |
focusView:aViewOrNil
|
|
615 |
"give focus to aViewOrNil"
|
|
616 |
|
|
617 |
focusView notNil ifTrue:[
|
|
618 |
focusView focusOut.
|
|
619 |
].
|
|
620 |
focusView := aViewOrNil.
|
|
621 |
focusView notNil ifTrue:[
|
|
622 |
focusView focusIn
|
|
623 |
].
|
|
624 |
|
|
625 |
"
|
|
626 |
|top v1 v2|
|
|
627 |
|
|
628 |
top := StandardSystemView new.
|
|
629 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top.
|
|
630 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top.
|
|
631 |
top open.
|
|
632 |
top windowGroup focusView:v1.
|
|
633 |
"
|
|
634 |
!
|
|
635 |
|
|
636 |
focusNext
|
|
637 |
"give focus to next view in focusSequence"
|
|
638 |
|
|
639 |
|index|
|
|
640 |
|
|
641 |
focusSequence isNil ifTrue:[^ self].
|
|
642 |
focusView notNil ifTrue:[
|
|
643 |
index := (focusSequence indexOf:focusView) + 1.
|
|
644 |
index > focusSequence size ifTrue:[index := 1].
|
|
645 |
] ifFalse:[
|
|
646 |
index := 1.
|
|
647 |
].
|
|
648 |
self focusView:(focusSequence at:index)
|
|
649 |
|
|
650 |
"
|
|
651 |
|top v1 v2|
|
|
652 |
|
|
653 |
top := StandardSystemView new.
|
|
654 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top.
|
|
655 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top.
|
|
656 |
top open.
|
|
657 |
top windowGroup focusSequence:(Array with:v1 with:v2).
|
|
658 |
top windowGroup focusOn:v1.
|
|
659 |
(Delay forSeconds:10) wait.
|
|
660 |
top windowGroup focusNext.
|
|
661 |
"
|
|
662 |
!
|
|
663 |
|
|
664 |
focusPrevious
|
|
665 |
"give focus to previous view in focusSequence"
|
|
666 |
|
|
667 |
|index|
|
|
668 |
|
|
669 |
focusSequence isNil ifTrue:[^ self].
|
|
670 |
focusView notNil ifTrue:[
|
|
671 |
index := (focusSequence indexOf:focusView) - 1.
|
|
672 |
index < 1 ifTrue:[index := focusSequence size].
|
|
673 |
] ifFalse:[
|
|
674 |
index := focusSequence size.
|
|
675 |
].
|
|
676 |
self focusView:(focusSequence at:index)
|
|
677 |
! !
|
|
678 |
|
19
|
679 |
!WindowGroup methodsFor:'printing'!
|
|
680 |
|
90
|
681 |
printOn:aStream
|
19
|
682 |
"return a printed representation;
|
|
683 |
just for more user friendlyness, add name of process."
|
|
684 |
|
90
|
685 |
myProcess isNil ifTrue:[
|
|
686 |
(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[
|
|
687 |
aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')').
|
|
688 |
^ self.
|
|
689 |
].
|
|
690 |
^ super printOn:aStream
|
|
691 |
].
|
|
692 |
aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')')
|
19
|
693 |
! !
|