WindowGroup.st
author Claus Gittinger <cg@exept.de>
Wed, 29 Jan 1997 19:46:57 +0100
changeset 1298 d070db2e4530
parent 1273 158d030a5553
child 1304 d914bfc99b49
permissions -rw-r--r--
always handle a windowGroupQuery - use that first when being asked for a group
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
144
claus
parents: 141
diff changeset
    48
    event queue (therefore views all share the same input event queue).
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 
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    85
        (for example, the FileBrowsers kill-Button is created that 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    86
         way, to allow a kill of an executing unix command, while the browser 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    87
         itself reads the pipeStream for incoming text.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
    88
         Even if the fileBrowser is busy reading the pipe, the killButton is still
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
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:
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   117
        You dont have to care for details in the normal case, a windowgroup is
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   118
        created for you automatically, when a view is opened.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
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
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   124
        views                   collection of views of this group
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   125
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   126
        topViews                collection of topviews of this group
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   127
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   128
        myProcess               the process executing the events
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   129
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   130
        mySensor                my input sensor
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   131
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   132
        isModal                 true if this is for a modal box
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   133
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   134
        previousGroup           if modal, the group that started this one
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   135
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   136
        focusView               the one that has the focus (or nil)
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   137
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
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:]
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   142
        LeaveSignal             if raised, a modal box leaves (closes)
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   143
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   144
        WindowGroupQuerySignal  to ask for the current windowGroup,
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   145
                                anywhere in the program, simply raise this
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   146
                                signal. The raise returns nil, for processes,
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   147
                                which are not under control of a windowGroup.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   148
                                (i.e. wg := WindowGroup windowGroupQuerySignal raise)
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   149
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   150
        LastEventQuerySignal    to ask for the event which was responsible
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   151
                                for being where you are (whereever that is).
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   152
                                The raise returns nil, if you did not arrive
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   153
                                there due to an event.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   154
                                (i.e. ev := WindowGroup lastEventQuerySignal raise)
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   155
                                The event can be asked for the view, the type
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
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
    (*) 
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   159
        due to historic reasons, many views have the controller functionality
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   160
        integrated, and handle events themself. The windowSensor takes care
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   161
        of this, by checking if a view has a controller, and, if so, forwarding 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   162
        the events to it. Otherwise, events are sent directly to the view.
144
claus
parents: 141
diff changeset
   163
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   164
        In the future, all views will be rewritten to actually use a controller.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   165
        Currently (being in the middle of this migration), only some views
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
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:]
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 605
diff changeset
   172
        Claus Gittinger
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:]
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   175
        WindowSensor WindowEvent EventListener KeyboardForwarder
598
1a2339e902d4 commentary
Claus Gittinger <cg@exept.de>
parents: 597
diff changeset
   176
        DeviceWorkstation
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   177
        View StandardSystemView
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
   178
        ApplicationModel
651
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   179
        Process ProcessorScheduler
1153
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
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:[
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   188
        LeaveSignal := (Signal new) mayProceed:true.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   189
        LeaveSignal nameClass:self message:#leaveSignal.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   190
        LeaveSignal notifierString:'unhandled leave signal'.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   191
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   192
        WindowGroupQuerySignal := QuerySignal new.
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   193
        WindowGroupQuerySignal nameClass:self message:#windowGroupQuerySignal.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   194
        WindowGroupQuerySignal notifierString:'query for windowgroup'.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   195
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   196
        LastEventQuerySignal := QuerySignal new.
1111
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
diff changeset
   197
        LastEventQuerySignal nameClass:self message:#lastEventQuerySignal.
13b350d13122 commentary
Claus Gittinger <cg@exept.de>
parents: 1110
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.
144
claus
parents: 141
diff changeset
   226
     This private signal, is always cought while a modalbox is active.
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:[
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   266
        LastActiveGroup process == LastActiveProcess ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   267
            ^ LastActiveGroup
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
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:[
1298
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   274
        "/ mhmh - noone willing to answer that question ...
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   275
        "/ (how can ths happen ?)
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   276
        groups := self scheduledWindowGroups 
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   277
                    select:[:wg | wg process == activeProcess].
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   278
        groups size == 1 ifTrue:[
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   279
            wg := groups anElement
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   280
        ] ifFalse:[
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   281
            wg := groups detect:[:wg | wg isModal] ifNone:nil.
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   282
            wg isNil ifTrue:[
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   283
                wg := groups anElement
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   284
            ]
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
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:[
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   289
        LastActiveProcess := activeProcess.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
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
claus
parents: 172
diff changeset
   298
    "Modified: 3.9.1995 / 14:49:53 / claus"
1298
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   299
    "Modified: 29.1.1997 / 19:46:25 / 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.
claus
parents: 172
diff changeset
   310
    screens isNil ifTrue:[^ #()].
claus
parents: 172
diff changeset
   311
claus
parents: 172
diff changeset
   312
    set := IdentitySet new.
claus
parents: 172
diff changeset
   313
    screens do:[:aDevice |
claus
parents: 172
diff changeset
   314
	aDevice allViewsDo:[:aView |
claus
parents: 172
diff changeset
   315
	    |wg|
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
   316
180
claus
parents: 172
diff changeset
   317
	    (wg := aView windowGroup) notNil ifTrue:[
claus
parents: 172
diff changeset
   318
		wg process notNil ifTrue:[
claus
parents: 172
diff changeset
   319
		    set add:wg
claus
parents: 172
diff changeset
   320
		]
claus
parents: 172
diff changeset
   321
	    ].
claus
parents: 172
diff changeset
   322
	].
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"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   331
!
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
setActiveGroup:aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   334
    "set the currently active windowGroup.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   335
     Temporary; do not use this interface, it will vanish."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   336
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   337
    LastActiveProcess := Processor activeProcess.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   338
    LastActiveGroup := aGroup
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   339
! !
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   340
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   341
!WindowGroup methodsFor:'accessing'!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   342
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   343
device
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   344
    "return the device, we receive our events from"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   345
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   346
    self obsoleteMethodWarning:'use #graphicsDevice'.
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   347
    ^ self graphicsDevice
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   348
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   349
    "Modified: 5.7.1996 / 17:53:58 / cg"
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   350
!
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
graphicsDevice
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   353
    "return the device, we receive our events from"
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   354
1116
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   355
    |v|
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   356
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   357
    (topViews notNil and:[topViews isEmpty not]) ifTrue:[
1116
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   358
        v := topViews first
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   359
    ] ifFalse:[
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   360
        (views notNil and:[views isEmpty not]) ifTrue:[
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   361
            v := views first
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   362
	]
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   363
    ].
1116
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   364
    v notNil ifTrue:[
c04e4739b42c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1111
diff changeset
   365
	^ v graphicsDevice
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   366
    ].
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   367
    ^ nil
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   368
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   369
    "Modified: 13.12.1995 / 14:18:11 / stefan"
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   370
    "Modified: 28.5.1996 / 20:26:59 / cg"
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   371
    "Created: 5.7.1996 / 17:53:31 / cg"
512
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   372
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   373
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   374
isModal
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   375
    "return true, if the receiver is in a modal mode
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   376
     (i.e. for a modal box)"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   377
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   378
    ^ isModal
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   379
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   380
    "Modified: 7.3.1996 / 14:29:46 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   381
!
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
mainGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   384
    "return the main windowgroup (for modal groups only) 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   385
     that is the top one, which is not modal.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   386
     NonModal groups return themSelf.
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
     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
   389
     returns itself as mainGroup (not its debuggee)."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   390
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   391
    |g prev|
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   392
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   393
    g := self.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   394
    [g notNil and:[g isModal and:[(prev := g previousGroup) notNil]]] whileTrue:[
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   395
        g := prev
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
    ^ g
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   398
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   399
    "Modified: 3.9.1995 / 14:57:20 / claus"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   400
    "Modified: 7.3.1996 / 14:29:28 / cg"
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
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   403
previousGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   404
    "return the windowgroup that started this group. (for modal groups only).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   405
     This may be another modalGroup (for boxes opened by boxes).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   406
     NonModal groups return nil."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   407
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   408
    ^ previousGroup
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   409
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   410
    "Modified: 7.3.1996 / 14:28:46 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   411
!
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
process 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   414
    "return the windowGroups process"
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
    ^ myProcess
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   417
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   418
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   419
sensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   420
    "return the windowGroups sensor.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   421
     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
   422
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   423
    ^ mySensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   424
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   425
    "Modified: 7.3.1996 / 14:30:21 / cg"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   426
!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   427
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   428
sensor:aSensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   429
    "set the windowGroups sensor"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   430
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   431
    mySensor := aSensor
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   432
! !
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
!WindowGroup methodsFor:'accessing-hook'!
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
postEventHook 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   437
    "return the postEventHook if any"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   438
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   439
    ^ postEventHook
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   440
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   441
    "Created: 7.3.1996 / 14:42:46 / cg"
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
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   444
postEventHook:anObject 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   445
    "set the postEventHook - this one will get all events
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   446
     passed after being processed here (via #processEvent:)."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   447
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   448
    postEventHook := anObject
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   449
!
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
preEventHook 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   452
    "return the preEventHook if any"
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   453
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   454
    ^ preEventHook
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   455
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   456
    "Created: 7.3.1996 / 14:42:42 / cg"
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
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   459
preEventHook:anObject 
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   460
    "set the preEventHook - this one will get all events
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   461
     passed before being processed here (via #processEvent:).
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   462
     If this returns true, the event is supposed to be already
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   463
     processed and ignored here.
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   464
     Otherwise, it is processed as usual."
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   465
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   466
    preEventHook := anObject
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
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   469
!WindowGroup methodsFor:'accessing-views'!
e8bc1216a254 commentary & hook access
Claus Gittinger <cg@exept.de>
parents: 507
diff changeset
   470
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   471
addTopView:aView
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   472
    "add a topview to the group"
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   473
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   474
    topViews isNil ifTrue:[
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   475
        topViews := OrderedCollection new.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   476
    ].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   477
    (topViews includesIdentical:aView) ifFalse:[
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   478
        topViews add:aView
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   479
    ]
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   480
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   481
    "Modified: 6.3.1996 / 15:35:15 / cg"
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   482
!
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   483
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   484
addView:aView
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   485
    "add aView to the windowGroup"
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   486
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   487
    views isNil ifTrue:[
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   488
        views := OrderedCollection new.
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   489
    ].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   490
    (views includesIdentical:aView) ifFalse:[
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   491
        views add:aView
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   492
    ]
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   493
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
   494
    "Modified: 6.3.1996 / 15:35:41 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   495
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   496
26
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   497
removeView:aView
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   498
    "remove aView from the windowGroup;
ac9f66dc8f53 *** empty log message ***
claus
parents: 23
diff changeset
   499
     if this was the last view in this group, 
81
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   500
     also shut down the corresponding process 
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   501
     (actually, only wake it up here - it will terminate itself 
4ba554473294 *** empty log message ***
claus
parents: 78
diff changeset
   502
      when finding out that all views are gone)"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   503
263
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   504
    |sema|
Claus Gittinger <cg@exept.de>
parents: 262
diff changeset
   505
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   506
    views notNil ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   507
	views remove:aView ifAbsent:[].
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   508
	views isEmpty ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   509
	    views := nil
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   510
	]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   511
    ].
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   512
    topViews notNil ifTrue:[
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   513
	topViews remove:aView ifAbsent:[].
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   514
	topViews isEmpty ifTrue:[
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   515
	    topViews := nil
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   516
	]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   517
    ].
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   518
    "
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   519
     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
   520
     removed (modalBoxes terminate their modalLoop if so)
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   521
    "
262
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   522
    mySensor notNil ifTrue:[
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   523
	(sema := mySensor eventSemaphore) notNil ifTrue:[
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   524
	    sema signal
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   525
	]
546f42586e3c only signal sema if there is one (when views are removed)
Claus Gittinger <cg@exept.de>
parents: 251
diff changeset
   526
    ]
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   527
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   528
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   529
topViews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   530
    "return the topviews accociated to this windowGroup"
172
claus
parents: 162
diff changeset
   531
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   532
    ^ topViews
172
claus
parents: 162
diff changeset
   533
!
claus
parents: 162
diff changeset
   534
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   535
views
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   536
    "return the views accociated to this windowGroup"
172
claus
parents: 162
diff changeset
   537
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   538
    ^ views
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   539
! !
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   540
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   541
!WindowGroup methodsFor:'activation / deactivation'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   542
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   543
closeDownViews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   544
    "destroy all views associated to this window group"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   545
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   546
    topViews notNil ifTrue:[
403
a3ff487fba88 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 393
diff changeset
   547
	topViews do:[:aTopView | aTopView notNil ifTrue:[aTopView destroy]]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   548
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   549
    views := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   550
    topViews := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   551
    mySensor := nil.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   552
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   553
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   554
realizeTopViews:isRestart
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   555
    "realize all topViews associated to this windowGroup.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   556
     If this is a restart, tell topViews about it."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   557
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   558
    topViews notNil ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   559
	topViews do:[:aView |
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   560
	    aView realize.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   561
	    isRestart ifTrue:[
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   562
		aView restarted
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   563
	    ]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   564
	].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   565
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   566
!
180
claus
parents: 172
diff changeset
   567
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   568
restart
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   569
    "restart after a snapin."
180
claus
parents: 172
diff changeset
   570
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   571
    topViews notNil ifTrue:[
1273
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   572
        "
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   573
         need a new semaphore, since obsolete processes 
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   574
         (from our previous live) may still sit on the current semaphore
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   575
        "
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   576
        mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema').
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   577
        isModal ifFalse:[
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   578
            self startup:true 
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   579
        ]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   580
    ]
1273
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   581
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
   582
    "Modified: 25.1.1997 / 00:20:25 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   583
!
180
claus
parents: 172
diff changeset
   584
582
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   585
shutDown
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   586
    "shutdown the window group; close all views and
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   587
     terminate process"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   588
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   589
    |p|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   590
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   591
    self closeDownViews.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   592
    myProcess notNil ifTrue:[
582
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   593
        p := myProcess.
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   594
        myProcess := nil.
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   595
        p terminate.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   596
    ]
582
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   597
dbb1d19a1065 obsolete shutdown (use shutDown)
Claus Gittinger <cg@exept.de>
parents: 565
diff changeset
   598
    "Created: 22.4.1996 / 17:58:37 / cg"
180
claus
parents: 172
diff changeset
   599
!
claus
parents: 172
diff changeset
   600
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   601
startup:isRestart
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   602
    "startup the window-group;
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   603
     this creates a new window group process, which
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   604
     does the event processing.
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   605
     The isRestart arg is true for an image restart; the topView
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   606
     is opened at the old position then (this is not done here)."
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   607
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   608
    |top nm dev devNm|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   609
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   610
    previousGroup := nil.
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   611
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   612
    myProcess isNil ifTrue:[
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   613
        isModal := false.
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   614
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   615
        "/
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   616
        "/ this is the windowGroup process;
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   617
        "/ realize all views, then handle events forever
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   618
        "/ (well, not really forever ... ;-)
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   619
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   620
        myProcess := [
1298
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   621
            WindowGroupQuerySignal handle:[:ex |
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   622
                ex proceedWith:self
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   623
            ] do:[
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   624
                [
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   625
                    self realizeTopViews:isRestart.
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   626
                    self eventLoopWhile:[true] onLeave:[]
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   627
                ] valueOnUnwindDo:[
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   628
                    self closeDownViews
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   629
                ]
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   630
            ]
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   631
        ] forkAt:Processor userSchedulingPriority.
180
claus
parents: 172
diff changeset
   632
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   633
        (topViews notNil and:[topViews isEmpty not]) ifTrue:[
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   634
            "/
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   635
            "/ give the windowGroup process a user friendly name
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   636
            "/ ask its topView for the processName, and
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   637
            "/ optionally append the displayName (if its not the default)
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   638
            "/
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   639
            top := topViews first.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   640
            nm := top processName.
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   641
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   642
            (dev := top graphicsDevice) notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   643
                devNm := dev displayName.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   644
                (devNm notNil and:[devNm ~= Display displayName]) ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   645
                    nm := nm , ' (' , devNm , ')'
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   646
                ]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   647
            ]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   648
        ] ifFalse:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   649
            nm := 'window handler'.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   650
        ].
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   651
        myProcess name:nm.
931
00fd4b461c31 renamed beProcessGroupLeader to beGroupLeader
Claus Gittinger <cg@exept.de>
parents: 930
diff changeset
   652
        myProcess beGroupLeader.
180
claus
parents: 172
diff changeset
   653
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   654
        "/
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   655
        "/ when the process gets suspended, 
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   656
        "/ there maybe still buffered draw requests.
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   657
        "/ Arrange for them to be flushed then.
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   658
        "/ (otherwise, you would not see the output of a process,
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   659
        "/  which suspends and waits - or we had to add buffer flushes
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   660
        "/  all over the place)
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   661
        "/
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   662
        myProcess addSuspendAction:[ 
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   663
            |dev|
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   664
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   665
            dev := self graphicsDevice.
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   666
            dev notNil ifTrue:[dev flush].
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
   667
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   668
    ]
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   669
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   670
    "Modified: 13.12.1995 / 14:04:53 / stefan"
1298
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
   671
    "Modified: 29.1.1997 / 19:40:25 / cg"
180
claus
parents: 172
diff changeset
   672
!
claus
parents: 172
diff changeset
   673
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   674
startupModal:checkBlock
301
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   675
    "startup the window-group in a modal loop 
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   676
     (i.e. under the currently running process);
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   677
     checkBlock is evaluated and the modal loop is left, whenever false is returned."
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   678
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   679
    ^ self startupModal:checkBlock forGroup:WindowGroup activeGroup.
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   680
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   681
    "Created: 10.12.1995 / 14:15:11 / cg"
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   682
!
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   683
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   684
startupModal:checkBlock forGroup:mainGroup
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   685
    "startup the window-group in a modal loop 
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   686
     (i.e. under the currently running process);
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   687
     checkBlock is evaluated and loop is left, when false is
301
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   688
     returned.
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   689
     The mainGroup info is required to allow peeking into its
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   690
     event queue in order for its expose/redraws to be handled."
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   691
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   692
    "set previousGroup to the main (non-modal) group"
180
claus
parents: 172
diff changeset
   693
301
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   694
    previousGroup := mainGroup.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   695
    isModal := true.
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   696
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   697
    WindowGroupQuerySignal handle:[:ex |
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   698
        ex proceedWith:self
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   699
    ] do:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   700
        self realizeTopViews:false.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   701
        self 
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   702
            eventLoopWhile:checkBlock 
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   703
            onLeave:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   704
                "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   705
                 cleanup, in case of a terminate
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   706
                "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   707
                previousGroup := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   708
                topViews := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   709
                views := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   710
                "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   711
                 the following is rubbish;
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   712
                 the views could be reused ..
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   713
                "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   714
    "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   715
                topViews notNil ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   716
                    topViews do:[:aView |
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   717
                        aView destroy
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   718
                    ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   719
                    topViews := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   720
                ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   721
                views notNil ifTrue:[
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   722
                    views do:[:aView |
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   723
                        aView destroy
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   724
                    ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   725
                    views := nil.
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   726
                ].
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   727
    "
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   728
            ]
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   729
        ]
301
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   730
b57451fd8560 passing group to avoid multiple activeGroup searches
Claus Gittinger <cg@exept.de>
parents: 297
diff changeset
   731
    "Created: 10.12.1995 / 14:14:26 / cg"
956
32a642b5dcd3 when asking for the active windowGroup, ask the windowGroupQuerySignal
Claus Gittinger <cg@exept.de>
parents: 949
diff changeset
   732
    "Modified: 17.7.1996 / 15:40:37 / cg"
180
claus
parents: 172
diff changeset
   733
! !
claus
parents: 172
diff changeset
   734
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
   735
!WindowGroup methodsFor:'enumerating'!
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   736
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   737
allNonTopViewsDo:aBlock
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   738
    "evaluate aBlock for all nonTopviews (i.e. subviews) in this group.
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   739
     This works on a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   740
     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
   741
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   742
    views notNil ifTrue:[
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   743
        views copy nonNilElementsDo:aBlock
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   744
    ]
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   745
!
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   746
1153
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   747
allTopViewsDo:aBlock
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   748
    "evaluate aBlock for all topviews in this group.
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   749
     This works on a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   750
     destroy and other collection changing operations to be performed in the loop."
1153
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   751
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   752
    topViews notNil ifTrue:[
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   753
	topViews copy nonNilElementsDo:aBlock
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   754
    ]
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   755
!
9a10a934c137 commentary
Claus Gittinger <cg@exept.de>
parents: 1117
diff changeset
   756
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   757
allTopViewsExcept:aView do:aBlock
157
claus
parents: 152
diff changeset
   758
    "evaluate aBlock for all topviews except aView in this group.
claus
parents: 152
diff changeset
   759
     This works on a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   760
     destroy and other collection changing operations to be performed in the loop."
157
claus
parents: 152
diff changeset
   761
claus
parents: 152
diff changeset
   762
    topViews notNil ifTrue:[
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   763
	topViews copy nonNilElementsDo:[:v |
157
claus
parents: 152
diff changeset
   764
	    v ~~ aView ifTrue:[aBlock value:v]
claus
parents: 152
diff changeset
   765
	]
claus
parents: 152
diff changeset
   766
    ].
claus
parents: 152
diff changeset
   767
!
claus
parents: 152
diff changeset
   768
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   769
allViewsDo:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   770
    "evaluate aBlock for all views & topviews in this group.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   771
     This works on a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   772
     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
   773
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   774
    self allTopViewsDo:aBlock.
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   775
    self allNonTopViewsDo:aBlock.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   776
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   777
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   778
partnersDo:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   779
    "evaluate aBlock for all partnerViews.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   780
     This works on a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   781
     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
   782
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   783
    topViews notNil ifTrue:[
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   784
	topViews copy nonNilElementsDo:[:v |
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   785
	    (v type == #partner) ifTrue:[aBlock value:v].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   786
	]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   787
    ].
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   788
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   789
157
claus
parents: 152
diff changeset
   790
slavesDo:aBlock
claus
parents: 152
diff changeset
   791
    "evaluate aBlock for all slaveViews.
claus
parents: 152
diff changeset
   792
     This works on a copy of the view collection, to allow for
1240
1dc8c6d791fd comment
Claus Gittinger <cg@exept.de>
parents: 1186
diff changeset
   793
     destroy and other collection changing operations to be performed in the loop."
54
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   794
29a6b2f8e042 *** empty log message ***
claus
parents: 48
diff changeset
   795
    topViews notNil ifTrue:[
1117
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   796
	topViews copy nonNilElementsDo:[:v |
a4eb82737146 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1116
diff changeset
   797
	    (v type == #slave) ifTrue:[aBlock value:v].
157
claus
parents: 152
diff changeset
   798
	]
claus
parents: 152
diff changeset
   799
    ].
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   800
! !
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   801
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   802
!WindowGroup methodsFor:'event debugging'!
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   803
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   804
traceEvents:trueOrFalse
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   805
    |hook|
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   806
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   807
    trueOrFalse ifFalse:[
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   808
        "/
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   809
        "/ remove any eventHook on the receiver
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   810
        "/
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   811
        self preEventHook:nil.
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
   812
        "/ Transcript showCR:'removed eventHook'.
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   813
    ] ifTrue:[
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   814
        "/
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   815
        "/ set an eventHook on its windowGroup
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   816
        "/
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   817
        hook := Plug new.
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   818
        hook respondTo:#processEvent:
698
3be775ccac3c printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   819
                  with:[:ev | ev displayString printCR. false].
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   820
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   821
        self preEventHook:hook.
697
cba925eed3da showCr: -> showCR:
Claus Gittinger <cg@exept.de>
parents: 651
diff changeset
   822
        "/ Transcript showCR:'set eventHook for tracing'.
605
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   823
    ]
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   824
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   825
    "Created: 24.4.1996 / 10:25:21 / cg"
698
3be775ccac3c printNL -> printCR
Claus Gittinger <cg@exept.de>
parents: 697
diff changeset
   826
    "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
   827
! !
20f960026796 convenient interface for eventTracing ; comments & docu
Claus Gittinger <cg@exept.de>
parents: 598
diff changeset
   828
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
   829
!WindowGroup methodsFor:'event handling'!
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   830
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   831
eventLoop
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   832
    "loop executed by windowGroup process;
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   833
     wait-for and process events forever"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   834
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   835
   self eventLoopWhile:[true] onLeave:[]
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   836
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   837
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   838
eventLoopWhile:aBlock onLeave:cleanupActions
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   839
    "wait-for and process events.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   840
     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
   841
     and aBlock evaluates to true.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   842
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   843
     Some signals are cought & handled: 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   844
        LeaveSignal forces an exit from the eventLoop;
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   845
        AbortSignal brings us back into the loop, processing the next event;
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   846
        ActivityNotifications send a #showActivity: if nonModal, 
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   847
        otherwise they are ignored."
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   848
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   849
    |thisProcess sigs|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   850
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   851
    thisProcess := Processor activeProcess.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   852
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   853
    sigs := SignalSet 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   854
                with:AbortSignal 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   855
                with:LeaveSignal 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   856
                with:ActivityNotificationSignal.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   857
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   858
    [
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   859
        |p g mainGroup mySema waitSema|
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   860
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   861
        waitSema := mySema := mySensor eventSemaphore.
325
b24d9a1c74dc stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   862
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   863
        isModal ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   864
            mainGroup := self mainGroup.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   865
            mainGroup == self ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   866
                mainGroup := nil
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   867
            ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   868
            mainGroup notNil ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   869
                waitSema := SemaphoreSet with:mySema 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   870
                                         with:(mainGroup sensor eventSemaphore).
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   871
            ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   872
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   873
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   874
        [aBlock value] whileTrue:[ 
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   875
            LastActiveGroup := self.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   876
            LastActiveProcess := thisProcess.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   877
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   878
            (views isNil and:[topViews isNil]) ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   879
                myProcess notNil ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   880
                    p := myProcess.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   881
                    myProcess := nil.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   882
                    p terminate.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   883
                    "not reached - there is no life after death"
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   884
                ].
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   885
                "
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   886
                 this is the end of a modal loop
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   887
                 (not having a private process ...)
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   888
                "
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   889
                ^ self
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   890
            ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   891
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   892
            "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   893
            "/ on abort, stay in the event loop
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   894
            "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   895
            sigs handle:[:ex |
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   896
                |theSig|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   897
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   898
                (theSig := ex signal) == AbortSignal ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   899
                    "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   900
                    "/ on abort, stay in loop
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   901
                    "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   902
                    ex return
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   903
                ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   904
                theSig == LeaveSignal ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   905
                    "/
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   906
                    "/ on leave, exit the event loop
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   907
                    "/
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   908
                    ^ self
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   909
                ].
323
619085d52522 be careful - device may be nil
Claus Gittinger <cg@exept.de>
parents: 319
diff changeset
   910
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   911
                "/ ActivityNotification
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   912
                "/
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   913
                "/ if I am a modal-group, let it be handled
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   914
                "/ by the outer main-groups handler
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   915
                "/ otherwise show the activityMessage and continue.
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   916
                "/
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   917
                isModal ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   918
                    ex reject
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   919
                    "never reached"
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   920
                ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   921
                self showActivity:(ex errorString).
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   922
                ex proceed.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   923
            ] do:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   924
                |dev gotSema mainView|
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   925
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   926
                "/ no more events. Flush device output. This may produce more events.
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
   927
                dev := self graphicsDevice.
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   928
                dev notNil ifTrue:[dev flush].
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
   929
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   930
                thisProcess setStateTo:#eventWait if:#active.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   931
                gotSema := waitSema wait.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   932
                LastActiveGroup := self.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   933
                LastActiveProcess := thisProcess.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   934
                gotSema == mySema ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   935
                    self processEvents
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   936
                ] ifFalse:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   937
                    mainGroup topViews notNil ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   938
                        mainView := mainGroup topViews first
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   939
                    ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   940
                    mainView notNil ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   941
                        (mainGroup sensor hasConfigureEventFor:mainView) ifTrue:[
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   942
                             topViews first raiseDeiconified
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   943
                        ]
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   944
                    ].
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   945
                    "
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   946
                     if modal, also check for redraw events in my maingroup
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   947
                     (we arrive here after we woke up on maingroup sensor eventSemaphore)
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   948
                    "
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   949
                    mainGroup processExposeEvents.
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   950
                ]
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   951
            ].
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   952
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   953
    ] valueNowOrOnUnwindDo:[
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
   954
        cleanupActions notNil ifTrue:[cleanupActions value]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   955
    ]
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
   956
325
b24d9a1c74dc stefans modalBox changes (no more polling)
Claus Gittinger <cg@exept.de>
parents: 324
diff changeset
   957
    "Modified: 14.12.1995 / 11:12:24 / stefan"
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
   958
    "Modified: 12.1.1997 / 00:18:57 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   959
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   960
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   961
leaveEventLoop
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   962
    "immediately leave the event loop, returning way back.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   963
     This can be used to leave (and closedown) a modal group.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   964
     (for normal views, this does not make sense)"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   965
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   966
    ^ LeaveSignal raise
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   967
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
   968
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   969
processEvents
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   970
    "process events from either the damage- or user input queues.
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
   971
     Abort is assumed to be handled elsewhere."
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
   972
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
   973
    <resource: #keyboard (#Escape )>
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   974
388
64e43f82d93e Escape leaves modalBoxes or PopUpViews
Claus Gittinger <cg@exept.de>
parents: 387
diff changeset
   975
    |event ignore key|
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
   976
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   977
    self processExposeEvents.
180
claus
parents: 172
diff changeset
   978
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
   979
    [mySensor hasEvents] whileTrue:[
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   980
        event := mySensor nextEvent.
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   981
        event notNil ifTrue:[
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
   982
            (views notNil or:[topViews notNil]) ifTrue:[
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   983
                LastEventQuerySignal handle:[:ex |
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   984
                    ex proceedWith:event
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   985
                ] do:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   986
                    ignore := false.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   987
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   988
                    (preEventHook  notNil 
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   989
                    and:[preEventHook processEvent:event]) ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   990
                        ignore := true.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   991
                    ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   992
                    ignore ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   993
                        event isKeyPressEvent ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   994
                            key := event key.
172
claus
parents: 162
diff changeset
   995
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   996
                            key == #Escape ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   997
                                isModal ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   998
                                    topViews first hideRequest
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
   999
                                ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1000
                            ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1001
                        ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1002
                        event isPointerEnterEvent ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1003
                            pointerView := event view
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1004
                        ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1005
                        event isPointerLeaveEvent ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1006
                            pointerView := nil
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1007
                        ].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1008
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1009
                        ignore ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1010
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1011
                            "/  button events turn off explicit focus, and revert
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1012
                            "/  to implicit focus control
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1013
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1014
                            (focusView notNil
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1015
                            and:[event isButtonEvent]) ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1016
                                self focusView:nil
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1017
                            ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1018
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1019
                            "/ let the event forward itself
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1020
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1021
                            LastActiveGroup := self.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1022
                            LastActiveProcess := Processor activeProcess.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1023
                            event sendEventWithFocusOn:focusView.
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  1024
                        ]
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  1025
                    ].
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1026
                    postEventHook notNil ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1027
                        postEventHook processEvent:event
496
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  1028
                    ]
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  1029
                ]
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  1030
            ]
71ecf6bfdff2 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 429
diff changeset
  1031
        ].
72
3e84121988c3 *** empty log message ***
claus
parents: 65
diff changeset
  1032
    ]
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
  1033
513
47b0f4bf4d89 use a single handler for handled signals
Claus Gittinger <cg@exept.de>
parents: 512
diff changeset
  1034
    "Modified: 7.3.1996 / 17:46:27 / cg"
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1035
!
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1036
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1037
processExposeEvents
103
6156d12a414d *** empty log message ***
claus
parents: 90
diff changeset
  1038
    "process only expose events from the damage queue"
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1039
180
claus
parents: 172
diff changeset
  1040
    |event view rect x y w h sensor thisProcess|
109
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
  1041
ba47d9d6bda8 *** empty log message ***
claus
parents: 107
diff changeset
  1042
    (sensor := mySensor) isNil ifTrue:[^ self].
48
9e584329a6da last version with separate queue
claus
parents: 46
diff changeset
  1043
180
claus
parents: 172
diff changeset
  1044
    thisProcess := Processor activeProcess.
claus
parents: 172
diff changeset
  1045
claus
parents: 172
diff changeset
  1046
    [sensor hasDamage] whileTrue:[
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1047
        LastActiveGroup := self.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1048
        LastActiveProcess := thisProcess.
180
claus
parents: 172
diff changeset
  1049
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1050
        event := sensor nextDamage.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1051
        event notNil ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1052
            (views notNil or:[topViews notNil]) ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1053
                LastEventQuerySignal handle:[:ex |
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1054
                    ex proceedWith:event
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1055
                ] do:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1056
                    (preEventHook notNil 
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1057
                    and:[preEventHook processEvent:event]) ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1058
                        event isDamage ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1059
                            view := event view.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1060
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1061
                            "/ if the view is no longer shown (iconified or closed),
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1062
                            "/ this is a leftover event and ignored.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1063
                            "/
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1064
                            view shown ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1065
                                rect := event rectangle.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1066
                                x := rect left.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1067
                                y := rect top.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1068
                                w := rect width.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1069
                                h := rect height.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1070
                                LastActiveGroup := self.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1071
                                LastActiveProcess := thisProcess.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1072
                                view transformation notNil ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1073
                                    view deviceExposeX:x y:y width:w height:h
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1074
                                ] ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1075
                                    view exposeX:x y:y width:w height:h
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1076
                                ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1077
                            ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1078
                        ] ifFalse:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1079
                            "
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1080
                             mhmh - could we possibly arrive here ?
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1081
                            "
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1082
                            LastActiveGroup := self.
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1083
                            LastActiveProcess := thisProcess.
1157
ffcb958058ad checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1084
                            event sendEventWithFocusOn:nil.
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1085
                        ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1086
                    ].
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1087
                    postEventHook notNil ifTrue:[
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1088
                        postEventHook processEvent:event
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1089
                    ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1090
                ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1091
            ]
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1092
        ]
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1093
    ]
1157
ffcb958058ad checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1094
ffcb958058ad checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1153
diff changeset
  1095
    "Modified: 8.1.1997 / 11:16:55 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1096
!
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1097
28
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1098
waitForExposeFor:aView
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1099
    "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
  1100
     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
  1101
     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
  1102
     (i.e. a synthetic noExpose may be generated there)."
28
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1103
3879ff2138f1 *** empty log message ***
claus
parents: 26
diff changeset
  1104
    mySensor waitForExposeFor:aView.
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1105
    AbortSignal catch:[
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1106
        self processExposeEvents
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1107
    ]
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1108
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1109
    "Modified: 6.3.1996 / 15:58:36 / cg"
11
bc3949e465a0 Initial revision
claus
parents:
diff changeset
  1110
! !
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1111
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1112
!WindowGroup methodsFor:'focus control'!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1113
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1114
focusNext
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1115
    "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
  1116
     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
  1117
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1118
    |index index0 last next|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1119
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1120
    focusSequence := self focusSequence.
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1121
    (last := focusSequence size) == 0 ifTrue:[^ self].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1122
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1123
    focusView notNil ifTrue:[
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1124
        index := index0 := (focusSequence identityIndexOf:focusView).
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1125
    ] ifFalse:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1126
        index := 0.
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1127
    ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1128
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1129
    [next isNil] whileTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1130
        index := index + 1.
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1131
        index > last ifTrue:[
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1132
            index := 1.
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1133
            index0 isNil ifTrue:[^ self].
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1134
        ].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1135
        index == index0 ifTrue:[^ self].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1136
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1137
        next := (focusSequence at:index).
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1138
        next realized not ifTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1139
            next := nil
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1140
        ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1141
    ].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1142
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1143
    self focusView:next
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1144
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1145
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1146
     |top v1 v2|
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1147
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1148
     top := StandardSystemView new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1149
     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
  1150
     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
  1151
     top open.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1152
     top windowGroup focusSequence:(Array with:v1 with:v2).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1153
     top windowGroup focusOn:v1.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1154
     (Delay forSeconds:10) wait.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1155
     top windowGroup focusNext.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1156
    "
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1157
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1158
    "Modified: 17.7.1996 / 12:27:30 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1159
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1160
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1161
focusPrevious
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1162
    "give focus to previous view in focusSequence"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1163
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1164
    |index prev index0|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1165
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1166
    focusSequence := self focusSequence.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1167
    focusSequence 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
  1168
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1169
    focusView notNil ifTrue:[
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1170
        index := index0 := (focusSequence identityIndexOf:focusView).
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1171
    ] ifFalse:[
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1172
        index := focusSequence size + 1.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1173
    ].
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1174
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1175
    [prev isNil] whileTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1176
        index := index - 1.
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1177
        index < 1 ifTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1178
            index := focusSequence size.
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1179
            index0 isNil ifTrue:[^ self].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1180
        ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1181
        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
  1182
949
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1183
        prev := (focusSequence at:index).
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1184
        prev realized not ifTrue:[
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1185
            prev := nil
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1186
        ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1187
    ].
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1188
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1189
    self focusView:prev
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1190
3894d442e895 care for invisible views when stepping the focus
Claus Gittinger <cg@exept.de>
parents: 931
diff changeset
  1191
    "Modified: 17.7.1996 / 12:42:10 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1192
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1193
135
claus
parents: 121
diff changeset
  1194
focusSequence
500
a313e9fda9f0 ask topView for focusSequence; focusKey handling now done in TopView/Controller
Claus Gittinger <cg@exept.de>
parents: 496
diff changeset
  1195
    "return my focus sequence for focusNext/focusPrevious.
135
claus
parents: 121
diff changeset
  1196
     Focus is stepped in the order in which subviews occur in
claus
parents: 121
diff changeset
  1197
     the sequence"
claus
parents: 121
diff changeset
  1198
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1199
    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
  1200
507
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1201
    topViews do:[:top |
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1202
        focusSequence := top focusSequence.
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1203
        focusSequence notNil ifTrue:[^ focusSequence].
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1204
    ].
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1205
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1206
    ^ nil
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1207
5098d8e9be3c oops - when asking for focusSequence, take first nonNil collection from any topView
Claus Gittinger <cg@exept.de>
parents: 500
diff changeset
  1208
    "Modified: 6.3.1996 / 17:50:01 / cg"
135
claus
parents: 121
diff changeset
  1209
!
claus
parents: 121
diff changeset
  1210
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1211
focusSequence:aSequenceableCollection
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1212
    "define the focus sequence for focusNext/focusPrevious.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1213
     Focus is stepped in the order in which subviews occur in
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1214
     the sequence"
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1215
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1216
    focusSequence := aSequenceableCollection
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1217
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1218
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1219
focusView
135
claus
parents: 121
diff changeset
  1220
    "return the view which currently has the focus"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1221
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1222
    ^ focusView
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1223
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1224
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1225
focusView:aViewOrNil
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1226
    "give focus to aViewOrNil"
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1227
410
9d9d03fa5d82 moved Tab handling to topView (which sends #focusNext if no subview handled it)
Claus Gittinger <cg@exept.de>
parents: 408
diff changeset
  1228
    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
  1229
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1230
    focusView notNil ifTrue:[
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1231
        "/ lost explicit focus
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1232
        focusView == aViewOrNil ifTrue:[^ self].
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1233
        focusView showNoFocus:true.
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
  1234
    ] ifFalse:[
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1235
        pointerView notNil ifTrue:[
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1236
            pointerView ~~ aViewOrNil ifTrue:[
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1237
                "/ lost implicit focus
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1238
                pointerView showNoFocus:false
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1239
            ]
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1240
        ].
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1241
    ].
387
aa80487842b8 compile event classes with optSpace;
Claus Gittinger <cg@exept.de>
parents: 385
diff changeset
  1242
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1243
    focusView := aViewOrNil.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1244
    focusView notNil ifTrue:[
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1245
        "/ got explicit focus
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1246
        focusView showFocus:true.
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1247
    ].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1248
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1249
    "
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1250
     |top v1 v2|
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1251
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1252
     top := StandardSystemView new.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1253
     v1 := EditTextView origin:0.0@0.0 corner:1.0@0.5 in:top.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1254
     v2 := EditTextView origin:0.0@0.5 corner:1.0@1.0 in:top.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1255
     top open.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1256
     top windowGroup focusView:v1.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1257
    "
357
3655807445b7 keep track of pointerView, for implizit focus tracking
Claus Gittinger <cg@exept.de>
parents: 330
diff changeset
  1258
777
4d0b66f65346 search in focusSequence for identical view - who knows
Claus Gittinger <cg@exept.de>
parents: 743
diff changeset
  1259
    "Modified: 31.5.1996 / 21:13:25 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1260
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1261
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1262
!WindowGroup methodsFor:'initialization'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1263
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1264
initialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1265
    "setup the windowgroup, by creating a new sensor
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1266
     and an event semaphore"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1267
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1268
    mySensor := WindowSensor new.
1273
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1269
    mySensor eventSemaphore:(Semaphore new name:'WGroup eventSema').
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1270
    isModal := false.
417
940ebb195fc6 added isModalForSubView flag
Claus Gittinger <cg@exept.de>
parents: 410
diff changeset
  1271
    isForModalSubview := false.
1273
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1272
158d030a5553 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1270
diff changeset
  1273
    "Modified: 25.1.1997 / 00:20:19 / cg"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1274
!
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1275
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1276
reinitialize
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1277
    "reinitialize the windowgroup after an image restart"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1278
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1279
    "throw away old (zombie) process"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1280
    myProcess notNil ifTrue:[
1186
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1281
        "/ careful: the old processes exit-actions must be cleared.
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1282
        "/ otherwise, it might do destroy or other actions when it
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1283
        "/ gets finalized ...
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1284
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1285
"/        myProcess removeAllExitActions.
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1286
        myProcess removeAllSuspendActions.
e1fbbabcd682 no longer use exitBlocks - a termination-unwind handler will
Claus Gittinger <cg@exept.de>
parents: 1157
diff changeset
  1287
        myProcess := nil.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1288
    ].
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1289
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1290
    "throw away old events"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1291
    mySensor reinitialize
313
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1292
2b776b2a26c5 stefans changes
Claus Gittinger <cg@exept.de>
parents: 302
diff changeset
  1293
    "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
  1294
    "Modified: 12.1.1997 / 00:45:01 / cg"
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1295
! !
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1296
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1297
!WindowGroup methodsFor:'printing'!
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1298
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1299
printOn:aStream
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1300
    "return a printed representation;
144
claus
parents: 141
diff changeset
  1301
     just for more user friendlyness: add name of process."
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1302
90
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1303
    myProcess isNil ifTrue:[
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1304
	(previousGroup notNil and:[previousGroup process notNil]) ifTrue:[
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1305
	    aStream nextPutAll:('WindowGroup(modal in ' , previousGroup process nameOrId , ')').
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1306
	    ^ self.
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1307
	].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1308
	^ super printOn:aStream
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1309
    ].
b1f1d7fc96eb *** empty log message ***
claus
parents: 86
diff changeset
  1310
    aStream nextPutAll:('WindowGroup(' , myProcess nameOrId , ')')
19
74683e998f36 *** empty log message ***
claus
parents: 17
diff changeset
  1311
! !
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1312
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1313
!WindowGroup methodsFor:'special'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1314
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1315
restoreCursors
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1316
    "restore the original cursors in all of my views"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1317
330
13a3fa93330c careful - view could have been destroyed in the meanwhile (in restoreCursors)
Claus Gittinger <cg@exept.de>
parents: 329
diff changeset
  1318
    self allViewsDo:[:aView |  
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1319
        |c dev id cid|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1320
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1321
        dev := aView graphicsDevice.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1322
        dev notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1323
            (id := aView id) notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1324
                c := aView cursor on:dev.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1325
                (cid := c id) notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1326
                    dev setCursor:cid in:id.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1327
                ]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1328
            ]
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1329
        ]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1330
    ].
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1331
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1332
    "Modified: 28.5.1996 / 20:27:14 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1333
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1334
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1335
showActivity:someMessage
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1336
    "some activityNotification shalt be communicated to
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1337
     the user; 
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1338
     forward it to my first topView if there is one
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1339
     (that one should know how to deal with it)"
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1340
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1341
    topViews notNil ifTrue:[
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1342
        topViews first showActivity:someMessage
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1343
    ]
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1344
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1345
    "Created: 16.12.1995 / 18:39:40 / cg"
597
958e2673ca11 commentary
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
  1346
    "Modified: 23.4.1996 / 21:36:54 / cg"
328
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1347
!
7bbe05da5769 activity notification added
Claus Gittinger <cg@exept.de>
parents: 325
diff changeset
  1348
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1349
showCursor:aCursor
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1350
    "change the cursor to aCursor in all of my views."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1351
406
aaf6b6b1e787 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 403
diff changeset
  1352
    |c id dev|
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1353
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1354
    c := aCursor.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1355
    self allViewsDo:[:aView |  
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1356
        c := c on:(dev := aView graphicsDevice).
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1357
        (id := c id) notNil ifTrue:[
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1358
            dev setCursor:id in:aView id.
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1359
        ]
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1360
    ].
743
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1361
64c9b71b3cc4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 698
diff changeset
  1362
    "Modified: 28.5.1996 / 20:27:17 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1363
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1364
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1365
withCursor:aCursor do:aBlock
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1366
    "evaluate aBlock while showing aCursor in all
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1367
     my views (used to show wait-cursor while doing something).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1368
     Return the result as returned by aBlock."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1369
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1370
    |oldCursors dev|
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1371
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1372
    dev := self graphicsDevice.   
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1373
    dev isNil ifTrue:[
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1374
        ^ aBlock value
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1375
    ].
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1376
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1377
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1378
     get mapping of view->cursor for all of my subviews
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1379
    "
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1380
    oldCursors := IdentityDictionary new.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1381
    self allViewsDo:[:aView |
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1382
        oldCursors at:aView put:(aView cursor).
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1383
        aView cursor:aCursor now:false
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1384
    ].
329
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1385
    "/
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1386
    "/ here sync looks better; flush leads to almost invisible cursors when accepting.
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1387
    "/ I dont really know why (maybe unix does not context-switch to the Xserver
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1388
    "/ early enough after the requests have been sent ?)
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1389
    "/
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1390
"/    dev flush. 
8a34deadc4ff sync (not flush) after a cursor change
Claus Gittinger <cg@exept.de>
parents: 328
diff changeset
  1391
    dev sync.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1392
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1393
    ^ aBlock valueNowOrOnUnwindDo:[
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1394
        "
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1395
         restore cursors from the mapping
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1396
        "
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1397
        oldCursors keysAndValuesDo:[:view :cursor |
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1398
            view cursor:cursor now:false.
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1399
        ].
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1400
        dev flush "/ sync.
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1401
    ]
317
7a1271ecb987 use new #cursor:now: if many cursors are switched
Claus Gittinger <cg@exept.de>
parents: 313
diff changeset
  1402
926
1b8422921e4d use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents: 777
diff changeset
  1403
    "Modified: 5.7.1996 / 17:54:16 / cg"
408
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1404
!
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1405
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1406
withWaitCursorDo:aBlock
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1407
    "evaluate aBlock while showing a waitCursor in all
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1408
     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
  1409
     Return the result as returned by aBlock."
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1410
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1411
    ^ self withCursor:(Cursor wait) do:aBlock
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1412
bd946e47bc07 added #withCursor:do:
Claus Gittinger <cg@exept.de>
parents: 407
diff changeset
  1413
    "Created: 6.2.1996 / 19:51:53 / cg"
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1414
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1415
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1416
!WindowGroup methodsFor:'special accessing'!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1417
429
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1418
isForModalSubview 
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1419
    "special for windowgroups for modal subviews.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1420
     These must be flagged specially to avoid the views being reassigned
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1421
     to the maingroup.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1422
     This is a private interface to the SimpleView class"
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1423
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1424
    ^ isForModalSubview
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1425
!
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1426
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1427
isForModalSubview:aBoolean
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1428
    "special for windowgroups for modal subviews.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1429
     These must be flagged specially to avoid the views being reassigned
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1430
     to the maingroup.
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1431
     This is a private interface to the SimpleView class"
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1432
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1433
    isForModalSubview := aBoolean
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1434
!
0d3bebf239ab autoRaise modalBox when mainView is moved/resized
werner
parents: 417
diff changeset
  1435
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1436
setModal:aBoolean
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1437
    "special entry for debugger: set the modal flag.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1438
     Not for public use"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1439
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1440
    isModal := aBoolean
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1441
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1442
    "Modified: 3.9.1995 / 14:51:04 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1443
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1444
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1445
setPreviousGroup:aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1446
    "special entry for debugger:
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1447
     set the windowgroup that started this group (for modal groups only).
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1448
     This is not a public interface."
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
    previousGroup := aGroup
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1451
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1452
    "Modified: 3.9.1995 / 14:55:40 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1453
!
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1454
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1455
setProcess:aProcess 
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1456
    "special entry for debugger: set the windowGroups process.
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1457
     Not for public use."
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1458
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1459
    myProcess := aProcess
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1460
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1461
    "Modified: 3.9.1995 / 14:25:38 / claus"
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1462
! !
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1463
1110
3ffcd22497fd last event query signal
ca
parents: 956
diff changeset
  1464
!WindowGroup class methodsFor:'documentation'!
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1465
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1466
version
1298
d070db2e4530 always handle a windowGroupQuery - use that first when being asked for a group
Claus Gittinger <cg@exept.de>
parents: 1273
diff changeset
  1467
    ^ '$Header: /cvs/stx/stx/libview/WindowGroup.st,v 1.100 1997-01-29 18:46:57 cg Exp $'
251
915de9a65169 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 244
diff changeset
  1468
! !
244
83218faf792c checkin from browser
Claus Gittinger <cg@exept.de>
parents: 221
diff changeset
  1469
WindowGroup initialize!