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