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