author | Claus Gittinger <cg@exept.de> |
Thu, 05 Jun 2008 14:41:07 +0200 | |
changeset 4973 | 3414fa1d71ea |
parent 4962 | d9ea7dfd084f |
child 5003 | 59c3b1d86175 |
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 |
" |
|
3212 | 12 |
"{ Package: 'stx:libview' }" |
13 |
||
11 | 14 |
Object subclass:#WindowGroup |
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
15 |
instanceVariableNames:'graphicsDevice views topViews myProcess mySensor isModal |
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
16 |
previousGroup focusView focusSequence preEventHook postEventHook |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
17 |
pointerView isForModalSubview focusByTab groupHasFocus busyHook |
3780
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
18 |
busyHookTimeout inModalLoop preEventHooks postEventHooks |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
19 |
creatingProcess traceEvents processPriority' |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
20 |
classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
21 |
WindowGroupQuerySignal LastEventQuerySignal BusyHookTime' |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
22 |
poolDictionaries:'' |
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
23 |
category:'Interface-Support' |
11 | 24 |
! |
25 |
||
1110 | 26 |
!WindowGroup class methodsFor:'documentation'! |
46 | 27 |
|
28 |
copyright |
|
29 |
" |
|
30 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
72 | 31 |
All Rights Reserved |
46 | 32 |
|
33 |
This software is furnished under a license and may be used |
|
34 |
only in accordance with the terms of that license and with the |
|
35 |
inclusion of the above copyright notice. This software may not |
|
36 |
be provided or otherwise made available to, or used by, any |
|
37 |
other person. No title to or ownership of the software is |
|
38 |
hereby transferred. |
|
39 |
" |
|
40 |
! |
|
41 |
||
42 |
documentation |
|
43 |
" |
|
103 | 44 |
In Smalltalk/X, the known (ST-80) concept of a controller has been |
297 | 45 |
extended (split) into a WindowGroup which handles process related stuff, |
46 |
and the Controller, which only handles events for a view and defines the user interaction. |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
47 |
The controller functionality might be (actually: often is) included in the view components. |
297 | 48 |
All interaction is via event queues - there is no polling in controllers (not even conceptionally). |
103 | 49 |
|
50 |
WindowGroups are responsible to wait for and forward events for a group of |
|
297 | 51 |
windows. All views in a windowGroup share a single windowSensor which holds the |
1503 | 52 |
event queue (therefore subviews all share the same input event queue). |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
53 |
Actually, there are two separate event queues - one for damage and view-visibility-related events, |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
54 |
another one for user interaction (such as mouse, keyboard etc.) |
144 | 55 |
|
297 | 56 |
The event queues are filled with incoming events as arriving from the physical display. |
57 |
This is done by a separate process (so called event-dispatcher) which runs at a higher |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
58 |
priority. The event dispatcher determines the queue into which an event has to be placed, |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
59 |
by asking the view for which the event is destined (via the views sensor). |
297 | 60 |
There may be multiple event dispatchers running (to support multiple displays); |
61 |
see the documentation/examples in DeviceWorkstation/XWorkstation on how this is done. |
|
62 |
||
103 | 63 |
Except for modal boxes, a separate process is created for each windowGroup |
297 | 64 |
which waits for events to arrive and processes them, by sending corresponding |
144 | 65 |
event messages to the views controller or the view (*). |
297 | 66 |
The controller is determined by asking the view (for which the event is destined); |
67 |
if the returned controller is nil, the event is sent directly to the view. |
|
68 |
This allows for simple views to work without a controller. |
|
69 |
(all of this is actually done in a WindowEvent method) |
|
70 |
||
71 |
Therefore, multiple applications run pseudo parallel. |
|
72 |
Even if some window performs a long time computation, events are still received |
|
73 |
and entered into the corresponding event queues (because the event dispatcher process |
|
74 |
runs at a higher priority). However, the actual processing of the event is only |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
75 |
possibly if no other process is busy at the same or a higher priority (unless timeslicing is enabled). |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
76 |
If timeslicing is off, it is possible to change a windowProcesses priority in order to give |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
77 |
other windows a chance to execute (some views do this while performing longtime actions). |
297 | 78 |
|
103 | 79 |
Modal boxes create an extra window group for the components of the modal |
297 | 80 |
box, but execute the event-processing loop for this new group in the original process - |
144 | 81 |
therefore, the original windowgroup is blocked for the duration of the modal |
297 | 82 |
interaction. |
83 |
However, the modal-event processing loop peeks into the original groups event queue |
|
84 |
from time to time, and handles expose events. Thus, even while blocked for user input, |
|
85 |
the original group continues to get update/redraw events. |
|
103 | 86 |
|
87 |
Normally, one windowgroup is associated to each topview (StandardSystemView) |
|
144 | 88 |
and all of its subviews. However, this is not strictly required; |
89 |
it is possible to create extra windowgroups for subviews, which will let them |
|
90 |
run in parallel |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
91 |
(for example, the FileBrowsers kill-Button is created that |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
92 |
way, to allow a kill of an executing unix command, while the browser |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
93 |
itself reads the pipeStream for incoming text. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
94 |
Even if the fileBrowser is busy reading the pipe, the killButton is still |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
95 |
working and allows terminating the pipe-read action). |
144 | 96 |
|
97 |
On the other hand, multiple topviews can be placed into the same windowGroup; |
|
98 |
which allows for multiview applications, of which only one communicates with |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
99 |
the user at a time (for example: the GUI painters canvas and gallery are in the same group). |
297 | 100 |
Multiple topviews within a windowGropup can be configured to behave like one |
101 |
unit with respect to iconification, deiconification and termination. |
|
102 |
This is done by creating multiple topViews in one group, and setting up a master/slave |
|
103 |
or partner relation among them (see TopView>>beSlave and TopView>>bePartner). |
|
103 | 104 |
|
109 | 105 |
WindowGroups also support a focus window: this is the one that gets the |
103 | 106 |
keyboard input - even if the cursor is located in another subview. |
512 | 107 |
The sequence is defined by the topView or its model (typically an applicationModel). |
108 |
It should return an orderedCollection of subviews when asked via #focusSequence. |
|
109 |
||
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
110 |
For debugging or special event manipulations, windowGroups allow for hooks to be installed |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
111 |
around the processing of events - preEventHook is sent a #procesEvent: message before an event is processed, |
512 | 112 |
postEventHook is informed after the event has been processed. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
113 |
The preEventHook should return a boolean - if it returns true, the event is considered |
512 | 114 |
being already processed by the hook and ignored. |
115 |
This allows for event-tracing, timing or even filtering (if preEventHook returns true). |
|
116 |
(notice: there is also an eventHook facility available in the sensor class.) |
|
103 | 117 |
|
118 |
Finally, windowgroups are the perfect place for things like defining a |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
119 |
cursor for all associated views, flushing all input, waiting for expose events etc. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
120 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
121 |
Late News: |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
122 |
a busyHook and busyHookTimeout has been added; this hook-(block) gets invoked, whenever |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
123 |
the process was busy handling an event for some time. This can be used to automatically install |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
124 |
a busy cursor (hour-glass) in an application, if some processing takes some time |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
125 |
(without a need for #withCursorDo: all over the place in the application) |
103 | 126 |
|
297 | 127 |
Dont get confused: |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
128 |
You dont have to care for all those details in the normal case; |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
129 |
a windowgroup is created for you automatically, when a view is opened. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
130 |
All of the internals are not required to be known for most applications. |
297 | 131 |
|
103 | 132 |
|
597 | 133 |
[instance variables:] |
144 | 134 |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
135 |
views collection of views of this group |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
136 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
137 |
topViews collection of topviews of this group |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
138 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
139 |
myProcess the process executing the events |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
140 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
141 |
mySensor my input sensor |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
142 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
143 |
isModal true if this is for a modal box |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
144 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
145 |
previousGroup if modal, the group that started this one |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
146 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
147 |
focusView the one that has the keyboard focus (or nil) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
148 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
149 |
focusByTab if focus came via tabbing |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
150 |
(as opposed to an implicit focus change) |
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
151 |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
152 |
focusSequence defines the focus sequence |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
153 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
154 |
preEventHook if non-nil, that one gets notified of incoming |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
155 |
events BEFORE an event is dispatched. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
156 |
May eat events (i.e. suppress dispatch) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
157 |
(hook for event filters or recorders) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
158 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
159 |
postEventHook if non-nil, that one gets notified |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
160 |
AFTER an event was dispatched. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
161 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
162 |
isForModalSubView |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
163 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
164 |
groupHasFocus true, if this windowGroup has the focus |
2506 | 165 |
|
103 | 166 |
|
597 | 167 |
[class variables:] |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
168 |
LeaveSignal if raised, a modal box leaves (closes) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
169 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
170 |
WindowGroupQuerySignal to ask for the current windowGroup, |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
171 |
anywhere in the program, simply raise this |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
172 |
signal. The raise returns nil, for processes, |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
173 |
which are not under control of a windowGroup. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
174 |
(i.e. wg := WindowGroup windowGroupQuerySignal raise) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
175 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
176 |
LastEventQuerySignal to ask for the event which was responsible |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
177 |
for being where you are (whereever that is). |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
178 |
The raise returns nil, if you did not arrive |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
179 |
there due to an event. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
180 |
(i.e. ev := WindowGroup lastEventQuerySignal raise) |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
181 |
The event can be asked for the view, the type |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
182 |
of event, x/y position etc. |
2506 | 183 |
|
184 |
||
144 | 185 |
(*) |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
186 |
due to historic reasons, many views have the controller functionality |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
187 |
integrated, and handle events themself. The windowSensor takes care |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
188 |
of this, by checking if a view has a controller, and, if so, forwarding |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
189 |
the events to it. Otherwise, events are sent directly to the view. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
190 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
191 |
In the future, all views will be rewritten to actually use a controller. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
192 |
Currently (being in the middle of this migration), only some views |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
193 |
(buttons, toggles and subclasses) do so. |
144 | 194 |
|
103 | 195 |
For more information, read 'introduction to view programming' in the |
196 |
doc/online directory. |
|
597 | 197 |
|
612 | 198 |
[author:] |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
199 |
Claus Gittinger |
612 | 200 |
|
597 | 201 |
[see also:] |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
202 |
WindowSensor WindowEvent EventListener KeyboardForwarder |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
203 |
DeviceWorkstation |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
204 |
View StandardSystemView |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
205 |
ApplicationModel |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
206 |
Process ProcessorScheduler |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
207 |
(``Working with processes (programmers manual)'': programming/processes.html#VIEWSNPROCS) |
46 | 208 |
" |
209 |
! ! |
|
210 |
||
1110 | 211 |
!WindowGroup class methodsFor:'initialization'! |
46 | 212 |
|
213 |
initialize |
|
214 |
LeaveSignal isNil ifTrue:[ |
|
2723 | 215 |
LeaveSignal := (Signal new) mayProceed:true. |
216 |
LeaveSignal nameClass:self message:#leaveSignal. |
|
217 |
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
|
218 |
|
2723 | 219 |
WindowGroupQuerySignal := QuerySignal new. |
220 |
WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal. |
|
221 |
WindowGroupQuerySignal notifierString:'query for windowgroup'. |
|
1111 | 222 |
|
2723 | 223 |
LastEventQuerySignal := QuerySignal new. |
224 |
LastEventQuerySignal nameClass:self message:#lastEventQuerySignal. |
|
225 |
LastEventQuerySignal notifierString:'query for last event'. |
|
54 | 226 |
]. |
46 | 227 |
|
228 |
"WindowGroup initialize" |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
229 |
|
1111 | 230 |
"Modified: 9.11.1996 / 17:00:53 / cg" |
46 | 231 |
! ! |
232 |
||
1110 | 233 |
!WindowGroup class methodsFor:'instance creation'! |
244 | 234 |
|
235 |
new |
|
236 |
"create and return a new WindowGroup object" |
|
237 |
||
238 |
^ self basicNew initialize |
|
239 |
! ! |
|
240 |
||
1110 | 241 |
!WindowGroup class methodsFor:'Signal constants'! |
242 |
||
243 |
lastEventQuerySignal |
|
244 |
"return the signal which is used to query for the last event" |
|
245 |
||
246 |
^ LastEventQuerySignal |
|
247 |
||
248 |
"Created: 17.7.1996 / 20:36:04 / cg" |
|
249 |
! |
|
72 | 250 |
|
251 |
leaveSignal |
|
109 | 252 |
"return the signal which is used to exit a modal loop. |
1752 | 253 |
This private signal, is always caught while a modalbox is active. |
144 | 254 |
Raising it will exit the modal loop and return from the views #openModal |
255 |
method." |
|
109 | 256 |
|
72 | 257 |
^ LeaveSignal |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
258 |
! |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
259 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
260 |
windowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
261 |
"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
|
262 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
263 |
^ WindowGroupQuerySignal |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
264 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
265 |
"Created: 17.7.1996 / 20:36:04 / cg" |
72 | 266 |
! ! |
267 |
||
1110 | 268 |
!WindowGroup class methodsFor:'accessing'! |
26 | 269 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
270 |
activeApplication |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
271 |
"return the currently active application. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
272 |
Notice: this may be a modal dialogs application - i.e. it is not |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
273 |
always the main application." |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
274 |
|
3751 | 275 |
|activeGroup| |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
276 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
277 |
(activeGroup := self activeGroup) notNil ifTrue:[ |
3751 | 278 |
^ activeGroup application |
3173
1947c87324d5
oops - the active* queries should return nil sometimes
Claus Gittinger <cg@exept.de>
parents:
3172
diff
changeset
|
279 |
]. |
1947c87324d5
oops - the active* queries should return nil sometimes
Claus Gittinger <cg@exept.de>
parents:
3172
diff
changeset
|
280 |
^ nil |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
281 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
282 |
" |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
283 |
WindowGroup activeApplication |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
284 |
" |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
285 |
! |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
286 |
|
26 | 287 |
activeGroup |
180 | 288 |
"return the currently active windowGroup. |
289 |
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
|
290 |
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
|
291 |
(usually) the first group is returned (prefering a modal if there is one). |
180 | 292 |
(maybe we should return a collection of windowGroups here). |
293 |
||
294 |
This method is required to simulate the historic ST-80 single display |
|
295 |
behavior for Cursor>>show / Cursor>>showWhile and some others (raising the |
|
296 |
activeGroups topView when modalBoxes appear) on multiple display screens. |
|
297 |
These methods should change the cursor for the currently |
|
298 |
active windowGroup ONLY, instead of globally affecting the display or |
|
299 |
all views |
|
300 |
(since, depending on the priority, other views could be unaffacted by this |
|
301 |
and an overall cursor change does not make sense.)" |
|
302 |
||
303 |
|activeProcess groups wg| |
|
304 |
||
305 |
Processor isNil ifTrue:[^ nil]. "/ only during very early init phase |
|
26 | 306 |
|
180 | 307 |
activeProcess := Processor activeProcess. |
308 |
" caching the last value ..." |
|
565
6867f1a9a470
oops - leftover global LastActive
Claus Gittinger <cg@exept.de>
parents:
513
diff
changeset
|
309 |
activeProcess == LastActiveProcess ifTrue:[ |
3541
7909bbc0bf42
oops (care for nil LastGroup)
Claus Gittinger <cg@exept.de>
parents:
3538
diff
changeset
|
310 |
(LastActiveGroup notNil |
7909bbc0bf42
oops (care for nil LastGroup)
Claus Gittinger <cg@exept.de>
parents:
3538
diff
changeset
|
311 |
and:[LastActiveGroup process == LastActiveProcess]) ifTrue:[ |
3212 | 312 |
^ LastActiveGroup |
313 |
] |
|
180 | 314 |
]. |
1298
d070db2e4530
always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents:
1273
diff
changeset
|
315 |
|
3212 | 316 |
WindowGroupQuerySignal isNil ifTrue:[^ nil]. "/ only during very early init phase |
2521
fe236fa74d5b
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2519
diff
changeset
|
317 |
wg := WindowGroupQuerySignal query. |
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
318 |
|
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
319 |
wg isNil ifTrue:[ |
3212 | 320 |
"/ mhmh - noone willing to answer that question ... |
321 |
"/ (how can this happen ?) |
|
322 |
groups := self scheduledWindowGroups |
|
323 |
select:[:wg | wg process == activeProcess]. |
|
3619 | 324 |
groups notEmpty ifTrue:[ |
325 |
wg := groups detect:[:wg | wg isModal] ifNone:nil. |
|
326 |
wg isNil ifTrue:[ |
|
327 |
wg := groups anElement |
|
3212 | 328 |
] |
329 |
]. |
|
956
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
330 |
]. |
32a642b5dcd3
when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents:
949
diff
changeset
|
331 |
|
180 | 332 |
wg notNil ifTrue:[ |
3212 | 333 |
LastActiveProcess := activeProcess. |
334 |
LastActiveGroup := wg. |
|
180 | 335 |
]. |
336 |
^ wg |
|
337 |
||
338 |
" |
|
339 |
WindowGroup activeGroup |
|
340 |
" |
|
341 |
||
2089 | 342 |
"Modified: / 3.9.1995 / 14:49:53 / claus" |
343 |
"Modified: / 17.4.1998 / 11:49:28 / cg" |
|
2521
fe236fa74d5b
Use #query instead of #raise when invoking QuerySignals
Stefan Vogel <sv@exept.de>
parents:
2519
diff
changeset
|
344 |
"Modified: / 18.3.1999 / 18:30:33 / stefan" |
54 | 345 |
! |
346 |
||
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
347 |
activeMainApplication |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
348 |
"return the currently active main application. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
349 |
Notice: |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
350 |
if invoked by a modal application, this returns the main (non-modal) |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
351 |
application." |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
352 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
353 |
|activeGroup mainView| |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
354 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
355 |
(activeGroup := self activeGroup) notNil ifTrue:[ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
356 |
(mainView := activeGroup mainGroup mainView) notNil ifTrue:[ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
357 |
^ mainView application |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
358 |
] |
3173
1947c87324d5
oops - the active* queries should return nil sometimes
Claus Gittinger <cg@exept.de>
parents:
3172
diff
changeset
|
359 |
]. |
1947c87324d5
oops - the active* queries should return nil sometimes
Claus Gittinger <cg@exept.de>
parents:
3172
diff
changeset
|
360 |
^ nil |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
361 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
362 |
" |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
363 |
WindowGroup activeMainApplication |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
364 |
" |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
365 |
|
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
366 |
! |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
367 |
|
54 | 368 |
scheduledWindowGroups |
180 | 369 |
"return a collection of all windowGroups (possibly for different |
370 |
display devices) which are scheduled (i.e. which have a process |
|
371 |
running, handling events)." |
|
372 |
||
373 |
|set screens| |
|
374 |
||
375 |
screens := Screen allScreens. |
|
1869 | 376 |
screens size == 0 ifTrue:[^ #()]. |
180 | 377 |
|
378 |
set := IdentitySet new. |
|
379 |
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
|
380 |
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
|
381 |
|wg| |
109 | 382 |
|
1977
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
383 |
(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
|
384 |
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
|
385 |
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
|
386 |
] |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
387 |
]. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
388 |
]. |
180 | 389 |
]. |
390 |
^ set asArray |
|
391 |
||
392 |
" |
|
393 |
WindowGroup scheduledWindowGroups |
|
394 |
" |
|
395 |
||
396 |
"Modified: 1.9.1995 / 13:43:09 / claus" |
|
1869 | 397 |
"Modified: 18.8.1997 / 18:44:29 / cg" |
244 | 398 |
! |
399 |
||
400 |
setActiveGroup:aGroup |
|
401 |
"set the currently active windowGroup. |
|
402 |
Temporary; do not use this interface, it will vanish." |
|
403 |
||
404 |
LastActiveProcess := Processor activeProcess. |
|
405 |
LastActiveGroup := aGroup |
|
26 | 406 |
! ! |
407 |
||
2723 | 408 |
!WindowGroup class methodsFor:'focus control support'! |
409 |
||
410 |
takeFocusFromDevice:aDevice |
|
4341 | 411 |
|prevFocusView prevFocusGroup prevFocusCameViaTab| |
2723 | 412 |
|
413 |
"/ |
|
414 |
"/ take the focus from whichEver view had it previously |
|
415 |
"/ |
|
416 |
prevFocusView := aDevice focusView. |
|
417 |
prevFocusView notNil ifTrue:[ |
|
4676 | 418 |
aDevice focusView:nil. |
419 |
(prevFocusGroup := prevFocusView windowGroup) notNil ifTrue:[ |
|
3376 | 420 |
prevFocusCameViaTab := prevFocusGroup focusCameByTab. |
421 |
||
422 |
prevFocusView showNoFocus:prevFocusCameViaTab. "/ true is bad - see pullDownMenu. |
|
423 |
self sendKeyboardFocusEventTo:prevFocusView withArgument:false. |
|
424 |
]. |
|
2723 | 425 |
]. |
4676 | 426 |
|
427 |
"Modified: / 08-11-2006 / 12:05:22 / cg" |
|
2723 | 428 |
! ! |
429 |
||
3376 | 430 |
!WindowGroup class methodsFor:'others'! |
431 |
||
432 |
sendKeyboardFocusEventTo:aView withArgument:arg |
|
433 |
|sensor ev| |
|
434 |
||
435 |
aView isNil ifTrue:[^ self]. |
|
436 |
||
437 |
(sensor := aView sensor) notNil ifTrue:[ |
|
3857
219231fc7e14
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
3853
diff
changeset
|
438 |
ev := WindowEvent keyboardFocus:arg view:aView. |
3376 | 439 |
sensor notifyEventListenersAbout:ev. |
440 |
sensor pushEvent:ev. |
|
441 |
] ifFalse:[ |
|
442 |
aView hasKeyboardFocus:arg |
|
443 |
]. |
|
444 |
! ! |
|
445 |
||
11 | 446 |
!WindowGroup methodsFor:'accessing'! |
447 |
||
3780
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
448 |
creatingProcess |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
449 |
"return the process which created this group or nil. |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
450 |
Only returns non-nil for modal groups." |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
451 |
|
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
452 |
^ creatingProcess |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
453 |
|
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
454 |
"Modified: / 17.8.1998 / 10:21:29 / cg" |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
455 |
! |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
456 |
|
512 | 457 |
device |
458 |
"return the device, we receive our events from" |
|
459 |
||
3436 | 460 |
<resource:#obsolete> |
461 |
||
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
462 |
self obsoleteMethodWarning:'use #graphicsDevice'. |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
463 |
^ self graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
464 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
465 |
"Modified: 5.7.1996 / 17:53:58 / cg" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
466 |
! |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
467 |
|
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
468 |
graphicsDevice |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
469 |
"return the device, we receive our events from" |
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
470 |
|
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
471 |
|dev| |
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
472 |
|
2857
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
473 |
graphicsDevice notNil ifTrue:[^ graphicsDevice]. |
b9bff260f854
cache graphicsDevice - its called often
Claus Gittinger <cg@exept.de>
parents:
2851
diff
changeset
|
474 |
|
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
475 |
topViews notNil ifTrue:[ |
3077 | 476 |
topViews do:[:v | |
477 |
|app| |
|
1116 | 478 |
|
3077 | 479 |
v notNil ifTrue:[ |
480 |
(app := v application) notNil ifTrue:[ |
|
481 |
"/ |
|
482 |
"/ ok, it has an application; |
|
483 |
"/ ask it for preferences. |
|
484 |
"/ |
|
485 |
(dev := app graphicsDevice) notNil ifTrue:[ |
|
486 |
^ (graphicsDevice := dev) |
|
487 |
] |
|
488 |
]. |
|
489 |
(dev := v graphicsDevice) notNil ifTrue:[ |
|
490 |
^ (graphicsDevice := dev) |
|
491 |
] |
|
492 |
] |
|
493 |
] |
|
512 | 494 |
]. |
1311
0746d3fe9a62
changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents:
1304
diff
changeset
|
495 |
views notNil ifTrue:[ |
3077 | 496 |
views do:[:v | |
497 |
v notNil ifTrue:[ |
|
498 |
(dev := v graphicsDevice) notNil ifTrue:[ |
|
499 |
^ (graphicsDevice := dev) |
|
500 |
] |
|
501 |
] |
|
502 |
] |
|
2170
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
503 |
]. |
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
504 |
"/ 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
|
505 |
"/ 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
|
506 |
previousGroup notNil ifTrue:[ |
3077 | 507 |
^ previousGroup graphicsDevice |
512 | 508 |
]. |
509 |
^ nil |
|
510 |
||
2170
44b86a4cc0d5
in #graphicsDevice: if there are no views, ask previousGroup if there is one.
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
511 |
"Modified: / 9.7.1998 / 18:18:08 / cg" |
512 | 512 |
! |
513 |
||
3737 | 514 |
isInModalLoop |
515 |
"return true, if the receiver has given up control to some other modal windowGroup |
|
516 |
(i.e. if it has popped up a modal dialog or a popUpMenu)" |
|
517 |
||
518 |
^ inModalLoop ? false |
|
519 |
! |
|
520 |
||
512 | 521 |
isModal |
3737 | 522 |
"return true, if the receiver is for a modal view |
523 |
(i.e. it is for a modal box, dialog or popUpMenu). |
|
524 |
The suspended windowgroup would return true to the isInModalLoop query if this is the case." |
|
512 | 525 |
|
526 |
^ isModal |
|
527 |
||
528 |
"Modified: 7.3.1996 / 14:29:46 / cg" |
|
529 |
! |
|
530 |
||
531 |
mainGroup |
|
532 |
"return the main windowgroup (for modal groups only) |
|
533 |
that is the top one, which is not modal. |
|
534 |
NonModal groups return themSelf. |
|
535 |
||
536 |
There is one exception to this: the debugger (which is sort of modal) |
|
537 |
returns itself as mainGroup (not its debuggee)." |
|
538 |
||
539 |
|g prev| |
|
540 |
||
541 |
g := self. |
|
3354 | 542 |
[g notNil |
543 |
and:[(g isModal or:[g isPopUp]) |
|
544 |
and:[(prev := g previousGroup) notNil]]] whileTrue:[ |
|
545 |
g := prev |
|
512 | 546 |
]. |
547 |
^ g |
|
548 |
||
549 |
"Modified: 3.9.1995 / 14:57:20 / claus" |
|
550 |
"Modified: 7.3.1996 / 14:29:28 / cg" |
|
551 |
! |
|
552 |
||
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
553 |
mainGroup:aWindowGroup |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
554 |
"set the main windowgroup (for modal/autonomous groups only) |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
555 |
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
|
556 |
as well." |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
557 |
|
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
558 |
previousGroup := aWindowGroup |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
559 |
|
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
560 |
"Created: 20.8.1997 / 17:57:35 / cg" |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
561 |
! |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
562 |
|
512 | 563 |
previousGroup |
564 |
"return the windowgroup that started this group. (for modal groups only). |
|
565 |
This may be another modalGroup (for boxes opened by boxes). |
|
566 |
NonModal groups return nil." |
|
567 |
||
568 |
^ previousGroup |
|
569 |
||
570 |
"Modified: 7.3.1996 / 14:28:46 / cg" |
|
571 |
! |
|
572 |
||
573 |
process |
|
574 |
"return the windowGroups process" |
|
575 |
||
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
576 |
myProcess isNil ifTrue:[ |
2363
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
577 |
previousGroup notNil ifTrue:[ |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
578 |
^ previousGroup process |
e456e5040a57
care for homeless (non-top) views when assigning the focus
Claus Gittinger <cg@exept.de>
parents:
2353
diff
changeset
|
579 |
] |
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
580 |
]. |
512 | 581 |
^ myProcess |
2250
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
582 |
|
281f9fafdbe0
follow parentGroup in #process-query
Claus Gittinger <cg@exept.de>
parents:
2221
diff
changeset
|
583 |
"Modified: / 17.8.1998 / 10:21:29 / cg" |
512 | 584 |
! |
585 |
||
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
586 |
processPriority |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
587 |
^ processPriority |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
588 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
589 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
590 |
processPriority:anInteger |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
591 |
processPriority := anInteger. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
592 |
myProcess notNil ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
593 |
myProcess priority:anInteger. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
594 |
]. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
595 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
596 |
|
512 | 597 |
sensor |
598 |
"return the windowGroups sensor. |
|
599 |
All events for any of the groups views is handled by that sensor." |
|
600 |
||
601 |
^ mySensor |
|
602 |
||
603 |
"Modified: 7.3.1996 / 14:30:21 / cg" |
|
604 |
! |
|
605 |
||
606 |
sensor:aSensor |
|
607 |
"set the windowGroups sensor" |
|
608 |
||
3683 | 609 |
self obsoleteMethodWarning. |
512 | 610 |
mySensor := aSensor |
611 |
! ! |
|
612 |
||
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
613 |
!WindowGroup methodsFor:'accessing-hooks'! |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
614 |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
615 |
addPostEventHook:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
616 |
"add another postEventHook" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
617 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
618 |
postEventHooks isNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
619 |
postEventHooks := OrderedCollection new. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
620 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
621 |
(postEventHooks includesIdentical:anEventProcessor) ifFalse:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
622 |
postEventHooks add:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
623 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
624 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
625 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
626 |
addPreEventHook:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
627 |
"add another preEventHook" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
628 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
629 |
preEventHooks isNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
630 |
preEventHooks := OrderedCollection new. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
631 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
632 |
(preEventHooks includesIdentical:anEventProcessor) ifFalse:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
633 |
preEventHooks add:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
634 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
635 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
636 |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
637 |
busyHook |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
638 |
"return the busyHook if any" |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
639 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
640 |
^ busyHook |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
641 |
! |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
642 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
643 |
busyHook:anObject |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
644 |
"set the busyHook - this one will be invoked when the event-handling action |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
645 |
takes some time." |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
646 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
647 |
busyHook := anObject |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
648 |
! |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
649 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
650 |
busyHookTimeout |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
651 |
"return the busyHooks timeout if any" |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
652 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
653 |
^ busyHookTimeout |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
654 |
! |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
655 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
656 |
busyHookTimeout:anObject |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
657 |
"set the busyHooks timeout - the busyHook will be invoked when the event-handling action |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
658 |
takes longer than this time." |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
659 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
660 |
busyHookTimeout := anObject |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
661 |
! |
512 | 662 |
|
663 |
postEventHook |
|
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
664 |
"return the postEventHook if any. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
665 |
That is a backwardCompatibility leftOver - no multiple hooks are supported." |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
666 |
|
4174 | 667 |
<resource:#obsolete> |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
668 |
self obsoleteMethodWarning:'use #postEventHooks'. |
512 | 669 |
^ postEventHook |
670 |
||
671 |
"Created: 7.3.1996 / 14:42:46 / cg" |
|
672 |
! |
|
673 |
||
674 |
postEventHook:anObject |
|
675 |
"set the postEventHook - this one will get all events |
|
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
676 |
passed after being processed here (via #processEvent:). |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
677 |
That is a backwardCompatibility leftOver - no multiple hooks are supported." |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
678 |
|
4174 | 679 |
<resource:#obsolete> |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
680 |
self obsoleteMethodWarning:'use #addPostEventHook:/removePostEventHook:'. |
512 | 681 |
postEventHook := anObject |
682 |
! |
|
683 |
||
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
684 |
postEventHooks |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
685 |
"return the postEventHooks if any" |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
686 |
|
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
687 |
^ postEventHooks |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
688 |
! |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
689 |
|
512 | 690 |
preEventHook |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
691 |
"return the preEventHook if any. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
692 |
That is a backwardCompatibility leftOver - no multiple hooks are supported." |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
693 |
|
4174 | 694 |
<resource:#obsolete> |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
695 |
self obsoleteMethodWarning:'use #preEventHooks'. |
512 | 696 |
^ preEventHook |
697 |
||
698 |
"Created: 7.3.1996 / 14:42:42 / cg" |
|
699 |
! |
|
700 |
||
701 |
preEventHook:anObject |
|
702 |
"set the preEventHook - this one will get all events |
|
703 |
passed before being processed here (via #processEvent:). |
|
704 |
If this returns true, the event is supposed to be already |
|
705 |
processed and ignored here. |
|
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
706 |
Otherwise, it is processed as usual. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
707 |
That is a backwardCompatibility leftOver - no multiple hooks are supported." |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
708 |
|
4174 | 709 |
<resource:#obsolete> |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
710 |
self obsoleteMethodWarning:'use #addPreEventHook:/removePreEventHook:'. |
512 | 711 |
preEventHook := anObject |
3280 | 712 |
! |
713 |
||
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
714 |
preEventHooks |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
715 |
"return the preEventHooks if any" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
716 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
717 |
^ preEventHooks |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
718 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
719 |
"Created: 7.3.1996 / 14:42:42 / cg" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
720 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
721 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
722 |
removePostEventHook:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
723 |
"remove a postEventHook" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
724 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
725 |
postEventHooks notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
726 |
postEventHooks removeIdentical:anEventProcessor ifAbsent:nil. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
727 |
postEventHooks isEmpty ifTrue:[ postEventHooks := nil ]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
728 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
729 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
730 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
731 |
removePreEventHook:anEventProcessor |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
732 |
"remove a preEventHook" |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
733 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
734 |
preEventHooks notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
735 |
preEventHooks removeIdentical:anEventProcessor ifAbsent:nil. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
736 |
preEventHooks isEmpty ifTrue:[ preEventHooks := nil ]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
737 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
738 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
739 |
|
3280 | 740 |
showWaitCursorWhenBusyForMillis:millis |
741 |
"setup a busyHook, which automatically shows a waitCursor, |
|
742 |
whenever some action takes longer than millis" |
|
743 |
||
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
744 |
self busyHookTimeout:millis. |
3280 | 745 |
self |
746 |
busyHook:[:isBusy | |
|
747 |
isBusy ifTrue:[ |
|
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
748 |
self showCursor:(Cursor wait). |
4536 | 749 |
] ifFalse:[ |
3280 | 750 |
self restoreCursors |
751 |
] |
|
752 |
]. |
|
512 | 753 |
! ! |
754 |
||
755 |
!WindowGroup methodsFor:'accessing-views'! |
|
756 |
||
244 | 757 |
addTopView:aView |
758 |
"add a topview to the group" |
|
26 | 759 |
|
244 | 760 |
topViews isNil ifTrue:[ |
2723 | 761 |
topViews := OrderedCollection with:aView. |
2445 | 762 |
] ifFalse:[ |
2723 | 763 |
(topViews includesIdentical:aView) ifFalse:[ |
764 |
topViews add:aView |
|
765 |
] |
|
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
766 |
] |
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
767 |
|
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
768 |
"Modified: 6.3.1996 / 15:35:15 / cg" |
26 | 769 |
! |
770 |
||
11 | 771 |
addView:aView |
26 | 772 |
"add aView to the windowGroup" |
773 |
||
11 | 774 |
views isNil ifTrue:[ |
3151 | 775 |
views := OrderedCollection with:aView. |
2445 | 776 |
] ifFalse:[ |
3151 | 777 |
(views includesIdentical:aView) ifFalse:[ |
778 |
views add:aView |
|
779 |
] |
|
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
780 |
] |
11 | 781 |
! |
782 |
||
3751 | 783 |
application |
784 |
|mainView| |
|
785 |
||
786 |
(mainView := self mainView) notNil ifTrue:[ |
|
787 |
^ mainView application |
|
788 |
]. |
|
789 |
^ nil |
|
790 |
! |
|
791 |
||
2445 | 792 |
mainView |
793 |
"return the mainview. Thats the first topView by default" |
|
794 |
||
795 |
topViews size == 0 ifTrue:[ ^ nil]. |
|
796 |
^ topViews first |
|
797 |
! |
|
798 |
||
26 | 799 |
removeView:aView |
800 |
"remove aView from the windowGroup; |
|
801 |
if this was the last view in this group, |
|
81 | 802 |
also shut down the corresponding process |
803 |
(actually, only wake it up here - it will terminate itself |
|
804 |
when finding out that all views are gone)" |
|
11 | 805 |
|
263 | 806 |
|sema| |
807 |
||
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
808 |
focusView == aView ifTrue:[ |
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
809 |
self setFocusView:nil |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
810 |
]. |
3151 | 811 |
|
11 | 812 |
views notNil ifTrue:[ |
3151 | 813 |
views removeIdentical:aView ifAbsent:nil. |
814 |
views isEmpty ifTrue:[ |
|
815 |
views := nil |
|
816 |
] |
|
11 | 817 |
]. |
818 |
topViews notNil ifTrue:[ |
|
3151 | 819 |
topViews removeIdentical:aView ifAbsent:nil. |
820 |
topViews isEmpty ifTrue:[ |
|
821 |
topViews := nil |
|
822 |
] |
|
11 | 823 |
]. |
54 | 824 |
" |
825 |
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
|
826 |
removed (modalBoxes terminate their modalLoop if so) |
54 | 827 |
" |
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
828 |
mySensor notNil ifTrue:[ |
3151 | 829 |
(sema := mySensor eventSemaphore) notNil ifTrue:[ |
830 |
sema signal |
|
831 |
] |
|
262
546f42586e3c
only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents:
251
diff
changeset
|
832 |
] |
1304 | 833 |
|
834 |
"Modified: 1.2.1997 / 12:13:26 / cg" |
|
11 | 835 |
! |
836 |
||
244 | 837 |
topViews |
2445 | 838 |
"return the topviews associated to this windowGroup" |
172 | 839 |
|
244 | 840 |
^ topViews |
172 | 841 |
! |
842 |
||
244 | 843 |
views |
2445 | 844 |
"return the views associated to this windowGroup" |
172 | 845 |
|
244 | 846 |
^ views |
54 | 847 |
! ! |
848 |
||
3887 | 849 |
!WindowGroup methodsFor:'activation & deactivation'! |
244 | 850 |
|
851 |
closeDownViews |
|
852 |
"destroy all views associated to this window group" |
|
853 |
||
854 |
topViews notNil ifTrue:[ |
|
3130
d489adbd1fd2
enumerate a copy of the collection, when closing down views
Claus Gittinger <cg@exept.de>
parents:
3103
diff
changeset
|
855 |
topViews copy do:[:aTopView | |
d489adbd1fd2
enumerate a copy of the collection, when closing down views
Claus Gittinger <cg@exept.de>
parents:
3103
diff
changeset
|
856 |
aTopView notNil ifTrue:[ |
d489adbd1fd2
enumerate a copy of the collection, when closing down views
Claus Gittinger <cg@exept.de>
parents:
3103
diff
changeset
|
857 |
aTopView destroy |
d489adbd1fd2
enumerate a copy of the collection, when closing down views
Claus Gittinger <cg@exept.de>
parents:
3103
diff
changeset
|
858 |
] |
d489adbd1fd2
enumerate a copy of the collection, when closing down views
Claus Gittinger <cg@exept.de>
parents:
3103
diff
changeset
|
859 |
] |
244 | 860 |
]. |
861 |
views := nil. |
|
862 |
topViews := nil. |
|
863 |
mySensor := nil. |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
864 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
865 |
"Modified: / 6.5.1999 / 09:47:18 / cg" |
3130
d489adbd1fd2
enumerate a copy of the collection, when closing down views
Claus Gittinger <cg@exept.de>
parents:
3103
diff
changeset
|
866 |
|
d489adbd1fd2
enumerate a copy of the collection, when closing down views
Claus Gittinger <cg@exept.de>
parents:
3103
diff
changeset
|
867 |
|
244 | 868 |
! |
869 |
||
3286
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
870 |
modalDialogFinished |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
871 |
"invoked, when a modal dialog is closed" |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
872 |
|
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
873 |
inModalLoop := false. |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
874 |
! |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
875 |
|
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
876 |
modalDialogStarts |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
877 |
"invoked, when a modal dialog is opened" |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
878 |
|
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
879 |
inModalLoop := true. |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
880 |
! |
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
881 |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
882 |
realizeTopViews |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
883 |
"realize all topViews associated to this windowGroup." |
244 | 884 |
|
885 |
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
|
886 |
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
|
887 |
aView realize. |
9bda3ac0d83d
no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents:
1966
diff
changeset
|
888 |
]. |
244 | 889 |
]. |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
890 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
891 |
"Created: 24.7.1997 / 12:56:09 / cg" |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
892 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
893 |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
894 |
restart |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
895 |
"restart after a snapin. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
896 |
This re-creates the windowGroup process and informs |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
897 |
my views." |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
898 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
899 |
topViews notNil ifTrue:[ |
2723 | 900 |
" |
901 |
need a new semaphore, since obsolete processes |
|
902 |
(from our previous live) may still sit on the current semaphore |
|
903 |
" |
|
904 |
mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema'). |
|
905 |
isModal ifFalse:[ |
|
906 |
self startupWith:[self restartTopViews]. |
|
907 |
] |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
908 |
] |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
909 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
910 |
"Modified: / 6.5.1999 / 09:46:08 / cg" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
911 |
! |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
912 |
|
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
913 |
restartTopViews |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
914 |
"inform all topViews associated to this windowGroup. |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
915 |
about the restart." |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
916 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
917 |
topViews notNil ifTrue:[ |
2723 | 918 |
topViews do:[:aView | |
919 |
aView isPopUpView ifFalse:[ |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
920 |
"/ aView realize. |
2723 | 921 |
aView restarted |
922 |
]. |
|
923 |
]. |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
924 |
]. |
180 | 925 |
|
2644
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
926 |
"Modified: / 6.5.1999 / 09:42:37 / cg" |
bb15778539af
oops - restart with iconified views recreated them
Claus Gittinger <cg@exept.de>
parents:
2587
diff
changeset
|
927 |
"Created: / 6.5.1999 / 09:46:33 / cg" |
244 | 928 |
! |
180 | 929 |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
930 |
shutDown |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
931 |
"shutdown the window group; close all views and |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
932 |
terminate the process" |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
933 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
934 |
self closeDownViews. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
935 |
self shutDownProcess. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
936 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
937 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
938 |
shutDownProcess |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
939 |
"shutdown the window group process" |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
940 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
941 |
|p| |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
942 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
943 |
myProcess notNil ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
944 |
p := myProcess. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
945 |
myProcess := nil. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
946 |
p terminate. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
947 |
] |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
948 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
949 |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
950 |
startupModal:checkBlock |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
951 |
"startup the window-group in a modal loop |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
952 |
(i.e. under the currently running process); |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
953 |
checkBlock is evaluated and the modal loop is left, |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
954 |
whenever false is returned." |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
955 |
|
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
956 |
^ self startupModal:checkBlock forGroup:(WindowGroup activeGroup). |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
957 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
958 |
"Created: 10.12.1995 / 14:15:11 / cg" |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
959 |
"Modified: 20.8.1997 / 17:54:33 / cg" |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
960 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
961 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
962 |
startupModal:checkBlock forGroup:mainGroup |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
963 |
"startup the window-group in a modal loop |
3780
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
964 |
(i.e. under the currently running process - NOT creating a new process); |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
965 |
checkBlock is evaluated and loop is left, when false is returned. |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
966 |
The mainGroup info is required to allow peeking into its |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
967 |
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
|
968 |
|
4182 | 969 |
|prevActiveKeyboardGrab prevActivePointerGrab prevFocus device tops prevGroup |
970 |
oldFocusScheme| |
|
971 |
||
972 |
oldFocusScheme := false. |
|
3348 | 973 |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
974 |
"set previousGroup to the main (non-modal) group" |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
975 |
|
3348 | 976 |
previousGroup isNil ifTrue:[previousGroup := mainGroup]. |
977 |
prevGroup := previousGroup. |
|
3354 | 978 |
prevGroup notNil ifTrue:[ |
979 |
"/ remember current grab, in case I am opened by |
|
980 |
"/ a popup (such as an extendedComboBox) ... |
|
981 |
device := prevGroup graphicsDevice. |
|
982 |
prevActiveKeyboardGrab := device activeKeyboardGrab. |
|
983 |
prevActivePointerGrab := device activePointerGrab. |
|
984 |
]. |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
985 |
isModal := true. |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
986 |
|
3780
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
987 |
myProcess isNil ifTrue:[ |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
988 |
creatingProcess := Processor activeProcess |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
989 |
]. |
69a0a7142c48
remember process which created a modal group,
Claus Gittinger <cg@exept.de>
parents:
3777
diff
changeset
|
990 |
|
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
991 |
mainGroup notNil ifTrue:[ |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
992 |
"/ tell the other group, that some modal dialog has started. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
993 |
mainGroup modalDialogStarts |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
994 |
]. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
995 |
|
4182 | 996 |
oldFocusScheme ifTrue:[ |
3352 | 997 |
previousGroup notNil ifTrue:[ |
998 |
prevFocus := previousGroup focusView. |
|
999 |
]. |
|
4182 | 1000 |
]. |
3348 | 1001 |
|
4340
de4c36dc3076
Use #answer:do: instead of #handle:do where appropriate
Stefan Vogel <sv@exept.de>
parents:
4335
diff
changeset
|
1002 |
WindowGroupQuerySignal answer:self do:[ |
3538
54c7307306b6
oops - redraw of a modal box which had a mdal box open
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
1003 |
LastActiveGroup := nil. |
54c7307306b6
oops - redraw of a modal box which had a mdal box open
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
1004 |
|
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1005 |
self realizeTopViews. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1006 |
|
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1007 |
self |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1008 |
eventLoopWhile:checkBlock |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1009 |
onLeave:[ |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1010 |
" |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1011 |
cleanup, in case of a terminate |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1012 |
" |
4182 | 1013 |
"/ previousGroup := nil. |
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1014 |
topViews := nil. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1015 |
views := nil. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1016 |
" |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1017 |
the following is rubbish; |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1018 |
the views could be reused .. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1019 |
" |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1020 |
|
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1021 |
"/ topViews notNil ifTrue:[ |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1022 |
"/ topViews do:[:aView | |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1023 |
"/ aView destroy |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1024 |
"/ ]. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1025 |
"/ topViews := nil. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1026 |
"/ ]. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1027 |
"/ views notNil ifTrue:[ |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1028 |
"/ views do:[:aView | |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1029 |
"/ aView destroy |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1030 |
"/ ]. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1031 |
"/ views := nil. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1032 |
"/ ]. |
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1033 |
|
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1034 |
] |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1035 |
]. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1036 |
|
3348 | 1037 |
"/ restore current grab, in case was opened by |
1038 |
"/ a popup (such as an extendedComboBox) ... |
|
1039 |
||
1040 |
mainGroup notNil ifTrue:[ |
|
1041 |
(prevGroup isModal or:[prevGroup isPopUp]) ifTrue:[ |
|
1042 |
" |
|
1043 |
return input focus to previously active groups top. |
|
1044 |
" |
|
4133 | 1045 |
tops := prevGroup topViews. |
1046 |
tops notEmptyOrNil ifTrue:[ |
|
3348 | 1047 |
tops first getKeyboardFocus. |
1048 |
]. |
|
1049 |
]. |
|
1050 |
]. |
|
1051 |
||
4378
29da8415352c
refactored intention revealing code:
Claus Gittinger <cg@exept.de>
parents:
4375
diff
changeset
|
1052 |
oldFocusScheme ifFalse:[ |
4182 | 1053 |
previousGroup notNil ifTrue:[ |
1054 |
prevFocus := previousGroup focusView. |
|
1055 |
]. |
|
1056 |
]. |
|
1057 |
||
1058 |
prevFocus notNil ifTrue:[ |
|
1059 |
previousGroup focusView requestFocus |
|
1060 |
]. |
|
1061 |
||
3348 | 1062 |
prevActivePointerGrab notNil ifTrue:[ device grabPointerInView:prevActivePointerGrab ]. |
1063 |
prevActiveKeyboardGrab notNil ifTrue:[ device grabKeyboardInView:prevActiveKeyboardGrab ]. |
|
1064 |
||
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1065 |
mainGroup notNil ifTrue:[ |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1066 |
"/ tell the other group, that some modal dialog has closed down. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1067 |
mainGroup modalDialogFinished |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1068 |
] |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1069 |
|
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1070 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1071 |
"Created: 10.12.1995 / 14:14:26 / cg" |
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1072 |
"Modified: 20.8.1997 / 18:12:20 / cg" |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1073 |
! |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1074 |
|
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1075 |
startupWith:startupAction |
244 | 1076 |
"startup the window-group; |
1822
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1077 |
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
|
1078 |
The startupAction arg is evaluated by the windowGroup process, |
38f24dca2eb2
changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents:
1806
diff
changeset
|
1079 |
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
|
1080 |
[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
|
1081 |
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
|
1082 |
blocking operations ...]" |
244 | 1083 |
|
2958
128f33a77fb1
added a hook to allow interception of new-sub-application
ca
parents:
2957
diff
changeset
|
1084 |
|top nm dev devNm invokingApp| |
244 | 1085 |
|
1086 |
previousGroup := nil. |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1087 |
|
244 | 1088 |
myProcess isNil ifTrue:[ |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1089 |
isModal := false. |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1090 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1091 |
"/ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1092 |
"/ this is the windowGroup process; |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1093 |
"/ realize all views, then handle events forever |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1094 |
"/ (well, not really forever ... ;-) |
2878 | 1095 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1096 |
myProcess := [ |
4340
de4c36dc3076
Use #answer:do: instead of #handle:do where appropriate
Stefan Vogel <sv@exept.de>
parents:
4335
diff
changeset
|
1097 |
WindowGroupQuerySignal answer:self do:[ |
3538
54c7307306b6
oops - redraw of a modal box which had a mdal box open
Claus Gittinger <cg@exept.de>
parents:
3511
diff
changeset
|
1098 |
LastActiveGroup := nil. |
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1099 |
[ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1100 |
startupAction value. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1101 |
self eventLoopWhile:[true] onLeave:[] |
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
1102 |
] ensure:[ |
3695 | 1103 |
|dev w app| |
1104 |
||
1105 |
(w := self mainView) notNil ifTrue:[ |
|
1106 |
(app := w application) notNil ifTrue:[ |
|
1107 |
app release |
|
1108 |
] |
|
1109 |
]. |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1110 |
(dev := self graphicsDevice) notNil ifTrue:[ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1111 |
dev deviceIOErrorSignal handle:[:ex | |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1112 |
] do:[ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1113 |
self closeDownViews |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1114 |
] |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1115 |
] |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1116 |
] |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1117 |
] |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1118 |
] newProcess. |
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
1119 |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1120 |
self setProcessNameWithRedirectIndicator:''. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
1121 |
myProcess priority:processPriority; |
3341 | 1122 |
beGroupLeader; |
1123 |
beGUIProcess. |
|
180 | 1124 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1125 |
"/ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1126 |
"/ when the process gets suspended, |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1127 |
"/ there maybe still buffered draw requests. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1128 |
"/ Arrange for them to be flushed then. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1129 |
"/ (otherwise, you would not see the output of a process, |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1130 |
"/ which suspends and waits - or we had to add buffer flushes |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1131 |
"/ all over the place) |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1132 |
"/ |
4801 | 1133 |
myProcess |
1134 |
addSuspendAction:[ |
|
1135 |
|dev| |
|
1136 |
||
1137 |
dev := self graphicsDevice. |
|
1138 |
dev notNil ifTrue:[dev flush]. |
|
1139 |
]. |
|
2851 | 1140 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1141 |
"/ allow for the currently active application, |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1142 |
"/ to hook on new-application process creation. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1143 |
(invokingApp := WindowGroup activeMainApplication) notNil ifTrue:[ |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1144 |
invokingApp postApplicationProcessCreate:myProcess windowGroup:self. |
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1145 |
]. |
4224
c0e06759a298
Avoid dangling references in context
Stefan Vogel <sv@exept.de>
parents:
4220
diff
changeset
|
1146 |
top := nm := dev := devNm := invokingApp:= nil. "/ to avoid dangling references via blocks home context. |
2959 | 1147 |
|
3172
9dbb035935b6
Define #activeApplication and #activeMainApplication (cg)
Stefan Vogel <sv@exept.de>
parents:
3156
diff
changeset
|
1148 |
myProcess resume. |
244 | 1149 |
] |
313 | 1150 |
|
4801 | 1151 |
"Modified: / 13-12-1995 / 14:04:53 / stefan" |
1152 |
"Created: / 24-07-1997 / 12:52:04 / cg" |
|
1153 |
"Modified: / 17-09-2007 / 10:59:34 / cg" |
|
3373
3585120d4d58
only eat a modal Escape-key event, if the modalView did unmap
Claus Gittinger <cg@exept.de>
parents:
3372
diff
changeset
|
1154 |
! ! |
180 | 1155 |
|
90 | 1156 |
!WindowGroup methodsFor:'enumerating'! |
54 | 1157 |
|
1117 | 1158 |
allNonTopViewsDo:aBlock |
1159 |
"evaluate aBlock for all nonTopviews (i.e. subviews) in this group. |
|
1334 | 1160 |
This enumerates a copy of the view collection, to allow for |
1240 | 1161 |
destroy and other collection changing operations to be performed in the loop." |
1117 | 1162 |
|
1163 |
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
|
1164 |
views copy nonNilElementsDo:aBlock |
1117 | 1165 |
] |
1334 | 1166 |
|
1167 |
"Modified: 12.2.1997 / 12:20:25 / cg" |
|
1117 | 1168 |
! |
1169 |
||
1153 | 1170 |
allTopViewsDo:aBlock |
1171 |
"evaluate aBlock for all topviews in this group. |
|
1334 | 1172 |
This enumerates a copy of the view collection, to allow for |
1240 | 1173 |
destroy and other collection changing operations to be performed in the loop." |
1153 | 1174 |
|
1175 |
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
|
1176 |
topViews copy nonNilElementsDo:aBlock |
1153 | 1177 |
] |
1334 | 1178 |
|
1179 |
"Modified: 12.2.1997 / 12:20:30 / cg" |
|
1153 | 1180 |
! |
1181 |
||
54 | 1182 |
allTopViewsExcept:aView do:aBlock |
157 | 1183 |
"evaluate aBlock for all topviews except aView in this group. |
1334 | 1184 |
This enumerates a copy of the view collection, to allow for |
1240 | 1185 |
destroy and other collection changing operations to be performed in the loop." |
157 | 1186 |
|
1334 | 1187 |
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
|
1188 |
v ~~ aView ifTrue:[aBlock value:v] |
157 | 1189 |
]. |
1334 | 1190 |
|
1191 |
"Modified: 12.2.1997 / 12:22:10 / cg" |
|
157 | 1192 |
! |
1193 |
||
244 | 1194 |
allViewsDo:aBlock |
1195 |
"evaluate aBlock for all views & topviews in this group. |
|
1334 | 1196 |
This enumerates a copy of the view collection, to allow for |
1240 | 1197 |
destroy and other collection changing operations to be performed in the loop." |
244 | 1198 |
|
1117 | 1199 |
self allTopViewsDo:aBlock. |
1200 |
self allNonTopViewsDo:aBlock. |
|
1334 | 1201 |
|
1202 |
"Modified: 12.2.1997 / 12:20:20 / cg" |
|
244 | 1203 |
! |
1204 |
||
1205 |
partnersDo:aBlock |
|
1206 |
"evaluate aBlock for all partnerViews. |
|
1334 | 1207 |
This enumerates a copy of the view collection, to allow for |
1240 | 1208 |
destroy and other collection changing operations to be performed in the loop." |
244 | 1209 |
|
1334 | 1210 |
self allTopViewsDo:[:v | |
3622
42b9c35a0f18
use #isSlave, #isPartner instead of comparing the type
Claus Gittinger <cg@exept.de>
parents:
3619
diff
changeset
|
1211 |
v isPartner ifTrue:[aBlock value:v]. |
244 | 1212 |
]. |
1334 | 1213 |
|
1214 |
"Modified: 12.2.1997 / 12:21:41 / cg" |
|
244 | 1215 |
! |
1216 |
||
157 | 1217 |
slavesDo:aBlock |
1218 |
"evaluate aBlock for all slaveViews. |
|
1334 | 1219 |
This enumerates a copy of the view collection, to allow for |
1240 | 1220 |
destroy and other collection changing operations to be performed in the loop." |
54 | 1221 |
|
1334 | 1222 |
self allTopViewsDo:[:v | |
3622
42b9c35a0f18
use #isSlave, #isPartner instead of comparing the type
Claus Gittinger <cg@exept.de>
parents:
3619
diff
changeset
|
1223 |
v isSlave ifTrue:[aBlock value:v]. |
157 | 1224 |
]. |
1334 | 1225 |
|
1226 |
"Modified: 12.2.1997 / 12:21:46 / cg" |
|
11 | 1227 |
! ! |
1228 |
||
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1229 |
!WindowGroup methodsFor:'event debugging'! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1230 |
|
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1231 |
traceEvents |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1232 |
"return the event tracing flag" |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1233 |
|
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1234 |
^ traceEvents |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1235 |
! |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1236 |
|
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1237 |
traceEvents:trueOrFalse |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1238 |
"turn event tracing on/off" |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1239 |
|
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1240 |
traceEvents := trueOrFalse |
605
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1241 |
! ! |
20f960026796
convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents:
598
diff
changeset
|
1242 |
|
19 | 1243 |
!WindowGroup methodsFor:'event handling'! |
11 | 1244 |
|
244 | 1245 |
eventLoop |
1246 |
"loop executed by windowGroup process; |
|
1247 |
wait-for and process events forever" |
|
1248 |
||
1249 |
self eventLoopWhile:[true] onLeave:[] |
|
1250 |
! |
|
1251 |
||
1252 |
eventLoopWhile:aBlock onLeave:cleanupActions |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1253 |
"wait-for and process events. |
244 | 1254 |
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
|
1255 |
and aBlock evaluates to true. |
244 | 1256 |
|
1752 | 1257 |
Some signals are caught & handled: |
3348 | 1258 |
LeaveSignal forces an exit from the eventLoop; |
4220 | 1259 |
AbortOperationRequest brings us back into the loop, processing the next event; |
3348 | 1260 |
ActivityNotifications send a #showActivity: if nonModal, |
1261 |
otherwise they are ignored." |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1262 |
|
3552 | 1263 |
|thisProcess sigs mainSema| |
244 | 1264 |
|
1265 |
thisProcess := Processor activeProcess. |
|
1266 |
||
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1267 |
sigs := SignalSet |
4474
58a2e62065a6
pass up AbortAllSignals to the original handler
Claus Gittinger <cg@exept.de>
parents:
4413
diff
changeset
|
1268 |
"/ with:AbortAllOperationRequest |
3348 | 1269 |
with:LeaveSignal |
1270 |
with:(self class activityNotificationSignal). |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1271 |
|
4474
58a2e62065a6
pass up AbortAllSignals to the original handler
Claus Gittinger <cg@exept.de>
parents:
4413
diff
changeset
|
1272 |
(isModal not or:[AbortAllOperationRequest isHandled not]) ifTrue:[ |
58a2e62065a6
pass up AbortAllSignals to the original handler
Claus Gittinger <cg@exept.de>
parents:
4413
diff
changeset
|
1273 |
sigs add:AbortAllOperationRequest |
58a2e62065a6
pass up AbortAllSignals to the original handler
Claus Gittinger <cg@exept.de>
parents:
4413
diff
changeset
|
1274 |
]. |
244 | 1275 |
[ |
3348 | 1276 |
|p g s mainGroup mySema waitSema groupForSema| |
1277 |
||
1278 |
waitSema := mySema := mySensor eventSemaphore. |
|
1279 |
||
1280 |
isModal ifTrue:[ |
|
1281 |
mainGroup := self mainGroup. |
|
1282 |
mainGroup == self ifTrue:[ |
|
1283 |
mainGroup := nil |
|
1284 |
]. |
|
1285 |
] ifFalse:[ |
|
1286 |
mainGroup := previousGroup |
|
1287 |
]. |
|
1876
6b5a5931a2b9
allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents:
1869
diff
changeset
|
1288 |
|
3348 | 1289 |
mainGroup notNil ifTrue:[ |
1290 |
mainSema := mainGroup sensor eventSemaphore. |
|
1291 |
waitSema := SemaphoreSet with:mySema with:mainSema. |
|
1292 |
||
1293 |
"/ must also care for all other groups in between |
|
1294 |
"/ (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
|
1295 |
|
3348 | 1296 |
g := previousGroup. |
1297 |
g ~~ mainGroup ifTrue:[ |
|
1298 |
groupForSema := IdentityDictionary new. |
|
1299 |
[g ~~ mainGroup] whileTrue:[ |
|
4329
514438e41210
care for group without sensor (already finished dialog)
Claus Gittinger <cg@exept.de>
parents:
4224
diff
changeset
|
1300 |
g sensor notNil ifTrue:[ |
514438e41210
care for group without sensor (already finished dialog)
Claus Gittinger <cg@exept.de>
parents:
4224
diff
changeset
|
1301 |
s := g sensor eventSemaphore. |
514438e41210
care for group without sensor (already finished dialog)
Claus Gittinger <cg@exept.de>
parents:
4224
diff
changeset
|
1302 |
waitSema add:s. |
514438e41210
care for group without sensor (already finished dialog)
Claus Gittinger <cg@exept.de>
parents:
4224
diff
changeset
|
1303 |
groupForSema at:s put:g. |
514438e41210
care for group without sensor (already finished dialog)
Claus Gittinger <cg@exept.de>
parents:
4224
diff
changeset
|
1304 |
]. |
3348 | 1305 |
g := g previousGroup. |
1306 |
] |
|
1307 |
]. |
|
1308 |
]. |
|
1309 |
||
1310 |
[aBlock value] whileTrue:[ |
|
1311 |
LastActiveGroup := self. |
|
1312 |
LastActiveProcess := thisProcess. |
|
1313 |
||
1314 |
(views isNil and:[topViews isNil]) ifTrue:[ |
|
1315 |
myProcess notNil ifTrue:[ |
|
4153 | 1316 |
self shutDownProcess. |
3348 | 1317 |
"not reached - there is no life after death" |
1318 |
]. |
|
1319 |
" |
|
1320 |
this is the end of a modal loop |
|
1321 |
(not having a private process ...) |
|
1322 |
" |
|
1323 |
^ self |
|
1324 |
]. |
|
1325 |
||
4408
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1326 |
(graphicsDevice notNil and:[graphicsDevice isOpen not]) ifTrue:[ |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1327 |
self closeDownViews. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1328 |
^ self. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1329 |
]. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1330 |
|
3348 | 1331 |
sigs handle:[:ex | |
1332 |
|theSig| |
|
1333 |
||
4335
b4bd7fae96bb
AbortOperationRequest is now a subclass (and child-Exception) of.
Stefan Vogel <sv@exept.de>
parents:
4329
diff
changeset
|
1334 |
theSig := ex signal. |
b4bd7fae96bb
AbortOperationRequest is now a subclass (and child-Exception) of.
Stefan Vogel <sv@exept.de>
parents:
4329
diff
changeset
|
1335 |
(AbortAllOperationRequest accepts:theSig) ifTrue:[ |
3348 | 1336 |
"/ |
1337 |
"/ on abort, stay in loop |
|
1338 |
"/ |
|
1339 |
ex return |
|
1340 |
]. |
|
1341 |
theSig == LeaveSignal ifTrue:[ |
|
1342 |
"/ |
|
1343 |
"/ on leave, exit the event loop |
|
1344 |
"/ |
|
3737 | 1345 |
self closeDownViews. |
3348 | 1346 |
^ self |
1347 |
]. |
|
1348 |
||
1349 |
"/ ActivityNotification |
|
1350 |
"/ |
|
1351 |
"/ if I am a modal-group, let it be handled |
|
4183 | 1352 |
"/ by the outer main-groups handler (but only if there is one) |
3348 | 1353 |
"/ otherwise show the activityMessage and continue. |
1354 |
"/ |
|
1355 |
isModal ifTrue:[ |
|
4335
b4bd7fae96bb
AbortOperationRequest is now a subclass (and child-Exception) of.
Stefan Vogel <sv@exept.de>
parents:
4329
diff
changeset
|
1356 |
(theSig isHandledIn:ex handlerContext sender) ifFalse:[ |
4183 | 1357 |
ex proceedWith:nil. |
1358 |
]. |
|
3348 | 1359 |
ex reject |
1360 |
"never reached" |
|
1361 |
]. |
|
4571
4ccda5e9bb8f
activityNotification - only pass message (not description)
Claus Gittinger <cg@exept.de>
parents:
4536
diff
changeset
|
1362 |
self showActivity:ex messageText. |
3348 | 1363 |
ex proceedWith:nil. |
1364 |
] do:[ |
|
1365 |
|dev gotSema mainView| |
|
1366 |
||
1367 |
(mainGroup notNil or:[mySensor hasEvents not]) ifTrue:[ |
|
1368 |
waitSema isNil ifTrue:[ |
|
1369 |
"/ oops - how can this happen .... |
|
1370 |
^ self. |
|
1371 |
]. |
|
1372 |
"/ Flush device output before going to sleep. |
|
1373 |
"/ This may produce more events to arrive. |
|
1374 |
"/ Q: is this still needed (see suspendAction) ? |
|
4408
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1375 |
Error |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1376 |
handle:[:ex | |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1377 |
(graphicsDevice notNil and:[graphicsDevice isOpen not]) ifTrue:[ |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1378 |
'WindowGroup [warning]: Error in flush - closing views' errorPrintCR. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1379 |
self closeDownViews. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1380 |
^ self. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1381 |
]. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1382 |
ex reject. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1383 |
] |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1384 |
do:[ |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1385 |
self graphicsDevice flush. |
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
1386 |
]. |
3348 | 1387 |
thisProcess setStateTo:#eventWait if:#active. |
3557 | 1388 |
|
1389 |
"/ now, wait for an event to arrive |
|
3348 | 1390 |
gotSema := waitSema wait. |
1391 |
] ifFalse:[ |
|
1392 |
gotSema := mySema |
|
1393 |
]. |
|
1394 |
LastActiveGroup := self. |
|
1395 |
LastActiveProcess := thisProcess. |
|
1396 |
||
1397 |
"/ some bad guy ;-) could have closed all down |
|
1398 |
"/ in the meanwhile ... |
|
1399 |
||
1400 |
mySensor notNil ifTrue:[ |
|
1401 |
gotSema == mySema ifTrue:[ |
|
1402 |
"/ |
|
1403 |
"/ an event for me |
|
1404 |
"/ |
|
1405 |
self processEventsWithModalGroup:nil |
|
1406 |
] ifFalse:[ |
|
1407 |
groupForSema notNil ifTrue:[ |
|
1408 |
g := groupForSema at:gotSema ifAbsent:nil. |
|
1409 |
g := g ? mainGroup. |
|
1410 |
] ifFalse:[ |
|
1411 |
g := mainGroup |
|
1412 |
]. |
|
1413 |
||
1414 |
"/ |
|
1415 |
"/ an event for my mainGroup |
|
1416 |
"/ |
|
1417 |
g topViews notNil ifTrue:[ |
|
1418 |
mainView := g topViews first |
|
1419 |
]. |
|
1420 |
mainView notNil ifTrue:[ |
|
1421 |
"/ |
|
1422 |
"/ if anything happened to the mainGroup |
|
1423 |
"/ bring my own topView back to the front |
|
1424 |
"/ This keeps modalBoxes visible |
|
4847
14c2810c8822
suppress reaiseDeiconified of the modal topview, if
Stefan Vogel <sv@exept.de>
parents:
4846
diff
changeset
|
1425 |
"/ (not needed with X, where the windowManager does it for us) |
3348 | 1426 |
(g sensor hasConfigureEventFor:mainView) ifTrue:[ |
1427 |
topViews size > 0 ifTrue:[ |
|
4847
14c2810c8822
suppress reaiseDeiconified of the modal topview, if
Stefan Vogel <sv@exept.de>
parents:
4846
diff
changeset
|
1428 |
topViews first shown ifTrue:[ |
4846
9a6f29cf47bf
suppress reaiseDeiconified of the modal topview, if
Stefan Vogel <sv@exept.de>
parents:
4801
diff
changeset
|
1429 |
topViews first raiseDeiconified |
9a6f29cf47bf
suppress reaiseDeiconified of the modal topview, if
Stefan Vogel <sv@exept.de>
parents:
4801
diff
changeset
|
1430 |
]. |
3348 | 1431 |
] |
1432 |
] |
|
1433 |
]. |
|
1434 |
" |
|
1435 |
if modal, also check for redraw events in my maingroup |
|
1436 |
(we arrive here after we woke up on maingroup sensor eventSemaphore) |
|
1437 |
" |
|
1438 |
g processEventsWithModalGroup:self. |
|
1439 |
] |
|
1440 |
] |
|
1441 |
]. |
|
1442 |
]. |
|
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
1443 |
] ensure:[ |
3348 | 1444 |
"/ |
1445 |
"/ perform any cleanupActions |
|
1446 |
"/ |
|
4413 | 1447 |
cleanupActions value |
244 | 1448 |
] |
313 | 1449 |
|
4571
4ccda5e9bb8f
activityNotification - only pass message (not description)
Claus Gittinger <cg@exept.de>
parents:
4536
diff
changeset
|
1450 |
"Modified: / 14-12-1995 / 11:12:24 / stefan" |
4ccda5e9bb8f
activityNotification - only pass message (not description)
Claus Gittinger <cg@exept.de>
parents:
4536
diff
changeset
|
1451 |
"Modified: / 29-08-2006 / 14:49:05 / cg" |
3373
3585120d4d58
only eat a modal Escape-key event, if the modalView did unmap
Claus Gittinger <cg@exept.de>
parents:
3372
diff
changeset
|
1452 |
! |
244 | 1453 |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1454 |
executePostEventHooksFor:anEvent |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1455 |
postEventHook notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1456 |
postEventHook processEvent:anEvent |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1457 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1458 |
postEventHooks notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1459 |
postEventHooks do:[:eachHook | |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1460 |
eachHook isBlock ifTrue:[ |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1461 |
eachHook value:anEvent |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1462 |
] ifFalse:[ |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1463 |
eachHook processEvent:anEvent |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1464 |
] |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1465 |
] |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1466 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1467 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1468 |
|
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1469 |
executePreEventHooksFor:anEvent |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1470 |
traceEvents == true ifTrue:[ |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1471 |
anEvent displayString infoPrintCR. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1472 |
]. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1473 |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1474 |
preEventHook notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1475 |
(preEventHook processEvent:anEvent) ifTrue:[ ^ true ]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1476 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1477 |
preEventHooks notNil ifTrue:[ |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1478 |
preEventHooks do:[:eachHook | |
3786
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1479 |
eachHook isBlock ifTrue:[ |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1480 |
(eachHook value:anEvent) ifTrue:[ ^ true ]. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1481 |
] ifFalse:[ |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1482 |
(eachHook processEvent:anEvent) ifTrue:[ ^ true ]. |
8e238ec303d8
obsoleted preEventHook and postEventHook;
Claus Gittinger <cg@exept.de>
parents:
3780
diff
changeset
|
1483 |
] |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1484 |
] |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1485 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1486 |
^ false |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1487 |
! |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1488 |
|
3736 | 1489 |
lastEvent |
1490 |
^ LastEventQuerySignal query |
|
1491 |
! |
|
1492 |
||
244 | 1493 |
leaveEventLoop |
1494 |
"immediately leave the event loop, returning way back. |
|
1495 |
This can be used to leave (and closedown) a modal group. |
|
1496 |
(for normal views, this does not make sense)" |
|
1497 |
||
1498 |
^ LeaveSignal raise |
|
1499 |
! |
|
1500 |
||
3737 | 1501 |
leaveModalLoop |
1502 |
"if the receiver has a modal window open (i.e. is in a modalLoop), |
|
1503 |
force him to leave it and proceed as usual. |
|
1504 |
Be warned: this is not a regular (i.e. OK/ESCAPE) the modal box closing." |
|
1505 |
||
1506 |
self isInModalLoop ifTrue:[ |
|
1507 |
LeaveSignal isHandled ifTrue:[ |
|
1508 |
self process interruptWith:[LeaveSignal raise] |
|
1509 |
] |
|
1510 |
]. |
|
1511 |
! |
|
1512 |
||
103 | 1513 |
processEvents |
1514 |
"process events from either the damage- or user input queues. |
|
1515 |
Abort is assumed to be handled elsewhere." |
|
19 | 1516 |
|
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1517 |
self processEventsWithModalGroup:nil |
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1518 |
|
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1519 |
"Modified: 5.3.1997 / 11:33:51 / cg" |
1328 | 1520 |
! |
1521 |
||
1419
a40a4f3ad589
while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents:
1411
diff
changeset
|
1522 |
processEventsWithModalGroup:modalGroup |
1328 | 1523 |
"process events from either the damage- or user input queues. |
1868 | 1524 |
Abort is assumed to be handled elsewhere." |
1328 | 1525 |
|
513
47b0f4bf4d89
use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents:
512
diff
changeset
|
1526 |
<resource: #keyboard (#Escape )> |
496 | 1527 |
|
3652 | 1528 |
|event ignore focus firstTop evView |
1529 |
modalTops modalTop modalDelegate keyboardProcessor |
|
3681 | 1530 |
busyHookBlock busyHookCalled top evReceiver| |
11 | 1531 |
|
72 | 1532 |
self processExposeEvents. |
180 | 1533 |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1534 |
[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1535 |
LastEventQuerySignal handle:[:ex | |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1536 |
ex proceedWith:event |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1537 |
] do:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1538 |
[mySensor notNil |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1539 |
and:[(event := mySensor nextEvent) notNil]] whileTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1540 |
ignore := false. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1541 |
focus := focusView. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1542 |
modalDelegate := false. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1543 |
modalTop := nil. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1544 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1545 |
modalGroup notNil ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1546 |
"/ an incoming event for a masterView, |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1547 |
"/ while being blocked by some other modalView. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1548 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1549 |
modalTops := modalGroup topViews. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1550 |
modalTops size > 0 ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1551 |
modalTop := modalTops first. |
3096 | 1552 |
]. |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1553 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1554 |
event isKeyEvent ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1555 |
"/ forward keyboard events to my modal |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1556 |
"/ groups first topView ... |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1557 |
modalTop notNil ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1558 |
focus := modalTop. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1559 |
modalDelegate := true. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1560 |
]. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1561 |
modalGroup focusView notNil ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1562 |
focus := modalGroup focusView |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1563 |
] |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1564 |
] ifFalse:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1565 |
event isFocusEvent ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1566 |
event isFocusInEvent ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1567 |
"/ move focus over to modalBox |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1568 |
modalTop notNil ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1569 |
modalTop getKeyboardFocus. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1570 |
"/ focusIn is forwarded to the modalGroup |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1571 |
"/ (since keyboard is forwarded) |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1572 |
event view:modalTop. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1573 |
focus := modalTop. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1574 |
] |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1575 |
] ifFalse:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1576 |
"/ focusOut goes to both the modal and |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1577 |
"/ the blocked main-group |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1578 |
"/ (actually, only the very first focusOut |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1579 |
"/ is needed in the mainGroup (to turn off the cursor) |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1580 |
"/ all others are only needed in the modalGroup) |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1581 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1582 |
"/ syntheticEvent := event copy. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1583 |
"/ syntheticEvent view:modalTop. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1584 |
"/ LastEventQuerySignal handle:[:ex | |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1585 |
"/ ex proceedWith:syntheticEvent |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1586 |
"/ ] do:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1587 |
"/ syntheticEvent sendEventWithFocusOn:nil. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1588 |
"/ ]. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1589 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1590 |
"/ event view:modalTop. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1591 |
]. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1592 |
modalDelegate := true. |
3096 | 1593 |
] ifFalse:[ |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1594 |
event isPointerLeaveEvent ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1595 |
] ifFalse:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1596 |
event isUserEvent ifTrue:[ |
3455
b519ff519547
button press in a view while a modal dialog is active:
Claus Gittinger <cg@exept.de>
parents:
3442
diff
changeset
|
1597 |
ignore := true. |
b519ff519547
button press in a view while a modal dialog is active:
Claus Gittinger <cg@exept.de>
parents:
3442
diff
changeset
|
1598 |
|
b519ff519547
button press in a view while a modal dialog is active:
Claus Gittinger <cg@exept.de>
parents:
3442
diff
changeset
|
1599 |
event isButtonPressEvent ifTrue:[ |
b519ff519547
button press in a view while a modal dialog is active:
Claus Gittinger <cg@exept.de>
parents:
3442
diff
changeset
|
1600 |
"/ raise the modalTop and beep |
b519ff519547
button press in a view while a modal dialog is active:
Claus Gittinger <cg@exept.de>
parents:
3442
diff
changeset
|
1601 |
event view device beep. |
b519ff519547
button press in a view while a modal dialog is active:
Claus Gittinger <cg@exept.de>
parents:
3442
diff
changeset
|
1602 |
modalTop notNil ifTrue:[ modalTop raise ]. |
b519ff519547
button press in a view while a modal dialog is active:
Claus Gittinger <cg@exept.de>
parents:
3442
diff
changeset
|
1603 |
] |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1604 |
] |
3096 | 1605 |
] |
1606 |
] |
|
1607 |
] |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1608 |
]. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1609 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1610 |
ignore ifFalse:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1611 |
(views notNil or:[topViews notNil]) ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1612 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1613 |
"/ give eventRecorders, catchers etc. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1614 |
"/ a chance to eat or modify that event |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1615 |
|
3777 | 1616 |
modalGroup notNil ifTrue:[ |
1617 |
ignore := (modalGroup executePreEventHooksFor:event). |
|
1618 |
] ifFalse:[ |
|
1619 |
ignore := false |
|
1620 |
]. |
|
1621 |
ignore ifFalse:[ |
|
1622 |
ignore := (self executePreEventHooksFor:event). |
|
4475 | 1623 |
ignore ifFalse:[ |
1624 |
evView := event view. |
|
1625 |
||
1626 |
(event isKeyEvent |
|
1627 |
and:[(keyboardProcessor := (modalTop ? evView topView) keyboardProcessor) notNil]) ifTrue:[ |
|
1628 |
ignore := keyboardProcessor processEvent:event forModalView:modalTop |
|
1629 |
]. |
|
1630 |
||
1631 |
ignore ifFalse:[ |
|
1632 |
"/ event handling below will vanish ... |
|
1633 |
"/ (keyboardProcessor will do it eventually) |
|
1634 |
||
1635 |
event isKeyPressEvent ifTrue:[ |
|
1636 |
event key == #Escape ifTrue:[ |
|
1637 |
modalDelegate ifTrue:[ |
|
1638 |
top := modalTop. |
|
1639 |
] ifFalse:[ |
|
1640 |
(isModal and:[topViews size > 0]) ifTrue:[ |
|
1641 |
top := topViews first. |
|
1642 |
] |
|
1643 |
]. |
|
1644 |
top notNil ifTrue:[ |
|
1645 |
top escapeIsCancel ifTrue:[ |
|
1646 |
top closeCancel. |
|
1647 |
"/ top hideRequest. |
|
1648 |
top realized ifFalse:[ ignore := true ]. |
|
1649 |
] |
|
1650 |
]. |
|
1651 |
] |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1652 |
] ifFalse:[ |
4475 | 1653 |
"/ |
1654 |
"/ keep track of which view has the pointer |
|
1655 |
"/ |
|
1656 |
event isPointerEnterEvent ifTrue:[ |
|
1657 |
pointerView := evView |
|
1658 |
] ifFalse:[ |
|
1659 |
event isPointerLeaveEvent ifTrue:[ |
|
1660 |
pointerView := nil |
|
1661 |
] |
|
3096 | 1662 |
] |
3440 | 1663 |
]. |
4475 | 1664 |
]. |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1665 |
]. |
3349 | 1666 |
]. |
1667 |
||
1668 |
ignore ifFalse:[ |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1669 |
"/ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1670 |
"/ buttonPress events turn off explicit focus, and reverts |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1671 |
"/ to implicit focus control |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1672 |
"/ This used to be done for every click - |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1673 |
"/ but behaved ugly if clicking in a scrollbar ... |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1674 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1675 |
"/ XXX: move to dispatchEvent |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1676 |
event isButtonPressEvent ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1677 |
(evView wantsFocusWithButtonPress) ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1678 |
"/ cannot use 'evView requestFocus' here, |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1679 |
"/ since we want to enforce it without giving the |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1680 |
"/ view a chance to circumvent this. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1681 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1682 |
"/ evView requestFocus. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1683 |
self focusView:evView. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1684 |
]. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1685 |
]. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1686 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1687 |
LastActiveGroup := self. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1688 |
LastActiveProcess := Processor activeProcess. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1689 |
|
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1690 |
(busyHook notNil and:[busyHookBlock isNil]) ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1691 |
(event isKeyEvent or:[event isButtonPressEvent]) ifTrue:[ |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1692 |
"/ start a timeout action - to invoke the busyHook after some time |
3298 | 1693 |
busyHookCalled := false. |
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1694 |
busyHookBlock := [ |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1695 |
(inModalLoop ~~ true and:[busyHookCalled not]) ifTrue:[ |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1696 |
busyHook value:true. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1697 |
busyHookCalled := true |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1698 |
] |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1699 |
]. |
4536 | 1700 |
Processor |
1701 |
addTimedBlock:busyHookBlock |
|
1702 |
for:Processor timeoutHandlerProcess |
|
1703 |
afterMilliseconds:(busyHookTimeout ? BusyHookTime ? 150). |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1704 |
]. |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1705 |
]. |
3681 | 1706 |
event isMessageSendEvent ifTrue:[ |
1707 |
event value "/ a synthetic event |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1708 |
] ifFalse:[ |
3681 | 1709 |
" |
1710 |
if there is no view information in the event, |
|
1711 |
it must have been sent directly to the sensor. |
|
1712 |
Send it to the first topView. |
|
1713 |
" |
|
1714 |
(evReceiver := evView) isNil ifTrue:[ |
|
1715 |
(firstTop := topViews first) notNil ifTrue:[ |
|
1716 |
event isApplicationEvent ifTrue:[ |
|
1717 |
evReceiver := firstTop application ? firstTop |
|
1718 |
] ifFalse:[ |
|
1719 |
evReceiver := firstTop. |
|
1720 |
]. |
|
1721 |
] |
|
1722 |
]. |
|
1723 |
evReceiver isNil ifTrue:[ |
|
1724 |
('WindowGroup [warning]: no receiver to dispatch ' , event type asString , '-event to. Ignored.') infoPrintCR. |
|
3298 | 1725 |
] ifFalse:[ |
3681 | 1726 |
evReceiver dispatchEvent:event withFocusOn:focus delegate:true |
1727 |
]. |
|
3096 | 1728 |
]. |
1729 |
]. |
|
2494
792881c4d938
slight change in keyboardProcessorHandling
Claus Gittinger <cg@exept.de>
parents:
2493
diff
changeset
|
1730 |
|
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1731 |
"/ give eventRecorders, postProcessors |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1732 |
"/ a chance to see that event |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1733 |
self executePostEventHooksFor:event |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1734 |
] |
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1735 |
]. |
3096 | 1736 |
]. |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1737 |
] |
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
1738 |
] ensure:[ |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1739 |
busyHookBlock notNil ifTrue:[ |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1740 |
Processor removeTimedBlock:busyHookBlock. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1741 |
busyHookBlock := nil. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1742 |
busyHookCalled ifTrue:[ |
3281
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1743 |
busyHook value:false. |
95e6d0e98f92
care for modal dialogs in automatic busy cursor handling
Claus Gittinger <cg@exept.de>
parents:
3280
diff
changeset
|
1744 |
busyHookCalled := false. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1745 |
] |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1746 |
]. |
3279
9d7a9a94bec0
unwind-protect busyBlock evaluation
Claus Gittinger <cg@exept.de>
parents:
3278
diff
changeset
|
1747 |
]. |
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
1748 |
|
2126
1f108c76dfdb
moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents:
2116
diff
changeset
|
1749 |
"Created: / 5.3.1997 / 11:33:11 / cg" |
3373
3585120d4d58
only eat a modal Escape-key event, if the modalView did unmap
Claus Gittinger <cg@exept.de>
parents:
3372
diff
changeset
|
1750 |
"Modified: / 4.8.1998 / 18:18:55 / cg" |
3585120d4d58
only eat a modal Escape-key event, if the modalView did unmap
Claus Gittinger <cg@exept.de>
parents:
3372
diff
changeset
|
1751 |
! |
48 | 1752 |
|
1753 |
processExposeEvents |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1754 |
"process only expose events from the damage queue. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1755 |
This also handles resize, mapped and unmap events." |
48 | 1756 |
|
2407 | 1757 |
self processExposeEventsFor:nil |
1758 |
||
1759 |
"Modified: / 3.12.1998 / 14:01:57 / cg" |
|
1760 |
! |
|
1761 |
||
1762 |
processExposeEventsFor:aViewOrNil |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1763 |
"process only expose events from the damage queue. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1764 |
This also handles resize, mapped and unmap events." |
2407 | 1765 |
|
3652 | 1766 |
|event view sensor thisProcess| |
109 | 1767 |
|
1768 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
|
2154 | 1769 |
(sensor damageCount ~~ 0) ifTrue:[ |
3096 | 1770 |
thisProcess := Processor activeProcess. |
180 | 1771 |
|
3096 | 1772 |
[(event := sensor nextDamageEventFor:aViewOrNil) notNil] whileTrue:[ |
1773 |
LastActiveGroup := self. |
|
1774 |
LastActiveProcess := thisProcess. |
|
180 | 1775 |
|
3096 | 1776 |
(views notNil or:[topViews notNil]) ifTrue:[ |
1777 |
view := event view. |
|
1778 |
(aViewOrNil isNil or:[aViewOrNil == view]) ifTrue:[ |
|
1779 |
LastEventQuerySignal handle:[:ex | |
|
1780 |
ex proceedWith:event |
|
1781 |
] do:[ |
|
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1782 |
(self executePreEventHooksFor:event) ifFalse:[ |
3096 | 1783 |
"/ |
1784 |
"/ if the view is no longer shown (iconified or closed), |
|
1785 |
"/ this is a leftover event and ignored. |
|
1786 |
"/ |
|
1787 |
"/ could this ever be a non-damage ? |
|
1788 |
"/ |
|
4152 | 1789 |
view notNil ifTrue:[ |
1790 |
(view shown or:[event isDamage not]) ifTrue:[ |
|
1791 |
LastActiveGroup := self. |
|
1792 |
LastActiveProcess := thisProcess. |
|
1793 |
||
1794 |
view dispatchEvent:event withFocusOn:nil delegate:true. |
|
1795 |
]. |
|
3096 | 1796 |
]. |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1797 |
]. |
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1798 |
self executePostEventHooksFor:event. |
3096 | 1799 |
]. |
1800 |
] |
|
1801 |
] |
|
1802 |
] |
|
90 | 1803 |
] |
1157 | 1804 |
|
2407 | 1805 |
"Created: / 3.12.1998 / 14:01:39 / cg" |
2440 | 1806 |
"Modified: / 5.2.1999 / 22:26:44 / cg" |
11 | 1807 |
! |
1808 |
||
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1809 |
processRealExposeEvents |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1810 |
"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
|
1811 |
(for any of my views). |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1812 |
This only handles true expose events - leaving map, unmap etc. in the queue. |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1813 |
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
|
1814 |
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
|
1815 |
|
2093 | 1816 |
self processRealExposeEventsFor:nil |
1817 |
! |
|
1818 |
||
1819 |
processRealExposeEventsFor:someViewOrNil |
|
1820 |
"process only expose events from the damage queue |
|
1821 |
(for any of my views if the arg is nil). |
|
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1822 |
This only handles true expose events - leaving map, unmap etc. in the queue. |
2093 | 1823 |
This is required after a scroll operation, |
1824 |
to wait for either a noExpose or a real expose." |
|
1825 |
||
4040 | 1826 |
|event view sensor thisProcess| |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1827 |
|
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1828 |
(sensor := mySensor) isNil ifTrue:[^ self]. |
2086
069a179b1849
dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents:
2051
diff
changeset
|
1829 |
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
|
1830 |
|
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1831 |
thisProcess := Processor activeProcess. |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1832 |
|
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1833 |
[true] whileTrue:[ |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1834 |
LastActiveGroup := self. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1835 |
LastActiveProcess := thisProcess. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1836 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1837 |
"/ event := aView nextDamage. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1838 |
event := sensor nextExposeEventFor:someViewOrNil. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1839 |
event isNil ifTrue:[^ self]. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1840 |
|
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1841 |
(views notNil or:[topViews notNil]) ifTrue:[ |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1842 |
LastEventQuerySignal handle:[:ex | |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1843 |
ex proceedWith:event |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1844 |
] do:[ |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1845 |
(self executePreEventHooksFor:event) ifFalse:[ |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1846 |
view := event view. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1847 |
"/ |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1848 |
"/ if the view is no longer shown (iconified or closed), |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1849 |
"/ this is a leftover event and ignored. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1850 |
"/ |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1851 |
view shown ifTrue:[ |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1852 |
LastActiveGroup := self. |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1853 |
LastActiveProcess := thisProcess. |
4040 | 1854 |
view dispatchEvent:event withFocusOn:nil delegate:true. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1855 |
] |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1856 |
]. |
3511
5c695c10caa1
multiple pre/post event hooks;
Claus Gittinger <cg@exept.de>
parents:
3486
diff
changeset
|
1857 |
self executePostEventHooksFor:event. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1858 |
] |
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1859 |
] |
1806
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1860 |
] |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1861 |
|
2086
069a179b1849
dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents:
2051
diff
changeset
|
1862 |
"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
|
1863 |
"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
|
1864 |
! |
16c958be35d8
fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents:
1752
diff
changeset
|
1865 |
|
2444 | 1866 |
repairDamage |
1867 |
"repair all damaged areas for any of my views right now." |
|
1868 |
||
1869 |
self processExposeEvents |
|
1870 |
||
1871 |
! |
|
1872 |
||
28 | 1873 |
waitForExposeFor:aView |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1874 |
"wait for an expose or noExpose event for aView, then process all exposes. |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1875 |
To be used after a scroll. |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1876 |
This is very X-specific and not needed with other systems |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1877 |
(i.e. a synthetic noExpose may be generated there)." |
28 | 1878 |
|
1879 |
mySensor waitForExposeFor:aView. |
|
4220 | 1880 |
AbortOperationRequest catch:[ |
3278
ecdd26a9d003
added busy hook (to support automatic hour-glass cursor)
Claus Gittinger <cg@exept.de>
parents:
3276
diff
changeset
|
1881 |
self processRealExposeEventsFor:aView |
90 | 1882 |
] |
500
a313e9fda9f0
ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents:
496
diff
changeset
|
1883 |
|
1851
6a6225647696
fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents:
1822
diff
changeset
|
1884 |
"Modified: 6.8.1997 / 19:50:24 / cg" |
11 | 1885 |
! ! |
19 | 1886 |
|
90 | 1887 |
!WindowGroup methodsFor:'focus control'! |
1888 |
||
2691
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1889 |
defaultKeyboardConsumer |
4180 | 1890 |
|view keyboardProcessor| |
1891 |
||
1892 |
view := self mainView. |
|
1893 |
view notNil ifTrue:[ |
|
1894 |
keyboardProcessor := view keyboardProcessor. |
|
1895 |
keyboardProcessor notNil ifTrue:[ |
|
1896 |
^ keyboardProcessor componentWithInitialFocus. |
|
1897 |
] |
|
1898 |
]. |
|
2691
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1899 |
^ nil |
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1900 |
! |
26dd87552563
provide a hook for a defaultFocusWidget (not yet implemented)
Claus Gittinger <cg@exept.de>
parents:
2686
diff
changeset
|
1901 |
|
2519 | 1902 |
explicitFocusView |
1903 |
"return the view which currently has the explicit (i.e. tabbed) focus" |
|
1904 |
||
1905 |
focusByTab == true ifFalse:[^ nil]. |
|
1906 |
^ focusView |
|
1907 |
! |
|
1908 |
||
2517 | 1909 |
focusCameByTab |
1910 |
^ focusByTab |
|
1911 |
! |
|
1912 |
||
244 | 1913 |
focusNext |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1914 |
"give focus to next view from focusView or topView |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1915 |
" |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1916 |
|curView oldView nxtView myTopViews| |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1917 |
|
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1918 |
(myTopViews := topViews) isEmptyOrNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1919 |
self setFocusView:nil. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1920 |
^ self |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1921 |
]. |
244 | 1922 |
|
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1923 |
(curView := focusView) isNil ifTrue:[ |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1924 |
myTopViews do:[:aView| |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1925 |
(aView shown and:[(nxtView := aView focusNext) notNil]) ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1926 |
^ self focusView:nxtView byTab:true |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1927 |
]. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1928 |
]. |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1929 |
^ self |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1930 |
]. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1931 |
(nxtView := curView focusNext) notNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1932 |
self focusView:nxtView byTab:true. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1933 |
^ self |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1934 |
]. |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1935 |
self setFocusView:nil. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1936 |
|
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1937 |
[ oldView := curView. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1938 |
(curView := curView superView) notNil |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1939 |
] whileTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1940 |
curView shown ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1941 |
nxtView := curView focusNextChildAfter:oldView. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1942 |
nxtView notNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1943 |
^ self focusView:nxtView byTab:true |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1944 |
]. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1945 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1946 |
]. |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1947 |
"/ ? should tab through the windowGroup ? |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1948 |
focusView isNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1949 |
self focusNext |
244 | 1950 |
]. |
1951 |
! |
|
1952 |
||
2219 | 1953 |
focusNextFrom:aView |
1954 |
"give focus to the view after aView in the focusSequence" |
|
1955 |
||
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
1956 |
self setFocusView:aView. |
2219 | 1957 |
self focusNext |
1958 |
||
1959 |
"Created: / 4.8.1998 / 02:43:17 / cg" |
|
1960 |
! |
|
1961 |
||
244 | 1962 |
focusPrevious |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1963 |
"give focus to previous view from focusView or topView |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1964 |
" |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1965 |
|curView oldView nxtView subViews done| |
244 | 1966 |
|
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1967 |
(curView := focusView) isNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1968 |
topViews notNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1969 |
curView := topViews detect:[:aView|aView shown] ifNone:nil. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1970 |
] |
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
1971 |
]. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1972 |
curView isNil ifTrue:[^ self]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1973 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1974 |
focusView isNil ifTrue:[ |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1975 |
subViews := curView subviewsInFocusOrder. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1976 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1977 |
subViews size ~~ 0 ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1978 |
curView := subViews detectLast:[:v|v shown] ifNone:nil |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1979 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1980 |
curView isNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1981 |
^ self focusToView:nil |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1982 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1983 |
done := false. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1984 |
|
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
1985 |
[done not and:[(subViews := curView subviewsInFocusOrder) size ~~ 0]] whileTrue:[ |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1986 |
nxtView := subViews detectLast:[:v|v shown] ifNone:nil. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1987 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1988 |
nxtView notNil ifTrue:[curView := nxtView] |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1989 |
ifFalse:[done := true]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1990 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1991 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1992 |
(curView canTab and:[curView enabled]) ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1993 |
^ self focusView:curView byTab:true |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1994 |
]. |
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
1995 |
self setFocusView:curView. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1996 |
] ifFalse:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1997 |
nxtView := focusView. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
1998 |
"/ check whether all superView's are shown |
949
3894d442e895
care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents:
931
diff
changeset
|
1999 |
|
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2000 |
[(nxtView := nxtView superView) notNil] whileTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2001 |
nxtView shown ifFalse:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2002 |
curView := nxtView superView |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2003 |
] |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2004 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2005 |
curView ~~ focusView ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2006 |
curView isNil ifTrue:[ |
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2007 |
self setFocusView:nil. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2008 |
self focusPrevious. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2009 |
] ifFalse:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2010 |
self focusView:curView byTab:true |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2011 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2012 |
^ self |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2013 |
]. |
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2014 |
self setFocusView:nil. |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2015 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2016 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2017 |
[true] whileTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2018 |
oldView := curView. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2019 |
curView := curView superView. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2020 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2021 |
curView isNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2022 |
focusView notNil ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2023 |
^ self |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2024 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2025 |
^ self focusPrevious |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2026 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2027 |
|
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2028 |
curView shown ifTrue:[ |
4733
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2029 |
nxtView := curView focusPreviousChildBefore:oldView. |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2030 |
nxtView notNil ifTrue:[ |
80b915a584ab
focus handling changed: looking for subviewsInFocusOrder
ca
parents:
4677
diff
changeset
|
2031 |
^ self focusView:nxtView byTab:true |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2032 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2033 |
]. |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2034 |
]. |
244 | 2035 |
! |
2036 |
||
2219 | 2037 |
focusPreviousFrom:aView |
2038 |
"give focus to the view before aView in the focusSequence" |
|
2039 |
||
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2040 |
self setFocusView:aView. |
2219 | 2041 |
self focusPrevious |
2042 |
||
2043 |
"Created: / 4.8.1998 / 02:43:08 / cg" |
|
2044 |
! |
|
2045 |
||
2506 | 2046 |
focusRequestFrom:aView |
2047 |
"aView requests focus. I will grant it, if I have no explicit |
|
2048 |
focusView (i.e. not tabbed)" |
|
2049 |
||
3651 | 2050 |
|prevFocusView myDisplay| |
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2051 |
|
2692 | 2052 |
"/ 'focusRequest:' print. aView print. |
2053 |
||
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2054 |
myDisplay := self graphicsDevice. |
3651 | 2055 |
(myDisplay notNil and:[myDisplay activateOnClick:nil]) ifTrue:[ |
3400 | 2056 |
prevFocusView := myDisplay focusView. |
2057 |
(prevFocusView notNil |
|
3651 | 2058 |
and:[prevFocusView windowGroup ~~ aView windowGroup]) ifTrue:[ |
3400 | 2059 |
"/ a view from another windowGroup requests the focus. |
2060 |
"/ Do not grant this, if in windows-activateOnClick mode. |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2061 |
|
2692 | 2062 |
"/ ' not granted' printCR. |
3657 | 2063 |
|
2064 |
"/ check this - must be commented for windows |
|
2065 |
"/ prevFocusView getKeyboardFocus. |
|
3400 | 2066 |
^ false |
2067 |
]. |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2068 |
]. |
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2069 |
|
2692 | 2070 |
"/ ' granted' printCR. |
2071 |
||
2506 | 2072 |
(focusView isNil or:[focusByTab not]) ifTrue:[ |
3400 | 2073 |
(aView isNil or:[aView ~~ focusView]) ifTrue:[ |
2074 |
self focusView:aView byTab:false. |
|
2075 |
]. |
|
2076 |
^ true |
|
2506 | 2077 |
]. |
2078 |
^ false |
|
2686
f074aa7d0748
care for activateOnClick mode when granting a focusRequest.
Claus Gittinger <cg@exept.de>
parents:
2644
diff
changeset
|
2079 |
|
2692 | 2080 |
"Modified: / 20.5.1999 / 18:30:31 / cg" |
2506 | 2081 |
! |
2082 |
||
90 | 2083 |
focusSequence:aSequenceableCollection |
2084 |
"define the focus sequence for focusNext/focusPrevious. |
|
2085 |
Focus is stepped in the order in which subviews occur in |
|
1946 | 2086 |
the sequence." |
90 | 2087 |
! |
2088 |
||
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2089 |
focusToView:aViewOrNil |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2090 |
"give focus to aViewOrNil" |
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2091 |
|
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2092 |
focusView == aViewOrNil ifFalse:[ |
4943 | 2093 |
(aViewOrNil isNil |
3156
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2094 |
or:[(aViewOrNil canTab and:[aViewOrNil enabled])] |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2095 |
) ifTrue:[ |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2096 |
self focusView:aViewOrNil |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2097 |
] |
38b73e5c08aa
focusNext and focusPrevious reimplemented; abwärts compatible
ca
parents:
3151
diff
changeset
|
2098 |
]. |
2353
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2099 |
! |
e04098201f7c
added #focusToView: - checks if its a valid view in the focusSequence.
Claus Gittinger <cg@exept.de>
parents:
2250
diff
changeset
|
2100 |
|
90 | 2101 |
focusView |
135 | 2102 |
"return the view which currently has the focus" |
90 | 2103 |
|
2104 |
^ focusView |
|
2105 |
! |
|
2106 |
||
2107 |
focusView:aViewOrNil |
|
2108 |
"give focus to aViewOrNil" |
|
2109 |
||
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2110 |
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
|
2111 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2112 |
" |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2113 |
|top v1 v2| |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2114 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2115 |
top := StandardSystemView new. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2116 |
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
|
2117 |
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
|
2118 |
top open. |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2119 |
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
|
2120 |
" |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2121 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2122 |
"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
|
2123 |
! |
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2124 |
|
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2125 |
focusView:aViewOrNil byTab:focusCameViaTab |
2507 | 2126 |
"give focus to aViewOrNil. |
2127 |
The focusCameViaTab argument specifies if the focus came via |
|
2128 |
tabbing or by pointer-movement/automatic. |
|
2129 |
If it came via tabbing, the view is notified differently, to allow |
|
2130 |
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
|
2131 |
|
3652 | 2132 |
|prevFocusView myDisplay| |
2506 | 2133 |
|
3376 | 2134 |
"/ 'focusToView:' print. aViewOrNil printCR. |
2692 | 2135 |
|
2507 | 2136 |
myDisplay := self graphicsDevice. |
2522 | 2137 |
myDisplay notNil ifTrue:[ |
3376 | 2138 |
"/ |
2139 |
"/ take the focus from whichEver view had it previously |
|
2140 |
"/ |
|
2141 |
prevFocusView := myDisplay focusView. |
|
2142 |
prevFocusView ~~ aViewOrNil ifTrue:[ |
|
2143 |
"/ 'take focus from ' print. prevFocusView printCR. |
|
2144 |
self class takeFocusFromDevice:myDisplay. |
|
2145 |
]. |
|
2506 | 2146 |
]. |
2147 |
||
4677 | 2148 |
myDisplay focusView:aViewOrNil. |
4676 | 2149 |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2150 |
focusView == aViewOrNil ifTrue:[ |
3376 | 2151 |
focusView notNil ifTrue:[ |
2152 |
"/ this is the case when the mouse-pointer reenters |
|
2153 |
"/ into a topView which had a focusView |
|
4973 | 2154 |
"/ cg: disabled 5.jun.08 |
2155 |
focusByTab := focusCameViaTab "or:[focusByTab]". |
|
3376 | 2156 |
focusView showFocus:focusByTab. |
2157 |
"/ 'give focus to ' print. aViewOrNil printCR. |
|
2158 |
self class sendKeyboardFocusEventTo:aViewOrNil withArgument:true. |
|
2159 |
]. |
|
2160 |
^ self |
|
2485
410e810ccbcc
remember if focus came by tabbing or clicking into the focusView
Claus Gittinger <cg@exept.de>
parents:
2479
diff
changeset
|
2161 |
]. |
410
9d9d03fa5d82
moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents:
408
diff
changeset
|
2162 |
|
90 | 2163 |
focusView notNil ifTrue:[ |
3376 | 2164 |
"/ lost explicit focus |
2165 |
focusView == aViewOrNil ifTrue:[ |
|
2166 |
"/ 'give focus to ' print. aViewOrNil printCR. |
|
2167 |
self class sendKeyboardFocusEventTo:aViewOrNil withArgument:true. |
|
2168 |
^ self |
|
2169 |
]. |
|
90 | 2170 |
]. |
387
aa80487842b8
compile event classes with optSpace;
Claus Gittinger <cg@exept.de>
parents:
385
diff
changeset
|
2171 |
|
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2172 |
self setFocusView:aViewOrNil. |
90 | 2173 |
focusView notNil ifTrue:[ |
3376 | 2174 |
"/ got explicit focus |
2175 |
aViewOrNil showFocus:focusCameViaTab. |
|
2176 |
"/ 'give focus to ' print. aViewOrNil printCR. |
|
2177 |
self class sendKeyboardFocusEventTo:aViewOrNil withArgument:true. |
|
2178 |
focusByTab := focusCameViaTab. |
|
90 | 2179 |
]. |
2180 |
||
2181 |
" |
|
2182 |
|top v1 v2| |
|
2183 |
||
2184 |
top := StandardSystemView new. |
|
2185 |
v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
2186 |
v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
2187 |
top open. |
|
2188 |
top windowGroup focusView:v1. |
|
2189 |
" |
|
357
3655807445b7
keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents:
330
diff
changeset
|
2190 |
|
4677 | 2191 |
"Modified: / 08-11-2006 / 12:17:55 / cg" |
2479
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
2192 |
! |
2dbe1821533b
care for subWidgets when searching for the currentFocusView
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
2193 |
|
4737 | 2194 |
focusViewUnmapped |
2195 |
"the view which currently had the focus was unmapped" |
|
2196 |
||
2197 |
self focusView:nil |
|
2198 |
! |
|
2199 |
||
2737 | 2200 |
pointerView |
2201 |
"return the view which currently has the pointer" |
|
2202 |
||
2203 |
^ pointerView |
|
3486
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2204 |
! |
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2205 |
|
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2206 |
setFocusView:aViewOrNil |
f93691c57540
cleanup - single access to focusView
Claus Gittinger <cg@exept.de>
parents:
3459
diff
changeset
|
2207 |
focusView := aViewOrNil |
244 | 2208 |
! ! |
2209 |
||
2210 |
!WindowGroup methodsFor:'initialization'! |
|
2211 |
||
3683 | 2212 |
beSynchronous |
2213 |
mySensor := SynchronousWindowSensor new. |
|
2214 |
! |
|
2215 |
||
244 | 2216 |
initialize |
2217 |
"setup the windowgroup, by creating a new sensor |
|
2218 |
and an event semaphore" |
|
2219 |
||
2220 |
mySensor := WindowSensor new. |
|
1273 | 2221 |
mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema'). |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2222 |
processPriority := Processor userSchedulingPriority. |
244 | 2223 |
isModal := false. |
417 | 2224 |
isForModalSubview := false. |
1273 | 2225 |
|
2226 |
"Modified: 25.1.1997 / 00:20:19 / cg" |
|
90 | 2227 |
! |
2228 |
||
244 | 2229 |
reinitialize |
2230 |
"reinitialize the windowgroup after an image restart" |
|
90 | 2231 |
|
244 | 2232 |
"throw away old (zombie) process" |
2233 |
myProcess notNil ifTrue:[ |
|
3683 | 2234 |
"/ careful: the old processes exit-actions must be cleared. |
2235 |
"/ otherwise, it might do destroy or other actions when it |
|
2236 |
"/ gets finalized ... |
|
1186
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2237 |
|
e1fbbabcd682
no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents:
1157
diff
changeset
|
2238 |
"/ myProcess removeAllExitActions. |
3683 | 2239 |
myProcess removeAllSuspendActions. |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2240 |
processPriority := myProcess priority. "save old priority" |
3683 | 2241 |
myProcess := nil. |
244 | 2242 |
]. |
90 | 2243 |
|
244 | 2244 |
"throw away old events" |
3683 | 2245 |
mySensor notNil ifTrue:[mySensor reinitialize] |
313 | 2246 |
|
2247 |
"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
|
2248 |
"Modified: 12.1.1997 / 00:45:01 / cg" |
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2249 |
! |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2250 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2251 |
setProcessNameWithRedirectIndicator:redirectString |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2252 |
"give the windowGroup process a user friendly name. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2253 |
This name shows up in the ProcessMonitor" |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2254 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2255 |
|top nm dev devNm defaultDisplay| |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2256 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2257 |
"ask my topView for the processName, and |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2258 |
optionally append the displayName (if its not the default)" |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2259 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2260 |
topViews size ~~ 0 ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2261 |
top := topViews first. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2262 |
nm := top processName. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2263 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2264 |
dev := top graphicsDevice. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2265 |
defaultDisplay := Screen default. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2266 |
(dev notNil and:[dev ~~ defaultDisplay]) ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2267 |
devNm := dev displayName. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2268 |
(devNm notNil and:[defaultDisplay isNil or:[devNm ~= defaultDisplay displayName]]) ifTrue:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2269 |
nm := nm , ' (' , redirectString , devNm , ')' |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2270 |
] |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2271 |
] |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2272 |
] ifFalse:[ |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2273 |
nm := 'window handler'. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2274 |
]. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2275 |
myProcess name:nm. |
90 | 2276 |
! ! |
2277 |
||
3372 | 2278 |
!WindowGroup methodsFor:'keyboard control'! |
2279 |
||
3391 | 2280 |
processMnemonic:aKeyEvent |
3372 | 2281 |
"a mnemonicKey event as forwarded from the keyboardProcessor - if there |
3822 | 2282 |
is the mnemonic-key defined for a subView, true is returned and the view |
2283 |
becomes the focusView. Otherwise return false. |
|
3372 | 2284 |
" |
2285 |
|topView mnemonicView| |
|
2286 |
||
2287 |
focusView notNil ifTrue:[ |
|
2288 |
"/ start from current focusView |
|
2289 |
mnemonicView := focusView mnemonicViewNext:aKeyEvent. |
|
2290 |
||
3391 | 2291 |
(mnemonicView notNil and:[true "mnemonicView canTab" and:[mnemonicView enabled]]) ifTrue:[ |
3372 | 2292 |
self focusView:mnemonicView byTab:false. |
3822 | 2293 |
^ true |
3372 | 2294 |
] |
2295 |
]. |
|
2296 |
||
2297 |
"/ start from any topview |
|
2298 |
topViews notNil ifTrue:[ |
|
2299 |
topView := topViews detect:[:aView| aView shown ] ifNone:nil. |
|
2300 |
||
2301 |
topView notNil ifTrue:[ |
|
2302 |
mnemonicView := topView mnemonicViewNext:aKeyEvent. |
|
2303 |
||
3391 | 2304 |
(mnemonicView notNil and:[true "mnemonicView canTab" and:[mnemonicView enabled]]) ifTrue:[ |
3372 | 2305 |
self focusView:mnemonicView byTab:false. |
3822 | 2306 |
^ true |
3372 | 2307 |
] |
2308 |
] |
|
2309 |
]. |
|
3376 | 2310 |
^ false |
2311 |
! |
|
3372 | 2312 |
|
2313 |
processShortcut:aKeyEvent |
|
3652 | 2314 |
"a shortcut key event as forwarded from the keyboardProcessor - if there is the |
4943 | 2315 |
shortcut key defined, process the shortcut and return true - otherwise false." |
2316 |
||
3652 | 2317 |
|topView| |
3372 | 2318 |
|
2319 |
"/ start from current focusView |
|
2320 |
(focusView notNil and:[focusView processShortcut:aKeyEvent]) ifTrue:[ |
|
2321 |
^ true |
|
2322 |
]. |
|
2323 |
||
2324 |
"/ start from any topview |
|
2325 |
topViews notNil ifTrue:[ |
|
2326 |
topView := topViews detect:[:v| v ~~ focusView and:[v shown]] ifNone:nil. |
|
4943 | 2327 |
^ topView notNil and:[topView processShortcut:aKeyEvent] |
3372 | 2328 |
]. |
3376 | 2329 |
^ false |
2330 |
! ! |
|
3372 | 2331 |
|
3276 | 2332 |
!WindowGroup methodsFor:'printing & storing'! |
19 | 2333 |
|
90 | 2334 |
printOn:aStream |
19 | 2335 |
"return a printed representation; |
144 | 2336 |
just for more user friendlyness: add name of process." |
19 | 2337 |
|
90 | 2338 |
myProcess isNil ifTrue:[ |
3077 | 2339 |
(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[ |
2340 |
aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')'). |
|
2341 |
^ self. |
|
2342 |
]. |
|
2343 |
^ super printOn:aStream |
|
2870 | 2344 |
]. |
2345 |
isModal ifTrue:[ |
|
3077 | 2346 |
aStream nextPutAll:('WindowGroup(modal for ' , myProcess nameOrId , ')'). |
2347 |
^ self. |
|
90 | 2348 |
]. |
2349 |
aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')') |
|
19 | 2350 |
! ! |
244 | 2351 |
|
4962 | 2352 |
!WindowGroup methodsFor:'queries'! |
2353 |
||
2354 |
anyViewHasFocus |
|
2355 |
^ graphicsDevice notNil |
|
2356 |
and:[ graphicsDevice focusView notNil |
|
2357 |
and:[ graphicsDevice focusView windowGroup == self ]] |
|
2358 |
! |
|
2359 |
||
2360 |
isPopUp |
|
2361 |
"return true, if the receiver is for a popUp view" |
|
2362 |
||
2363 |
isModal ifFalse:[^ false]. |
|
2364 |
topViews isNil ifTrue:[^ true]. "/ a closed popup ... |
|
2365 |
^ topViews first isPopUpView |
|
2366 |
||
2367 |
"Created: / 9.7.1998 / 01:13:01 / cg" |
|
2368 |
"Modified: / 9.7.1998 / 01:17:11 / cg" |
|
2369 |
! ! |
|
2370 |
||
244 | 2371 |
!WindowGroup methodsFor:'special'! |
2372 |
||
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2373 |
migrateTo:anotherDisplay |
3302 | 2374 |
"migrate all of my views to some other display device" |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2375 |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2376 |
|myDevice previouslyRealized| |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2377 |
|
3304
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2378 |
self isModal ifTrue:[ |
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2379 |
"/ cannot migrate a modal box away from its owner ... |
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2380 |
"/ (need a separate process and views may not be owned) |
4348 | 2381 |
Transcript showCR:'Modal windogroup cannot be migrated.'. |
2382 |
"/ self error:'Modal windogroup cannot be migrated.'. |
|
3304
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2383 |
^ self |
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2384 |
]. |
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2385 |
|
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2386 |
previouslyRealized := IdentitySet new. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2387 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2388 |
myDevice := self graphicsDevice. |
3308 | 2389 |
DeviceWorkstation flushCachedLastScreen. |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2390 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2391 |
graphicsDevice := nil. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2392 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2393 |
"/ enumerate views - flush their device info ... |
3841
39b293125434
care for 'migrate back' pressed without any topViews left (closed before).
martin
parents:
3822
diff
changeset
|
2394 |
self allTopViewsDo:[:eachTopView | |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2395 |
eachTopView realized ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2396 |
previouslyRealized add:eachTopView |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2397 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2398 |
eachTopView unmap. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2399 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2400 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2401 |
"/ destroy them - but without notifying application/views |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2402 |
self allViewsDo:[:eachView | |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2403 |
eachView releaseDeviceResources. |
3302 | 2404 |
eachView setDevice:anotherDisplay id:nil gcId:nil. |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2405 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2406 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2407 |
"/ recreate them ... |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2408 |
self allViewsDo:[:eachView | |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2409 |
eachView recreate. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2410 |
eachView fetchDeviceResources |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2411 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2412 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2413 |
"/ realize them ... |
3304
6dcc6bb7c3e5
block migration of a modalBox
Claus Gittinger <cg@exept.de>
parents:
3302
diff
changeset
|
2414 |
(topViews ? previouslyRealized) do:[:eachTopView | |
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2415 |
(previouslyRealized includes:eachTopView) ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2416 |
eachTopView realize |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2417 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2418 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2419 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2420 |
graphicsDevice := anotherDisplay. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2421 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2422 |
anotherDisplay sync. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2423 |
myDevice sync. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2424 |
|
4375
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2425 |
|
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2426 |
"change the name of my process" |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2427 |
self setProcessNameWithRedirectIndicator:'->'. |
d16dc7e26e38
On snapshot image restart, restore the priority
Stefan Vogel <sv@exept.de>
parents:
4348
diff
changeset
|
2428 |
|
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2429 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2430 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2431 |
|anotherDisplay v host| |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2432 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2433 |
v := StandardSystemView new. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2434 |
v extent:100@100. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2435 |
v addSubView:(Button label:'foo'). |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2436 |
v openAndWait. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2437 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2438 |
host := Dialog request:'display:' initialAnswer:'dawn:0'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2439 |
host isNil ifTrue:[^ self]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2440 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2441 |
anotherDisplay := XWorkstation newDispatchingFor:host. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2442 |
anotherDisplay isNil ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2443 |
self warn:'Could not connect to remote display'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2444 |
^ self |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2445 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2446 |
Smalltalk at:#Display2 put:anotherDisplay. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2447 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2448 |
v windowGroup migrateTo:anotherDisplay |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2449 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2450 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2451 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2452 |
|anotherDisplay app host| |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2453 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2454 |
app := NewSystemBrowser open. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2455 |
app window waitUntilVisible. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2456 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2457 |
host := Dialog request:'display:' initialAnswer:'dawn:0'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2458 |
host isNil ifTrue:[^ self]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2459 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2460 |
anotherDisplay := XWorkstation newDispatchingFor:host. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2461 |
anotherDisplay isNil ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2462 |
self warn:'Could not connect to remote display'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2463 |
^ self |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2464 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2465 |
Smalltalk at:#Display2 put:anotherDisplay. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2466 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2467 |
app windowGroup migrateTo:anotherDisplay |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2468 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2469 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2470 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2471 |
|host anotherDisplay| |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2472 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2473 |
host := Dialog request:'display:' initialAnswer:'dawn:0'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2474 |
host isNil ifTrue:[^ self]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2475 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2476 |
anotherDisplay := XWorkstation newDispatchingFor:host. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2477 |
anotherDisplay isNil ifTrue:[ |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2478 |
self warn:'Could not connect to remote display'. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2479 |
^ self |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2480 |
]. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2481 |
Smalltalk at:#Display2 put:anotherDisplay. |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2482 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2483 |
Transcript topView windowGroup migrateTo:anotherDisplay |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2484 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2485 |
|
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2486 |
" |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2487 |
Transcript topView windowGroup migrateTo:Display |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2488 |
" |
3302 | 2489 |
! ! |
2490 |
||
2491 |
!WindowGroup methodsFor:'special-accessing'! |
|
2492 |
||
2493 |
isForModalSubview |
|
2494 |
"special for windowgroups for modal subviews. |
|
2495 |
These must be flagged specially to avoid the views being reassigned |
|
2496 |
to the maingroup. |
|
2497 |
This is a private interface to the SimpleView class" |
|
2498 |
||
2499 |
^ isForModalSubview |
|
3293
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2500 |
! |
a5c5d64b36e9
migration - not yet finished
Claus Gittinger <cg@exept.de>
parents:
3288
diff
changeset
|
2501 |
|
3302 | 2502 |
isForModalSubview:aBoolean |
2503 |
"special for windowgroups for modal subviews. |
|
2504 |
These must be flagged specially to avoid the views being reassigned |
|
2505 |
to the maingroup. |
|
2506 |
This is a private interface to the SimpleView class" |
|
2507 |
||
2508 |
isForModalSubview := aBoolean |
|
2509 |
! |
|
2510 |
||
2511 |
setModal:aBoolean |
|
2512 |
"special entry for debugger: set the modal flag. |
|
2513 |
Not for public use" |
|
2514 |
||
2515 |
isModal := aBoolean |
|
2516 |
||
2517 |
"Modified: 3.9.1995 / 14:51:04 / claus" |
|
2518 |
! |
|
2519 |
||
2520 |
setPreviousGroup:aGroup |
|
2521 |
"special entry for debugger: |
|
2522 |
set the windowgroup that started this group (for modal groups only). |
|
2523 |
This is not a public interface." |
|
2524 |
||
2525 |
previousGroup := aGroup |
|
2526 |
||
2527 |
"Modified: 3.9.1995 / 14:55:40 / claus" |
|
2528 |
! |
|
2529 |
||
2530 |
setProcess:aProcess |
|
2531 |
"special entry for debugger: set the windowGroups process. |
|
2532 |
Not for public use." |
|
2533 |
||
2534 |
myProcess := aProcess |
|
2535 |
||
2536 |
"Modified: 3.9.1995 / 14:25:38 / claus" |
|
2537 |
! ! |
|
2538 |
||
2539 |
!WindowGroup methodsFor:'special-user interaction'! |
|
2540 |
||
244 | 2541 |
restoreCursors |
2542 |
"restore the original cursors in all of my views" |
|
2543 |
||
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2544 |
|myDevice| |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2545 |
|
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2546 |
myDevice := self graphicsDevice. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2547 |
|
330
13a3fa93330c
careful - view could have been destroyed in the meanwhile (in restoreCursors)
Claus Gittinger <cg@exept.de>
parents:
329
diff
changeset
|
2548 |
self allViewsDo:[:aView | |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2549 |
|c dev id cid| |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2550 |
|
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2551 |
dev := aView graphicsDevice. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2552 |
dev notNil ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2553 |
(id := aView id) notNil ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2554 |
c := aView cursor. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2555 |
c notNil ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2556 |
c := c onDevice:dev. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2557 |
(c notNil and:[(cid := c id) notNil]) ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2558 |
dev setCursor:cid in:id. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2559 |
dev ~~ myDevice ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2560 |
dev flush |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2561 |
] |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2562 |
]. |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2563 |
] |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2564 |
] |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2565 |
] |
244 | 2566 |
]. |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2567 |
myDevice flush |
743 | 2568 |
|
2097
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2569 |
"Modified: / 22.4.1998 / 14:28:22 / cg" |
244 | 2570 |
! |
2571 |
||
328 | 2572 |
showActivity:someMessage |
597 | 2573 |
"some activityNotification shalt be communicated to |
2574 |
the user; |
|
2575 |
forward it to my first topView if there is one |
|
2576 |
(that one should know how to deal with it)" |
|
2577 |
||
328 | 2578 |
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
|
2579 |
topViews first showActivity:someMessage |
328 | 2580 |
] |
2581 |
||
2582 |
"Created: 16.12.1995 / 18:39:40 / cg" |
|
597 | 2583 |
"Modified: 23.4.1996 / 21:36:54 / cg" |
328 | 2584 |
! |
2585 |
||
244 | 2586 |
showCursor:aCursor |
3280 | 2587 |
"change the cursor to aCursor in all of my views |
2588 |
(This sets the cursor directly, without changing the state of the cursor instance variable; |
|
2589 |
the reason is to allow for #restoreCursors to be able to undo this)." |
|
244 | 2590 |
|
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2591 |
|myDevice c| |
244 | 2592 |
|
3062 | 2593 |
aCursor isNil ifTrue:[^ self]. |
2594 |
||
244 | 2595 |
c := aCursor. |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2596 |
myDevice := self graphicsDevice. |
244 | 2597 |
self allViewsDo:[:aView | |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2598 |
|cId vId dev| |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2599 |
|
3280 | 2600 |
dev := aView graphicsDevice. |
4408
308c798612a8
more care for brokenConnections.
Claus Gittinger <cg@exept.de>
parents:
4378
diff
changeset
|
2601 |
(dev notNil and:[dev isOpen]) ifTrue:[ |
3280 | 2602 |
c := c onDevice:dev. |
2603 |
(cId := c id) notNil ifTrue:[ |
|
2604 |
(vId := aView id) notNil ifTrue:[ |
|
2605 |
dev setCursor:cId in:vId. |
|
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2606 |
dev ~~ myDevice ifTrue:[ |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2607 |
dev flush |
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2608 |
] |
3280 | 2609 |
] |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2610 |
]. |
3286
21f022859294
flush device-queue when showing cursor,
Claus Gittinger <cg@exept.de>
parents:
3281
diff
changeset
|
2611 |
]. |
244 | 2612 |
]. |
3288
13ae063e593e
only flush once in #showCursor
Claus Gittinger <cg@exept.de>
parents:
3286
diff
changeset
|
2613 |
myDevice flush |
244 | 2614 |
! |
2615 |
||
2616 |
withCursor:aCursor do:aBlock |
|
2617 |
"evaluate aBlock while showing aCursor in all |
|
2618 |
my views (used to show wait-cursor while doing something). |
|
2619 |
Return the result as returned by aBlock." |
|
2620 |
||
1986 | 2621 |
|oldCursors dev deviceCursor action| |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
2622 |
|
926
1b8422921e4d
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
777
diff
changeset
|
2623 |
dev := self graphicsDevice. |
3062 | 2624 |
(dev isNil or:[aCursor isNil]) ifTrue:[ |
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2625 |
^ aBlock value |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
2626 |
]. |
244 | 2627 |
|
1652 | 2628 |
deviceCursor := aCursor onDevice:dev. |
2629 |
||
244 | 2630 |
" |
2631 |
get mapping of view->cursor for all of my subviews |
|
2632 |
" |
|
2633 |
oldCursors := IdentityDictionary new. |
|
2634 |
self allViewsDo:[:aView | |
|
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2635 |
|old| |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2636 |
|
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2637 |
old := aView cursor. |
4519 | 2638 |
old ~~ deviceCursor ifTrue:[ |
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2639 |
oldCursors at:aView put:old. |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2640 |
aView cursor:deviceCursor now:false |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2641 |
] |
244 | 2642 |
]. |
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2643 |
|
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2644 |
oldCursors size == 0 ifTrue:[ |
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2645 |
action := aBlock |
1986 | 2646 |
] ifFalse:[ |
3604
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2647 |
action := [ |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2648 |
|rslt| |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2649 |
|
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2650 |
"/ |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2651 |
"/ here sync looks better; flush leads to almost invisible cursors when accepting. |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2652 |
"/ I dont really know why (maybe unix does not context-switch to the Xserver |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2653 |
"/ early enough after the requests have been sent ?) |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2654 |
"/ |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2655 |
dev sync. |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2656 |
|
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2657 |
rslt := aBlock ensure:[ |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2658 |
" |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2659 |
restore cursors from the mapping |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2660 |
" |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2661 |
oldCursors keysAndValuesDo:[:view :cursor | |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2662 |
view cursor:cursor now:false. |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2663 |
]. |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2664 |
dev flush |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2665 |
]. |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2666 |
rslt |
e32b5044a59e
#valueNowOrOnUnwindDo: -> #ensure:
Claus Gittinger <cg@exept.de>
parents:
3557
diff
changeset
|
2667 |
] |
1387
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2668 |
]. |
3fabdef0790d
better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents:
1364
diff
changeset
|
2669 |
|
2097
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2670 |
"/ (self isModal and:[previousGroup notNil]) ifTrue:[ |
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2671 |
"/ "/ pass the work to my parentGroup |
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2672 |
"/ ^ previousGroup withCursor:aCursor do:action |
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2673 |
"/ ]. |
1986 | 2674 |
^ action value. |
317
7a1271ecb987
use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents:
313
diff
changeset
|
2675 |
|
2097
d290e7910bec
dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents:
2093
diff
changeset
|
2676 |
"Modified: / 22.4.1998 / 14:36:47 / cg" |
408 | 2677 |
! |
2678 |
||
2213
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2679 |
withExecuteCursorDo:aBlock |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2680 |
"evaluate aBlock while showing a busyCursor in all |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2681 |
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
|
2682 |
Return the result as returned by aBlock." |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2683 |
|
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2684 |
^ self withCursor:(Cursor execute) do:aBlock |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2685 |
|
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2686 |
"Created: / 31.7.1998 / 20:11:52 / cg" |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2687 |
! |
84035dc560e0
added #withExecuteCursorDo: (for completeness)
Claus Gittinger <cg@exept.de>
parents:
2172
diff
changeset
|
2688 |
|
408 | 2689 |
withWaitCursorDo:aBlock |
2690 |
"evaluate aBlock while showing a waitCursor in all |
|
2691 |
my views (used to show wait-cursor while doing something time consuming). |
|
2692 |
Return the result as returned by aBlock." |
|
2693 |
||
2694 |
^ self withCursor:(Cursor wait) do:aBlock |
|
2695 |
||
2696 |
"Created: 6.2.1996 / 19:51:53 / cg" |
|
244 | 2697 |
! ! |
2698 |
||
1110 | 2699 |
!WindowGroup class methodsFor:'documentation'! |
251 | 2700 |
|
2701 |
version |
|
4973 | 2702 |
^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.292 2008-06-05 12:41:07 cg Exp $' |
251 | 2703 |
! ! |
3736 | 2704 |
|
244 | 2705 |
WindowGroup initialize! |