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