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