author | ca |
Fri, 08 Oct 1999 11:05:34 +0200 | |
changeset 2959 | a7969f737425 |
parent 2958 | 128f33a77fb1 |
child 2962 | c60ec983a6f3 |
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 |
|
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
14 |
instanceVariableNames:'graphicsDevice views topViews myProcess mySensor isModal |
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
15 |
previousGroup focusView focusSequence preEventHook postEventHook |
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
16 |
pointerView isForModalSubview focusByTab groupHasFocus' |
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 |
2723 | 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 |
1503 | 48 |
event queue (therefore subviews all share the same input event queue). |
144 | 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 |
|
2723 | 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: |
2723 | 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 |
|
2723 | 124 |
views collection of views of this group |
103 | 125 |
|
2723 | 126 |
topViews collection of topviews of this group |
103 | 127 |
|
2723 | 128 |
myProcess the process executing the events |
103 | 129 |
|
2723 | 130 |
mySensor my input sensor |
103 | 131 |
|
2723 | 132 |
isModal true if this is for a modal box |
103 | 133 |
|
2723 | 134 |
previousGroup if modal, the group that started this one |
103 | 135 |
|
2723 | 136 |
focusView the one that has the keyboard focus (or nil) |
103 | 137 |
|
2723 | 138 |
focusByTab if focus came via tabbing |
139 |
(as opposed to an implicit focus change) |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
140 |
|
2723 | 141 |
focusSequence defines the focus sequence |
103 | 142 |
|
2723 | 143 |
preEventHook if non-nil, that one gets notified of incoming |
144 |
events BEFORE an event is dispatched. |
|
145 |
May eat events (i.e. suppress dispatch) |
|
146 |
(hook for event filters or recorders) |
|
2506 | 147 |
|
2723 | 148 |
postEventHook if non-nil, that one gets notified |
149 |
AFTER an event was dispatched. |
|
2506 | 150 |
|
2723 | 151 |
isForModalSubView |
2506 | 152 |
|
2723 | 153 |
groupHasFocus true, if this windowGroup has the focus |
2506 | 154 |
|
103 | 155 |
|
597 | 156 |
[class variables:] |
2723 | 157 |
LeaveSignal if raised, a modal box leaves (closes) |
103 | 158 |
|
2723 | 159 |
WindowGroupQuerySignal to ask for the current windowGroup, |
160 |
anywhere in the program, simply raise this |
|
161 |
signal. The raise returns nil, for processes, |
|
162 |
which are not under control of a windowGroup. |
|
163 |
(i.e. wg := WindowGroup windowGroupQuerySignal raise) |
|
1111 | 164 |
|
2723 | 165 |
LastEventQuerySignal to ask for the event which was responsible |
166 |
for being where you are (whereever that is). |
|
167 |
The raise returns nil, if you did not arrive |
|
168 |
there due to an event. |
|
169 |
(i.e. ev := WindowGroup lastEventQuerySignal raise) |
|
170 |
The event can be asked for the view, the type |
|
171 |
of event, x/y position etc. |
|
2506 | 172 |
|
173 |
||
144 | 174 |
(*) |
2723 | 175 |
due to historic reasons, many views have the controller functionality |
176 |
integrated, and handle events themself. The windowSensor takes care |
|
177 |
of this, by checking if a view has a controller, and, if so, forwarding |
|
178 |
the events to it. Otherwise, events are sent directly to the view. |
|
144 | 179 |
|
2723 | 180 |
In the future, all views will be rewritten to actually use a controller. |
181 |
Currently (being in the middle of this migration), only some views |
|
182 |
(buttons, toggles and subclasses) do so. |
|
144 | 183 |
|
103 | 184 |
For more information, read 'introduction to view programming' in the |
185 |
doc/online directory. |
|
597 | 186 |
|
612 | 187 |
[author:] |
2723 | 188 |
Claus Gittinger |
612 | 189 |
|
597 | 190 |
[see also:] |
2723 | 191 |
WindowSensor WindowEvent EventListener KeyboardForwarder |
192 |
DeviceWorkstation |
|
193 |
View StandardSystemView |
|
194 |
ApplicationModel |
|
195 |
Process ProcessorScheduler |
|
196 |
(``Working with processes (programmers manual)'': programming/processes.html#VIEWSNPROCS) |
|
46 | 197 |
" |
198 |
! ! |
|
199 |
||
1110 | 200 |
!WindowGroup class methodsFor:'initialization'! |
46 | 201 |
|
202 |
initialize |
|
203 |
LeaveSignal isNil ifTrue:[ |
|
2723 | 204 |
LeaveSignal := (Signal new) mayProceed:true. |
205 |
LeaveSignal nameClass:self message:#leaveSignal. |
|
206 |
LeaveSignal notifierString:'unhandled leave signal'. |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
207 |
|
2723 | 208 |
WindowGroupQuerySignal := QuerySignal new. |
209 |
WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal. |
|
210 |
WindowGroupQuerySignal notifierString:'query for windowgroup'. |
|
1111 | 211 |
|
2723 | 212 |
LastEventQuerySignal := QuerySignal new. |
213 |
LastEventQuerySignal nameClass:self message:#lastEventQuerySignal. |
|
214 |
LastEventQuerySignal notifierString:'query for last event'. |
|
54 | 215 |
]. |
46 | 216 |
|
217 |
"WindowGroup initialize" |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
218 |
|
1111 | 219 |
"Modified: 9.11.1996 / 17:00:53 / cg" |
46 | 220 |
! ! |
221 |
||
1110 | 222 |
!WindowGroup class methodsFor:'instance creation'! |
244 | 223 |
|
224 |
new |
|
225 |
"create and return a new WindowGroup object" |
|
226 |
||
227 |
^ self basicNew initialize |
|
228 |
! ! |
|
229 |
||
1110 | 230 |
!WindowGroup class methodsFor:'Signal constants'! |
231 |
||
232 |
lastEventQuerySignal |
|
233 |
"return the signal which is used to query for the last event" |
|
234 |
||
235 |
^ LastEventQuerySignal |
|
236 |
||
237 |
"Created: 17.7.1996 / 20:36:04 / cg" |
|
238 |
! |
|
72 | 239 |
|
240 |
leaveSignal |
|
109 | 241 |
"return the signal which is used to exit a modal loop. |
1752 | 242 |
This private signal, is always caught while a modalbox is active. |
144 | 243 |
Raising it will exit the modal loop and return from the views #openModal |
244 |
method." |
|
109 | 245 |
|
72 | 246 |
^ LeaveSignal |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
247 |
! |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
248 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
249 |
windowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
250 |
"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
|
251 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
252 |
^ WindowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
253 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
254 |
"Created: 17.7.1996 / 20:36:04 / cg" |
72 | 255 |
! ! |
256 |
||
1110 | 257 |
!WindowGroup class methodsFor:'accessing'! |
26 | 258 |
|
259 |
activeGroup |
|
180 | 260 |
"return the currently active windowGroup. |
261 |
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
|
262 |
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
|
263 |
(usually) the first group is returned (prefering a modal if there is one). |
180 | 264 |
(maybe we should return a collection of windowGroups here). |
265 |
||
266 |
This method is required to simulate the historic ST-80 single display |
|
267 |
behavior for Cursor>>show / Cursor>>showWhile and some others (raising the |
|
268 |
activeGroups topView when modalBoxes appear) on multiple display screens. |
|
269 |
These methods should change the cursor for the currently |
|
270 |
active windowGroup ONLY, instead of globally affecting the display or |
|
271 |
all views |
|
272 |
(since, depending on the priority, other views could be unaffacted by this |
|
273 |
and an overall cursor change does not make sense.)" |
|
274 |
||
275 |
|activeProcess groups wg| |
|
276 |
||
277 |
Processor isNil ifTrue:[^ nil]. "/ only during very early init phase |
|
26 | 278 |
|
180 | 279 |
activeProcess := Processor activeProcess. |
280 |
" caching the last value ..." |
|
565
6867f1a9a470
oops - leftover global LastActive
Claus Gittinger <cg@exept.de>
parents:
513
diff
changeset
|
281 |
activeProcess == LastActiveProcess ifTrue:[ |
2723 | 282 |
LastActiveGroup process == LastActiveProcess ifTrue:[ |
283 |
^ LastActiveGroup |
|
284 |
] |
|
180 | 285 |
]. |
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
286 |
|
2521
fe236fa74d5b
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2519
diff
changeset
|
287 |
wg := WindowGroupQuerySignal query. |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
288 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
289 |
wg isNil ifTrue:[ |
2723 | 290 |
"/ mhmh - noone willing to answer that question ... |
291 |
"/ (how can this happen ?) |
|
292 |
groups := self scheduledWindowGroups |
|
293 |
select:[:wg | wg process == activeProcess]. |
|
294 |
groups size == 1 ifTrue:[ |
|
295 |
wg := groups anElement |
|
296 |
] ifFalse:[ |
|
297 |
wg := groups detect:[:wg | wg isModal] ifNone:nil. |
|
298 |
wg isNil ifTrue:[ |
|
299 |
wg := groups anElement |
|
300 |
] |
|
301 |
]. |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
302 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
303 |
|
180 | 304 |
wg notNil ifTrue:[ |
2723 | 305 |
LastActiveProcess := activeProcess. |
306 |
LastActiveGroup := wg. |
|
180 | 307 |
]. |
308 |
^ wg |
|
309 |
||
310 |
" |
|
311 |
WindowGroup activeGroup |
|
312 |
" |
|
313 |
||
2089 | 314 |
"Modified: / 3.9.1995 / 14:49:53 / claus" |
315 |
"Modified: / 17.4.1998 / 11:49:28 / cg" |
|
2521
fe236fa74d5b
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2519
diff
changeset
|
316 |
"Modified: / 18.3.1999 / 18:30:33 / stefan" |
54 | 317 |
! |
318 |
||
319 |
scheduledWindowGroups |
|
180 | 320 |
"return a collection of all windowGroups (possibly for different |
321 |
display devices) which are scheduled (i.e. which have a process |
|
322 |
running, handling events)." |
|
323 |
||
324 |
|set screens| |
|
325 |
||
326 |
screens := Screen allScreens. |
|
1869 | 327 |
screens size == 0 ifTrue:[^ #()]. |
180 | 328 |
|
329 |
set := IdentitySet new. |
|
330 |
screens do:[:aDevice | |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
331 |
aDevice allViewsDo:[:aView | |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
332 |
|wg| |
109 | 333 |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
334 |
(wg := aView windowGroup) notNil ifTrue:[ |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
335 |
wg process notNil ifTrue:[ |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
336 |
set add:wg |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
337 |
] |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
338 |
]. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
339 |
]. |
180 | 340 |
]. |
341 |
^ set asArray |
|
342 |
||
343 |
" |
|
344 |
WindowGroup scheduledWindowGroups |
|
345 |
" |
|
346 |
||
347 |
"Modified: 1.9.1995 / 13:43:09 / claus" |
|
1869 | 348 |
"Modified: 18.8.1997 / 18:44:29 / cg" |
244 | 349 |
! |
350 |
||
351 |
setActiveGroup:aGroup |
|
352 |
"set the currently active windowGroup. |
|
353 |
Temporary; do not use this interface, it will vanish." |
|
354 |
||
355 |
LastActiveProcess := Processor activeProcess. |
|
356 |
LastActiveGroup := aGroup |
|
26 | 357 |
! ! |
358 |
||
2723 | 359 |
!WindowGroup class methodsFor:'focus control support'! |
360 |
||
361 |
takeFocusFromDevice:aDevice |
|
362 |
|prevFocusView prevFocusGroup prevFocusCameViaTab| |
|
363 |
||
364 |
"/ |
|
365 |
"/ take the focus from whichEver view had it previously |
|
366 |
"/ |
|
367 |
prevFocusView := aDevice focusView. |
|
368 |
prevFocusView notNil ifTrue:[ |
|
369 |
(prevFocusView notNil |
|
370 |
and:[(prevFocusGroup := prevFocusView windowGroup) notNil]) ifTrue:[ |
|
371 |
prevFocusCameViaTab := prevFocusGroup focusCameByTab. |
|
372 |
||
373 |
prevFocusView showNoFocus:prevFocusCameViaTab. "/ true is bad - see pullDownMenu. |
|
374 |
prevFocusView hasKeyboardFocus:false. |
|
375 |
]. |
|
376 |
]. |
|
377 |
aDevice focusView:nil. |
|
378 |
! ! |
|
379 |
||
11 | 380 |
!WindowGroup methodsFor:'accessing'! |
381 |
||
512 | 382 |
device |
383 |
"return the device, we receive our events from" |
|
384 |
||
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
385 |
self obsoleteMethodWarning:'use #graphicsDevice'. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
386 |
^ self graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
387 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
388 |
"Modified: 5.7.1996 / 17:53:58 / cg" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
389 |
! |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
390 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
391 |
graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
392 |
"return the device, we receive our events from" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
393 |
|
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
394 |
|dev| |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
395 |
|
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
396 |
graphicsDevice notNil ifTrue:[^ graphicsDevice]. |
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
397 |
|
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
398 |
topViews notNil ifTrue:[ |
2780
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
399 |
topViews do:[:v | |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
400 |
|app| |
1116 | 401 |
|
2780
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
402 |
v notNil ifTrue:[ |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
403 |
(app := v application) notNil ifTrue:[ |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
404 |
"/ |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
405 |
"/ ok, it has an application; |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
406 |
"/ ask it for preferences. |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
407 |
"/ |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
408 |
(dev := app graphicsDevice) notNil ifTrue:[ |
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
409 |
^ (graphicsDevice := dev) |
2780
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
410 |
] |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
411 |
]. |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
412 |
(dev := v graphicsDevice) notNil ifTrue:[ |
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
413 |
^ (graphicsDevice := dev) |
2780
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
414 |
] |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
415 |
] |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
416 |
] |
512 | 417 |
]. |
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
418 |
views notNil ifTrue:[ |
2780
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
419 |
views do:[:v | |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
420 |
v notNil ifTrue:[ |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
421 |
(dev := v graphicsDevice) notNil ifTrue:[ |
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
422 |
^ (graphicsDevice := dev) |
2780
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
423 |
] |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
424 |
] |
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
425 |
] |
2170
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
426 |
]. |
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
427 |
"/ ask the previousGroup; I could be a popUp-views group, |
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
428 |
"/ which has already closed its views (and is performing its action) |
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
429 |
previousGroup notNil ifTrue:[ |
2780
05844bdd42bd
paranoia - check for nil in topViews & views lists
Claus Gittinger <cg@exept.de>
parents:
2737
diff
changeset
|
430 |
^ previousGroup graphicsDevice |
512 | 431 |
]. |
432 |
^ nil |
|
433 |
||
2170
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
434 |
"Modified: / 9.7.1998 / 18:18:08 / cg" |
512 | 435 |
! |
436 |
||
437 |
isModal |
|
438 |
"return true, if the receiver is in a modal mode |
|
439 |
(i.e. for a modal box)" |
|
440 |
||
441 |
^ isModal |
|
442 |
||
443 |
"Modified: 7.3.1996 / 14:29:46 / cg" |
|
444 |
! |
|
445 |
||
2168
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
446 |
isPopUp |
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
447 |
"return true, if the receiver is for a popUp view" |
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
448 |
|
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
449 |
isModal ifFalse:[^ false]. |
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
450 |
topViews isNil ifTrue:[^ true]. "/ a close popup ... |
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
451 |
^ topViews first isPopUpView |
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
452 |
|
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
453 |
"Created: / 9.7.1998 / 01:13:01 / cg" |
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
454 |
"Modified: / 9.7.1998 / 01:17:11 / cg" |
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
455 |
! |
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
456 |
|
512 | 457 |
mainGroup |
458 |
"return the main windowgroup (for modal groups only) |
|
459 |
that is the top one, which is not modal. |
|
460 |
NonModal groups return themSelf. |
|
461 |
||
462 |
There is one exception to this: the debugger (which is sort of modal) |
|
463 |
returns itself as mainGroup (not its debuggee)." |
|
464 |
||
465 |
|g prev| |
|
466 |
||
467 |
g := self. |
|
468 |
[g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
469 |
g := prev |
512 | 470 |
]. |
471 |
^ g |
|
472 |
||
473 |
"Modified: 3.9.1995 / 14:57:20 / claus" |
|
474 |
"Modified: 7.3.1996 / 14:29:28 / cg" |
|
475 |
! |
|
476 |
||
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
477 |
mainGroup:aWindowGroup |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
478 |
"set the main windowgroup (for modal/autonomous groups only) |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
479 |
Exposeevents for that windowGroup will be handled by this group |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
480 |
as well." |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
481 |
|
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
482 |
previousGroup := aWindowGroup |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
483 |
|
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
484 |
"Created: 20.8.1997 / 17:57:35 / cg" |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
485 |
! |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
486 |
|
512 | 487 |
previousGroup |
488 |
"return the windowgroup that started this group. (for modal groups only). |
|
489 |
This may be another modalGroup (for boxes opened by boxes). |
|
490 |
NonModal groups return nil." |
|
491 |
||
492 |
^ previousGroup |
|
493 |
||
494 |
"Modified: 7.3.1996 / 14:28:46 / cg" |
|
495 |
! |
|
496 |
||
497 |
process |
|
498 |
"return the windowGroups process" |
|
499 |
||
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
500 |
myProcess isNil ifTrue:[ |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
501 |
previousGroup notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
502 |
^ previousGroup process |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
503 |
] |
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
504 |
]. |
512 | 505 |
^ myProcess |
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
506 |
|
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
507 |
"Modified: / 17.8.1998 / 10:21:29 / cg" |
512 | 508 |
! |
509 |
||
510 |
sensor |
|
511 |
"return the windowGroups sensor. |
|
512 |
All events for any of the groups views is handled by that sensor." |
|
513 |
||
514 |
^ mySensor |
|
515 |
||
516 |
"Modified: 7.3.1996 / 14:30:21 / cg" |
|
517 |
! |
|
518 |
||
519 |
sensor:aSensor |
|
520 |
"set the windowGroups sensor" |
|
521 |
||
522 |
mySensor := aSensor |
|
523 |
! ! |
|
524 |
||
525 |
!WindowGroup methodsFor:'accessing-hook'! |
|
526 |
||
527 |
postEventHook |
|
528 |
"return the postEventHook if any" |
|
529 |
||
530 |
^ postEventHook |
|
531 |
||
532 |
"Created: 7.3.1996 / 14:42:46 / cg" |
|
533 |
! |
|
534 |
||
535 |
postEventHook:anObject |
|
536 |
"set the postEventHook - this one will get all events |
|
537 |
passed after being processed here (via #processEvent:)." |
|
538 |
||
539 |
postEventHook := anObject |
|
540 |
! |
|
541 |
||
542 |
preEventHook |
|
543 |
"return the preEventHook if any" |
|
544 |
||
545 |
^ preEventHook |
|
546 |
||
547 |
"Created: 7.3.1996 / 14:42:42 / cg" |
|
548 |
! |
|
549 |
||
550 |
preEventHook:anObject |
|
551 |
"set the preEventHook - this one will get all events |
|
552 |
passed before being processed here (via #processEvent:). |
|
553 |
If this returns true, the event is supposed to be already |
|
554 |
processed and ignored here. |
|
555 |
Otherwise, it is processed as usual." |
|
556 |
||
557 |
preEventHook := anObject |
|
558 |
! ! |
|
559 |
||
560 |
!WindowGroup methodsFor:'accessing-views'! |
|
561 |
||
244 | 562 |
addTopView:aView |
563 |
"add a topview to the group" |
|
26 | 564 |
|
244 | 565 |
topViews isNil ifTrue:[ |
2723 | 566 |
topViews := OrderedCollection with:aView. |
2445 | 567 |
] ifFalse:[ |
2723 | 568 |
(topViews includesIdentical:aView) ifFalse:[ |
569 |
topViews add:aView |
|
570 |
] |
|
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
571 |
] |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
572 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
573 |
"Modified: 6.3.1996 / 15:35:15 / cg" |
26 | 574 |
! |
575 |
||
11 | 576 |
addView:aView |
26 | 577 |
"add aView to the windowGroup" |
578 |
||
11 | 579 |
views isNil ifTrue:[ |
2723 | 580 |
views := OrderedCollection with:aView. |
2445 | 581 |
] ifFalse:[ |
2723 | 582 |
(views includesIdentical:aView) ifFalse:[ |
583 |
views add:aView |
|
584 |
] |
|
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
585 |
] |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
586 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
587 |
"Modified: 6.3.1996 / 15:35:41 / cg" |
11 | 588 |
! |
589 |
||
2445 | 590 |
mainView |
591 |
"return the mainview. Thats the first topView by default" |
|
592 |
||
593 |
topViews size == 0 ifTrue:[ ^ nil]. |
|
594 |
^ topViews first |
|
595 |
! |
|
596 |
||
26 | 597 |
removeView:aView |
598 |
"remove aView from the windowGroup; |
|
599 |
if this was the last view in this group, |
|
81 | 600 |
also shut down the corresponding process |
601 |
(actually, only wake it up here - it will terminate itself |
|
602 |
when finding out that all views are gone)" |
|
11 | 603 |
|
263 | 604 |
|sema| |
605 |
||
11 | 606 |
views notNil ifTrue:[ |
2723 | 607 |
views removeIdentical:aView ifAbsent:nil. |
608 |
views isEmpty ifTrue:[ |
|
609 |
views := nil |
|
610 |
] |
|
11 | 611 |
]. |
612 |
topViews notNil ifTrue:[ |
|
2723 | 613 |
topViews removeIdentical:aView ifAbsent:nil. |
614 |
topViews isEmpty ifTrue:[ |
|
615 |
topViews := nil |
|
616 |
] |
|
11 | 617 |
]. |
54 | 618 |
" |
619 |
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
|
620 |
removed (modalBoxes terminate their modalLoop if so) |
54 | 621 |
" |
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
622 |
mySensor notNil ifTrue:[ |
2723 | 623 |
(sema := mySensor eventSemaphore) notNil ifTrue:[ |
624 |
sema signal |
|
625 |
] |
|
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
626 |
] |
1304 | 627 |
|
628 |
"Modified: 1.2.1997 / 12:13:26 / cg" |
|
11 | 629 |
! |
630 |
||
244 | 631 |
topViews |
2445 | 632 |
"return the topviews associated to this windowGroup" |
172 | 633 |
|
244 | 634 |
^ topViews |
172 | 635 |
! |
636 |
||
244 | 637 |
views |
2445 | 638 |
"return the views associated to this windowGroup" |
172 | 639 |
|
244 | 640 |
^ views |
54 | 641 |
! ! |
642 |
||
244 | 643 |
!WindowGroup methodsFor:'activation / deactivation'! |
644 |
||
645 |
closeDownViews |
|
646 |
"destroy all views associated to this window group" |
|
647 |
||
648 |
topViews notNil ifTrue:[ |
|
2723 | 649 |
topViews do:[:aTopView | |
650 |
aTopView notNil ifTrue:[ |
|
651 |
aTopView destroy |
|
652 |
] |
|
653 |
] |
|
244 | 654 |
]. |
655 |
views := nil. |
|
656 |
topViews := nil. |
|
657 |
mySensor := nil. |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
658 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
659 |
"Modified: / 6.5.1999 / 09:47:18 / cg" |
244 | 660 |
! |
661 |
||
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
662 |
realizeTopViews |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
663 |
"realize all topViews associated to this windowGroup." |
244 | 664 |
|
665 |
topViews notNil ifTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
666 |
topViews do:[:aView | |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
667 |
aView realize. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
668 |
]. |
244 | 669 |
]. |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
670 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
671 |
"Created: 24.7.1997 / 12:56:09 / cg" |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
672 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
673 |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
674 |
restart |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
675 |
"restart after a snapin. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
676 |
This re-creates the windowGroup process and informs |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
677 |
my views." |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
678 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
679 |
topViews notNil ifTrue:[ |
2723 | 680 |
" |
681 |
need a new semaphore, since obsolete processes |
|
682 |
(from our previous live) may still sit on the current semaphore |
|
683 |
" |
|
684 |
mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema'). |
|
685 |
isModal ifFalse:[ |
|
686 |
self startupWith:[self restartTopViews]. |
|
687 |
] |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
688 |
] |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
689 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
690 |
"Modified: / 6.5.1999 / 09:46:08 / cg" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
691 |
! |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
692 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
693 |
restartTopViews |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
694 |
"inform all topViews associated to this windowGroup. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
695 |
about the restart." |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
696 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
697 |
topViews notNil ifTrue:[ |
2723 | 698 |
topViews do:[:aView | |
699 |
aView isPopUpView ifFalse:[ |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
700 |
"/ aView realize. |
2723 | 701 |
aView restarted |
702 |
]. |
|
703 |
]. |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
704 |
]. |
180 | 705 |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
706 |
"Modified: / 6.5.1999 / 09:42:37 / cg" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
707 |
"Created: / 6.5.1999 / 09:46:33 / cg" |
244 | 708 |
! |
180 | 709 |
|
582
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
710 |
shutDown |
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
711 |
"shutdown the window group; close all views and |
1317 | 712 |
terminate the process" |
244 | 713 |
|
714 |
|p| |
|
715 |
||
716 |
self closeDownViews. |
|
717 |
myProcess notNil ifTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
718 |
p := myProcess. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
719 |
myProcess := nil. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
720 |
p terminate. |
244 | 721 |
] |
582
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
722 |
|
dbb1d19a1065
obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents:
565
diff
changeset
|
723 |
"Created: 22.4.1996 / 17:58:37 / cg" |
1317 | 724 |
"Modified: 8.2.1997 / 16:46:31 / cg" |
180 | 725 |
! |
726 |
||
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
727 |
startupModal:checkBlock |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
728 |
"startup the window-group in a modal loop |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
729 |
(i.e. under the currently running process); |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
730 |
checkBlock is evaluated and the modal loop is left, |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
731 |
whenever false is returned." |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
732 |
|
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
733 |
^ self startupModal:checkBlock forGroup:(WindowGroup activeGroup). |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
734 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
735 |
"Created: 10.12.1995 / 14:15:11 / cg" |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
736 |
"Modified: 20.8.1997 / 17:54:33 / cg" |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
737 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
738 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
739 |
startupModal:checkBlock forGroup:mainGroup |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
740 |
"startup the window-group in a modal loop |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
741 |
(i.e. under the currently running process); |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
742 |
checkBlock is evaluated and loop is left, when false is |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
743 |
returned. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
744 |
The mainGroup info is required to allow peeking into its |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
745 |
event queue in order for its expose/redraws to be handled." |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
746 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
747 |
"set previousGroup to the main (non-modal) group" |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
748 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
749 |
previousGroup := mainGroup. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
750 |
isModal := true. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
751 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
752 |
WindowGroupQuerySignal handle:[:ex | |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
753 |
ex proceedWith:self |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
754 |
] do:[ |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
755 |
self realizeTopViews. |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
756 |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
757 |
self |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
758 |
eventLoopWhile:checkBlock |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
759 |
onLeave:[ |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
760 |
" |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
761 |
cleanup, in case of a terminate |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
762 |
" |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
763 |
previousGroup := nil. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
764 |
topViews := nil. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
765 |
views := nil. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
766 |
" |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
767 |
the following is rubbish; |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
768 |
the views could be reused .. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
769 |
" |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
770 |
|
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
771 |
"/ topViews notNil ifTrue:[ |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
772 |
"/ topViews do:[:aView | |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
773 |
"/ aView destroy |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
774 |
"/ ]. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
775 |
"/ topViews := nil. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
776 |
"/ ]. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
777 |
"/ views notNil ifTrue:[ |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
778 |
"/ views do:[:aView | |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
779 |
"/ aView destroy |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
780 |
"/ ]. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
781 |
"/ views := nil. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
782 |
"/ ]. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
783 |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
784 |
] |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
785 |
] |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
786 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
787 |
"Created: 10.12.1995 / 14:14:26 / cg" |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
788 |
"Modified: 20.8.1997 / 18:12:20 / cg" |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
789 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
790 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
791 |
startupWith:startupAction |
244 | 792 |
"startup the window-group; |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
793 |
this creates a new window group process, which does the event processing. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
794 |
The startupAction arg is evaluated by the windowGroup process, |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
795 |
before the eventLoop is entered, and is used to realize any views. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
796 |
[this is done to have the new process realize its views, instead of |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
797 |
the caller - which may make a difference in case of errors and/or |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
798 |
blocking operations ...]" |
244 | 799 |
|
2958
128f33a77fb1
added a hook to allow interception of new-sub-application
ca
parents:
2957
diff
changeset
|
800 |
|top nm dev devNm invokingApp| |
244 | 801 |
|
802 |
previousGroup := nil. |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
803 |
|
244 | 804 |
myProcess isNil ifTrue:[ |
2851 | 805 |
isModal := false. |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
806 |
|
2851 | 807 |
"/ |
808 |
"/ this is the windowGroup process; |
|
809 |
"/ realize all views, then handle events forever |
|
810 |
"/ (well, not really forever ... ;-) |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
811 |
|
2851 | 812 |
myProcess := [ |
813 |
WindowGroupQuerySignal handle:[:ex | |
|
814 |
ex proceedWith:self |
|
815 |
] do:[ |
|
816 |
[ |
|
817 |
startupAction value. |
|
818 |
self eventLoopWhile:[true] onLeave:[] |
|
819 |
] valueNowOrOnUnwindDo:[ |
|
2878 | 820 |
|dev| |
821 |
||
822 |
(dev := self graphicsDevice) notNil ifTrue:[ |
|
823 |
dev deviceIOErrorSignal handle:[:ex | |
|
824 |
] do:[ |
|
825 |
self closeDownViews |
|
826 |
] |
|
2860
8616722bff39
handle errors when closing views.
Claus Gittinger <cg@exept.de>
parents:
2857
diff
changeset
|
827 |
] |
2851 | 828 |
] |
829 |
] |
|
830 |
] newProcess. |
|
831 |
myProcess priority:(Processor userSchedulingPriority). |
|
180 | 832 |
|
2851 | 833 |
(topViews size > 0) ifTrue:[ |
834 |
"/ |
|
835 |
"/ give the windowGroup process a user friendly name |
|
836 |
"/ ask its topView for the processName, and |
|
837 |
"/ optionally append the displayName (if its not the default) |
|
838 |
"/ |
|
839 |
top := topViews first. |
|
840 |
nm := top processName. |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
841 |
|
2851 | 842 |
(dev := top graphicsDevice) notNil ifTrue:[ |
843 |
devNm := dev displayName. |
|
844 |
(devNm notNil and:[devNm ~= Display displayName]) ifTrue:[ |
|
845 |
nm := nm , ' (' , devNm , ')' |
|
846 |
] |
|
847 |
] |
|
848 |
] ifFalse:[ |
|
849 |
nm := 'window handler'. |
|
850 |
]. |
|
851 |
myProcess name:nm. |
|
2957 | 852 |
"/ myProcess beGroupLeader. |
853 |
myProcess beGUIProcess. |
|
180 | 854 |
|
2851 | 855 |
"/ |
856 |
"/ when the process gets suspended, |
|
857 |
"/ there maybe still buffered draw requests. |
|
858 |
"/ Arrange for them to be flushed then. |
|
859 |
"/ (otherwise, you would not see the output of a process, |
|
860 |
"/ which suspends and waits - or we had to add buffer flushes |
|
861 |
"/ all over the place) |
|
862 |
"/ |
|
863 |
myProcess addSuspendAction:[ |
|
864 |
|dev| |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
865 |
|
2851 | 866 |
dev := self graphicsDevice. |
867 |
dev notNil ifTrue:[dev flush]. |
|
868 |
]. |
|
869 |
||
2958
128f33a77fb1
added a hook to allow interception of new-sub-application
ca
parents:
2957
diff
changeset
|
870 |
"/ allow for the currently active application, |
128f33a77fb1
added a hook to allow interception of new-sub-application
ca
parents:
2957
diff
changeset
|
871 |
"/ to hook on new-application process creation. |
2959 | 872 |
( (invokingApp := WindowGroup activeGroup) notNil |
873 |
and:[(invokingApp := invokingApp mainGroup) notNil |
|
874 |
and:[(invokingApp := invokingApp mainView) notNil |
|
875 |
and:[(invokingApp := invokingApp application) notNil]]] |
|
876 |
) ifTrue:[ |
|
877 |
||
878 |
"/ CLAUS |
|
2958
128f33a77fb1
added a hook to allow interception of new-sub-application
ca
parents:
2957
diff
changeset
|
879 |
invokingApp postApplicationProcessCreate:myProcess windowGroup:self. |
128f33a77fb1
added a hook to allow interception of new-sub-application
ca
parents:
2957
diff
changeset
|
880 |
]. |
128f33a77fb1
added a hook to allow interception of new-sub-application
ca
parents:
2957
diff
changeset
|
881 |
|
2851 | 882 |
myProcess resume. |
244 | 883 |
] |
313 | 884 |
|
1965 | 885 |
"Modified: / 13.12.1995 / 14:04:53 / stefan" |
886 |
"Created: / 24.7.1997 / 12:52:04 / cg" |
|
887 |
"Modified: / 4.12.1997 / 14:13:35 / cg" |
|
180 | 888 |
! ! |
889 |
||
90 | 890 |
!WindowGroup methodsFor:'enumerating'! |
54 | 891 |
|
1117 | 892 |
allNonTopViewsDo:aBlock |
893 |
"evaluate aBlock for all nonTopviews (i.e. subviews) in this group. |
|
1334 | 894 |
This enumerates a copy of the view collection, to allow for |
1240 | 895 |
destroy and other collection changing operations to be performed in the loop." |
1117 | 896 |
|
897 |
views notNil ifTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
898 |
views copy nonNilElementsDo:aBlock |
1117 | 899 |
] |
1334 | 900 |
|
901 |
"Modified: 12.2.1997 / 12:20:25 / cg" |
|
1117 | 902 |
! |
903 |
||
1153 | 904 |
allTopViewsDo:aBlock |
905 |
"evaluate aBlock for all topviews in this group. |
|
1334 | 906 |
This enumerates a copy of the view collection, to allow for |
1240 | 907 |
destroy and other collection changing operations to be performed in the loop." |
1153 | 908 |
|
909 |
topViews notNil ifTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
910 |
topViews copy nonNilElementsDo:aBlock |
1153 | 911 |
] |
1334 | 912 |
|
913 |
"Modified: 12.2.1997 / 12:20:30 / cg" |
|
1153 | 914 |
! |
915 |
||
54 | 916 |
allTopViewsExcept:aView do:aBlock |
157 | 917 |
"evaluate aBlock for all topviews except aView in this group. |
1334 | 918 |
This enumerates a copy of the view collection, to allow for |
1240 | 919 |
destroy and other collection changing operations to be performed in the loop." |
157 | 920 |
|
1334 | 921 |
self allTopViewsDo:[:v | |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
922 |
v ~~ aView ifTrue:[aBlock value:v] |
157 | 923 |
]. |
1334 | 924 |
|
925 |
"Modified: 12.2.1997 / 12:22:10 / cg" |
|
157 | 926 |
! |
927 |
||
244 | 928 |
allViewsDo:aBlock |
929 |
"evaluate aBlock for all views & topviews in this group. |
|
1334 | 930 |
This enumerates a copy of the view collection, to allow for |
1240 | 931 |
destroy and other collection changing operations to be performed in the loop." |
244 | 932 |
|
1117 | 933 |
self allTopViewsDo:aBlock. |
934 |
self allNonTopViewsDo:aBlock. |
|
1334 | 935 |
|
936 |
"Modified: 12.2.1997 / 12:20:20 / cg" |
|
244 | 937 |
! |
938 |
||
939 |
partnersDo:aBlock |
|
940 |
"evaluate aBlock for all partnerViews. |
|
1334 | 941 |
This enumerates a copy of the view collection, to allow for |
1240 | 942 |
destroy and other collection changing operations to be performed in the loop." |
244 | 943 |
|
1334 | 944 |
self allTopViewsDo:[:v | |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
945 |
(v type == #partner) ifTrue:[aBlock value:v]. |
244 | 946 |
]. |
1334 | 947 |
|
948 |
"Modified: 12.2.1997 / 12:21:41 / cg" |
|
244 | 949 |
! |
950 |
||
157 | 951 |
slavesDo:aBlock |
952 |
"evaluate aBlock for all slaveViews. |
|
1334 | 953 |
This enumerates a copy of the view collection, to allow for |
1240 | 954 |
destroy and other collection changing operations to be performed in the loop." |
54 | 955 |
|
1334 | 956 |
self allTopViewsDo:[:v | |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
957 |
(v type == #slave) ifTrue:[aBlock value:v]. |
157 | 958 |
]. |
1334 | 959 |
|
960 |
"Modified: 12.2.1997 / 12:21:46 / cg" |
|
11 | 961 |
! ! |
962 |
||
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
963 |
!WindowGroup methodsFor:'event debugging'! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
964 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
965 |
traceEvents:trueOrFalse |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
966 |
|hook| |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
967 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
968 |
trueOrFalse ifFalse:[ |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
969 |
"/ |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
970 |
"/ remove any eventHook on the receiver |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
971 |
"/ |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
972 |
self preEventHook:nil. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
973 |
"/ Transcript showCR:'removed eventHook'. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
974 |
] ifTrue:[ |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
975 |
"/ |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
976 |
"/ set an eventHook on its windowGroup |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
977 |
"/ |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
978 |
hook := Plug new. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
979 |
hook respondTo:#processEvent: |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
980 |
with:[:ev | ev displayString printCR. false]. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
981 |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
982 |
self preEventHook:hook. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
983 |
"/ Transcript showCR:'set eventHook for tracing'. |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
984 |
] |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
985 |
|
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
986 |
"Created: 24.4.1996 / 10:25:21 / cg" |
698 | 987 |
"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
|
988 |
! ! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
989 |
|
19 | 990 |
!WindowGroup methodsFor:'event handling'! |
11 | 991 |
|
244 | 992 |
eventLoop |
993 |
"loop executed by windowGroup process; |
|
994 |
wait-for and process events forever" |
|
995 |
||
996 |
self eventLoopWhile:[true] onLeave:[] |
|
997 |
! |
|
998 |
||
999 |
eventLoopWhile:aBlock onLeave:cleanupActions |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1000 |
"wait-for and process events. |
244 | 1001 |
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
|
1002 |
and aBlock evaluates to true. |
244 | 1003 |
|
1752 | 1004 |
Some signals are caught & handled: |
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1005 |
LeaveSignal forces an exit from the eventLoop; |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1006 |
AbortSignal brings us back into the loop, processing the next event; |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1007 |
ActivityNotifications send a #showActivity: if nonModal, |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1008 |
otherwise they are ignored." |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1009 |
|
2168
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1010 |
|thisProcess sigs mainSema prevSema| |
244 | 1011 |
|
1012 |
thisProcess := Processor activeProcess. |
|
1013 |
||
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1014 |
sigs := SignalSet |
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1015 |
with:AbortSignal |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1016 |
with:LeaveSignal |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1017 |
with:(self class activityNotificationSignal). |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1018 |
|
244 | 1019 |
[ |
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1020 |
|p g s mainGroup mySema waitSema groupForSema| |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1021 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1022 |
waitSema := mySema := mySensor eventSemaphore. |
325
b24d9a1c74dc
stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents:
324
diff
changeset
|
1023 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1024 |
isModal ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1025 |
mainGroup := self mainGroup. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1026 |
mainGroup == self ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1027 |
mainGroup := nil |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1028 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1029 |
] ifFalse:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1030 |
mainGroup := previousGroup |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1031 |
]. |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1032 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1033 |
mainGroup notNil ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1034 |
mainSema := mainGroup sensor eventSemaphore. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1035 |
waitSema := SemaphoreSet with:mySema with:mainSema. |
2168
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1036 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1037 |
"/ must also care for all other groups in between |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1038 |
"/ (in case its a modal dialog opened from a modal dialog) |
2168
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1039 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1040 |
g := previousGroup. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1041 |
g ~~ mainGroup ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1042 |
groupForSema := IdentityDictionary new. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1043 |
[g ~~ mainGroup] whileTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1044 |
s := g sensor eventSemaphore. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1045 |
waitSema add:s. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1046 |
groupForSema at:s put:g. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1047 |
g := g previousGroup. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1048 |
] |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1049 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1050 |
]. |
244 | 1051 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1052 |
[aBlock value] whileTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1053 |
LastActiveGroup := self. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1054 |
LastActiveProcess := thisProcess. |
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1055 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1056 |
(views isNil and:[topViews isNil]) ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1057 |
myProcess notNil ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1058 |
p := myProcess. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1059 |
myProcess := nil. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1060 |
p terminate. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1061 |
"not reached - there is no life after death" |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1062 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1063 |
" |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1064 |
this is the end of a modal loop |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1065 |
(not having a private process ...) |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1066 |
" |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1067 |
^ self |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1068 |
]. |
244 | 1069 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1070 |
sigs handle:[:ex | |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1071 |
|theSig| |
244 | 1072 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1073 |
(theSig := ex signal) == AbortSignal ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1074 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1075 |
"/ on abort, stay in loop |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1076 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1077 |
ex return |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1078 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1079 |
theSig == LeaveSignal ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1080 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1081 |
"/ on leave, exit the event loop |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1082 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1083 |
^ self |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1084 |
]. |
323
619085d52522
be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents:
319
diff
changeset
|
1085 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1086 |
"/ ActivityNotification |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1087 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1088 |
"/ if I am a modal-group, let it be handled |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1089 |
"/ by the outer main-groups handler |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1090 |
"/ otherwise show the activityMessage and continue. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1091 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1092 |
isModal ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1093 |
ex reject |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1094 |
"never reached" |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1095 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1096 |
self showActivity:(ex errorString). |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1097 |
ex proceedWith:nil. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1098 |
] do:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1099 |
|dev gotSema mainView| |
429 | 1100 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1101 |
"/ Flush device output before going to sleep. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1102 |
"/ This may produce more events to arrive. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1103 |
"/ Q: is this still needed (see suspendAction) ? |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1104 |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1105 |
"/ dev := self graphicsDevice. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1106 |
"/ dev notNil ifTrue:[dev flush]. |
328 | 1107 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1108 |
(mainGroup notNil or:[mySensor hasEvents not]) ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1109 |
"/ now, wait for an event to arrive |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1110 |
thisProcess setStateTo:#eventWait if:#active. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1111 |
waitSema isNil ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1112 |
"/ oops - how can this happen .... |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1113 |
^ self. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1114 |
]. |
2951
961fc9375b99
Have to flush in #eventLoopWhile:onLeave: before waiting. (stefan)
Claus Gittinger <cg@exept.de>
parents:
2940
diff
changeset
|
1115 |
self graphicsDevice flush. |
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1116 |
gotSema := waitSema wait. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1117 |
] ifFalse:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1118 |
gotSema := mySema |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1119 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1120 |
LastActiveGroup := self. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1121 |
LastActiveProcess := thisProcess. |
2221
e78bd550484b
care for windows beeing closed down, while
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1122 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1123 |
"/ some bad guy ;-) could have closed all down |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1124 |
"/ in the meanwhile ... |
2440 | 1125 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1126 |
mySensor notNil ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1127 |
gotSema == mySema ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1128 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1129 |
"/ an event for me |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1130 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1131 |
self processEventsWithModalGroup:nil |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1132 |
] ifFalse:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1133 |
groupForSema notNil ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1134 |
g := groupForSema at:gotSema ifAbsent:nil. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1135 |
g := g ? mainGroup. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1136 |
] ifFalse:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1137 |
g := mainGroup |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1138 |
]. |
2168
83571b3cde37
fixed modal group handling when started from another modal group
Claus Gittinger <cg@exept.de>
parents:
2154
diff
changeset
|
1139 |
|
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1140 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1141 |
"/ an event for my mainGroup |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1142 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1143 |
g topViews notNil ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1144 |
mainView := g topViews first |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1145 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1146 |
mainView notNil ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1147 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1148 |
"/ if anything happened to the mainGroup |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1149 |
"/ bring my own topView back to the front |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1150 |
"/ This keeps modalBoxes visible |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1151 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1152 |
(g sensor hasConfigureEventFor:mainView) ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1153 |
topViews size > 0 ifTrue:[ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1154 |
topViews first raiseDeiconified |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1155 |
] |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1156 |
] |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1157 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1158 |
" |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1159 |
if modal, also check for redraw events in my maingroup |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1160 |
(we arrive here after we woke up on maingroup sensor eventSemaphore) |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1161 |
" |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1162 |
g processEventsWithModalGroup:self. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1163 |
] |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1164 |
] |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1165 |
]. |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1166 |
]. |
244 | 1167 |
] valueNowOrOnUnwindDo:[ |
2815
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1168 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1169 |
"/ perform any cleanupActions |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1170 |
"/ |
6ccd4b529067
replaced #proceed with #proceedWith:nil
Claus Gittinger <cg@exept.de>
parents:
2780
diff
changeset
|
1171 |
cleanupActions notNil ifTrue:[cleanupActions value] |
244 | 1172 |
] |
313 | 1173 |
|
2116 | 1174 |
"Modified: / 14.12.1995 / 11:12:24 / stefan" |
2440 | 1175 |
"Modified: / 5.2.1999 / 22:32:07 / cg" |
244 | 1176 |
! |
1177 |
||
1178 |
leaveEventLoop |
|
1179 |
"immediately leave the event loop, returning way back. |
|
1180 |
This can be used to leave (and closedown) a modal group. |
|
1181 |
(for normal views, this does not make sense)" |
|
1182 |
||
1183 |
^ LeaveSignal raise |
|
1184 |
! |
|
1185 |
||
103 | 1186 |
processEvents |
1187 |
"process events from either the damage- or user input queues. |
|
1188 |
Abort is assumed to be handled elsewhere." |
|
19 | 1189 |
|
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1190 |
self processEventsWithModalGroup:nil |
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1191 |
|
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1192 |
"Modified: 5.3.1997 / 11:33:51 / cg" |
1328 | 1193 |
! |
1194 |
||
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1195 |
processEventsWithModalGroup:modalGroup |
1328 | 1196 |
"process events from either the damage- or user input queues. |
1868 | 1197 |
Abort is assumed to be handled elsewhere." |
1328 | 1198 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1199 |
<resource: #keyboard (#Escape )> |
496 | 1200 |
|
2493
6de86b4cc4f6
pass keyEvents to keyboardProcessor - if there is one.
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
1201 |
|event ignore focus firstTop evView evType evArgs |
2494
792881c4d938
slight change in keyboardProcessorHandling
Claus Gittinger <cg@exept.de>
parents:
2493
diff
changeset
|
1202 |
modalTops modalTop modalDelegate syntheticEvent keyboardProcessor| |
11 | 1203 |
|
72 | 1204 |
self processExposeEvents. |
180 | 1205 |
|
2487
097d52d671a0
moved LastEventQuery handler out of the inner loop.
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
1206 |
LastEventQuerySignal handle:[:ex | |
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1207 |
ex proceedWith:event |
2487
097d52d671a0
moved LastEventQuery handler out of the inner loop.
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
1208 |
] do:[ |
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1209 |
[mySensor notNil |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1210 |
and:[(event := mySensor nextEvent) notNil]] whileTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1211 |
ignore := false. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1212 |
focus := focusView. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1213 |
modalDelegate := false. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1214 |
modalTop := nil. |
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1215 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1216 |
modalGroup notNil ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1217 |
"/ an incoming event for a masterView, |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1218 |
"/ while being blocked by some other modalView. |
1328 | 1219 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1220 |
modalTops := modalGroup topViews. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1221 |
modalTops size > 0 ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1222 |
modalTop := modalTops first. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1223 |
]. |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1224 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1225 |
event isKeyEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1226 |
"/ forward keyboard events to my modal |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1227 |
"/ groups first topView ... |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1228 |
modalTop notNil ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1229 |
focus := modalTop. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1230 |
modalDelegate := true. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1231 |
]. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1232 |
modalGroup focusView notNil ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1233 |
focus := modalGroup focusView |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1234 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1235 |
] ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1236 |
event isFocusEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1237 |
event isFocusInEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1238 |
"/ move focus over to modalBox |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1239 |
modalTop notNil ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1240 |
modalTop getKeyboardFocus. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1241 |
"/ focusIn is forwarded to the modalGroup |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1242 |
"/ (since keyboard is forwarded) |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1243 |
event view:modalTop. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1244 |
focus := modalTop. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1245 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1246 |
] ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1247 |
"/ focusOut goes to both the modal and |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1248 |
"/ the blocked main-group |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1249 |
"/ (actually, only the very first focusOut |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1250 |
"/ is needed in the mainGroup (to turn off the cursor) |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1251 |
"/ all others are only needed in the modalGroup) |
2487
097d52d671a0
moved LastEventQuery handler out of the inner loop.
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
1252 |
|
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1253 |
"/ syntheticEvent := event copy. |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1254 |
"/ syntheticEvent view:modalTop. |
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1255 |
"/ LastEventQuerySignal handle:[:ex | |
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1256 |
"/ ex proceedWith:syntheticEvent |
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1257 |
"/ ] do:[ |
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1258 |
"/ syntheticEvent sendEventWithFocusOn:nil. |
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1259 |
"/ ]. |
2487
097d52d671a0
moved LastEventQuery handler out of the inner loop.
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
1260 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1261 |
"/ event view:modalTop. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1262 |
]. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1263 |
modalDelegate := true. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1264 |
] ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1265 |
event isPointerLeaveEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1266 |
] ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1267 |
event isUserEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1268 |
ignore := true |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1269 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1270 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1271 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1272 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1273 |
]. |
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1274 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1275 |
ignore ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1276 |
(views notNil or:[topViews notNil]) ifTrue:[ |
2487
097d52d671a0
moved LastEventQuery handler out of the inner loop.
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
1277 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1278 |
"/ give eventRecorders, catchers etc. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1279 |
"/ a chance to eat or modify that event |
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1280 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1281 |
(preEventHook notNil |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1282 |
and:[preEventHook processEvent:event]) ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1283 |
ignore := true. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1284 |
]. |
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2116
diff
changeset
|
1285 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1286 |
ignore ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1287 |
evView := event view. |
2487
097d52d671a0
moved LastEventQuery handler out of the inner loop.
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
1288 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1289 |
(event isKeyEvent |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1290 |
and:[(keyboardProcessor := (modalTop ? evView topView) keyboardProcessor) notNil]) ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1291 |
ignore := keyboardProcessor processEvent:event forModalView:modalTop |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1292 |
]. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1293 |
]. |
1110 | 1294 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1295 |
ignore ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1296 |
"/ event handling below will vanish ... |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1297 |
"/ (keyboardProcessor will do it) |
2494
792881c4d938
slight change in keyboardProcessorHandling
Claus Gittinger <cg@exept.de>
parents:
2493
diff
changeset
|
1298 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1299 |
event isKeyPressEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1300 |
event key == #Escape ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1301 |
modalDelegate ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1302 |
modalTop hideRequest |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1303 |
] ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1304 |
isModal ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1305 |
topViews size > 0 ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1306 |
topViews first hideRequest |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1307 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1308 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1309 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1310 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1311 |
] ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1312 |
"/ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1313 |
"/ keep track of which view has the pointer |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1314 |
"/ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1315 |
event isPointerEnterEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1316 |
pointerView := evView |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1317 |
] ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1318 |
event isPointerLeaveEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1319 |
pointerView := nil |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1320 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1321 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1322 |
]. |
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1323 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1324 |
"/ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1325 |
"/ buttonPress events turn off explicit focus, and reverts |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1326 |
"/ to implicit focus control |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1327 |
"/ This used to be done for every click - |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1328 |
"/ but behaved ugly if clicking in a scrollbar ... |
2525 | 1329 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1330 |
event isButtonPressEvent ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1331 |
(evView wantsFocusWithButtonPress) ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1332 |
self focusView:evView. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1333 |
]. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1334 |
]. |
2494
792881c4d938
slight change in keyboardProcessorHandling
Claus Gittinger <cg@exept.de>
parents:
2493
diff
changeset
|
1335 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1336 |
LastActiveGroup := self. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1337 |
LastActiveProcess := Processor activeProcess. |
2172
6dccf11733fd
avoid a send in #processEventsWithModalGroup:
Claus Gittinger <cg@exept.de>
parents:
2170
diff
changeset
|
1338 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1339 |
" |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1340 |
if there is no view information in the event, |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1341 |
it must have been sent directly to the sensor. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1342 |
Send it to the first topView. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1343 |
" |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1344 |
evType := event type. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1345 |
evArgs := event arguments. |
2494
792881c4d938
slight change in keyboardProcessorHandling
Claus Gittinger <cg@exept.de>
parents:
2493
diff
changeset
|
1346 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1347 |
evView isNil ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1348 |
(firstTop := topViews first) notNil ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1349 |
firstTop perform:evType withArguments:evArgs |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1350 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1351 |
] ifFalse:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1352 |
evView |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1353 |
dispatchEvent:evType |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1354 |
arguments:evArgs |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1355 |
withFocusOn:focus |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1356 |
delegate:true |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1357 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1358 |
]. |
2172
6dccf11733fd
avoid a send in #processEventsWithModalGroup:
Claus Gittinger <cg@exept.de>
parents:
2170
diff
changeset
|
1359 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1360 |
"/ give eventRecorders, postProcessors |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1361 |
"/ a chance to see that event |
2487
097d52d671a0
moved LastEventQuery handler out of the inner loop.
Claus Gittinger <cg@exept.de>
parents:
2485
diff
changeset
|
1362 |
|
2940
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1363 |
postEventHook notNil ifTrue:[ |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1364 |
postEventHook processEvent:event |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1365 |
]. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1366 |
] |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1367 |
]. |
a1ee0883fde2
care for empty topViews when trying to hide one.
Claus Gittinger <cg@exept.de>
parents:
2878
diff
changeset
|
1368 |
] |
72 | 1369 |
] |
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1370 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2116
diff
changeset
|
1371 |
"Created: / 5.3.1997 / 11:33:11 / cg" |
2221
e78bd550484b
care for windows beeing closed down, while
Claus Gittinger <cg@exept.de>
parents:
2219
diff
changeset
|
1372 |
"Modified: / 4.8.1998 / 18:18:55 / cg" |
48 | 1373 |
! |
1374 |
||
1375 |
processExposeEvents |
|
103 | 1376 |
"process only expose events from the damage queue" |
48 | 1377 |
|
2407 | 1378 |
self processExposeEventsFor:nil |
1379 |
||
1380 |
"Modified: / 3.12.1998 / 14:01:57 / cg" |
|
1381 |
! |
|
1382 |
||
1383 |
processExposeEventsFor:aViewOrNil |
|
1384 |
"process only expose events from the damage queue" |
|
1385 |
||
180 | 1386 |
|event view rect x y w h sensor thisProcess| |
109 | 1387 |
|
1388 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
|
2154 | 1389 |
(sensor damageCount ~~ 0) ifTrue:[ |
2723 | 1390 |
thisProcess := Processor activeProcess. |
180 | 1391 |
|
2723 | 1392 |
[(event := sensor nextDamageEventFor:aViewOrNil) notNil] whileTrue:[ |
1393 |
LastActiveGroup := self. |
|
1394 |
LastActiveProcess := thisProcess. |
|
180 | 1395 |
|
2723 | 1396 |
(views notNil or:[topViews notNil]) ifTrue:[ |
1397 |
view := event view. |
|
1398 |
(aViewOrNil isNil or:[aViewOrNil == view]) ifTrue:[ |
|
1399 |
LastEventQuerySignal handle:[:ex | |
|
1400 |
ex proceedWith:event |
|
1401 |
] do:[ |
|
1402 |
(preEventHook notNil |
|
1403 |
and:[preEventHook processEvent:event]) ifFalse:[ |
|
1404 |
"/ |
|
1405 |
"/ if the view is no longer shown (iconified or closed), |
|
1406 |
"/ this is a leftover event and ignored. |
|
1407 |
"/ |
|
1408 |
"/ could this ever be a non-damage ? |
|
1409 |
"/ |
|
1410 |
(view shown or:[event isDamage not]) ifTrue:[ |
|
1411 |
LastActiveGroup := self. |
|
1412 |
LastActiveProcess := thisProcess. |
|
2440 | 1413 |
|
2723 | 1414 |
view |
1415 |
dispatchEvent:(event type) |
|
1416 |
arguments:(event arguments) |
|
1417 |
withFocusOn:nil |
|
1418 |
delegate:true |
|
1419 |
]. |
|
1420 |
] |
|
1421 |
]. |
|
1422 |
postEventHook notNil ifTrue:[ |
|
1423 |
postEventHook processEvent:event |
|
1424 |
] |
|
1425 |
] |
|
1426 |
] |
|
1427 |
] |
|
90 | 1428 |
] |
1157 | 1429 |
|
2407 | 1430 |
"Created: / 3.12.1998 / 14:01:39 / cg" |
2440 | 1431 |
"Modified: / 5.2.1999 / 22:26:44 / cg" |
11 | 1432 |
! |
1433 |
||
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1434 |
processRealExposeEvents |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1435 |
"process only expose events from the damage queue |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1436 |
(for any of my views). |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1437 |
This is required after a scroll operation, |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1438 |
to wait for either a noExpose or a real expose." |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1439 |
|
2093 | 1440 |
self processRealExposeEventsFor:nil |
1441 |
! |
|
1442 |
||
1443 |
processRealExposeEventsFor:someViewOrNil |
|
1444 |
"process only expose events from the damage queue |
|
1445 |
(for any of my views if the arg is nil). |
|
1446 |
This is required after a scroll operation, |
|
1447 |
to wait for either a noExpose or a real expose." |
|
1448 |
||
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1449 |
|event view rect x y w h sensor thisProcess| |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1450 |
|
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1451 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
2086
069a179b1849
dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents:
2051
diff
changeset
|
1452 |
sensor damageCount == 0 ifTrue:[^ self]. |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1453 |
|
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1454 |
thisProcess := Processor activeProcess. |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1455 |
|
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1456 |
[true] whileTrue:[ |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1457 |
LastActiveGroup := self. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1458 |
LastActiveProcess := thisProcess. |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1459 |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1460 |
"/ event := aView nextDamage. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1461 |
event := sensor nextExposeEventFor:someViewOrNil. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1462 |
event isNil ifTrue:[^ self]. |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1463 |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1464 |
(views notNil or:[topViews notNil]) ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1465 |
LastEventQuerySignal handle:[:ex | |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1466 |
ex proceedWith:event |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1467 |
] do:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1468 |
(preEventHook notNil |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1469 |
and:[preEventHook processEvent:event]) ifFalse:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1470 |
view := event view. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1471 |
"/ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1472 |
"/ if the view is no longer shown (iconified or closed), |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1473 |
"/ this is a leftover event and ignored. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1474 |
"/ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1475 |
view shown ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1476 |
rect := event rectangle. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1477 |
x := rect left. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1478 |
y := rect top. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1479 |
w := rect width. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1480 |
h := rect height. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1481 |
LastActiveGroup := self. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1482 |
LastActiveProcess := thisProcess. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1483 |
view transformation notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1484 |
view deviceExposeX:x y:y width:w height:h |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1485 |
] ifFalse:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1486 |
view exposeX:x y:y width:w height:h |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1487 |
] |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1488 |
] |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1489 |
]. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1490 |
postEventHook notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1491 |
postEventHook processEvent:event |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1492 |
] |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1493 |
] |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1494 |
] |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1495 |
] |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1496 |
|
2086
069a179b1849
dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents:
2051
diff
changeset
|
1497 |
"Created: / 2.7.1997 / 14:32:19 / cg" |
069a179b1849
dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents:
2051
diff
changeset
|
1498 |
"Modified: / 5.4.1998 / 11:35:43 / cg" |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1499 |
! |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1500 |
|
2444 | 1501 |
repairDamage |
1502 |
"repair all damaged areas for any of my views right now." |
|
1503 |
||
1504 |
self processExposeEvents |
|
1505 |
||
1506 |
! |
|
1507 |
||
28 | 1508 |
waitForExposeFor:aView |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1509 |
"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
|
1510 |
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
|
1511 |
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
|
1512 |
(i.e. a synthetic noExpose may be generated there)." |
28 | 1513 |
|
1514 |
mySensor waitForExposeFor:aView. |
|
90 | 1515 |
AbortSignal catch:[ |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1516 |
self processRealExposeEventsFor:aView |
90 | 1517 |
] |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1518 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
1519 |
"Modified: 6.8.1997 / 19:50:24 / cg" |
11 | 1520 |
! ! |
19 | 1521 |
|
90 | 1522 |
!WindowGroup methodsFor:'focus control'! |
1523 |
||
2691
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1524 |
defaultKeyboardConsumer |
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1525 |
^ nil |
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1526 |
|
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1527 |
"Created: / 20.5.1999 / 18:17:07 / cg" |
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1528 |
! |
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1529 |
|
2519 | 1530 |
explicitFocusView |
1531 |
"return the view which currently has the explicit (i.e. tabbed) focus" |
|
1532 |
||
1533 |
focusByTab == true ifFalse:[^ nil]. |
|
1534 |
^ focusView |
|
1535 |
! |
|
1536 |
||
2517 | 1537 |
focusCameByTab |
1538 |
^ focusByTab |
|
1539 |
! |
|
1540 |
||
244 | 1541 |
focusNext |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1542 |
"give focus to the next view in the focusSequence. |
2506 | 1543 |
Skip invisible & disabled widgets." |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1544 |
|
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1545 |
|index "{ Class: SmallInteger }" |
1946 | 1546 |
lastIndex "{ Class: SmallInteger }" |
1547 |
index0 next sequence| |
|
244 | 1548 |
|
1946 | 1549 |
sequence := self focusSequence. |
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1550 |
(lastIndex := sequence size) == 0 ifTrue:[ |
2723 | 1551 |
^ self |
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1552 |
]. |
244 | 1553 |
|
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1554 |
focusView isNil ifTrue:[ |
2723 | 1555 |
index := 0 |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1556 |
] ifFalse:[ |
2723 | 1557 |
index := index0 := self indexOfFocusViewInFocusSequence. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1558 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1559 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1560 |
[next isNil] whileTrue:[ |
2723 | 1561 |
index := index + 1. |
1562 |
index > lastIndex ifTrue:[ |
|
1563 |
index := 1. |
|
1564 |
index0 isNil ifTrue:[^ self ]. |
|
1565 |
]. |
|
1566 |
index == index0 ifTrue:[ |
|
1567 |
^ self |
|
1568 |
]. |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1569 |
|
2723 | 1570 |
next := (sequence at:index). |
1571 |
next realized not ifTrue:[ |
|
1572 |
next := nil |
|
1573 |
] ifFalse:[ |
|
1574 |
next enabled ifFalse:[ |
|
1575 |
next := nil |
|
1576 |
] |
|
1577 |
] |
|
244 | 1578 |
]. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1579 |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1580 |
self focusView:next byTab:true |
244 | 1581 |
|
1582 |
" |
|
1583 |
|top v1 v2| |
|
1584 |
||
1585 |
top := StandardSystemView new. |
|
1586 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
1587 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
1588 |
top open. |
|
1589 |
top windowGroup focusSequence:(Array with:v1 with:v2). |
|
1590 |
top windowGroup focusOn:v1. |
|
1591 |
(Delay forSeconds:10) wait. |
|
1592 |
top windowGroup focusNext. |
|
1593 |
" |
|
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1594 |
|
1946 | 1595 |
"Modified: / 31.10.1997 / 19:22:34 / cg" |
244 | 1596 |
! |
1597 |
||
2219 | 1598 |
focusNextFrom:aView |
1599 |
"give focus to the view after aView in the focusSequence" |
|
1600 |
||
1601 |
focusView := aView. |
|
1602 |
self focusNext |
|
1603 |
||
1604 |
"Created: / 4.8.1998 / 02:43:17 / cg" |
|
1605 |
! |
|
1606 |
||
244 | 1607 |
focusPrevious |
1608 |
"give focus to previous view in focusSequence" |
|
1609 |
||
1946 | 1610 |
|index "{ Class: SmallInteger }" |
1611 |
lastIndex "{ Class: SmallInteger }" |
|
1612 |
prev index0 sequence| |
|
244 | 1613 |
|
1946 | 1614 |
sequence := self focusSequence. |
1615 |
(lastIndex := sequence 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
|
1616 |
|
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1617 |
focusView isNil ifTrue:[ |
2723 | 1618 |
index := 0 |
244 | 1619 |
] ifFalse:[ |
2723 | 1620 |
index := self indexOfFocusViewInFocusSequence. |
1621 |
index0 := index. |
|
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1622 |
]. |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1623 |
index == 0 ifTrue:[ |
2723 | 1624 |
index := lastIndex + 1. |
244 | 1625 |
]. |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1626 |
|
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1627 |
[prev isNil] whileTrue:[ |
2723 | 1628 |
index := index - 1. |
1629 |
index < 1 ifTrue:[ |
|
1630 |
index := lastIndex. |
|
1631 |
index0 isNil ifTrue:[^ self]. |
|
1632 |
]. |
|
1633 |
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
|
1634 |
|
2723 | 1635 |
prev := (sequence at:index). |
1636 |
prev realized not ifTrue:[ |
|
1637 |
prev := nil |
|
1638 |
] ifFalse:[ |
|
1639 |
prev enabled ifFalse:[ |
|
1640 |
prev := nil |
|
1641 |
] |
|
1642 |
]. |
|
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1643 |
]. |
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1644 |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1645 |
self focusView:prev byTab:true |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1646 |
|
1946 | 1647 |
"Modified: / 31.10.1997 / 19:21:50 / cg" |
244 | 1648 |
! |
1649 |
||
2219 | 1650 |
focusPreviousFrom:aView |
1651 |
"give focus to the view before aView in the focusSequence" |
|
1652 |
||
1653 |
focusView := aView. |
|
1654 |
self focusPrevious |
|
1655 |
||
1656 |
"Created: / 4.8.1998 / 02:43:08 / cg" |
|
1657 |
! |
|
1658 |
||
2506 | 1659 |
focusRequestFrom:aView |
1660 |
"aView requests focus. I will grant it, if I have no explicit |
|
1661 |
focusView (i.e. not tabbed)" |
|
1662 |
||
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1663 |
|prevFocusView myDisplay i| |
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1664 |
|
2692 | 1665 |
"/ 'focusRequest:' print. aView print. |
1666 |
||
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1667 |
myDisplay := self graphicsDevice. |
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1668 |
(myDisplay notNil |
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1669 |
and:[myDisplay activateOnClick:nil]) ifTrue:[ |
2723 | 1670 |
prevFocusView := myDisplay focusView. |
1671 |
(prevFocusView notNil |
|
1672 |
and:[prevFocusView windowGroup ~~ aView windowGroup]) ifTrue:[ |
|
1673 |
"/ a view from another windowGroup requests the focus. |
|
1674 |
"/ Do not grant this, if in windows-activateOnClick mode. |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1675 |
|
2692 | 1676 |
"/ ' not granted' printCR. |
2723 | 1677 |
myDisplay setInputFocusTo:prevFocusView. |
1678 |
^ false |
|
1679 |
]. |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1680 |
]. |
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1681 |
|
2692 | 1682 |
"/ ' granted' printCR. |
1683 |
||
2506 | 1684 |
(focusView isNil or:[focusByTab not]) ifTrue:[ |
2723 | 1685 |
self focusView:aView byTab:false. |
1686 |
^ true |
|
2506 | 1687 |
]. |
1688 |
^ false |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
1689 |
|
2692 | 1690 |
"Modified: / 20.5.1999 / 18:30:31 / cg" |
2506 | 1691 |
! |
1692 |
||
135 | 1693 |
focusSequence |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1694 |
"return my focus sequence for focusNext/focusPrevious. |
135 | 1695 |
Focus is stepped in the order in which subviews occur in |
1696 |
the sequence" |
|
1697 |
||
1946 | 1698 |
|sequence| |
1699 |
||
1700 |
"/ a fix focusSequence ... |
|
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1701 |
focusSequence notNil ifTrue:[^ focusSequence]. |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1702 |
topViews isNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1703 |
"/ mhmh - a topView-less windowGroup ... |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1704 |
^ nil. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1705 |
]. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1706 |
|
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1707 |
topViews do:[:top | |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1708 |
sequence := top focusSequence. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1709 |
sequence notNil ifTrue:[^ sequence]. |
507
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1710 |
]. |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1711 |
|
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1712 |
^ nil |
5098d8e9be3c
oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents:
500
diff
changeset
|
1713 |
|
1946 | 1714 |
"Modified: / 31.10.1997 / 20:37:54 / cg" |
135 | 1715 |
! |
1716 |
||
90 | 1717 |
focusSequence:aSequenceableCollection |
1718 |
"define the focus sequence for focusNext/focusPrevious. |
|
1719 |
Focus is stepped in the order in which subviews occur in |
|
1946 | 1720 |
the sequence." |
90 | 1721 |
|
1722 |
focusSequence := aSequenceableCollection |
|
1946 | 1723 |
|
1724 |
"Modified: / 31.10.1997 / 20:40:04 / cg" |
|
90 | 1725 |
! |
1726 |
||
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1727 |
focusToView:aViewOrNil |
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1728 |
"give focus to aViewOrNil - if its in my focusSequence" |
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1729 |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1730 |
|seq doAssignFocusView| |
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1731 |
|
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1732 |
focusView == aViewOrNil ifFalse:[ |
2723 | 1733 |
doAssignFocusView := false. |
1734 |
topViews isNil ifTrue:[ |
|
1735 |
"/ mhmh - a topview-less windowGroup |
|
1736 |
doAssignFocusView := true. |
|
1737 |
] ifFalse:[ |
|
1738 |
(seq := self focusSequence) notNil ifTrue:[ |
|
1739 |
doAssignFocusView := (seq includesIdentical:aViewOrNil). |
|
1740 |
] |
|
1741 |
]. |
|
1742 |
doAssignFocusView ifTrue:[ |
|
1743 |
self focusView:aViewOrNil. |
|
1744 |
] |
|
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1745 |
] |
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1746 |
|
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1747 |
"Created: / 18.9.1998 / 16:28:27 / cg" |
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1748 |
! |
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
1749 |
|
90 | 1750 |
focusView |
135 | 1751 |
"return the view which currently has the focus" |
90 | 1752 |
|
1753 |
^ focusView |
|
1754 |
! |
|
1755 |
||
1756 |
focusView:aViewOrNil |
|
1757 |
"give focus to aViewOrNil" |
|
1758 |
||
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1759 |
self focusView:aViewOrNil byTab:false |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1760 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1761 |
" |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1762 |
|top v1 v2| |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1763 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1764 |
top := StandardSystemView new. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1765 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1766 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1767 |
top open. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1768 |
top windowGroup focusView:v1. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1769 |
" |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1770 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1771 |
"Modified: 31.5.1996 / 21:13:25 / cg" |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1772 |
! |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1773 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1774 |
focusView:aViewOrNil byTab:focusCameViaTab |
2507 | 1775 |
"give focus to aViewOrNil. |
1776 |
The focusCameViaTab argument specifies if the focus came via |
|
1777 |
tabbing or by pointer-movement/automatic. |
|
1778 |
If it came via tabbing, the view is notified differently, to allow |
|
1779 |
for special highlighting (i.e. drawing a focus-border around itself)" |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1780 |
|
2723 | 1781 |
|i prevFocusView myDisplay| |
2506 | 1782 |
|
2692 | 1783 |
"/ 'focusToView:' print. aViewOrNil printCR. |
1784 |
||
2507 | 1785 |
myDisplay := self graphicsDevice. |
2522 | 1786 |
myDisplay notNil ifTrue:[ |
2723 | 1787 |
"/ |
1788 |
"/ take the focus from whichEver view had it previously |
|
1789 |
"/ |
|
1790 |
prevFocusView := myDisplay focusView. |
|
1791 |
prevFocusView ~~ aViewOrNil ifTrue:[ |
|
1792 |
self class takeFocusFromDevice:myDisplay. |
|
1793 |
]. |
|
1794 |
myDisplay focusView:aViewOrNil. |
|
2506 | 1795 |
]. |
1796 |
||
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1797 |
focusView == aViewOrNil ifTrue:[ |
2723 | 1798 |
focusView notNil ifTrue:[ |
1799 |
"/ this is the case when the mouse-pointer reenters |
|
1800 |
"/ into a topView which had a focusView |
|
1801 |
focusByTab := focusCameViaTab or:[focusByTab]. |
|
1802 |
focusView showFocus:focusByTab. |
|
1803 |
aViewOrNil hasKeyboardFocus:true. |
|
1804 |
myDisplay focusView:aViewOrNil. |
|
1805 |
]. |
|
1806 |
^ self |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
1807 |
]. |
410
9d9d03fa5d82
moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
1808 |
|
90 | 1809 |
focusView notNil ifTrue:[ |
2723 | 1810 |
"/ lost explicit focus |
1811 |
focusView == aViewOrNil ifTrue:[ |
|
1812 |
aViewOrNil hasKeyboardFocus:true. |
|
1813 |
myDisplay focusView:aViewOrNil. |
|
1814 |
^ self |
|
1815 |
]. |
|
90 | 1816 |
]. |
387
aa80487842b8
compile event classes with optSpace;
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
1817 |
|
90 | 1818 |
focusView := aViewOrNil. |
1819 |
focusView notNil ifTrue:[ |
|
2723 | 1820 |
"/ got explicit focus |
1821 |
aViewOrNil showFocus:focusCameViaTab. |
|
1822 |
aViewOrNil hasKeyboardFocus:true. |
|
1823 |
focusByTab := focusCameViaTab. |
|
1824 |
myDisplay focusView:aViewOrNil. |
|
90 | 1825 |
]. |
1826 |
||
1827 |
" |
|
1828 |
|top v1 v2| |
|
1829 |
||
1830 |
top := StandardSystemView new. |
|
1831 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
1832 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
1833 |
top open. |
|
1834 |
top windowGroup focusView:v1. |
|
1835 |
" |
|
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1836 |
|
2692 | 1837 |
"Modified: / 20.5.1999 / 18:30:16 / cg" |
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1838 |
! |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1839 |
|
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1840 |
indexOfFocusViewInFocusSequence |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1841 |
"give focus to previous view in focusSequence" |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1842 |
|
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1843 |
|index "{ Class: SmallInteger }" |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1844 |
sequence v| |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1845 |
|
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1846 |
sequence := self focusSequence. |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1847 |
|
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1848 |
focusView notNil ifTrue:[ |
2723 | 1849 |
index := (sequence identityIndexOf:focusView). |
1850 |
index == 0 ifTrue:[ |
|
1851 |
"/ mhmh - how comes ? |
|
1852 |
"/ (in rare cases, a subwidget of one of my |
|
1853 |
"/ focusSequence-widgets has the focus. |
|
1854 |
"/ in that case, care for this here) |
|
1855 |
v := focusView superView. |
|
1856 |
[index == 0 and:[v notNil]] whileTrue:[ |
|
1857 |
index := (sequence identityIndexOf:v). |
|
1858 |
v := v superView |
|
1859 |
]. |
|
1860 |
] |
|
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1861 |
] ifFalse:[ |
2723 | 1862 |
index := 0. |
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1863 |
]. |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1864 |
^ index |
2737 | 1865 |
! |
1866 |
||
1867 |
pointerView |
|
1868 |
"return the view which currently has the pointer" |
|
1869 |
||
1870 |
^ pointerView |
|
244 | 1871 |
! ! |
1872 |
||
1873 |
!WindowGroup methodsFor:'initialization'! |
|
1874 |
||
1875 |
initialize |
|
1876 |
"setup the windowgroup, by creating a new sensor |
|
1877 |
and an event semaphore" |
|
1878 |
||
1879 |
mySensor := WindowSensor new. |
|
1273 | 1880 |
mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema'). |
244 | 1881 |
isModal := false. |
417 | 1882 |
isForModalSubview := false. |
1273 | 1883 |
|
1884 |
"Modified: 25.1.1997 / 00:20:19 / cg" |
|
90 | 1885 |
! |
1886 |
||
244 | 1887 |
reinitialize |
1888 |
"reinitialize the windowgroup after an image restart" |
|
90 | 1889 |
|
244 | 1890 |
"throw away old (zombie) process" |
1891 |
myProcess notNil ifTrue:[ |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1892 |
"/ careful: the old processes exit-actions must be cleared. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1893 |
"/ otherwise, it might do destroy or other actions when it |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1894 |
"/ gets finalized ... |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1895 |
|
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1896 |
"/ myProcess removeAllExitActions. |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1897 |
myProcess removeAllSuspendActions. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1898 |
myProcess := nil. |
244 | 1899 |
]. |
90 | 1900 |
|
244 | 1901 |
"throw away old events" |
1902 |
mySensor reinitialize |
|
313 | 1903 |
|
1904 |
"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
|
1905 |
"Modified: 12.1.1997 / 00:45:01 / cg" |
90 | 1906 |
! ! |
1907 |
||
19 | 1908 |
!WindowGroup methodsFor:'printing'! |
1909 |
||
90 | 1910 |
printOn:aStream |
19 | 1911 |
"return a printed representation; |
144 | 1912 |
just for more user friendlyness: add name of process." |
19 | 1913 |
|
90 | 1914 |
myProcess isNil ifTrue:[ |
2870 | 1915 |
(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[ |
1916 |
aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')'). |
|
1917 |
^ self. |
|
1918 |
]. |
|
1919 |
^ super printOn:aStream |
|
1920 |
]. |
|
1921 |
isModal ifTrue:[ |
|
1922 |
aStream nextPutAll:('WindowGroup(modal for ' , myProcess nameOrId , ')'). |
|
1923 |
^ self. |
|
90 | 1924 |
]. |
1925 |
aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')') |
|
19 | 1926 |
! ! |
244 | 1927 |
|
1928 |
!WindowGroup methodsFor:'special'! |
|
1929 |
||
1930 |
restoreCursors |
|
1931 |
"restore the original cursors in all of my views" |
|
1932 |
||
330
13a3fa93330c
careful - view could have been destroyed in the meanwhile (in restoreCursors)
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
1933 |
self allViewsDo:[:aView | |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1934 |
|c dev id cid| |
244 | 1935 |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1936 |
dev := aView graphicsDevice. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1937 |
dev notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1938 |
(id := aView id) notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1939 |
c := aView cursor onDevice:dev. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1940 |
(cid := c id) notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1941 |
dev setCursor:cid in:id. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1942 |
] |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1943 |
] |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1944 |
] |
244 | 1945 |
]. |
743 | 1946 |
|
2097
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
1947 |
"Modified: / 22.4.1998 / 14:28:22 / cg" |
244 | 1948 |
! |
1949 |
||
328 | 1950 |
showActivity:someMessage |
597 | 1951 |
"some activityNotification shalt be communicated to |
1952 |
the user; |
|
1953 |
forward it to my first topView if there is one |
|
1954 |
(that one should know how to deal with it)" |
|
1955 |
||
328 | 1956 |
topViews notNil ifTrue:[ |
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
1957 |
topViews first showActivity:someMessage |
328 | 1958 |
] |
1959 |
||
1960 |
"Created: 16.12.1995 / 18:39:40 / cg" |
|
597 | 1961 |
"Modified: 23.4.1996 / 21:36:54 / cg" |
328 | 1962 |
! |
1963 |
||
244 | 1964 |
showCursor:aCursor |
1965 |
"change the cursor to aCursor in all of my views." |
|
1966 |
||
2051
323362098e21
care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents:
2046
diff
changeset
|
1967 |
|c cId vId dev| |
244 | 1968 |
|
1969 |
c := aCursor. |
|
1970 |
self allViewsDo:[:aView | |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1971 |
dev := aView graphicsDevice. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1972 |
dev notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1973 |
c := c onDevice:dev. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1974 |
(cId := c id) notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1975 |
(vId := aView id) notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1976 |
dev setCursor:cId in:vId. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1977 |
] |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1978 |
] |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1979 |
] |
244 | 1980 |
]. |
743 | 1981 |
|
2097
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
1982 |
"Modified: / 22.4.1998 / 14:26:45 / cg" |
244 | 1983 |
! |
1984 |
||
1985 |
withCursor:aCursor do:aBlock |
|
1986 |
"evaluate aBlock while showing aCursor in all |
|
1987 |
my views (used to show wait-cursor while doing something). |
|
1988 |
Return the result as returned by aBlock." |
|
1989 |
||
1986 | 1990 |
|oldCursors dev deviceCursor action| |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1991 |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
1992 |
dev := self graphicsDevice. |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1993 |
dev isNil ifTrue:[ |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
1994 |
^ aBlock value |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
1995 |
]. |
244 | 1996 |
|
1652 | 1997 |
deviceCursor := aCursor onDevice:dev. |
1998 |
||
244 | 1999 |
" |
2000 |
get mapping of view->cursor for all of my subviews |
|
2001 |
" |
|
2002 |
oldCursors := IdentityDictionary new. |
|
2003 |
self allViewsDo:[:aView | |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2004 |
|old| |
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2005 |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2006 |
old := aView cursor. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2007 |
old ~~ aCursor ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2008 |
oldCursors at:aView put:old. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2009 |
aView cursor:deviceCursor now:false |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2010 |
] |
244 | 2011 |
]. |
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2012 |
|
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2013 |
oldCursors size == 0 ifTrue:[ |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2014 |
action := aBlock |
1986 | 2015 |
] ifFalse:[ |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2016 |
action := [ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2017 |
|rslt| |
1986 | 2018 |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2019 |
"/ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2020 |
"/ here sync looks better; flush leads to almost invisible cursors when accepting. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2021 |
"/ I dont really know why (maybe unix does not context-switch to the Xserver |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2022 |
"/ early enough after the requests have been sent ?) |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2023 |
"/ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2024 |
dev sync. |
1986 | 2025 |
|
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2026 |
rslt := aBlock valueNowOrOnUnwindDo:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2027 |
" |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2028 |
restore cursors from the mapping |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2029 |
" |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2030 |
oldCursors keysAndValuesDo:[:view :cursor | |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2031 |
view cursor:cursor now:false. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2032 |
]. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2033 |
dev flush |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2034 |
]. |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2035 |
rslt |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
2036 |
] |
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2037 |
]. |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2038 |
|
2097
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2039 |
"/ (self isModal and:[previousGroup notNil]) ifTrue:[ |
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2040 |
"/ "/ pass the work to my parentGroup |
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2041 |
"/ ^ previousGroup withCursor:aCursor do:action |
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2042 |
"/ ]. |
1986 | 2043 |
^ action value. |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
2044 |
|
2097
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2045 |
"Modified: / 22.4.1998 / 14:36:47 / cg" |
408 | 2046 |
! |
2047 |
||
2213
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2048 |
withExecuteCursorDo:aBlock |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2049 |
"evaluate aBlock while showing a busyCursor in all |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2050 |
my views (used to show busy-cursor while doing something time consuming). |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2051 |
Return the result as returned by aBlock." |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2052 |
|
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2053 |
^ self withCursor:(Cursor execute) do:aBlock |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2054 |
|
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2055 |
"Created: / 31.7.1998 / 20:11:52 / cg" |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2056 |
! |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2057 |
|
408 | 2058 |
withWaitCursorDo:aBlock |
2059 |
"evaluate aBlock while showing a waitCursor in all |
|
2060 |
my views (used to show wait-cursor while doing something time consuming). |
|
2061 |
Return the result as returned by aBlock." |
|
2062 |
||
2063 |
^ self withCursor:(Cursor wait) do:aBlock |
|
2064 |
||
2065 |
"Created: 6.2.1996 / 19:51:53 / cg" |
|
244 | 2066 |
! ! |
2067 |
||
2068 |
!WindowGroup methodsFor:'special accessing'! |
|
2069 |
||
429 | 2070 |
isForModalSubview |
2071 |
"special for windowgroups for modal subviews. |
|
2072 |
These must be flagged specially to avoid the views being reassigned |
|
2073 |
to the maingroup. |
|
2074 |
This is a private interface to the SimpleView class" |
|
2075 |
||
2076 |
^ isForModalSubview |
|
2077 |
! |
|
2078 |
||
2079 |
isForModalSubview:aBoolean |
|
2080 |
"special for windowgroups for modal subviews. |
|
2081 |
These must be flagged specially to avoid the views being reassigned |
|
2082 |
to the maingroup. |
|
2083 |
This is a private interface to the SimpleView class" |
|
2084 |
||
2085 |
isForModalSubview := aBoolean |
|
2086 |
! |
|
2087 |
||
244 | 2088 |
setModal:aBoolean |
2089 |
"special entry for debugger: set the modal flag. |
|
2090 |
Not for public use" |
|
2091 |
||
2092 |
isModal := aBoolean |
|
2093 |
||
2094 |
"Modified: 3.9.1995 / 14:51:04 / claus" |
|
2095 |
! |
|
2096 |
||
2097 |
setPreviousGroup:aGroup |
|
2098 |
"special entry for debugger: |
|
2099 |
set the windowgroup that started this group (for modal groups only). |
|
2100 |
This is not a public interface." |
|
2101 |
||
2102 |
previousGroup := aGroup |
|
2103 |
||
2104 |
"Modified: 3.9.1995 / 14:55:40 / claus" |
|
2105 |
! |
|
2106 |
||
2107 |
setProcess:aProcess |
|
2108 |
"special entry for debugger: set the windowGroups process. |
|
2109 |
Not for public use." |
|
2110 |
||
2111 |
myProcess := aProcess |
|
2112 |
||
2113 |
"Modified: 3.9.1995 / 14:25:38 / claus" |
|
2114 |
! ! |
|
2115 |
||
1110 | 2116 |
!WindowGroup class methodsFor:'documentation'! |
251 | 2117 |
|
2118 |
version |
|
2959 | 2119 |
^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.189 1999-10-08 09:05:34 ca Exp $' |
251 | 2120 |
! ! |
244 | 2121 |
WindowGroup initialize! |