author | Claus Gittinger <cg@exept.de> |
Fri, 28 Feb 1997 10:25:28 +0100 | |
changeset 1387 | 3fabdef0790d |
parent 1364 | ba84e05c1622 |
child 1411 | 86559faec840 |
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 |
417 | 15 |
focusSequence preEventHook postEventHook pointerView |
16 |
isForModalSubview' |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
17 |
classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal |
1110 | 18 |
WindowGroupQuerySignal LastEventQuerySignal' |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
19 |
poolDictionaries:'' |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
20 |
category:'Interface-Support' |
11 | 21 |
! |
22 |
||
1110 | 23 |
!WindowGroup class methodsFor:'documentation'! |
46 | 24 |
|
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 28 |
All Rights Reserved |
46 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
103 | 41 |
In Smalltalk/X, the known (ST-80) concept of a controller has been |
297 | 42 |
extended (split) into a WindowGroup which handles process related stuff, |
43 |
and the Controller, which only handles events for a view and defines the user interaction. |
|
44 |
All interaction is via event queues - there is no polling in controllers (not even conceptionally). |
|
103 | 45 |
|
46 |
WindowGroups are responsible to wait for and forward events for a group of |
|
297 | 47 |
windows. All views in a windowGroup share a single windowSensor which holds the |
144 | 48 |
event queue (therefore views all share the same input event queue). |
49 |
||
297 | 50 |
The event queues are filled with incoming events as arriving from the physical display. |
51 |
This is done by a separate process (so called event-dispatcher) which runs at a higher |
|
52 |
priority. The event dispatcher determines the queue into which an event has to be placed |
|
53 |
by the view for which the event is destined (via the views sensor). |
|
54 |
There may be multiple event dispatchers running (to support multiple displays); |
|
55 |
see the documentation/examples in DeviceWorkstation/XWorkstation on how this is done. |
|
56 |
||
103 | 57 |
Except for modal boxes, a separate process is created for each windowGroup |
297 | 58 |
which waits for events to arrive and processes them, by sending corresponding |
144 | 59 |
event messages to the views controller or the view (*). |
297 | 60 |
The controller is determined by asking the view (for which the event is destined); |
61 |
if the returned controller is nil, the event is sent directly to the view. |
|
62 |
This allows for simple views to work without a controller. |
|
63 |
(all of this is actually done in a WindowEvent method) |
|
64 |
||
65 |
Therefore, multiple applications run pseudo parallel. |
|
66 |
Even if some window performs a long time computation, events are still received |
|
67 |
and entered into the corresponding event queues (because the event dispatcher process |
|
68 |
runs at a higher priority). However, the actual processing of the event is only |
|
69 |
possibly if no other process is busy at the same or a higher priority. |
|
70 |
It is possible to change a windowProcesses priority in order to give other windows |
|
71 |
a chance to execute (some views do this while performing longtime actions). |
|
72 |
||
103 | 73 |
Modal boxes create an extra window group for the components of the modal |
297 | 74 |
box, but execute the event-processing loop for this new group in the original process - |
144 | 75 |
therefore, the original windowgroup is blocked for the duration of the modal |
297 | 76 |
interaction. |
77 |
However, the modal-event processing loop peeks into the original groups event queue |
|
78 |
from time to time, and handles expose events. Thus, even while blocked for user input, |
|
79 |
the original group continues to get update/redraw events. |
|
103 | 80 |
|
81 |
Normally, one windowgroup is associated to each topview (StandardSystemView) |
|
144 | 82 |
and all of its subviews. However, this is not strictly required; |
83 |
it is possible to create extra windowgroups for subviews, which will let them |
|
84 |
run in parallel |
|
512 | 85 |
(for example, the FileBrowsers kill-Button is created that |
86 |
way, to allow a kill of an executing unix command, while the browser |
|
87 |
itself reads the pipeStream for incoming text. |
|
88 |
Even if the fileBrowser is busy reading the pipe, the killButton is still |
|
89 |
working and allows terminating the pipe-read action). |
|
144 | 90 |
|
91 |
On the other hand, multiple topviews can be placed into the same windowGroup; |
|
92 |
which allows for multiview applications, of which only one communicates with |
|
103 | 93 |
the user at a time. |
297 | 94 |
Multiple topviews within a windowGropup can be configured to behave like one |
95 |
unit with respect to iconification, deiconification and termination. |
|
96 |
This is done by creating multiple topViews in one group, and setting up a master/slave |
|
97 |
or partner relation among them (see TopView>>beSlave and TopView>>bePartner). |
|
103 | 98 |
|
109 | 99 |
WindowGroups also support a focus window: this is the one that gets the |
103 | 100 |
keyboard input - even if the cursor is located in another subview. |
512 | 101 |
The sequence is defined by the topView or its model (typically an applicationModel). |
102 |
It should return an orderedCollection of subviews when asked via #focusSequence. |
|
103 |
||
104 |
For debugging, windowGroups allow hooks to be installed around the processing of |
|
105 |
events - preEventHook is sent a #procesEvent: message before an event is processed, |
|
106 |
postEventHook is informed after the event has been processed. |
|
107 |
The preEventHook should return true - if it returns true, the event is considered |
|
108 |
being already processed by the hook and ignored. |
|
109 |
This allows for event-tracing, timing or even filtering (if preEventHook returns true). |
|
110 |
(notice: there is also an eventHook facility available in the sensor class.) |
|
103 | 111 |
|
112 |
Finally, windowgroups are the perfect place for things like defining a |
|
113 |
cursor for all associated views, flushing all input, waiting for expose |
|
114 |
events etc. |
|
115 |
||
297 | 116 |
Dont get confused: |
512 | 117 |
You dont have to care for details in the normal case, a windowgroup is |
118 |
created for you automatically, when a view is opened. |
|
119 |
All of the internals are not required to be known for most applications. |
|
297 | 120 |
|
103 | 121 |
|
597 | 122 |
[instance variables:] |
144 | 123 |
|
512 | 124 |
views collection of views of this group |
103 | 125 |
|
512 | 126 |
topViews collection of topviews of this group |
103 | 127 |
|
512 | 128 |
myProcess the process executing the events |
103 | 129 |
|
512 | 130 |
mySensor my input sensor |
103 | 131 |
|
512 | 132 |
isModal true if this is for a modal box |
103 | 133 |
|
512 | 134 |
previousGroup if modal, the group that started this one |
103 | 135 |
|
512 | 136 |
focusView the one that has the focus (or nil) |
103 | 137 |
|
512 | 138 |
focusSequence defines the focus sequence |
103 | 139 |
|
140 |
||
597 | 141 |
[class variables:] |
512 | 142 |
LeaveSignal if raised, a modal box leaves (closes) |
103 | 143 |
|
1111 | 144 |
WindowGroupQuerySignal to ask for the current windowGroup, |
145 |
anywhere in the program, simply raise this |
|
146 |
signal. The raise returns nil, for processes, |
|
147 |
which are not under control of a windowGroup. |
|
148 |
(i.e. wg := WindowGroup windowGroupQuerySignal raise) |
|
149 |
||
150 |
LastEventQuerySignal to ask for the event which was responsible |
|
151 |
for being where you are (whereever that is). |
|
152 |
The raise returns nil, if you did not arrive |
|
153 |
there due to an event. |
|
154 |
(i.e. ev := WindowGroup lastEventQuerySignal raise) |
|
155 |
The event can be asked for the view, the type |
|
156 |
of event, x/y position etc. |
|
103 | 157 |
|
144 | 158 |
(*) |
512 | 159 |
due to historic reasons, many views have the controller functionality |
160 |
integrated, and handle events themself. The windowSensor takes care |
|
161 |
of this, by checking if a view has a controller, and, if so, forwarding |
|
162 |
the events to it. Otherwise, events are sent directly to the view. |
|
144 | 163 |
|
512 | 164 |
In the future, all views will be rewritten to actually use a controller. |
165 |
Currently (being in the middle of this migration), only some views |
|
166 |
(buttons, toggles and subclasses) do so. |
|
144 | 167 |
|
103 | 168 |
For more information, read 'introduction to view programming' in the |
169 |
doc/online directory. |
|
597 | 170 |
|
612 | 171 |
[author:] |
172 |
Claus Gittinger |
|
173 |
||
597 | 174 |
[see also:] |
1111 | 175 |
WindowSensor WindowEvent EventListener KeyboardForwarder |
598 | 176 |
DeviceWorkstation |
597 | 177 |
View StandardSystemView |
178 |
ApplicationModel |
|
651 | 179 |
Process ProcessorScheduler |
1153 | 180 |
(``Working with processes (programmers manual)'': programming/processes.html#VIEWSNPROCS) |
46 | 181 |
" |
182 |
! ! |
|
183 |
||
1110 | 184 |
!WindowGroup class methodsFor:'initialization'! |
46 | 185 |
|
186 |
initialize |
|
187 |
LeaveSignal isNil ifTrue:[ |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
188 |
LeaveSignal := (Signal new) mayProceed:true. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
189 |
LeaveSignal nameClass:self message:#leaveSignal. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
190 |
LeaveSignal notifierString:'unhandled leave signal'. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
191 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
192 |
WindowGroupQuerySignal := QuerySignal new. |
1111 | 193 |
WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal. |
194 |
WindowGroupQuerySignal notifierString:'query for windowgroup'. |
|
195 |
||
1110 | 196 |
LastEventQuerySignal := QuerySignal new. |
1111 | 197 |
LastEventQuerySignal nameClass:self message:#lastEventQuerySignal. |
198 |
LastEventQuerySignal notifierString:'query for last event'. |
|
54 | 199 |
]. |
46 | 200 |
|
201 |
"WindowGroup initialize" |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
202 |
|
1111 | 203 |
"Modified: 9.11.1996 / 17:00:53 / cg" |
46 | 204 |
! ! |
205 |
||
1110 | 206 |
!WindowGroup class methodsFor:'instance creation'! |
244 | 207 |
|
208 |
new |
|
209 |
"create and return a new WindowGroup object" |
|
210 |
||
211 |
^ self basicNew initialize |
|
212 |
! ! |
|
213 |
||
1110 | 214 |
!WindowGroup class methodsFor:'Signal constants'! |
215 |
||
216 |
lastEventQuerySignal |
|
217 |
"return the signal which is used to query for the last event" |
|
218 |
||
219 |
^ LastEventQuerySignal |
|
220 |
||
221 |
"Created: 17.7.1996 / 20:36:04 / cg" |
|
222 |
! |
|
72 | 223 |
|
224 |
leaveSignal |
|
109 | 225 |
"return the signal which is used to exit a modal loop. |
144 | 226 |
This private signal, is always cought while a modalbox is active. |
227 |
Raising it will exit the modal loop and return from the views #openModal |
|
228 |
method." |
|
109 | 229 |
|
72 | 230 |
^ LeaveSignal |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
231 |
! |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
232 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
233 |
windowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
234 |
"return the signal which is used to query for the windowGroup" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
235 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
236 |
^ WindowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
237 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
238 |
"Created: 17.7.1996 / 20:36:04 / cg" |
72 | 239 |
! ! |
240 |
||
1110 | 241 |
!WindowGroup class methodsFor:'accessing'! |
26 | 242 |
|
243 |
activeGroup |
|
180 | 244 |
"return the currently active windowGroup. |
245 |
The returned value may not be fully correct, in case the current process |
|
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
246 |
handles multiple windowGroups simultaneously. In this case, |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
247 |
(usually) the first group is returned (prefering a modal if there is one). |
180 | 248 |
(maybe we should return a collection of windowGroups here). |
249 |
||
250 |
This method is required to simulate the historic ST-80 single display |
|
251 |
behavior for Cursor>>show / Cursor>>showWhile and some others (raising the |
|
252 |
activeGroups topView when modalBoxes appear) on multiple display screens. |
|
253 |
These methods should change the cursor for the currently |
|
254 |
active windowGroup ONLY, instead of globally affecting the display or |
|
255 |
all views |
|
256 |
(since, depending on the priority, other views could be unaffacted by this |
|
257 |
and an overall cursor change does not make sense.)" |
|
258 |
||
259 |
|activeProcess groups wg| |
|
260 |
||
261 |
Processor isNil ifTrue:[^ nil]. "/ only during very early init phase |
|
26 | 262 |
|
180 | 263 |
activeProcess := Processor activeProcess. |
264 |
" caching the last value ..." |
|
565
6867f1a9a470
oops - leftover global LastActive
Claus Gittinger <cg@exept.de>
parents:
513
diff
changeset
|
265 |
activeProcess == LastActiveProcess ifTrue:[ |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
266 |
LastActiveGroup process == LastActiveProcess ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
267 |
^ LastActiveGroup |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
268 |
] |
180 | 269 |
]. |
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
270 |
|
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
271 |
wg := WindowGroupQuerySignal raise. |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
272 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
273 |
wg isNil ifTrue:[ |
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
274 |
"/ mhmh - noone willing to answer that question ... |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
275 |
"/ (how can ths happen ?) |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
276 |
groups := self scheduledWindowGroups |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
277 |
select:[:wg | wg process == activeProcess]. |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
278 |
groups size == 1 ifTrue:[ |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
279 |
wg := groups anElement |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
280 |
] ifFalse:[ |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
281 |
wg := groups detect:[:wg | wg isModal] ifNone:nil. |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
282 |
wg isNil ifTrue:[ |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
283 |
wg := groups anElement |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
284 |
] |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
285 |
]. |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
286 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
287 |
|
180 | 288 |
wg notNil ifTrue:[ |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
289 |
LastActiveProcess := activeProcess. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
290 |
LastActiveGroup := wg. |
180 | 291 |
]. |
292 |
^ wg |
|
293 |
||
294 |
" |
|
295 |
WindowGroup activeGroup |
|
296 |
" |
|
297 |
||
298 |
"Modified: 3.9.1995 / 14:49:53 / claus" |
|
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
299 |
"Modified: 29.1.1997 / 19:46:25 / cg" |
54 | 300 |
! |
301 |
||
302 |
scheduledWindowGroups |
|
180 | 303 |
"return a collection of all windowGroups (possibly for different |
304 |
display devices) which are scheduled (i.e. which have a process |
|
305 |
running, handling events)." |
|
306 |
||
307 |
|set screens| |
|
308 |
||
309 |
screens := Screen allScreens. |
|
310 |
screens isNil ifTrue:[^ #()]. |
|
311 |
||
312 |
set := IdentitySet new. |
|
313 |
screens do:[:aDevice | |
|
314 |
aDevice allViewsDo:[:aView | |
|
315 |
|wg| |
|
109 | 316 |
|
180 | 317 |
(wg := aView windowGroup) notNil ifTrue:[ |
318 |
wg process notNil ifTrue:[ |
|
319 |
set add:wg |
|
320 |
] |
|
321 |
]. |
|
322 |
]. |
|
323 |
]. |
|
324 |
^ set asArray |
|
325 |
||
326 |
" |
|
327 |
WindowGroup scheduledWindowGroups |
|
328 |
" |
|
329 |
||
330 |
"Modified: 1.9.1995 / 13:43:09 / claus" |
|
244 | 331 |
! |
332 |
||
333 |
setActiveGroup:aGroup |
|
334 |
"set the currently active windowGroup. |
|
335 |
Temporary; do not use this interface, it will vanish." |
|
336 |
||
337 |
LastActiveProcess := Processor activeProcess. |
|
338 |
LastActiveGroup := aGroup |
|
26 | 339 |
! ! |
340 |
||
11 | 341 |
!WindowGroup methodsFor:'accessing'! |
342 |
||
512 | 343 |
device |
344 |
"return the device, we receive our events from" |
|
345 |
||
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
346 |
self obsoleteMethodWarning:'use #graphicsDevice'. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
347 |
^ self graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
348 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
349 |
"Modified: 5.7.1996 / 17:53:58 / cg" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
350 |
! |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
351 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
352 |
graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
353 |
"return the device, we receive our events from" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
354 |
|
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
355 |
|dev| |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
356 |
|
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
357 |
topViews notNil ifTrue:[ |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
358 |
topViews do:[:v | |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
359 |
|app| |
1116 | 360 |
|
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
361 |
(app := v application) notNil ifTrue:[ |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
362 |
"/ |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
363 |
"/ ok, it has an application; |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
364 |
"/ ask it for preferences. |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
365 |
"/ |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
366 |
(dev := app graphicsDevice) notNil ifTrue:[ |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
367 |
^ dev |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
368 |
] |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
369 |
]. |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
370 |
(dev := v graphicsDevice) notNil ifTrue:[ |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
371 |
^ dev |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
372 |
] |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
373 |
] |
512 | 374 |
]. |
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
375 |
views notNil ifTrue:[ |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
376 |
views do:[:v | |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
377 |
(dev := v graphicsDevice) notNil ifTrue:[ |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
378 |
^ dev |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
379 |
] |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
380 |
] |
512 | 381 |
]. |
382 |
^ nil |
|
383 |
||
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
384 |
"Modified: 7.2.1997 / 16:14:24 / cg" |
512 | 385 |
! |
386 |
||
387 |
isModal |
|
388 |
"return true, if the receiver is in a modal mode |
|
389 |
(i.e. for a modal box)" |
|
390 |
||
391 |
^ isModal |
|
392 |
||
393 |
"Modified: 7.3.1996 / 14:29:46 / cg" |
|
394 |
! |
|
395 |
||
396 |
mainGroup |
|
397 |
"return the main windowgroup (for modal groups only) |
|
398 |
that is the top one, which is not modal. |
|
399 |
NonModal groups return themSelf. |
|
400 |
||
401 |
There is one exception to this: the debugger (which is sort of modal) |
|
402 |
returns itself as mainGroup (not its debuggee)." |
|
403 |
||
404 |
|g prev| |
|
405 |
||
406 |
g := self. |
|
407 |
[g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[ |
|
408 |
g := prev |
|
409 |
]. |
|
410 |
^ g |
|
411 |
||
412 |
"Modified: 3.9.1995 / 14:57:20 / claus" |
|
413 |
"Modified: 7.3.1996 / 14:29:28 / cg" |
|
414 |
! |
|
415 |
||
416 |
previousGroup |
|
417 |
"return the windowgroup that started this group. (for modal groups only). |
|
418 |
This may be another modalGroup (for boxes opened by boxes). |
|
419 |
NonModal groups return nil." |
|
420 |
||
421 |
^ previousGroup |
|
422 |
||
423 |
"Modified: 7.3.1996 / 14:28:46 / cg" |
|
424 |
! |
|
425 |
||
426 |
process |
|
427 |
"return the windowGroups process" |
|
428 |
||
429 |
^ myProcess |
|
430 |
! |
|
431 |
||
432 |
sensor |
|
433 |
"return the windowGroups sensor. |
|
434 |
All events for any of the groups views is handled by that sensor." |
|
435 |
||
436 |
^ mySensor |
|
437 |
||
438 |
"Modified: 7.3.1996 / 14:30:21 / cg" |
|
439 |
! |
|
440 |
||
441 |
sensor:aSensor |
|
442 |
"set the windowGroups sensor" |
|
443 |
||
444 |
mySensor := aSensor |
|
445 |
! ! |
|
446 |
||
447 |
!WindowGroup methodsFor:'accessing-hook'! |
|
448 |
||
449 |
postEventHook |
|
450 |
"return the postEventHook if any" |
|
451 |
||
452 |
^ postEventHook |
|
453 |
||
454 |
"Created: 7.3.1996 / 14:42:46 / cg" |
|
455 |
! |
|
456 |
||
457 |
postEventHook:anObject |
|
458 |
"set the postEventHook - this one will get all events |
|
459 |
passed after being processed here (via #processEvent:)." |
|
460 |
||
461 |
postEventHook := anObject |
|
462 |
! |
|
463 |
||
464 |
preEventHook |
|
465 |
"return the preEventHook if any" |
|
466 |
||
467 |
^ preEventHook |
|
468 |
||
469 |
"Created: 7.3.1996 / 14:42:42 / cg" |
|
470 |
! |
|
471 |
||
472 |
preEventHook:anObject |
|
473 |
"set the preEventHook - this one will get all events |
|
474 |
passed before being processed here (via #processEvent:). |
|
475 |
If this returns true, the event is supposed to be already |
|
476 |
processed and ignored here. |
|
477 |
Otherwise, it is processed as usual." |
|
478 |
||
479 |
preEventHook := anObject |
|
480 |
! ! |
|
481 |
||
482 |
!WindowGroup methodsFor:'accessing-views'! |
|
483 |
||
244 | 484 |
addTopView:aView |
485 |
"add a topview to the group" |
|
26 | 486 |
|
244 | 487 |
topViews isNil ifTrue:[ |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
488 |
topViews := OrderedCollection new. |
244 | 489 |
]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
490 |
(topViews includesIdentical:aView) ifFalse:[ |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
491 |
topViews add:aView |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
492 |
] |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
493 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
494 |
"Modified: 6.3.1996 / 15:35:15 / cg" |
26 | 495 |
! |
496 |
||
11 | 497 |
addView:aView |
26 | 498 |
"add aView to the windowGroup" |
499 |
||
11 | 500 |
views isNil ifTrue:[ |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
501 |
views := OrderedCollection new. |
11 | 502 |
]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
503 |
(views includesIdentical:aView) ifFalse:[ |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
504 |
views add:aView |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
505 |
] |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
506 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
507 |
"Modified: 6.3.1996 / 15:35:41 / cg" |
11 | 508 |
! |
509 |
||
26 | 510 |
removeView:aView |
511 |
"remove aView from the windowGroup; |
|
512 |
if this was the last view in this group, |
|
81 | 513 |
also shut down the corresponding process |
514 |
(actually, only wake it up here - it will terminate itself |
|
515 |
when finding out that all views are gone)" |
|
11 | 516 |
|
263 | 517 |
|sema| |
518 |
||
11 | 519 |
views notNil ifTrue:[ |
1304 | 520 |
views removeIdentical:aView ifAbsent:[]. |
521 |
views isEmpty ifTrue:[ |
|
522 |
views := nil |
|
523 |
] |
|
11 | 524 |
]. |
525 |
topViews notNil ifTrue:[ |
|
1304 | 526 |
topViews removeIdentical:aView ifAbsent:[]. |
527 |
topViews isEmpty ifTrue:[ |
|
528 |
topViews := nil |
|
529 |
] |
|
11 | 530 |
]. |
54 | 531 |
" |
532 |
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
|
533 |
removed (modalBoxes terminate their modalLoop if so) |
54 | 534 |
" |
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
535 |
mySensor notNil ifTrue:[ |
1304 | 536 |
(sema := mySensor eventSemaphore) notNil ifTrue:[ |
537 |
sema signal |
|
538 |
] |
|
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
539 |
] |
1304 | 540 |
|
541 |
"Modified: 1.2.1997 / 12:13:26 / cg" |
|
11 | 542 |
! |
543 |
||
244 | 544 |
topViews |
545 |
"return the topviews accociated to this windowGroup" |
|
172 | 546 |
|
244 | 547 |
^ topViews |
172 | 548 |
! |
549 |
||
244 | 550 |
views |
551 |
"return the views accociated to this windowGroup" |
|
172 | 552 |
|
244 | 553 |
^ views |
54 | 554 |
! ! |
555 |
||
244 | 556 |
!WindowGroup methodsFor:'activation / deactivation'! |
557 |
||
558 |
closeDownViews |
|
559 |
"destroy all views associated to this window group" |
|
560 |
||
561 |
topViews notNil ifTrue:[ |
|
403 | 562 |
topViews do:[:aTopView | aTopView notNil ifTrue:[aTopView destroy]] |
244 | 563 |
]. |
564 |
views := nil. |
|
565 |
topViews := nil. |
|
566 |
mySensor := nil. |
|
567 |
! |
|
568 |
||
569 |
realizeTopViews:isRestart |
|
570 |
"realize all topViews associated to this windowGroup. |
|
571 |
If this is a restart, tell topViews about it." |
|
572 |
||
573 |
topViews notNil ifTrue:[ |
|
574 |
topViews do:[:aView | |
|
575 |
aView realize. |
|
576 |
isRestart ifTrue:[ |
|
577 |
aView restarted |
|
578 |
] |
|
579 |
]. |
|
580 |
]. |
|
581 |
! |
|
180 | 582 |
|
244 | 583 |
restart |
584 |
"restart after a snapin." |
|
180 | 585 |
|
244 | 586 |
topViews notNil ifTrue:[ |
1273 | 587 |
" |
588 |
need a new semaphore, since obsolete processes |
|
589 |
(from our previous live) may still sit on the current semaphore |
|
590 |
" |
|
591 |
mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema'). |
|
592 |
isModal ifFalse:[ |
|
593 |
self startup:true |
|
594 |
] |
|
244 | 595 |
] |
1273 | 596 |
|
597 |
"Modified: 25.1.1997 / 00:20:25 / cg" |
|
244 | 598 |
! |
180 | 599 |
|
582
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
600 |
shutDown |
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
601 |
"shutdown the window group; close all views and |
1317 | 602 |
terminate the process" |
244 | 603 |
|
604 |
|p| |
|
605 |
||
606 |
self closeDownViews. |
|
607 |
myProcess notNil ifTrue:[ |
|
582
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
608 |
p := myProcess. |
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
609 |
myProcess := nil. |
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
610 |
p terminate. |
244 | 611 |
] |
582
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
612 |
|
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
613 |
"Created: 22.4.1996 / 17:58:37 / cg" |
1317 | 614 |
"Modified: 8.2.1997 / 16:46:31 / cg" |
180 | 615 |
! |
616 |
||
244 | 617 |
startup:isRestart |
618 |
"startup the window-group; |
|
619 |
this creates a new window group process, which |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
620 |
does the event processing. |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
621 |
The isRestart arg is true for an image restart; the topView |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
622 |
is opened at the old position then (this is not done here)." |
244 | 623 |
|
624 |
|top nm dev devNm| |
|
625 |
||
626 |
previousGroup := nil. |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
627 |
|
244 | 628 |
myProcess isNil ifTrue:[ |
743 | 629 |
isModal := false. |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
630 |
|
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
631 |
"/ |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
632 |
"/ this is the windowGroup process; |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
633 |
"/ realize all views, then handle events forever |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
634 |
"/ (well, not really forever ... ;-) |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
635 |
|
743 | 636 |
myProcess := [ |
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
637 |
WindowGroupQuerySignal handle:[:ex | |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
638 |
ex proceedWith:self |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
639 |
] do:[ |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
640 |
[ |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
641 |
self realizeTopViews:isRestart. |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
642 |
self eventLoopWhile:[true] onLeave:[] |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
643 |
] valueOnUnwindDo:[ |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
644 |
self closeDownViews |
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
645 |
] |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
646 |
] |
743 | 647 |
] forkAt:Processor userSchedulingPriority. |
180 | 648 |
|
743 | 649 |
(topViews notNil and:[topViews isEmpty not]) ifTrue:[ |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
650 |
"/ |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
651 |
"/ give the windowGroup process a user friendly name |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
652 |
"/ ask its topView for the processName, and |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
653 |
"/ optionally append the displayName (if its not the default) |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
654 |
"/ |
743 | 655 |
top := topViews first. |
656 |
nm := top processName. |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
657 |
|
743 | 658 |
(dev := top graphicsDevice) notNil ifTrue:[ |
659 |
devNm := dev displayName. |
|
660 |
(devNm notNil and:[devNm ~= Display displayName]) ifTrue:[ |
|
661 |
nm := nm , ' (' , devNm , ')' |
|
662 |
] |
|
663 |
] |
|
664 |
] ifFalse:[ |
|
665 |
nm := 'window handler'. |
|
666 |
]. |
|
667 |
myProcess name:nm. |
|
931
00fd4b461c31
renamed beProcessGroupLeader to beGroupLeader
Claus Gittinger <cg@exept.de>
parents:
930
diff
changeset
|
668 |
myProcess beGroupLeader. |
180 | 669 |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
670 |
"/ |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
671 |
"/ when the process gets suspended, |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
672 |
"/ there maybe still buffered draw requests. |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
673 |
"/ Arrange for them to be flushed then. |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
674 |
"/ (otherwise, you would not see the output of a process, |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
675 |
"/ which suspends and waits - or we had to add buffer flushes |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
676 |
"/ all over the place) |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
677 |
"/ |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
678 |
myProcess addSuspendAction:[ |
743 | 679 |
|dev| |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
680 |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
681 |
dev := self graphicsDevice. |
743 | 682 |
dev notNil ifTrue:[dev flush]. |
683 |
]. |
|
244 | 684 |
] |
313 | 685 |
|
686 |
"Modified: 13.12.1995 / 14:04:53 / stefan" |
|
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
687 |
"Modified: 29.1.1997 / 19:40:25 / cg" |
180 | 688 |
! |
689 |
||
244 | 690 |
startupModal:checkBlock |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
691 |
"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
|
692 |
(i.e. under the currently running process); |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
693 |
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
|
694 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
695 |
^ self startupModal:checkBlock forGroup:WindowGroup activeGroup. |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
696 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
697 |
"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
|
698 |
! |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
699 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
700 |
startupModal:checkBlock forGroup:mainGroup |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
701 |
"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
|
702 |
(i.e. under the currently running process); |
244 | 703 |
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
|
704 |
returned. |
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
705 |
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
|
706 |
event queue in order for its expose/redraws to be handled." |
244 | 707 |
|
708 |
"set previousGroup to the main (non-modal) group" |
|
180 | 709 |
|
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
710 |
previousGroup := mainGroup. |
244 | 711 |
isModal := true. |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
712 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
713 |
WindowGroupQuerySignal handle:[:ex | |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
714 |
ex proceedWith:self |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
715 |
] do:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
716 |
self realizeTopViews:false. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
717 |
self |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
718 |
eventLoopWhile:checkBlock |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
719 |
onLeave:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
720 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
721 |
cleanup, in case of a terminate |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
722 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
723 |
previousGroup := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
724 |
topViews := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
725 |
views := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
726 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
727 |
the following is rubbish; |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
728 |
the views could be reused .. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
729 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
730 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
731 |
topViews notNil ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
732 |
topViews do:[:aView | |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
733 |
aView destroy |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
734 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
735 |
topViews := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
736 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
737 |
views notNil ifTrue:[ |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
738 |
views do:[:aView | |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
739 |
aView destroy |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
740 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
741 |
views := nil. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
742 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
743 |
" |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
744 |
] |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
745 |
] |
301
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
746 |
|
b57451fd8560
passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents:
297
diff
changeset
|
747 |
"Created: 10.12.1995 / 14:14:26 / cg" |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
748 |
"Modified: 17.7.1996 / 15:40:37 / cg" |
180 | 749 |
! ! |
750 |
||
90 | 751 |
!WindowGroup methodsFor:'enumerating'! |
54 | 752 |
|
1117 | 753 |
allNonTopViewsDo:aBlock |
754 |
"evaluate aBlock for all nonTopviews (i.e. subviews) in this group. |
|
1334 | 755 |
This enumerates a copy of the view collection, to allow for |
1240 | 756 |
destroy and other collection changing operations to be performed in the loop." |
1117 | 757 |
|
758 |
views notNil ifTrue:[ |
|
759 |
views copy nonNilElementsDo:aBlock |
|
760 |
] |
|
1334 | 761 |
|
762 |
"Modified: 12.2.1997 / 12:20:25 / cg" |
|
1117 | 763 |
! |
764 |
||
1153 | 765 |
allTopViewsDo:aBlock |
766 |
"evaluate aBlock for all topviews in this group. |
|
1334 | 767 |
This enumerates a copy of the view collection, to allow for |
1240 | 768 |
destroy and other collection changing operations to be performed in the loop." |
1153 | 769 |
|
770 |
topViews notNil ifTrue:[ |
|
1334 | 771 |
topViews copy nonNilElementsDo:aBlock |
1153 | 772 |
] |
1334 | 773 |
|
774 |
"Modified: 12.2.1997 / 12:20:30 / cg" |
|
1153 | 775 |
! |
776 |
||
54 | 777 |
allTopViewsExcept:aView do:aBlock |
157 | 778 |
"evaluate aBlock for all topviews except aView in this group. |
1334 | 779 |
This enumerates a copy of the view collection, to allow for |
1240 | 780 |
destroy and other collection changing operations to be performed in the loop." |
157 | 781 |
|
1334 | 782 |
self allTopViewsDo:[:v | |
783 |
v ~~ aView ifTrue:[aBlock value:v] |
|
157 | 784 |
]. |
1334 | 785 |
|
786 |
"Modified: 12.2.1997 / 12:22:10 / cg" |
|
157 | 787 |
! |
788 |
||
244 | 789 |
allViewsDo:aBlock |
790 |
"evaluate aBlock for all views & topviews in this group. |
|
1334 | 791 |
This enumerates a copy of the view collection, to allow for |
1240 | 792 |
destroy and other collection changing operations to be performed in the loop." |
244 | 793 |
|
1117 | 794 |
self allTopViewsDo:aBlock. |
795 |
self allNonTopViewsDo:aBlock. |
|
1334 | 796 |
|
797 |
"Modified: 12.2.1997 / 12:20:20 / cg" |
|
244 | 798 |
! |
799 |
||
800 |
partnersDo:aBlock |
|
801 |
"evaluate aBlock for all partnerViews. |
|
1334 | 802 |
This enumerates a copy of the view collection, to allow for |
1240 | 803 |
destroy and other collection changing operations to be performed in the loop." |
244 | 804 |
|
1334 | 805 |
self allTopViewsDo:[:v | |
806 |
(v type == #partner) ifTrue:[aBlock value:v]. |
|
244 | 807 |
]. |
1334 | 808 |
|
809 |
"Modified: 12.2.1997 / 12:21:41 / cg" |
|
244 | 810 |
! |
811 |
||
157 | 812 |
slavesDo:aBlock |
813 |
"evaluate aBlock for all slaveViews. |
|
1334 | 814 |
This enumerates a copy of the view collection, to allow for |
1240 | 815 |
destroy and other collection changing operations to be performed in the loop." |
54 | 816 |
|
1334 | 817 |
self allTopViewsDo:[:v | |
818 |
(v type == #slave) ifTrue:[aBlock value:v]. |
|
157 | 819 |
]. |
1334 | 820 |
|
821 |
"Modified: 12.2.1997 / 12:21:46 / cg" |
|
11 | 822 |
! ! |
823 |
||
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
824 |
!WindowGroup methodsFor:'event debugging'! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
825 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
826 |
traceEvents:trueOrFalse |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
827 |
|hook| |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
828 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
829 |
trueOrFalse ifFalse:[ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
830 |
"/ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
831 |
"/ remove any eventHook on the receiver |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
832 |
"/ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
833 |
self preEventHook:nil. |
697 | 834 |
"/ Transcript showCR:'removed eventHook'. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
835 |
] ifTrue:[ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
836 |
"/ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
837 |
"/ set an eventHook on its windowGroup |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
838 |
"/ |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
839 |
hook := Plug new. |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
840 |
hook respondTo:#processEvent: |
698 | 841 |
with:[:ev | ev displayString printCR. false]. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
842 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
843 |
self preEventHook:hook. |
697 | 844 |
"/ Transcript showCR:'set eventHook for tracing'. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
845 |
] |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
846 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
847 |
"Created: 24.4.1996 / 10:25:21 / cg" |
698 | 848 |
"Modified: 20.5.1996 / 10:30:00 / cg" |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
849 |
! ! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
850 |
|
19 | 851 |
!WindowGroup methodsFor:'event handling'! |
11 | 852 |
|
244 | 853 |
eventLoop |
854 |
"loop executed by windowGroup process; |
|
855 |
wait-for and process events forever" |
|
856 |
||
857 |
self eventLoopWhile:[true] onLeave:[] |
|
858 |
! |
|
859 |
||
860 |
eventLoopWhile:aBlock onLeave:cleanupActions |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
861 |
"wait-for and process events. |
244 | 862 |
Stay in this loop while there are still any views to dispatch for, |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
863 |
and aBlock evaluates to true. |
244 | 864 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
865 |
Some signals are cought & handled: |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
866 |
LeaveSignal forces an exit from the eventLoop; |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
867 |
AbortSignal brings us back into the loop, processing the next event; |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
868 |
ActivityNotifications send a #showActivity: if nonModal, |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
869 |
otherwise they are ignored." |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
870 |
|
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
871 |
|thisProcess sigs| |
244 | 872 |
|
873 |
thisProcess := Processor activeProcess. |
|
874 |
||
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
875 |
sigs := SignalSet |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
876 |
with:AbortSignal |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
877 |
with:LeaveSignal |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
878 |
with:ActivityNotificationSignal. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
879 |
|
244 | 880 |
[ |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
881 |
|p g mainGroup mySema waitSema| |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
882 |
|
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
883 |
waitSema := mySema := mySensor eventSemaphore. |
325
b24d9a1c74dc
stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
884 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
885 |
isModal ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
886 |
mainGroup := self mainGroup. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
887 |
mainGroup == self ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
888 |
mainGroup := nil |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
889 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
890 |
mainGroup notNil ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
891 |
waitSema := SemaphoreSet with:mySema |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
892 |
with:(mainGroup sensor eventSemaphore). |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
893 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
894 |
]. |
244 | 895 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
896 |
[aBlock value] whileTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
897 |
LastActiveGroup := self. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
898 |
LastActiveProcess := thisProcess. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
899 |
|
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
900 |
(views isNil and:[topViews isNil]) ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
901 |
myProcess notNil ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
902 |
p := myProcess. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
903 |
myProcess := nil. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
904 |
p terminate. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
905 |
"not reached - there is no life after death" |
429 | 906 |
]. |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
907 |
" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
908 |
this is the end of a modal loop |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
909 |
(not having a private process ...) |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
910 |
" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
911 |
^ self |
429 | 912 |
]. |
244 | 913 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
914 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
915 |
"/ on abort, stay in the event loop |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
916 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
917 |
sigs handle:[:ex | |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
918 |
|theSig| |
244 | 919 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
920 |
(theSig := ex signal) == AbortSignal ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
921 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
922 |
"/ on abort, stay in loop |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
923 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
924 |
ex return |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
925 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
926 |
theSig == LeaveSignal ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
927 |
"/ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
928 |
"/ on leave, exit the event loop |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
929 |
"/ |
429 | 930 |
^ self |
931 |
]. |
|
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
932 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
933 |
"/ ActivityNotification |
429 | 934 |
"/ |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
935 |
"/ if I am a modal-group, let it be handled |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
936 |
"/ by the outer main-groups handler |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
937 |
"/ otherwise show the activityMessage and continue. |
429 | 938 |
"/ |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
939 |
isModal ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
940 |
ex reject |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
941 |
"never reached" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
942 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
943 |
self showActivity:(ex errorString). |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
944 |
ex proceed. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
945 |
] do:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
946 |
|dev gotSema mainView| |
429 | 947 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
948 |
"/ no more events. Flush device output. This may produce more events. |
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
949 |
dev := self graphicsDevice. |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
950 |
dev notNil ifTrue:[dev flush]. |
328 | 951 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
952 |
thisProcess setStateTo:#eventWait if:#active. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
953 |
gotSema := waitSema wait. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
954 |
LastActiveGroup := self. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
955 |
LastActiveProcess := thisProcess. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
956 |
gotSema == mySema ifTrue:[ |
1328 | 957 |
self processEvents:false |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
958 |
] ifFalse:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
959 |
mainGroup topViews notNil ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
960 |
mainView := mainGroup topViews first |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
961 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
962 |
mainView notNil ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
963 |
(mainGroup sensor hasConfigureEventFor:mainView) ifTrue:[ |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
964 |
topViews first raiseDeiconified |
429 | 965 |
] |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
966 |
]. |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
967 |
" |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
968 |
if modal, also check for redraw events in my maingroup |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
969 |
(we arrive here after we woke up on maingroup sensor eventSemaphore) |
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
970 |
" |
1328 | 971 |
mainGroup processEvents:true. |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
972 |
] |
429 | 973 |
]. |
974 |
]. |
|
244 | 975 |
] valueNowOrOnUnwindDo:[ |
429 | 976 |
cleanupActions notNil ifTrue:[cleanupActions value] |
244 | 977 |
] |
313 | 978 |
|
325
b24d9a1c74dc
stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
979 |
"Modified: 14.12.1995 / 11:12:24 / stefan" |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
980 |
"Modified: 12.1.1997 / 00:18:57 / cg" |
244 | 981 |
! |
982 |
||
983 |
leaveEventLoop |
|
984 |
"immediately leave the event loop, returning way back. |
|
985 |
This can be used to leave (and closedown) a modal group. |
|
986 |
(for normal views, this does not make sense)" |
|
987 |
||
988 |
^ LeaveSignal raise |
|
989 |
! |
|
990 |
||
103 | 991 |
processEvents |
992 |
"process events from either the damage- or user input queues. |
|
993 |
Abort is assumed to be handled elsewhere." |
|
19 | 994 |
|
1328 | 995 |
self processEvents:false |
996 |
! |
|
997 |
||
998 |
processEvents:ignoreUserInput |
|
999 |
"process events from either the damage- or user input queues. |
|
1000 |
Abort is assumed to be handled elsewhere. |
|
1001 |
If the ignore argument is true, key- and buttonEvents are ignored; |
|
1002 |
this is used by a modalBox to handle updates of its suspended mainView." |
|
1003 |
||
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1004 |
<resource: #keyboard (#Escape )> |
496 | 1005 |
|
388
64e43f82d93e
Escape leaves modalBoxes or PopUpViews
Claus Gittinger <cg@exept.de>
parents:
387
diff
changeset
|
1006 |
|event ignore key| |
11 | 1007 |
|
72 | 1008 |
self processExposeEvents. |
180 | 1009 |
|
72 | 1010 |
[mySensor hasEvents] whileTrue:[ |
496 | 1011 |
event := mySensor nextEvent. |
1012 |
event notNil ifTrue:[ |
|
1328 | 1013 |
(ignoreUserInput not |
1014 |
or:[event isUserEvent not]) ifTrue:[ |
|
1015 |
||
1016 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
1017 |
LastEventQuerySignal handle:[:ex | |
|
1018 |
ex proceedWith:event |
|
1019 |
] do:[ |
|
1020 |
ignore := false. |
|
1021 |
||
1022 |
(preEventHook notNil |
|
1023 |
and:[preEventHook processEvent:event]) ifTrue:[ |
|
1024 |
ignore := true. |
|
1025 |
]. |
|
1026 |
ignore ifFalse:[ |
|
1027 |
event isKeyPressEvent ifTrue:[ |
|
1028 |
key := event key. |
|
1110 | 1029 |
|
1328 | 1030 |
key == #Escape ifTrue:[ |
1031 |
isModal ifTrue:[ |
|
1032 |
topViews first hideRequest |
|
1033 |
] |
|
1034 |
] |
|
1035 |
]. |
|
1036 |
event isPointerEnterEvent ifTrue:[ |
|
1037 |
pointerView := event view |
|
1038 |
]. |
|
1039 |
event isPointerLeaveEvent ifTrue:[ |
|
1040 |
pointerView := nil |
|
1041 |
]. |
|
172 | 1042 |
|
1328 | 1043 |
ignore ifFalse:[ |
1044 |
"/ |
|
1045 |
"/ button events turn off explicit focus, and revert |
|
1046 |
"/ to implicit focus control |
|
1047 |
"/ |
|
1048 |
(focusView notNil |
|
1049 |
and:[event isButtonEvent]) ifTrue:[ |
|
1050 |
self focusView:nil |
|
1051 |
]. |
|
1052 |
"/ |
|
1053 |
"/ let the event forward itself |
|
1054 |
"/ |
|
1055 |
LastActiveGroup := self. |
|
1056 |
LastActiveProcess := Processor activeProcess. |
|
1057 |
event sendEventWithFocusOn:focusView. |
|
1110 | 1058 |
] |
1059 |
]. |
|
1328 | 1060 |
postEventHook notNil ifTrue:[ |
1061 |
postEventHook processEvent:event |
|
496 | 1062 |
] |
1063 |
] |
|
1064 |
] |
|
1065 |
] |
|
1066 |
]. |
|
72 | 1067 |
] |
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1068 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1069 |
"Modified: 7.3.1996 / 17:46:27 / cg" |
48 | 1070 |
! |
1071 |
||
1072 |
processExposeEvents |
|
103 | 1073 |
"process only expose events from the damage queue" |
48 | 1074 |
|
180 | 1075 |
|event view rect x y w h sensor thisProcess| |
109 | 1076 |
|
1077 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
|
48 | 1078 |
|
180 | 1079 |
thisProcess := Processor activeProcess. |
1080 |
||
1081 |
[sensor hasDamage] whileTrue:[ |
|
1110 | 1082 |
LastActiveGroup := self. |
1083 |
LastActiveProcess := thisProcess. |
|
180 | 1084 |
|
1110 | 1085 |
event := sensor nextDamage. |
1086 |
event notNil ifTrue:[ |
|
1087 |
(views notNil or:[topViews notNil]) ifTrue:[ |
|
1088 |
LastEventQuerySignal handle:[:ex | |
|
1089 |
ex proceedWith:event |
|
1090 |
] do:[ |
|
1091 |
(preEventHook notNil |
|
1092 |
and:[preEventHook processEvent:event]) ifFalse:[ |
|
1093 |
event isDamage ifTrue:[ |
|
1094 |
view := event view. |
|
1095 |
"/ |
|
1096 |
"/ if the view is no longer shown (iconified or closed), |
|
1097 |
"/ this is a leftover event and ignored. |
|
1098 |
"/ |
|
1099 |
view shown ifTrue:[ |
|
1100 |
rect := event rectangle. |
|
1101 |
x := rect left. |
|
1102 |
y := rect top. |
|
1103 |
w := rect width. |
|
1104 |
h := rect height. |
|
1105 |
LastActiveGroup := self. |
|
1106 |
LastActiveProcess := thisProcess. |
|
1107 |
view transformation notNil ifTrue:[ |
|
1108 |
view deviceExposeX:x y:y width:w height:h |
|
1109 |
] ifFalse:[ |
|
1110 |
view exposeX:x y:y width:w height:h |
|
1111 |
] |
|
1112 |
] |
|
1113 |
] ifFalse:[ |
|
1114 |
" |
|
1115 |
mhmh - could we possibly arrive here ? |
|
1116 |
" |
|
1117 |
LastActiveGroup := self. |
|
1118 |
LastActiveProcess := thisProcess. |
|
1157 | 1119 |
event sendEventWithFocusOn:nil. |
1110 | 1120 |
] |
1121 |
]. |
|
1122 |
postEventHook notNil ifTrue:[ |
|
1123 |
postEventHook processEvent:event |
|
1124 |
] |
|
1125 |
] |
|
1126 |
] |
|
1127 |
] |
|
90 | 1128 |
] |
1157 | 1129 |
|
1130 |
"Modified: 8.1.1997 / 11:16:55 / cg" |
|
11 | 1131 |
! |
1132 |
||
28 | 1133 |
waitForExposeFor:aView |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1134 |
"wait for a noExpose event for aView, then process all exposes. |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1135 |
To be used after a scroll. |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1136 |
This is very Xspecific and not needed with other systems |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1137 |
(i.e. a synthetic noExpose may be generated there)." |
28 | 1138 |
|
1139 |
mySensor waitForExposeFor:aView. |
|
90 | 1140 |
AbortSignal catch:[ |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1141 |
self processExposeEvents |
90 | 1142 |
] |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1143 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1144 |
"Modified: 6.3.1996 / 15:58:36 / cg" |
11 | 1145 |
! ! |
19 | 1146 |
|
90 | 1147 |
!WindowGroup methodsFor:'focus control'! |
1148 |
||
244 | 1149 |
focusNext |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1150 |
"give focus to the next view in the focusSequence. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1151 |
Skip invisible views." |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1152 |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1153 |
|index index0 last next| |
244 | 1154 |
|
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1155 |
focusSequence := self focusSequence. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1156 |
(last := focusSequence size) == 0 ifTrue:[^ self]. |
244 | 1157 |
|
1158 |
focusView notNil ifTrue:[ |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1159 |
index := index0 := (focusSequence identityIndexOf:focusView). |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1160 |
] ifFalse:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1161 |
index := 0. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1162 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1163 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1164 |
[next isNil] whileTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1165 |
index := index + 1. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1166 |
index > last ifTrue:[ |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1167 |
index := 1. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1168 |
index0 isNil ifTrue:[^ self]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1169 |
]. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1170 |
index == index0 ifTrue:[^ self]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1171 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1172 |
next := (focusSequence at:index). |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1173 |
next realized not ifTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1174 |
next := nil |
1364 | 1175 |
] ifFalse:[ |
1176 |
next enabled ifFalse:[ |
|
1177 |
next := nil |
|
1178 |
] |
|
1179 |
] |
|
244 | 1180 |
]. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1181 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1182 |
self focusView:next |
244 | 1183 |
|
1184 |
" |
|
1185 |
|top v1 v2| |
|
1186 |
||
1187 |
top := StandardSystemView new. |
|
1188 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
1189 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
1190 |
top open. |
|
1191 |
top windowGroup focusSequence:(Array with:v1 with:v2). |
|
1192 |
top windowGroup focusOn:v1. |
|
1193 |
(Delay forSeconds:10) wait. |
|
1194 |
top windowGroup focusNext. |
|
1195 |
" |
|
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1196 |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1197 |
"Modified: 17.7.1996 / 12:27:30 / cg" |
244 | 1198 |
! |
1199 |
||
1200 |
focusPrevious |
|
1201 |
"give focus to previous view in focusSequence" |
|
1202 |
||
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1203 |
|index prev index0| |
244 | 1204 |
|
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1205 |
focusSequence := self focusSequence. |
244 | 1206 |
focusSequence size == 0 ifTrue:[^ self]. |
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1207 |
|
244 | 1208 |
focusView notNil ifTrue:[ |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1209 |
index := index0 := (focusSequence identityIndexOf:focusView). |
244 | 1210 |
] ifFalse:[ |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1211 |
index := focusSequence size + 1. |
244 | 1212 |
]. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1213 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1214 |
[prev isNil] whileTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1215 |
index := index - 1. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1216 |
index < 1 ifTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1217 |
index := focusSequence size. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1218 |
index0 isNil ifTrue:[^ self]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1219 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1220 |
index == index0 ifTrue:[^ self]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1221 |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1222 |
prev := (focusSequence at:index). |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1223 |
prev realized not ifTrue:[ |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1224 |
prev := nil |
1364 | 1225 |
] ifFalse:[ |
1226 |
prev enabled ifFalse:[ |
|
1227 |
prev := nil |
|
1228 |
] |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1229 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1230 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1231 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1232 |
self focusView:prev |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1233 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1234 |
"Modified: 17.7.1996 / 12:42:10 / cg" |
244 | 1235 |
! |
1236 |
||
135 | 1237 |
focusSequence |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1238 |
"return my focus sequence for focusNext/focusPrevious. |
135 | 1239 |
Focus is stepped in the order in which subviews occur in |
1240 |
the sequence" |
|
1241 |
||
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1242 |
focusSequence notNil ifTrue:[^ focusSequence]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1243 |
|
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1244 |
topViews do:[:top | |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1245 |
focusSequence := top focusSequence. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1246 |
focusSequence notNil ifTrue:[^ focusSequence]. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1247 |
]. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1248 |
|
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1249 |
^ nil |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1250 |
|
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1251 |
"Modified: 6.3.1996 / 17:50:01 / cg" |
135 | 1252 |
! |
1253 |
||
90 | 1254 |
focusSequence:aSequenceableCollection |
1255 |
"define the focus sequence for focusNext/focusPrevious. |
|
1256 |
Focus is stepped in the order in which subviews occur in |
|
1257 |
the sequence" |
|
1258 |
||
1259 |
focusSequence := aSequenceableCollection |
|
1260 |
! |
|
1261 |
||
1262 |
focusView |
|
135 | 1263 |
"return the view which currently has the focus" |
90 | 1264 |
|
1265 |
^ focusView |
|
1266 |
! |
|
1267 |
||
1268 |
focusView:aViewOrNil |
|
1269 |
"give focus to aViewOrNil" |
|
1270 |
||
410
9d9d03fa5d82
moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1271 |
focusView == aViewOrNil ifTrue:[^ self]. |
9d9d03fa5d82
moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1272 |
|
90 | 1273 |
focusView notNil ifTrue:[ |
777
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1274 |
"/ lost explicit focus |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1275 |
focusView == aViewOrNil ifTrue:[^ self]. |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1276 |
focusView showNoFocus:true. |
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1277 |
] ifFalse:[ |
777
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1278 |
pointerView notNil ifTrue:[ |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1279 |
pointerView ~~ aViewOrNil ifTrue:[ |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1280 |
"/ lost implicit focus |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1281 |
pointerView showNoFocus:false |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1282 |
] |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1283 |
]. |
90 | 1284 |
]. |
387
aa80487842b8
compile event classes with optSpace;
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
1285 |
|
90 | 1286 |
focusView := aViewOrNil. |
1287 |
focusView notNil ifTrue:[ |
|
777
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1288 |
"/ got explicit focus |
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1289 |
focusView showFocus:true. |
90 | 1290 |
]. |
1291 |
||
1292 |
" |
|
1293 |
|top v1 v2| |
|
1294 |
||
1295 |
top := StandardSystemView new. |
|
1296 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
1297 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
1298 |
top open. |
|
1299 |
top windowGroup focusView:v1. |
|
1300 |
" |
|
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1301 |
|
777
4d0b66f65346
search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents:
743
diff
changeset
|
1302 |
"Modified: 31.5.1996 / 21:13:25 / cg" |
244 | 1303 |
! ! |
1304 |
||
1305 |
!WindowGroup methodsFor:'initialization'! |
|
1306 |
||
1307 |
initialize |
|
1308 |
"setup the windowgroup, by creating a new sensor |
|
1309 |
and an event semaphore" |
|
1310 |
||
1311 |
mySensor := WindowSensor new. |
|
1273 | 1312 |
mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema'). |
244 | 1313 |
isModal := false. |
417 | 1314 |
isForModalSubview := false. |
1273 | 1315 |
|
1316 |
"Modified: 25.1.1997 / 00:20:19 / cg" |
|
90 | 1317 |
! |
1318 |
||
244 | 1319 |
reinitialize |
1320 |
"reinitialize the windowgroup after an image restart" |
|
90 | 1321 |
|
244 | 1322 |
"throw away old (zombie) process" |
1323 |
myProcess notNil ifTrue:[ |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1324 |
"/ careful: the old processes exit-actions must be cleared. |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1325 |
"/ otherwise, it might do destroy or other actions when it |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1326 |
"/ gets finalized ... |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1327 |
|
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1328 |
"/ myProcess removeAllExitActions. |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1329 |
myProcess removeAllSuspendActions. |
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1330 |
myProcess := nil. |
244 | 1331 |
]. |
90 | 1332 |
|
244 | 1333 |
"throw away old events" |
1334 |
mySensor reinitialize |
|
313 | 1335 |
|
1336 |
"Modified: 13.12.1995 / 13:45:35 / stefan" |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1337 |
"Modified: 12.1.1997 / 00:45:01 / cg" |
90 | 1338 |
! ! |
1339 |
||
19 | 1340 |
!WindowGroup methodsFor:'printing'! |
1341 |
||
90 | 1342 |
printOn:aStream |
19 | 1343 |
"return a printed representation; |
144 | 1344 |
just for more user friendlyness: add name of process." |
19 | 1345 |
|
90 | 1346 |
myProcess isNil ifTrue:[ |
1347 |
(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[ |
|
1348 |
aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')'). |
|
1349 |
^ self. |
|
1350 |
]. |
|
1351 |
^ super printOn:aStream |
|
1352 |
]. |
|
1353 |
aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')') |
|
19 | 1354 |
! ! |
244 | 1355 |
|
1356 |
!WindowGroup methodsFor:'special'! |
|
1357 |
||
1358 |
restoreCursors |
|
1359 |
"restore the original cursors in all of my views" |
|
1360 |
||
330
13a3fa93330c
careful - view could have been destroyed in the meanwhile (in restoreCursors)
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1361 |
self allViewsDo:[:aView | |
743 | 1362 |
|c dev id cid| |
244 | 1363 |
|
743 | 1364 |
dev := aView graphicsDevice. |
1365 |
dev notNil ifTrue:[ |
|
1366 |
(id := aView id) notNil ifTrue:[ |
|
1367 |
c := aView cursor on:dev. |
|
1368 |
(cid := c id) notNil ifTrue:[ |
|
1369 |
dev setCursor:cid in:id. |
|
1370 |
] |
|
1371 |
] |
|
1372 |
] |
|
244 | 1373 |
]. |
743 | 1374 |
|
1375 |
"Modified: 28.5.1996 / 20:27:14 / cg" |
|
244 | 1376 |
! |
1377 |
||
328 | 1378 |
showActivity:someMessage |
597 | 1379 |
"some activityNotification shalt be communicated to |
1380 |
the user; |
|
1381 |
forward it to my first topView if there is one |
|
1382 |
(that one should know how to deal with it)" |
|
1383 |
||
328 | 1384 |
topViews notNil ifTrue:[ |
597 | 1385 |
topViews first showActivity:someMessage |
328 | 1386 |
] |
1387 |
||
1388 |
"Created: 16.12.1995 / 18:39:40 / cg" |
|
597 | 1389 |
"Modified: 23.4.1996 / 21:36:54 / cg" |
328 | 1390 |
! |
1391 |
||
244 | 1392 |
showCursor:aCursor |
1393 |
"change the cursor to aCursor in all of my views." |
|
1394 |
||
406 | 1395 |
|c id dev| |
244 | 1396 |
|
1397 |
c := aCursor. |
|
1398 |
self allViewsDo:[:aView | |
|
743 | 1399 |
c := c on:(dev := aView graphicsDevice). |
1400 |
(id := c id) notNil ifTrue:[ |
|
1401 |
dev setCursor:id in:aView id. |
|
1402 |
] |
|
244 | 1403 |
]. |
743 | 1404 |
|
1405 |
"Modified: 28.5.1996 / 20:27:17 / cg" |
|
244 | 1406 |
! |
1407 |
||
1408 |
withCursor:aCursor do:aBlock |
|
1409 |
"evaluate aBlock while showing aCursor in all |
|
1410 |
my views (used to show wait-cursor while doing something). |
|
1411 |
Return the result as returned by aBlock." |
|
1412 |
||
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1413 |
|oldCursors dev| |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1414 |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1415 |
dev := self graphicsDevice. |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1416 |
dev isNil ifTrue:[ |
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1417 |
^ aBlock value |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1418 |
]. |
244 | 1419 |
|
1420 |
" |
|
1421 |
get mapping of view->cursor for all of my subviews |
|
1422 |
" |
|
1423 |
oldCursors := IdentityDictionary new. |
|
1424 |
self allViewsDo:[:aView | |
|
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1425 |
|old| |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1426 |
|
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1427 |
old := aView cursor. |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1428 |
old ~~ aCursor ifTrue:[ |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1429 |
oldCursors at:aView put:old. |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1430 |
aView cursor:aCursor now:false |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1431 |
] |
244 | 1432 |
]. |
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1433 |
|
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1434 |
oldCursors size == 0 ifTrue:[ |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1435 |
^ aBlock value |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1436 |
]. |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1437 |
|
329
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1438 |
"/ |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1439 |
"/ here sync looks better; flush leads to almost invisible cursors when accepting. |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1440 |
"/ I dont really know why (maybe unix does not context-switch to the Xserver |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1441 |
"/ early enough after the requests have been sent ?) |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1442 |
"/ |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1443 |
"/ dev flush. |
8a34deadc4ff
sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents:
328
diff
changeset
|
1444 |
dev sync. |
244 | 1445 |
|
1446 |
^ aBlock valueNowOrOnUnwindDo:[ |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1447 |
" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1448 |
restore cursors from the mapping |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1449 |
" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1450 |
oldCursors keysAndValuesDo:[:view :cursor | |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1451 |
view cursor:cursor now:false. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1452 |
]. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1453 |
dev flush "/ sync. |
244 | 1454 |
] |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1455 |
|
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1456 |
"Modified: 27.2.1997 / 17:21:37 / cg" |
408 | 1457 |
! |
1458 |
||
1459 |
withWaitCursorDo:aBlock |
|
1460 |
"evaluate aBlock while showing a waitCursor in all |
|
1461 |
my views (used to show wait-cursor while doing something time consuming). |
|
1462 |
Return the result as returned by aBlock." |
|
1463 |
||
1464 |
^ self withCursor:(Cursor wait) do:aBlock |
|
1465 |
||
1466 |
"Created: 6.2.1996 / 19:51:53 / cg" |
|
244 | 1467 |
! ! |
1468 |
||
1469 |
!WindowGroup methodsFor:'special accessing'! |
|
1470 |
||
429 | 1471 |
isForModalSubview |
1472 |
"special for windowgroups for modal subviews. |
|
1473 |
These must be flagged specially to avoid the views being reassigned |
|
1474 |
to the maingroup. |
|
1475 |
This is a private interface to the SimpleView class" |
|
1476 |
||
1477 |
^ isForModalSubview |
|
1478 |
! |
|
1479 |
||
1480 |
isForModalSubview:aBoolean |
|
1481 |
"special for windowgroups for modal subviews. |
|
1482 |
These must be flagged specially to avoid the views being reassigned |
|
1483 |
to the maingroup. |
|
1484 |
This is a private interface to the SimpleView class" |
|
1485 |
||
1486 |
isForModalSubview := aBoolean |
|
1487 |
! |
|
1488 |
||
244 | 1489 |
setModal:aBoolean |
1490 |
"special entry for debugger: set the modal flag. |
|
1491 |
Not for public use" |
|
1492 |
||
1493 |
isModal := aBoolean |
|
1494 |
||
1495 |
"Modified: 3.9.1995 / 14:51:04 / claus" |
|
1496 |
! |
|
1497 |
||
1498 |
setPreviousGroup:aGroup |
|
1499 |
"special entry for debugger: |
|
1500 |
set the windowgroup that started this group (for modal groups only). |
|
1501 |
This is not a public interface." |
|
1502 |
||
1503 |
previousGroup := aGroup |
|
1504 |
||
1505 |
"Modified: 3.9.1995 / 14:55:40 / claus" |
|
1506 |
! |
|
1507 |
||
1508 |
setProcess:aProcess |
|
1509 |
"special entry for debugger: set the windowGroups process. |
|
1510 |
Not for public use." |
|
1511 |
||
1512 |
myProcess := aProcess |
|
1513 |
||
1514 |
"Modified: 3.9.1995 / 14:25:38 / claus" |
|
1515 |
! ! |
|
1516 |
||
1110 | 1517 |
!WindowGroup class methodsFor:'documentation'! |
251 | 1518 |
|
1519 |
version |
|
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
1520 |
^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.107 1997-02-28 09:25:28 cg Exp $' |
251 | 1521 |
! ! |
244 | 1522 |
WindowGroup initialize! |