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