WindowGroup.st
author Claus Gittinger <cg@exept.de>
Thu, 21 May 1998 01:58:25 +0200
changeset 2126 1f108c76dfdb
parent 2116 b389262e58b1
child 2154 4b2a478e59b8
permissions -rw-r--r--
moved event dispatching code to view (where it belongs)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     1
"
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     2
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
     3
	      All Rights Reserved
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     4
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     5
 This software is furnished under a license and may be used
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     6
 only in accordance with the terms of that license and with the
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     8
 be provided or otherwise made available to, or used by, any
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
     9
 other person.  No title to or ownership of the software is
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
    10
 hereby transferred.
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
    11
"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
    12
bc3949e465a0 Initial revision
claus
parents:
diff changeset
    13
Object subclass:#WindowGroup
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    14
	instanceVariableNames:'views topViews myProcess mySensor isModal previousGroup focusView
417
940ebb195fc6 added isModalForSubView flag
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
    15
		focusSequence preEventHook postEventHook pointerView
940ebb195fc6 added isModalForSubView flag
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
    16
		isForModalSubview'
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
    17
	classVariableNames:'LastActiveGroup LastActiveProcess LeaveSignal
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
    18
		WindowGroupQuerySignal LastEventQuerySignal'
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    19
	poolDictionaries:''
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
    20
	category:'Interface-Support'
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
    21
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
    22
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
    23
!WindowGroup class methodsFor:'documentation'!
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    24
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    25
copyright
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    26
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    27
 COPYRIGHT (c) 1993 by Claus Gittinger
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
    28
	      All Rights Reserved
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    29
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    30
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    31
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    33
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    34
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    35
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    36
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    37
!
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    38
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    39
documentation
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
    40
"
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    41
    In Smalltalk/X, the known (ST-80) concept of a controller has been
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    42
    extended (split) into a WindowGroup which handles process related stuff, 
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    43
    and the Controller, which only handles events for a view and defines the user interaction.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    44
    All interaction is via event queues - there is no polling in controllers (not even conceptionally).
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    45
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    46
    WindowGroups are responsible to wait for and forward events for a group of 
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    47
    windows. All views in a windowGroup share a single windowSensor which holds the
1503
47c18026683d commentary
Claus Gittinger <cg@exept.de>
parents: 1494
diff changeset
    48
    event queue (therefore subviews all share the same input event queue).
144
claus
parents: 141
diff changeset
    49
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    50
    The event queues are filled with incoming events as arriving from the physical display.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    51
    This is done by a separate process (so called event-dispatcher) which runs at a higher
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    52
    priority. The event dispatcher determines the queue into which an event has to be placed
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    53
    by the view for which the event is destined (via the views sensor).
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    54
    There may be multiple event dispatchers running (to support multiple displays);
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    55
    see the documentation/examples in DeviceWorkstation/XWorkstation on how this is done.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    56
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    57
    Except for modal boxes, a separate process is created for each windowGroup 
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    58
    which waits for events to arrive and processes them, by sending corresponding
144
claus
parents: 141
diff changeset
    59
    event messages to the views controller or the view (*). 
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    60
    The controller is determined by asking the view (for which the event is destined);
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    61
    if the returned controller is nil, the event is sent directly to the view.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    62
    This allows for simple views to work without a controller.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    63
    (all of this is actually done in a WindowEvent method)
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    64
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    65
    Therefore, multiple applications run pseudo parallel.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    66
    Even if some window performs a long time computation, events are still received
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    67
    and entered into the corresponding event queues (because the event dispatcher process
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    68
    runs at a higher priority). However, the actual processing of the event is only
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    69
    possibly if no other process is busy at the same or a higher priority.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    70
    It is possible to change a windowProcesses priority in order to give other windows
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    71
    a chance to execute (some views do this while performing longtime actions).
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    72
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    73
    Modal boxes create an extra window group for the components of the modal
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    74
    box, but execute the event-processing loop for this new group in the original process - 
144
claus
parents: 141
diff changeset
    75
    therefore, the original windowgroup is blocked for the duration of the modal 
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    76
    interaction.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    77
    However, the modal-event processing loop peeks into the original groups event queue
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    78
    from time to time, and handles expose events. Thus, even while blocked for user input,
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    79
    the original group continues to get update/redraw events.
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    80
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    81
    Normally, one windowgroup is associated to each topview (StandardSystemView)
144
claus
parents: 141
diff changeset
    82
    and all of its subviews. However, this is not strictly required; 
claus
parents: 141
diff changeset
    83
    it is possible to create extra windowgroups for subviews, which will let them
claus
parents: 141
diff changeset
    84
    run in parallel 
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    85
	(for example, the FileBrowsers kill-Button is created that 
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    86
	 way, to allow a kill of an executing unix command, while the browser 
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    87
	 itself reads the pipeStream for incoming text.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    88
	 Even if the fileBrowser is busy reading the pipe, the killButton is still
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
    89
	 working and allows terminating the pipe-read action).
144
claus
parents: 141
diff changeset
    90
claus
parents: 141
diff changeset
    91
    On the other hand, multiple topviews can be placed into the same windowGroup;
claus
parents: 141
diff changeset
    92
    which allows for multiview applications, of which only one communicates with
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    93
    the user at a time.
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    94
    Multiple topviews within a windowGropup can be configured to behave like one 
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    95
    unit with respect to iconification, deiconification and termination.
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    96
    This is done by creating multiple topViews in one group, and setting up a master/slave
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
    97
    or partner relation among them (see TopView>>beSlave and TopView>>bePartner).
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
    98
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
    99
    WindowGroups also support a focus window: this is the one that gets the
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   100
    keyboard input - even if the cursor is located in another subview.
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   101
    The sequence is defined by the topView or its model (typically an applicationModel).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   102
    It should return an orderedCollection of subviews when asked via #focusSequence.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   103
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   104
    For debugging, windowGroups allow hooks to be installed around the processing of
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   105
    events - preEventHook is sent a #procesEvent: message before an event is processed,
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   106
    postEventHook is informed after the event has been processed.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   107
    The preEventHook should return true - if it returns true, the event is considered
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   108
    being already processed by the hook and ignored.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   109
    This allows for event-tracing, timing or even filtering (if preEventHook returns true).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   110
    (notice: there is also an eventHook facility available in the sensor class.)
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   111
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   112
    Finally, windowgroups are the perfect place for things like defining a
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   113
    cursor for all associated views, flushing all input, waiting for expose
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   114
    events etc.
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   115
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
   116
    Dont get confused:
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   117
	You dont have to care for details in the normal case, a windowgroup is
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   118
	created for you automatically, when a view is opened.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   119
	All of the internals are not required to be known for most applications.
297
9942b0660ae5 documentation update
Claus Gittinger <cg@exept.de>
parents: 275
diff changeset
   120
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   121
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   122
    [instance variables:]
144
claus
parents: 141
diff changeset
   123
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   124
	views                   collection of views of this group
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   125
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   126
	topViews                collection of topviews of this group
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   127
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   128
	myProcess               the process executing the events
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   129
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   130
	mySensor                my input sensor
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   131
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   132
	isModal                 true if this is for a modal box
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   133
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   134
	previousGroup           if modal, the group that started this one
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   135
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   136
	focusView               the one that has the focus (or nil)
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   137
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   138
	focusSequence           defines the focus sequence
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   139
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   140
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   141
    [class variables:]
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   142
	LeaveSignal             if raised, a modal box leaves (closes)
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   143
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   144
	WindowGroupQuerySignal  to ask for the current windowGroup,
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   145
				anywhere in the program, simply raise this
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   146
				signal. The raise returns nil, for processes,
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   147
				which are not under control of a windowGroup.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   148
				(i.e. wg := WindowGroup windowGroupQuerySignal raise)
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   149
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   150
	LastEventQuerySignal    to ask for the event which was responsible
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   151
				for being where you are (whereever that is).
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   152
				The raise returns nil, if you did not arrive
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   153
				there due to an event.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   154
				(i.e. ev := WindowGroup lastEventQuerySignal raise)
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   155
				The event can be asked for the view, the type
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   156
				of event, x/y position etc.
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   157
144
claus
parents: 141
diff changeset
   158
    (*) 
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   159
	due to historic reasons, many views have the controller functionality
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   160
	integrated, and handle events themself. The windowSensor takes care
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   161
	of this, by checking if a view has a controller, and, if so, forwarding 
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   162
	the events to it. Otherwise, events are sent directly to the view.
144
claus
parents: 141
diff changeset
   163
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   164
	In the future, all views will be rewritten to actually use a controller.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   165
	Currently (being in the middle of this migration), only some views
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   166
	(buttons, toggles and subclasses) do so.
144
claus
parents: 141
diff changeset
   167
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   168
    For more information, read 'introduction to view programming' in the
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   169
    doc/online directory.
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   170
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   171
    [author:]
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   172
	Claus Gittinger
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   173
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   174
    [see also:]
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   175
	WindowSensor WindowEvent EventListener KeyboardForwarder
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   176
	DeviceWorkstation
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   177
	View StandardSystemView
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   178
	ApplicationModel
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   179
	Process ProcessorScheduler
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   180
	(``Working with processes (programmers manual)'': programming/processes.html#VIEWSNPROCS)
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   181
"
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   182
! !
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   183
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   184
!WindowGroup class methodsFor:'initialization'!
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   185
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   186
initialize
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   187
    LeaveSignal isNil ifTrue:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   188
	LeaveSignal := (Signal new) mayProceed:true.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   189
	LeaveSignal nameClass:self message:#leaveSignal.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   190
	LeaveSignal notifierString:'unhandled leave signal'.
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   191
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   192
	WindowGroupQuerySignal := QuerySignal new.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   193
	WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   194
	WindowGroupQuerySignal notifierString:'query for windowgroup'.
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   195
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   196
	LastEventQuerySignal := QuerySignal new.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   197
	LastEventQuerySignal nameClass:self message:#lastEventQuerySignal.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   198
	LastEventQuerySignal notifierString:'query for last event'.
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   199
    ].
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   200
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   201
    "WindowGroup initialize"
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   202
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   203
    "Modified: 9.11.1996 / 17:00:53 / cg"
46
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   204
! !
7b331e9012fd *** empty log message ***
claus
parents: 28
diff changeset
   205
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   206
!WindowGroup class methodsFor:'instance creation'!
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   207
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   208
new
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   209
    "create and return a new WindowGroup object"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   210
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   211
    ^ self basicNew initialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   212
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   213
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   214
!WindowGroup class methodsFor:'Signal constants'!
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   215
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   216
lastEventQuerySignal
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   217
    "return the signal which is used to query for the last event"
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   218
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   219
    ^ LastEventQuerySignal
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   220
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   221
    "Created: 17.7.1996 / 20:36:04 / cg"
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   222
!
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   223
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   224
leaveSignal
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   225
    "return the signal which is used to exit a modal loop.
1752
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   226
     This private signal, is always caught while a modalbox is active.
144
claus
parents: 141
diff changeset
   227
     Raising it will exit the modal loop and return from the views #openModal
claus
parents: 141
diff changeset
   228
     method."
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   229
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   230
    ^ LeaveSignal
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   231
!
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   232
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   233
windowGroupQuerySignal
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   234
    "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
   235
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   236
    ^ WindowGroupQuerySignal
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   237
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   238
    "Created: 17.7.1996 / 20:36:04 / cg"
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   239
! !
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   240
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   241
!WindowGroup class methodsFor:'accessing'!
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   242
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   243
activeGroup
180
claus
parents: 172
diff changeset
   244
    "return the currently active windowGroup.
claus
parents: 172
diff changeset
   245
     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
   246
     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
   247
     (usually) the first group is returned (prefering a modal if there is one). 
180
claus
parents: 172
diff changeset
   248
     (maybe we should return a collection of windowGroups here).
claus
parents: 172
diff changeset
   249
claus
parents: 172
diff changeset
   250
     This method is required to simulate the historic ST-80 single display
claus
parents: 172
diff changeset
   251
     behavior for Cursor>>show / Cursor>>showWhile and some others (raising the
claus
parents: 172
diff changeset
   252
     activeGroups topView when modalBoxes appear) on multiple display screens. 
claus
parents: 172
diff changeset
   253
     These methods should change the cursor for the currently 
claus
parents: 172
diff changeset
   254
     active windowGroup ONLY, instead of globally affecting the display or
claus
parents: 172
diff changeset
   255
     all views
claus
parents: 172
diff changeset
   256
     (since, depending on the priority, other views could be unaffacted by this 
claus
parents: 172
diff changeset
   257
      and an overall cursor change does not make sense.)"
claus
parents: 172
diff changeset
   258
claus
parents: 172
diff changeset
   259
    |activeProcess groups wg|
claus
parents: 172
diff changeset
   260
claus
parents: 172
diff changeset
   261
    Processor isNil ifTrue:[^ nil]. "/ only during very early init phase
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   262
180
claus
parents: 172
diff changeset
   263
    activeProcess := Processor activeProcess.
claus
parents: 172
diff changeset
   264
    " caching the last value ..."
565
6867f1a9a470 oops - leftover global LastActive
Claus Gittinger <cg@exept.de>
parents: 513
diff changeset
   265
    activeProcess == LastActiveProcess ifTrue:[
2089
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   266
        LastActiveGroup process == LastActiveProcess ifTrue:[
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   267
            ^ LastActiveGroup
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   268
        ]
180
claus
parents: 172
diff changeset
   269
    ].
1298
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   270
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   271
    wg := WindowGroupQuerySignal raise.
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   272
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   273
    wg isNil ifTrue:[
2089
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   274
        "/ mhmh - noone willing to answer that question ...
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   275
        "/ (how can this happen ?)
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   276
        groups := self scheduledWindowGroups 
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   277
                    select:[:wg | wg process == activeProcess].
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   278
        groups size == 1 ifTrue:[
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   279
            wg := groups anElement
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   280
        ] ifFalse:[
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   281
            wg := groups detect:[:wg | wg isModal] ifNone:nil.
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   282
            wg isNil ifTrue:[
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   283
                wg := groups anElement
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   284
            ]
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   285
        ].
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   286
    ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   287
180
claus
parents: 172
diff changeset
   288
    wg notNil ifTrue:[
2089
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   289
        LastActiveProcess := activeProcess.
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   290
        LastActiveGroup := wg.
180
claus
parents: 172
diff changeset
   291
    ].
claus
parents: 172
diff changeset
   292
    ^ wg
claus
parents: 172
diff changeset
   293
claus
parents: 172
diff changeset
   294
    "
claus
parents: 172
diff changeset
   295
     WindowGroup activeGroup 
claus
parents: 172
diff changeset
   296
    "
claus
parents: 172
diff changeset
   297
2089
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   298
    "Modified: / 3.9.1995 / 14:49:53 / claus"
07ed201c592e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2086
diff changeset
   299
    "Modified: / 17.4.1998 / 11:49:28 / cg"
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   300
!
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   301
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   302
scheduledWindowGroups
180
claus
parents: 172
diff changeset
   303
    "return a collection of all windowGroups (possibly for different
claus
parents: 172
diff changeset
   304
     display devices) which are scheduled (i.e. which have a process 
claus
parents: 172
diff changeset
   305
     running, handling events)."
claus
parents: 172
diff changeset
   306
claus
parents: 172
diff changeset
   307
    |set screens|
claus
parents: 172
diff changeset
   308
claus
parents: 172
diff changeset
   309
    screens := Screen allScreens.
1869
24813440013f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1868
diff changeset
   310
    screens size == 0 ifTrue:[^ #()].
180
claus
parents: 172
diff changeset
   311
claus
parents: 172
diff changeset
   312
    set := IdentitySet new.
claus
parents: 172
diff changeset
   313
    screens do:[:aDevice |
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   314
	aDevice allViewsDo:[:aView |
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   315
	    |wg|
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   316
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   317
	    (wg := aView windowGroup) notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   318
		wg process notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   319
		    set add:wg
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   320
		]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   321
	    ].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   322
	].
180
claus
parents: 172
diff changeset
   323
    ].
claus
parents: 172
diff changeset
   324
    ^ set asArray
claus
parents: 172
diff changeset
   325
claus
parents: 172
diff changeset
   326
    "
claus
parents: 172
diff changeset
   327
     WindowGroup scheduledWindowGroups   
claus
parents: 172
diff changeset
   328
    "
claus
parents: 172
diff changeset
   329
claus
parents: 172
diff changeset
   330
    "Modified: 1.9.1995 / 13:43:09 / claus"
1869
24813440013f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1868
diff changeset
   331
    "Modified: 18.8.1997 / 18:44:29 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   332
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   333
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   334
setActiveGroup:aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   335
    "set the currently active windowGroup.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   336
     Temporary; do not use this interface, it will vanish."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   337
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   338
    LastActiveProcess := Processor activeProcess.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   339
    LastActiveGroup := aGroup
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   340
! !
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   341
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   342
!WindowGroup methodsFor:'accessing'!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   343
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   344
device
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   345
    "return the device, we receive our events from"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   346
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   347
    self obsoleteMethodWarning:'use #graphicsDevice'.
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   348
    ^ self graphicsDevice
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   349
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   350
    "Modified: 5.7.1996 / 17:53:58 / cg"
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   351
!
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   352
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   353
graphicsDevice
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   354
    "return the device, we receive our events from"
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   355
1311
0746d3fe9a62 changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   356
    |dev|
0746d3fe9a62 changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   357
0746d3fe9a62 changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   358
    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
   359
	topViews do:[:v |
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   360
	    |app|
1116
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   361
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   362
	    (app := v application) notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   363
		"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   364
		"/ ok, it has an application;
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   365
		"/ ask it for preferences.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   366
		"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   367
		(dev := app graphicsDevice) notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   368
		    ^ dev
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   369
		]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   370
	    ].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   371
	    (dev := v graphicsDevice) notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   372
		^ dev
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   373
	    ]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   374
	]
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   375
    ].
1311
0746d3fe9a62 changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   376
    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
   377
	views do:[:v |
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   378
	    (dev := v graphicsDevice) notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   379
		^ dev
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   380
	    ]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   381
	]
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   382
    ].
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   383
    ^ nil
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   384
1311
0746d3fe9a62 changed (fixed ?) graphicsDevice
Claus Gittinger <cg@exept.de>
parents: 1304
diff changeset
   385
    "Modified: 7.2.1997 / 16:14:24 / cg"
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   386
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   387
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   388
isModal
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   389
    "return true, if the receiver is in a modal mode
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   390
     (i.e. for a modal box)"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   391
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   392
    ^ isModal
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   393
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   394
    "Modified: 7.3.1996 / 14:29:46 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   395
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   396
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   397
mainGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   398
    "return the main windowgroup (for modal groups only) 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   399
     that is the top one, which is not modal.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   400
     NonModal groups return themSelf.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   401
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   402
     There is one exception to this: the debugger (which is sort of modal)
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   403
     returns itself as mainGroup (not its debuggee)."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   404
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   405
    |g prev|
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   406
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   407
    g := self.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   408
    [g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   409
	g := prev
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   410
    ].
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   411
    ^ g
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   412
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   413
    "Modified: 3.9.1995 / 14:57:20 / claus"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   414
    "Modified: 7.3.1996 / 14:29:28 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   415
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   416
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   417
mainGroup:aWindowGroup
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   418
    "set the main windowgroup (for modal/autonomous groups only) 
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   419
     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
   420
     as well."
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   421
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   422
    previousGroup := aWindowGroup
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   423
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   424
    "Created: 20.8.1997 / 17:57:35 / cg"
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   425
!
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   426
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   427
previousGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   428
    "return the windowgroup that started this group. (for modal groups only).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   429
     This may be another modalGroup (for boxes opened by boxes).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   430
     NonModal groups return nil."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   431
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   432
    ^ previousGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   433
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   434
    "Modified: 7.3.1996 / 14:28:46 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   435
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   436
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   437
process 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   438
    "return the windowGroups process"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   439
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   440
    ^ myProcess
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   441
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   442
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   443
sensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   444
    "return the windowGroups sensor.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   445
     All events for any of the groups views is handled by that sensor."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   446
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   447
    ^ mySensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   448
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   449
    "Modified: 7.3.1996 / 14:30:21 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   450
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   451
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   452
sensor:aSensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   453
    "set the windowGroups sensor"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   454
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   455
    mySensor := aSensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   456
! !
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   457
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   458
!WindowGroup methodsFor:'accessing-hook'!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   459
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   460
postEventHook 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   461
    "return the postEventHook if any"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   462
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   463
    ^ postEventHook
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   464
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   465
    "Created: 7.3.1996 / 14:42:46 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   466
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   467
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   468
postEventHook:anObject 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   469
    "set the postEventHook - this one will get all events
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   470
     passed after being processed here (via #processEvent:)."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   471
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   472
    postEventHook := anObject
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   473
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   474
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   475
preEventHook 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   476
    "return the preEventHook if any"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   477
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   478
    ^ preEventHook
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   479
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   480
    "Created: 7.3.1996 / 14:42:42 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   481
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   482
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   483
preEventHook:anObject 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   484
    "set the preEventHook - this one will get all events
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   485
     passed before being processed here (via #processEvent:).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   486
     If this returns true, the event is supposed to be already
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   487
     processed and ignored here.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   488
     Otherwise, it is processed as usual."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   489
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   490
    preEventHook := anObject
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   491
! !
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   492
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   493
!WindowGroup methodsFor:'accessing-views'!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   494
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   495
addTopView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   496
    "add a topview to the group"
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   497
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   498
    topViews isNil ifTrue:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   499
	topViews := OrderedCollection new.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   500
    ].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   501
    (topViews includesIdentical:aView) ifFalse:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   502
	topViews add:aView
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   503
    ]
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   504
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   505
    "Modified: 6.3.1996 / 15:35:15 / cg"
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   506
!
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   507
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   508
addView:aView
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   509
    "add aView to the windowGroup"
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   510
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   511
    views isNil ifTrue:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   512
	views := OrderedCollection new.
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   513
    ].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   514
    (views includesIdentical:aView) ifFalse:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   515
	views add:aView
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   516
    ]
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   517
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   518
    "Modified: 6.3.1996 / 15:35:41 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   519
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   520
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   521
removeView:aView
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   522
    "remove aView from the windowGroup;
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   523
     if this was the last view in this group, 
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   524
     also shut down the corresponding process 
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   525
     (actually, only wake it up here - it will terminate itself 
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   526
      when finding out that all views are gone)"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   527
263
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   528
    |sema|
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   529
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   530
    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
   531
	views removeIdentical:aView ifAbsent:[].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   532
	views isEmpty ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   533
	    views := nil
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   534
	]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   535
    ].
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   536
    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
   537
	topViews removeIdentical:aView ifAbsent:[].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   538
	topViews isEmpty ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   539
	    topViews := nil
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   540
	]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   541
    ].
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   542
    "
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   543
     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
   544
     removed (modalBoxes terminate their modalLoop if so)
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   545
    "
262
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   546
    mySensor 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
   547
	(sema := mySensor eventSemaphore) notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   548
	    sema signal
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   549
	]
262
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   550
    ]
1304
d914bfc99b49 use #removeIdentical
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
   551
d914bfc99b49 use #removeIdentical
Claus Gittinger <cg@exept.de>
parents: 1298
diff changeset
   552
    "Modified: 1.2.1997 / 12:13:26 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   553
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   554
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   555
topViews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   556
    "return the topviews accociated to this windowGroup"
172
claus
parents: 162
diff changeset
   557
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   558
    ^ topViews
172
claus
parents: 162
diff changeset
   559
!
claus
parents: 162
diff changeset
   560
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   561
views
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   562
    "return the views accociated to this windowGroup"
172
claus
parents: 162
diff changeset
   563
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   564
    ^ views
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   565
! !
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   566
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   567
!WindowGroup methodsFor:'activation / deactivation'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   568
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   569
closeDownViews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   570
    "destroy all views associated to this window group"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   571
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   572
    topViews notNil ifTrue:[
403
a3ff487fba88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   573
	topViews do:[:aTopView | aTopView notNil ifTrue:[aTopView destroy]]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   574
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   575
    views := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   576
    topViews := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   577
    mySensor := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   578
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   579
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   580
realizeTopViews
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   581
    "realize all topViews associated to this windowGroup."
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   582
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   583
    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
   584
	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
   585
	    aView realize.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   586
	].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   587
    ].
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   588
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   589
    "Created: 24.7.1997 / 12:56:09 / cg"
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   590
!
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   591
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   592
rerealizeTopViews
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   593
    "rerealize all topViews associated to this windowGroup.
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   594
     and tell topViews about it."
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   595
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   596
    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
   597
	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
   598
	    aView isPopUpView
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   599
	    ifFalse:
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   600
	    [
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   601
		aView realize.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   602
		aView restarted
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   603
	    ].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   604
	].
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   605
    ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   606
!
180
claus
parents: 172
diff changeset
   607
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   608
restart
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   609
    "restart after a snapin.
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   610
     This reopens all views in this group."
180
claus
parents: 172
diff changeset
   611
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   612
    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
   613
	"
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   614
	 need a new semaphore, since obsolete processes 
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   615
	 (from our previous live) may still sit on the current semaphore
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   616
	"
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   617
	mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema').
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   618
	isModal ifFalse:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   619
	    self startupWith:[self rerealizeTopViews].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   620
	]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   621
    ]
1273
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   622
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   623
    "Modified: 24.7.1997 / 13:00:12 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   624
!
180
claus
parents: 172
diff changeset
   625
582
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   626
shutDown
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   627
    "shutdown the window group; close all views and
1317
e1bd3b4aee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1311
diff changeset
   628
     terminate the process"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   629
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   630
    |p|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   631
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   632
    self closeDownViews.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   633
    myProcess 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
   634
	p := myProcess.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   635
	myProcess := nil.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   636
	p terminate.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   637
    ]
582
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   638
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   639
    "Created: 22.4.1996 / 17:58:37 / cg"
1317
e1bd3b4aee72 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1311
diff changeset
   640
    "Modified: 8.2.1997 / 16:46:31 / cg"
180
claus
parents: 172
diff changeset
   641
!
claus
parents: 172
diff changeset
   642
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   643
startupModal:checkBlock
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   644
    "startup the window-group in a modal loop 
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   645
     (i.e. under the currently running process);
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   646
     checkBlock is evaluated and the modal loop is left, 
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   647
     whenever false is returned."
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   648
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   649
    ^ self startupModal:checkBlock forGroup:(WindowGroup activeGroup).
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   650
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   651
    "Created: 10.12.1995 / 14:15:11 / cg"
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   652
    "Modified: 20.8.1997 / 17:54:33 / cg"
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   653
!
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   654
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   655
startupModal:checkBlock forGroup:mainGroup
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   656
    "startup the window-group in a modal loop 
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   657
     (i.e. under the currently running process);
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   658
     checkBlock is evaluated and loop is left, when false is
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   659
     returned.
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   660
     The mainGroup info is required to allow peeking into its
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   661
     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
   662
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   663
    "set previousGroup to the main (non-modal) group"
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   664
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   665
    previousGroup := mainGroup.
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   666
    isModal := true.
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   667
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   668
    WindowGroupQuerySignal handle:[:ex |
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   669
	ex proceedWith:self
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   670
    ] do:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   671
	self realizeTopViews.
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   672
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   673
	self 
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   674
	    eventLoopWhile:checkBlock 
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   675
	    onLeave:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   676
		"
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   677
		 cleanup, in case of a terminate
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   678
		"
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   679
		previousGroup := nil.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   680
		topViews := nil.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   681
		views := nil.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   682
		"
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   683
		 the following is rubbish;
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   684
		 the views could be reused ..
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   685
		"
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   686
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   687
"/                topViews notNil ifTrue:[
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   688
"/                    topViews do:[:aView |
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   689
"/                        aView destroy
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   690
"/                    ].
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   691
"/                    topViews := nil.
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   692
"/                ].
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   693
"/                views notNil ifTrue:[
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   694
"/                    views do:[:aView |
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   695
"/                        aView destroy
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   696
"/                    ].
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   697
"/                    views := nil.
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   698
"/                ].
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   699
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   700
	    ]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   701
	]
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   702
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   703
    "Created: 10.12.1995 / 14:14:26 / cg"
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   704
    "Modified: 20.8.1997 / 18:12:20 / cg"
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   705
!
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   706
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   707
startupWith:startupAction
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   708
    "startup the window-group;
1822
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   709
     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
   710
     The startupAction arg is evaluated by the windowGroup process,
38f24dca2eb2 changes to support #openIconified.
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
   711
     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
   712
     [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
   713
      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
   714
      blocking operations ...]"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   715
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   716
    |top nm dev devNm|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   717
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   718
    previousGroup := nil.
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   719
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   720
    myProcess isNil ifTrue:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   721
	isModal := false.
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   722
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   723
	"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   724
	"/ this is the windowGroup process;
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   725
	"/ realize all views, then handle events forever
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   726
	"/ (well, not really forever ... ;-)
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   727
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   728
	myProcess := [
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   729
	    WindowGroupQuerySignal handle:[:ex |
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   730
		ex proceedWith:self
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   731
	    ] do:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   732
		[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   733
		    startupAction value.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   734
		    self eventLoopWhile:[true] onLeave:[]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   735
		] valueNowOrOnUnwindDo:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   736
		    self closeDownViews
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   737
		]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   738
	    ]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   739
	] forkAt:(Processor userSchedulingPriority).
180
claus
parents: 172
diff changeset
   740
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   741
	(topViews size > 0) ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   742
	    "/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   743
	    "/ give the windowGroup process a user friendly name
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   744
	    "/ ask its topView for the processName, and
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   745
	    "/ optionally append the displayName (if its not the default)
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   746
	    "/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   747
	    top := topViews first.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   748
	    nm := top processName.
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   749
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   750
	    (dev := top graphicsDevice) notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   751
		devNm := dev displayName.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   752
		(devNm notNil and:[devNm ~= Display displayName]) ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   753
		    nm := nm , ' (' , devNm , ')'
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   754
		]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   755
	    ]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   756
	] ifFalse:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   757
	    nm := 'window handler'.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   758
	].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   759
	myProcess name:nm.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   760
	myProcess beGroupLeader.
180
claus
parents: 172
diff changeset
   761
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   762
	"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   763
	"/ when the process gets suspended, 
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   764
	"/ there maybe still buffered draw requests.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   765
	"/ Arrange for them to be flushed then.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   766
	"/ (otherwise, you would not see the output of a process,
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   767
	"/  which suspends and waits - or we had to add buffer flushes
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   768
	"/  all over the place)
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   769
	"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   770
	myProcess addSuspendAction:[ 
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   771
	    |dev|
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   772
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   773
	    dev := self graphicsDevice.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   774
	    dev notNil ifTrue:[dev flush].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   775
	].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   776
    ]
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   777
1965
765f9e696b42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
   778
    "Modified: / 13.12.1995 / 14:04:53 / stefan"
765f9e696b42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
   779
    "Created: / 24.7.1997 / 12:52:04 / cg"
765f9e696b42 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1946
diff changeset
   780
    "Modified: / 4.12.1997 / 14:13:35 / cg"
180
claus
parents: 172
diff changeset
   781
! !
claus
parents: 172
diff changeset
   782
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   783
!WindowGroup methodsFor:'enumerating'!
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   784
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   785
allNonTopViewsDo:aBlock
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   786
    "evaluate aBlock for all nonTopviews (i.e. subviews) in this group.
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   787
     This enumerates a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   788
     destroy and other collection changing operations to be performed in the loop."
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   789
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   790
    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
   791
	views copy nonNilElementsDo:aBlock
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   792
    ]
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   793
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   794
    "Modified: 12.2.1997 / 12:20:25 / cg"
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   795
!
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   796
1153
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   797
allTopViewsDo:aBlock
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   798
    "evaluate aBlock for all topviews in this group.
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   799
     This enumerates a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   800
     destroy and other collection changing operations to be performed in the loop."
1153
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   801
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   802
    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
   803
	topViews copy nonNilElementsDo:aBlock
1153
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   804
    ]
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   805
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   806
    "Modified: 12.2.1997 / 12:20:30 / cg"
1153
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   807
!
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   808
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   809
allTopViewsExcept:aView do:aBlock
157
claus
parents: 152
diff changeset
   810
    "evaluate aBlock for all topviews except aView in this group.
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   811
     This enumerates a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   812
     destroy and other collection changing operations to be performed in the loop."
157
claus
parents: 152
diff changeset
   813
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   814
    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
   815
	v ~~ aView ifTrue:[aBlock value:v]
157
claus
parents: 152
diff changeset
   816
    ].
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   817
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   818
    "Modified: 12.2.1997 / 12:22:10 / cg"
157
claus
parents: 152
diff changeset
   819
!
claus
parents: 152
diff changeset
   820
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   821
allViewsDo:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   822
    "evaluate aBlock for all views & topviews in this group.
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   823
     This enumerates a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   824
     destroy and other collection changing operations to be performed in the loop."
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   825
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   826
    self allTopViewsDo:aBlock.
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   827
    self allNonTopViewsDo:aBlock.
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   828
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   829
    "Modified: 12.2.1997 / 12:20:20 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   830
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   831
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   832
partnersDo:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   833
    "evaluate aBlock for all partnerViews.
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   834
     This enumerates a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   835
     destroy and other collection changing operations to be performed in the loop."
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   836
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   837
    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
   838
	(v type == #partner) ifTrue:[aBlock value:v].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   839
    ].
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   840
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   841
    "Modified: 12.2.1997 / 12:21:41 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   842
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   843
157
claus
parents: 152
diff changeset
   844
slavesDo:aBlock
claus
parents: 152
diff changeset
   845
    "evaluate aBlock for all slaveViews.
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   846
     This enumerates a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   847
     destroy and other collection changing operations to be performed in the loop."
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   848
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   849
    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
   850
	(v type == #slave) ifTrue:[aBlock value:v].
157
claus
parents: 152
diff changeset
   851
    ].
1334
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   852
4d1065c38970 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1328
diff changeset
   853
    "Modified: 12.2.1997 / 12:21:46 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   854
! !
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   855
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   856
!WindowGroup methodsFor:'event debugging'!
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   857
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   858
traceEvents:trueOrFalse
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   859
    |hook|
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   860
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   861
    trueOrFalse ifFalse:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   862
	"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   863
	"/ remove any eventHook on the receiver
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   864
	"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   865
	self preEventHook:nil.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   866
	"/ Transcript showCR:'removed eventHook'.
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   867
    ] ifTrue:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   868
	"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   869
	"/ set an eventHook on its windowGroup
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   870
	"/
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   871
	hook := Plug new.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   872
	hook respondTo:#processEvent:
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   873
		  with:[:ev | ev displayString printCR. false].
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   874
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   875
	self preEventHook:hook.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   876
	"/ Transcript showCR:'set eventHook for tracing'.
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   877
    ]
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   878
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   879
    "Created: 24.4.1996 / 10:25:21 / cg"
698
3be775ccac3c printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   880
    "Modified: 20.5.1996 / 10:30:00 / cg"
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   881
! !
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   882
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
   883
!WindowGroup methodsFor:'event handling'!
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   884
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   885
eventLoop
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   886
    "loop executed by windowGroup process;
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   887
     wait-for and process events forever"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   888
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   889
   self eventLoopWhile:[true] onLeave:[]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   890
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   891
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   892
eventLoopWhile:aBlock onLeave:cleanupActions
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   893
    "wait-for and process events.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   894
     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
   895
     and aBlock evaluates to true.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   896
1752
Claus Gittinger <cg@exept.de>
parents: 1652
diff changeset
   897
     Some signals are caught & handled: 
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   898
        LeaveSignal forces an exit from the eventLoop;
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   899
        AbortSignal brings us back into the loop, processing the next event;
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   900
        ActivityNotifications send a #showActivity: if nonModal, 
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   901
        otherwise they are ignored."
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   902
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   903
    |thisProcess sigs otherSema|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   904
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   905
    thisProcess := Processor activeProcess.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   906
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   907
    sigs := SignalSet 
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   908
                with:AbortSignal 
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   909
                with:LeaveSignal 
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   910
                with:(self class activityNotificationSignal).
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   911
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   912
    [
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   913
        |p g mainGroup mySema waitSema|
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   914
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   915
        waitSema := mySema := mySensor eventSemaphore.
325
b24d9a1c74dc stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   916
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   917
        isModal ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   918
            mainGroup := self mainGroup.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   919
            mainGroup == self ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   920
                mainGroup := nil
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   921
            ].
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   922
        ] ifFalse:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   923
            mainGroup := previousGroup
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   924
        ].
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   925
        
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   926
        mainGroup notNil ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   927
            otherSema := mainGroup sensor eventSemaphore.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   928
            waitSema := SemaphoreSet with:mySema with:otherSema.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   929
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   930
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   931
        [aBlock value] whileTrue:[ 
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   932
            LastActiveGroup := self.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   933
            LastActiveProcess := thisProcess.
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   934
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   935
            (views isNil and:[topViews isNil]) ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   936
                myProcess notNil ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   937
                    p := myProcess.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   938
                    myProcess := nil.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   939
                    p terminate.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   940
                    "not reached - there is no life after death"
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   941
                ].
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   942
                "
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   943
                 this is the end of a modal loop
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   944
                 (not having a private process ...)
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   945
                "
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   946
                ^ self
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   947
            ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   948
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   949
            sigs handle:[:ex |
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   950
                |theSig|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   951
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   952
                (theSig := ex signal) == AbortSignal ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   953
                    "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   954
                    "/ on abort, stay in loop
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   955
                    "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   956
                    ex return
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   957
                ].
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   958
                theSig == LeaveSignal ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   959
                    "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   960
                    "/ on leave, exit the event loop
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   961
                    "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   962
                    ^ self
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   963
                ].
323
619085d52522 be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents: 319
diff changeset
   964
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   965
                "/ ActivityNotification
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   966
                "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   967
                "/ if I am a modal-group, let it be handled
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   968
                "/ by the outer main-groups handler
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   969
                "/ otherwise show the activityMessage and continue.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   970
                "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   971
                isModal ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   972
                    ex reject
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   973
                    "never reached"
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   974
                ].
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   975
                self showActivity:(ex errorString).
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   976
                ex proceed.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   977
            ] do:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   978
                |dev gotSema mainView|
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   979
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   980
                "/ Flush device output before going to sleep. 
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   981
                "/ This may produce more events to arrive.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   982
                "/ Q: is this still needed (see suspendAction) ?
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   983
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   984
"/                dev := self graphicsDevice.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
   985
"/                dev notNil ifTrue:[dev flush].
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   986
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   987
                "/ now, wait for an event to arrive
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   988
                thisProcess setStateTo:#eventWait if:#active.
2116
b389262e58b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   989
                waitSema isNil ifTrue:[
b389262e58b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   990
                    "/ oops - how can this happen ....
b389262e58b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   991
                    ^ self.
b389262e58b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
   992
                ].
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   993
                gotSema := waitSema wait.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   994
                LastActiveGroup := self.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   995
                LastActiveProcess := thisProcess.
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
   996
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   997
                gotSema == mySema ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   998
                    "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
   999
                    "/ an event for me 
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1000
                    "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1001
                    self processEventsWithModalGroup:nil
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1002
                ] ifFalse:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1003
                    "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1004
                    "/ an event for my mainGroup 
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1005
                    "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1006
                    mainGroup topViews notNil ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1007
                        mainView := mainGroup topViews first
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1008
                    ].
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1009
                    mainView notNil ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1010
                        "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1011
                        "/ if anything happened to the mainGroup
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1012
                        "/ bring my own topView back to the front
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1013
                        "/ This keeps modalBoxes visible
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1014
                        "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1015
                        (mainGroup sensor hasConfigureEventFor:mainView) ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1016
                            topViews size > 0 ifTrue:[
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1017
                                topViews first raiseDeiconified
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1018
                            ]
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1019
                        ]
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1020
                    ].
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1021
                    "
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1022
                     if modal, also check for redraw events in my maingroup
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1023
                     (we arrive here after we woke up on maingroup sensor eventSemaphore)
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1024
                    "
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1025
                    mainGroup processEventsWithModalGroup:self.
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1026
                ]
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1027
            ].
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1028
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1029
    ] valueNowOrOnUnwindDo:[
2046
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1030
        "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1031
        "/ perform any cleanupActions
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1032
        "/
abd56d83bac5 use activityNotificationSignal (easier to find)
ca
parents: 1987
diff changeset
  1033
        cleanupActions notNil ifTrue:[cleanupActions value]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1034
    ]
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1035
2116
b389262e58b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
  1036
    "Modified: / 14.12.1995 / 11:12:24 / stefan"
b389262e58b1 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2097
diff changeset
  1037
    "Modified: / 16.5.1998 / 17:26:28 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1038
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1039
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1040
leaveEventLoop
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1041
    "immediately leave the event loop, returning way back.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1042
     This can be used to leave (and closedown) a modal group.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1043
     (for normal views, this does not make sense)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1044
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1045
    ^ LeaveSignal raise
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1046
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1047
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
  1048
processEvents
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
  1049
    "process events from either the damage- or user input queues.
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
  1050
     Abort is assumed to be handled elsewhere."
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1051
1419
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1052
    self processEventsWithModalGroup:nil
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1053
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1054
    "Modified: 5.3.1997 / 11:33:51 / cg"
1328
99ffa52743c5 in modalGroup: only ignore key- and buttonEvents;
ca
parents: 1317
diff changeset
  1055
!
99ffa52743c5 in modalGroup: only ignore key- and buttonEvents;
ca
parents: 1317
diff changeset
  1056
1419
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1057
processEventsWithModalGroup:modalGroup
1328
99ffa52743c5 in modalGroup: only ignore key- and buttonEvents;
ca
parents: 1317
diff changeset
  1058
    "process events from either the damage- or user input queues.
1868
484e0fca2cf6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1059
     Abort is assumed to be handled elsewhere."
1328
99ffa52743c5 in modalGroup: only ignore key- and buttonEvents;
ca
parents: 1317
diff changeset
  1060
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
  1061
    <resource: #keyboard (#Escape )>
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  1062
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1063
    |event ignore key focus firstTop evView evType evArgs
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1064
     modalTops modalTop modalDelegate syntheticEvent|
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1065
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
  1066
    self processExposeEvents.
180
claus
parents: 172
diff changeset
  1067
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
  1068
    [mySensor hasEvents] whileTrue:[
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1069
        event := mySensor nextEvent.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1070
        event notNil ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1071
            ignore := false.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1072
            focus := focusView.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1073
            modalDelegate := false.
1419
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1074
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1075
            modalGroup notNil ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1076
                "/ an incoming event for a masterView, 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1077
                "/ while being blocked by some other modalView.
1328
99ffa52743c5 in modalGroup: only ignore key- and buttonEvents;
ca
parents: 1317
diff changeset
  1078
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1079
                modalTops := modalGroup topViews.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1080
                modalTops size > 0 ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1081
                    modalTop := modalTops first.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1082
                ].
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
  1083
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1084
                event isKeyEvent ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1085
                    "/ forward keyboard events to my modal
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1086
                    "/ groups first topView ...
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1087
                    modalTop notNil ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1088
                        focus := modalTop.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1089
                        modalDelegate := true.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1090
                    ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1091
                ] ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1092
                    event isFocusEvent ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1093
                        event isFocusInEvent ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1094
                            "/ focusIn is forwarded to the modalGroup
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1095
                            "/ (since keyboard is forwarded)
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1096
                            event view:modalTop.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1097
                            focus := modalTop.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1098
                        ] ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1099
                            "/ focusOut goes to both the modal and
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1100
                            "/ the blocked main-group
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1101
                            "/ (actually, only the very first focusOut
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1102
                            "/  is needed in the mainGroup (to turn off the cursor)
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1103
                            "/  all others are only needed in the modalGroup)
1419
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1104
"/                            syntheticEvent := event copy.
1876
6b5a5931a2b9 allow autonomous windowGroup processes to
Claus Gittinger <cg@exept.de>
parents: 1869
diff changeset
  1105
"/                            syntheticEvent view:modalTop.
1419
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1106
"/                            LastEventQuerySignal handle:[:ex |
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1107
"/                                ex proceedWith:syntheticEvent
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1108
"/                            ] do:[
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1109
"/                                syntheticEvent sendEventWithFocusOn:nil.
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1110
"/                            ].
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1111
                            event view:modalTop.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1112
                        ].
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1113
                        modalDelegate := true.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1114
                    ] ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1115
                        event isPointerLeaveEvent ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1116
                        ] ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1117
                            event isUserEvent ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1118
                                ignore := true
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1119
                            ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1120
                        ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1121
                    ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1122
                ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1123
            ].
1419
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1124
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1125
            ignore ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1126
                (views notNil or:[topViews notNil]) ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1127
                    LastEventQuerySignal handle:[:ex |
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1128
                        ex proceedWith:event
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1129
                    ] do:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1130
                        (preEventHook  notNil 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1131
                        and:[preEventHook processEvent:event]) ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1132
                            ignore := true.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1133
                        ].
1419
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1134
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1135
                        ignore ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1136
                            evView := event view.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1137
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1138
                            event isKeyPressEvent ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1139
                                key := event key.
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1140
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1141
                                key == #Escape ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1142
                                    modalDelegate ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1143
                                        modalTop hideRequest
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1144
                                    ] ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1145
                                        isModal ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1146
                                            topViews first hideRequest
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1147
                                        ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1148
                                    ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1149
                                ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1150
                            ] ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1151
                                "/
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1152
                                "/ keep track of which view has the pointer
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1153
                                "/
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1154
                                event isPointerEnterEvent ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1155
                                    pointerView := evView
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1156
                                ] ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1157
                                    event isPointerLeaveEvent ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1158
                                        pointerView := nil
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1159
                                    ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1160
                                ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1161
                            ].
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1162
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1163
                            "/
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1164
                            "/  buttonPress events turn off explicit focus, and revert
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1165
                            "/  to implicit focus control
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1166
                            "/
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1167
                            (focusView notNil
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1168
                            and:[event isButtonPressEvent]) ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1169
                                self focusView:nil
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1170
                            ].
172
claus
parents: 162
diff changeset
  1171
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1172
                            LastActiveGroup := self.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1173
                            LastActiveProcess := Processor activeProcess.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1174
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1175
                            "
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1176
                             if there is no view information in the event,
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1177
                             it must have been sent directly to the sensor.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1178
                             Send it to the first topView.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1179
                            "
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1180
                            evType := event type.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1181
                            evArgs := event arguments.
1411
86559faec840 handle non-view events (ST-80 support)
Claus Gittinger <cg@exept.de>
parents: 1387
diff changeset
  1182
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1183
                            evView isNil ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1184
                                (firstTop := topViews first) notNil ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1185
                                    firstTop perform:evType withArguments:evArgs
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1186
                                ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1187
                            ] ifFalse:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1188
                                evView
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1189
                                    dispatchEvent:evType 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1190
                                    arguments:evArgs 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1191
                                    withFocusOn:focus 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1192
                                    delegate:true
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1193
                            ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1194
                        ].
1419
a40a4f3ad589 while blocked by a modal view, forward key events to
Claus Gittinger <cg@exept.de>
parents: 1411
diff changeset
  1195
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1196
                        postEventHook notNil ifTrue:[
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1197
                            postEventHook processEvent:event
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1198
                        ].
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1199
                    ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1200
                ]
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1201
            ].
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1202
            event := nil.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1203
        ].
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
  1204
    ]
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
  1205
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1206
    "Created: / 5.3.1997 / 11:33:11 / cg"
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1207
    "Modified: / 21.5.1998 / 00:14:59 / cg"
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1208
!
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1209
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1210
processExposeEvents
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
  1211
    "process only expose events from the damage queue"
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1212
180
claus
parents: 172
diff changeset
  1213
    |event view rect x y w h sensor thisProcess|
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
  1214
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
  1215
    (sensor := mySensor) isNil ifTrue:[^ self].
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1216
180
claus
parents: 172
diff changeset
  1217
    thisProcess := Processor activeProcess.
claus
parents: 172
diff changeset
  1218
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1219
    [sensor damageCount ~~ 0] whileTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1220
        LastActiveGroup := self.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1221
        LastActiveProcess := thisProcess.
180
claus
parents: 172
diff changeset
  1222
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1223
        event := sensor nextDamage.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1224
        event notNil ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1225
            (views notNil or:[topViews notNil]) ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1226
                LastEventQuerySignal handle:[:ex |
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1227
                    ex proceedWith:event
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1228
                ] do:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1229
                    (preEventHook notNil 
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1230
                    and:[preEventHook processEvent:event]) ifFalse:[
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1231
                        view := event view.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1232
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1233
                        event isDamage ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1234
                            "/
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1235
                            "/ if the view is no longer shown (iconified or closed),
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1236
                            "/ this is a leftover event and ignored.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1237
                            "/
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1238
                            view shown ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1239
                                LastActiveGroup := self.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1240
                                LastActiveProcess := thisProcess.
1868
484e0fca2cf6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1241
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1242
                                view
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1243
                                    dispatchEvent:(event type) 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1244
                                    arguments:(event arguments) 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1245
                                    withFocusOn:nil 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1246
                                    delegate:true
1868
484e0fca2cf6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1247
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1248
"/                            ] ifFalse:[
1851
6a6225647696 fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  1249
"/                                ('WGROUP: damage for ' , view displayString , ' ignored') infoPrintCR.
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1250
                            ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1251
                        ] ifFalse:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1252
                            "
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1253
                             mhmh - could we possibly arrive here ?
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1254
                            "
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1255
                            LastActiveGroup := self.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1256
                            LastActiveProcess := thisProcess.
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1257
                            "/ event sendEventWithFocusOn:nil.
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1258
                            view
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1259
                                dispatchEvent:(event type) 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1260
                                arguments:(event arguments) 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1261
                                withFocusOn:nil 
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1262
                                delegate:true
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1263
                        ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1264
                    ].
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1265
                    postEventHook notNil ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1266
                        postEventHook processEvent:event
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1267
                    ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1268
                ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1269
            ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1270
        ]
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1271
    ]
1157
ffcb958058ad checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1272
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1273
    "Modified: / 21.5.1998 / 00:17:18 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1274
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1275
1806
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1276
processRealExposeEvents
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1277
    "process only expose events from the damage queue
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1278
     (for any of my views).
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1279
     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
  1280
     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
  1281
2093
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1282
    self processRealExposeEventsFor:nil
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1283
!
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1284
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1285
processRealExposeEventsFor:someViewOrNil
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1286
    "process only expose events from the damage queue
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1287
     (for any of my views if the arg is nil).
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1288
     This is required after a scroll operation,
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1289
     to wait for either a noExpose or a real expose."
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1290
1806
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1291
    |event view rect x y w h sensor thisProcess|
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1292
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1293
    (sensor := mySensor) isNil ifTrue:[^ self].
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1294
    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
  1295
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1296
    thisProcess := Processor activeProcess.
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1297
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1298
    [true] whileTrue:[
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1299
        LastActiveGroup := self.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1300
        LastActiveProcess := thisProcess.
1806
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1301
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1302
        "/ event := aView nextDamage.
2093
955072f08466 checkin from browser
ca
parents: 2089
diff changeset
  1303
        event := sensor nextExposeEventFor:someViewOrNil.
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1304
        event isNil ifTrue:[^ self].
1806
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1305
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1306
        (views notNil or:[topViews notNil]) ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1307
            LastEventQuerySignal handle:[:ex |
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1308
                ex proceedWith:event
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1309
            ] do:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1310
                (preEventHook notNil 
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1311
                and:[preEventHook processEvent:event]) ifFalse:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1312
                    view := event view.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1313
                    "/
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1314
                    "/ if the view is no longer shown (iconified or closed),
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1315
                    "/ this is a leftover event and ignored.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1316
                    "/
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1317
                    view shown ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1318
                        rect := event rectangle.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1319
                        x := rect left.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1320
                        y := rect top.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1321
                        w := rect width.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1322
                        h := rect height.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1323
                        LastActiveGroup := self.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1324
                        LastActiveProcess := thisProcess.
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1325
                        view transformation notNil ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1326
                            view deviceExposeX:x y:y width:w height:h
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1327
                        ] ifFalse:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1328
                            view exposeX:x y:y width:w height:h
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1329
                        ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1330
                    ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1331
                ].
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1332
                postEventHook notNil ifTrue:[
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1333
                    postEventHook processEvent:event
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1334
                ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1335
            ]
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1336
        ]
1806
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1337
    ]
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1338
2086
069a179b1849 dont yield when asking for pending events.
Claus Gittinger <cg@exept.de>
parents: 2051
diff changeset
  1339
    "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
  1340
    "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
  1341
!
16c958be35d8 fixed no-deviceID error with destroy arriving while waiting for
Claus Gittinger <cg@exept.de>
parents: 1752
diff changeset
  1342
28
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1343
waitForExposeFor:aView
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1344
    "wait for a noExpose event for aView, then process all exposes.
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1345
     To be used after a scroll.
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1346
     This is very Xspecific and not needed with other systems
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1347
     (i.e. a synthetic noExpose may be generated there)."
28
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1348
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1349
    mySensor waitForExposeFor:aView.
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1350
    AbortSignal catch:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1351
	self processRealExposeEventsFor:aView
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1352
    ]
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1353
1851
6a6225647696 fixes for expose-event-lost after re-map
Claus Gittinger <cg@exept.de>
parents: 1822
diff changeset
  1354
    "Modified: 6.8.1997 / 19:50:24 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1355
! !
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1356
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1357
!WindowGroup methodsFor:'focus control'!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1358
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1359
focusNext
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1360
    "give focus to the next view in the focusSequence.
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1361
     Skip invisible views."
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1362
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1363
    |index "{ Class: SmallInteger }"
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1364
     lastIndex "{ Class: SmallInteger }"
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1365
     index0 next sequence|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1366
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1367
    sequence := self focusSequence.
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1368
    (lastIndex := sequence size) == 0 ifTrue:[^ self].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1369
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1370
    focusView 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
  1371
	index := index0 := (sequence identityIndexOf:focusView).
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1372
    ] ifFalse:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1373
	index := 0.
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1374
    ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1375
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1376
    [next isNil] whileTrue:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1377
	index := index + 1.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1378
	index > lastIndex ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1379
	    index := 1.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1380
	    index0 isNil ifTrue:[^ self].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1381
	].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1382
	index == index0 ifTrue:[^ self].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1383
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1384
	next := (sequence at:index).
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1385
	next realized not ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1386
	    next := nil
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1387
	] ifFalse:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1388
	    next enabled ifFalse:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1389
		next := nil
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1390
	    ]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1391
	]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1392
    ].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1393
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1394
    self focusView:next
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1395
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1396
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1397
     |top v1 v2|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1398
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1399
     top := StandardSystemView new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1400
     v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1401
     v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1402
     top open.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1403
     top windowGroup focusSequence:(Array with:v1 with:v2).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1404
     top windowGroup focusOn:v1.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1405
     (Delay forSeconds:10) wait.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1406
     top windowGroup focusNext.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1407
    "
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1408
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1409
    "Modified: / 31.10.1997 / 19:22:34 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1410
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1411
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1412
focusPrevious
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1413
    "give focus to previous view in focusSequence"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1414
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1415
    |index     "{ Class: SmallInteger }"
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1416
     lastIndex "{ Class: SmallInteger }"
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1417
     prev index0 sequence|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1418
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1419
    sequence := self focusSequence.
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1420
    (lastIndex := sequence size) == 0 ifTrue:[^ self].
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1421
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1422
    focusView 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
  1423
	index := index0 := (sequence identityIndexOf:focusView).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1424
    ] ifFalse:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1425
	index := lastIndex + 1.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1426
    ].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1427
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1428
    [prev isNil] whileTrue:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1429
	index := index - 1.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1430
	index < 1 ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1431
	    index := lastIndex.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1432
	    index0 isNil ifTrue:[^ self].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1433
	].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1434
	index == index0 ifTrue:[^ self].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1435
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1436
	prev := (sequence at:index).
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1437
	prev realized not ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1438
	    prev := nil
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1439
	] ifFalse:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1440
	    prev enabled ifFalse:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1441
		prev := nil
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1442
	    ]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1443
	].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1444
    ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1445
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1446
    self focusView:prev
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1447
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1448
    "Modified: / 31.10.1997 / 19:21:50 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1449
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1450
135
claus
parents: 121
diff changeset
  1451
focusSequence
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1452
    "return my focus sequence for focusNext/focusPrevious.
135
claus
parents: 121
diff changeset
  1453
     Focus is stepped in the order in which subviews occur in
claus
parents: 121
diff changeset
  1454
     the sequence"
claus
parents: 121
diff changeset
  1455
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1456
    |sequence|
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1457
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1458
    "/ a fix focusSequence ...    
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1459
    focusSequence notNil ifTrue:[^ focusSequence].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1460
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1461
    topViews do:[:top |
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1462
	sequence := top focusSequence.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1463
	sequence notNil ifTrue:[^ sequence].
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1464
    ].
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1465
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1466
    ^ nil
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1467
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1468
    "Modified: / 31.10.1997 / 20:37:54 / cg"
135
claus
parents: 121
diff changeset
  1469
!
claus
parents: 121
diff changeset
  1470
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1471
focusSequence:aSequenceableCollection
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1472
    "define the focus sequence for focusNext/focusPrevious.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1473
     Focus is stepped in the order in which subviews occur in
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1474
     the sequence."
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1475
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1476
    focusSequence := aSequenceableCollection
1946
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1477
17a52204481e checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1876
diff changeset
  1478
    "Modified: / 31.10.1997 / 20:40:04 / cg"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1479
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1480
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1481
focusView
135
claus
parents: 121
diff changeset
  1482
    "return the view which currently has the focus"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1483
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1484
    ^ focusView
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1485
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1486
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1487
focusView:aViewOrNil
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1488
    "give focus to aViewOrNil"
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1489
410
9d9d03fa5d82 moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents: 408
diff changeset
  1490
    focusView == aViewOrNil ifTrue:[^ self].
9d9d03fa5d82 moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents: 408
diff changeset
  1491
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1492
    focusView 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
  1493
	"/ lost explicit focus
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1494
	focusView == aViewOrNil ifTrue:[^ self].
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1495
	focusView showNoFocus:true.
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
  1496
    ] ifFalse:[
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1497
	pointerView notNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1498
	    pointerView ~~ aViewOrNil ifTrue:[
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1499
		"/ lost implicit focus
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1500
		pointerView showNoFocus:false
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1501
	    ]
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1502
	].
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1503
    ].
387
aa80487842b8 compile event classes with optSpace;
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  1504
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1505
    focusView := aViewOrNil.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1506
    focusView 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
  1507
	"/ got explicit focus
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1508
	focusView showFocus:true.
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1509
    ].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1510
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1511
    "
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1512
     |top v1 v2|
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1513
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1514
     top := StandardSystemView new.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1515
     v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1516
     v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1517
     top open.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1518
     top windowGroup focusView:v1.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1519
    "
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
  1520
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1521
    "Modified: 31.5.1996 / 21:13:25 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1522
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1523
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1524
!WindowGroup methodsFor:'initialization'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1525
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1526
initialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1527
    "setup the windowgroup, by creating a new sensor
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1528
     and an event semaphore"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1529
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1530
    mySensor := WindowSensor new.
1273
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1531
    mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema').
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1532
    isModal := false.
417
940ebb195fc6 added isModalForSubView flag
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
  1533
    isForModalSubview := false.
1273
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1534
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1535
    "Modified: 25.1.1997 / 00:20:19 / cg"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1536
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1537
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1538
reinitialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1539
    "reinitialize the windowgroup after an image restart"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1540
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1541
    "throw away old (zombie) process"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1542
    myProcess 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
  1543
	"/ careful: the old processes exit-actions must be cleared.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1544
	"/ otherwise, it might do destroy or other actions when it
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1545
	"/ gets finalized ...
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1546
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1547
"/        myProcess removeAllExitActions.
1977
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1548
	myProcess removeAllSuspendActions.
9bda3ac0d83d no need for #flush in event-loop (already done by threads suspendAction)
Claus Gittinger <cg@exept.de>
parents: 1966
diff changeset
  1549
	myProcess := nil.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1550
    ].
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1551
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1552
    "throw away old events"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1553
    mySensor reinitialize
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1554
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1555
    "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
  1556
    "Modified: 12.1.1997 / 00:45:01 / cg"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1557
! !
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1558
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1559
!WindowGroup methodsFor:'printing'!
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1560
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1561
printOn:aStream
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1562
    "return a printed representation;
144
claus
parents: 141
diff changeset
  1563
     just for more user friendlyness: add name of process."
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1564
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1565
    myProcess isNil ifTrue:[
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1566
	(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1567
	    aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')').
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1568
	    ^ self.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1569
	].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1570
	^ super printOn:aStream
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1571
    ].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1572
    aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')')
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1573
! !
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1574
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1575
!WindowGroup methodsFor:'special'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1576
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1577
restoreCursors
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1578
    "restore the original cursors in all of my views"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1579
330
13a3fa93330c careful - view could have been destroyed in the meanwhile (in restoreCursors)
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
  1580
    self allViewsDo:[:aView |  
2097
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1581
        |c dev id cid|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1582
2097
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1583
        dev := aView graphicsDevice.
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1584
        dev notNil ifTrue:[
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1585
            (id := aView id) notNil ifTrue:[
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1586
                c := aView cursor onDevice:dev.
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1587
                (cid := c id) notNil ifTrue:[
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1588
                    dev setCursor:cid in:id.
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1589
                ]
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1590
            ]
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1591
        ]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1592
    ].
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1593
2097
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1594
    "Modified: / 22.4.1998 / 14:28:22 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1595
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1596
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1597
showActivity:someMessage
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1598
    "some activityNotification shalt be communicated to
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1599
     the user; 
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1600
     forward it to my first topView if there is one
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1601
     (that one should know how to deal with it)"
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1602
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1603
    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
  1604
	topViews first showActivity:someMessage
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1605
    ]
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1606
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1607
    "Created: 16.12.1995 / 18:39:40 / cg"
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1608
    "Modified: 23.4.1996 / 21:36:54 / cg"
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1609
!
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1610
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1611
showCursor:aCursor
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1612
    "change the cursor to aCursor in all of my views."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1613
2051
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1614
    |c cId vId dev|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1615
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1616
    c := aCursor.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1617
    self allViewsDo:[:aView |  
2051
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1618
        dev := aView graphicsDevice.
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1619
        dev notNil ifTrue:[
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1620
            c := c onDevice:dev.
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1621
            (cId := c id) notNil ifTrue:[
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1622
               (vId := aView id) notNil ifTrue:[
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1623
                    dev setCursor:cId in:vId.
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1624
                ]
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1625
            ]
323362098e21 care for view being still physically present, when setting cursor back
Claus Gittinger <cg@exept.de>
parents: 2046
diff changeset
  1626
        ]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1627
    ].
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1628
2097
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1629
    "Modified: / 22.4.1998 / 14:26:45 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1630
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1631
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1632
withCursor:aCursor do:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1633
    "evaluate aBlock while showing aCursor in all
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1634
     my views (used to show wait-cursor while doing something).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1635
     Return the result as returned by aBlock."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1636
1986
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1637
    |oldCursors dev deviceCursor action|
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1638
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1639
    dev := self graphicsDevice.   
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1640
    dev isNil ifTrue:[
1986
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1641
        ^ aBlock value
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1642
    ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1643
1652
5745269f78a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1561
diff changeset
  1644
    deviceCursor := aCursor onDevice:dev.
5745269f78a3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1561
diff changeset
  1645
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1646
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1647
     get mapping of view->cursor for all of my subviews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1648
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1649
    oldCursors := IdentityDictionary new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1650
    self allViewsDo:[:aView |
1986
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1651
        |old|
1387
3fabdef0790d better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
  1652
1986
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1653
        old := aView cursor.
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1654
        old ~~ aCursor ifTrue:[
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1655
            oldCursors at:aView put:old.
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1656
            aView cursor:deviceCursor now:false
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1657
        ]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1658
    ].
1387
3fabdef0790d better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
  1659
3fabdef0790d better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
  1660
    oldCursors size == 0 ifTrue:[
1986
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1661
        action := aBlock
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1662
    ] ifFalse:[
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1663
        action := [
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1664
                    |rslt|
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1665
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1666
                    "/
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1667
                    "/ here sync looks better; flush leads to almost invisible cursors when accepting.
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1668
                    "/ I dont really know why (maybe unix does not context-switch to the Xserver
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1669
                    "/ early enough after the requests have been sent ?)
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1670
                    "/
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1671
                    dev sync.
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1672
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1673
                    rslt := aBlock valueNowOrOnUnwindDo:[
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1674
                        "
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1675
                         restore cursors from the mapping
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1676
                        "
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1677
                        oldCursors keysAndValuesDo:[:view :cursor |
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1678
                            view cursor:cursor now:false.
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1679
                        ].
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1680
                        dev flush
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1681
                    ].
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1682
                    rslt
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1683
                  ]
1387
3fabdef0790d better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
  1684
    ].
3fabdef0790d better behavior if called recursively
Claus Gittinger <cg@exept.de>
parents: 1364
diff changeset
  1685
2097
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1686
"/    (self isModal and:[previousGroup notNil]) ifTrue:[
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1687
"/        "/ pass the work to my parentGroup
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1688
"/        ^ previousGroup withCursor:aCursor do:action
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1689
"/    ].
1986
344c50a87cbe #withCursor:do: for a modal group
ca
parents: 1977
diff changeset
  1690
    ^ action value.
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1691
2097
d290e7910bec dont change cursors of mainGroup
Claus Gittinger <cg@exept.de>
parents: 2093
diff changeset
  1692
    "Modified: / 22.4.1998 / 14:36:47 / cg"
408
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1693
!
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1694
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1695
withWaitCursorDo:aBlock
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1696
    "evaluate aBlock while showing a waitCursor in all
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1697
     my views (used to show wait-cursor while doing something time consuming).
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1698
     Return the result as returned by aBlock."
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1699
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1700
    ^ self withCursor:(Cursor wait) do:aBlock
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1701
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1702
    "Created: 6.2.1996 / 19:51:53 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1703
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1704
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1705
!WindowGroup methodsFor:'special accessing'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1706
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1707
isForModalSubview 
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1708
    "special for windowgroups for modal subviews.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1709
     These must be flagged specially to avoid the views being reassigned
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1710
     to the maingroup.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1711
     This is a private interface to the SimpleView class"
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1712
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1713
    ^ isForModalSubview
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1714
!
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1715
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1716
isForModalSubview:aBoolean
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1717
    "special for windowgroups for modal subviews.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1718
     These must be flagged specially to avoid the views being reassigned
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1719
     to the maingroup.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1720
     This is a private interface to the SimpleView class"
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1721
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1722
    isForModalSubview := aBoolean
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1723
!
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1724
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1725
setModal:aBoolean
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1726
    "special entry for debugger: set the modal flag.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1727
     Not for public use"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1728
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1729
    isModal := aBoolean
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1730
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1731
    "Modified: 3.9.1995 / 14:51:04 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1732
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1733
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1734
setPreviousGroup:aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1735
    "special entry for debugger:
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1736
     set the windowgroup that started this group (for modal groups only).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1737
     This is not a public interface."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1738
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1739
    previousGroup := aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1740
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1741
    "Modified: 3.9.1995 / 14:55:40 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1742
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1743
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1744
setProcess:aProcess 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1745
    "special entry for debugger: set the windowGroups process.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1746
     Not for public use."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1747
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1748
    myProcess := aProcess
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1749
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1750
    "Modified: 3.9.1995 / 14:25:38 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1751
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1752
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1753
!WindowGroup class methodsFor:'documentation'!
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1754
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1755
version
2126
1f108c76dfdb moved event dispatching code to view (where it belongs)
Claus Gittinger <cg@exept.de>
parents: 2116
diff changeset
  1756
    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.135 1998-05-20 23:57:43 cg Exp $'
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1757
! !
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1758
WindowGroup initialize!