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