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