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