Controller.st
author Claus Gittinger <cg@exept.de>
Thu, 25 Apr 1996 18:35:00 +0200
changeset 612 8758d0c9933e
parent 509 3e4d2800717a
child 681 bf6770d3d032
permissions -rw-r--r--
documentation
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     1
"
48194c26a46c Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1992 by Claus Gittinger
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
     3
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
     4
48194c26a46c Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
48194c26a46c Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
48194c26a46c Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
48194c26a46c Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
48194c26a46c Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
48194c26a46c Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
48194c26a46c Initial revision
claus
parents:
diff changeset
    11
"
48194c26a46c Initial revision
claus
parents:
diff changeset
    12
48194c26a46c Initial revision
claus
parents:
diff changeset
    13
Object subclass:#Controller
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    14
	instanceVariableNames:'model view sensor'
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    15
	classVariableNames:''
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    16
	poolDictionaries:''
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    17
	category:'Interface-Support-Controllers'
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    18
!
48194c26a46c Initial revision
claus
parents:
diff changeset
    19
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    20
!Controller class methodsFor:'documentation'!
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    21
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    22
copyright
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    23
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    24
 COPYRIGHT (c) 1992 by Claus Gittinger
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
    25
	      All Rights Reserved
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    26
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    27
 This software is furnished under a license and may be used
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    28
 only in accordance with the terms of that license and with the
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    30
 be provided or otherwise made available to, or used by, any
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    31
 other person.  No title to or ownership of the software is
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    32
 hereby transferred.
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    33
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    34
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    35
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    36
documentation
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    37
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    38
    Controllers can be used to controll the user-interactions
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    39
    to a model which is shown in a view. 
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    40
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    41
    For very simple views (and due to the evolution of Smalltalk/X),
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    42
    many view-classes have the controller function integrated.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    43
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
    44
    To allow both controller and non-controller operation, events are
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    45
    sent directly to the view, if the view has no controller
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    46
    (i.e. if its controller instance variable is nil). 
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    47
    Otherwise, the controller gets the event message.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    48
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    49
    For now (vsn 2.10.4) there are only a few view classes using controllers;
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    50
    however, over time, more will be converted, since separating the controller
127
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
    51
    offers much more flexibility 
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
    52
    (although view initialization becomes a bit more complex).
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    53
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    54
    Over time, expect the buttonPress/Release/Motion and keyPress/Release
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    55
    methods to vanish from the view classes and corresponding controllers to
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    56
    be appearing.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    57
    This migration should be backward compatible.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    58
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    59
    [Instance variables:]
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    60
        view        <View>               the view I control
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    61
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    62
        model       <Model>              the model which is to be worked on
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    63
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    64
    [author:]
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    65
        Claus Gittinger
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    66
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    67
    [see also:]
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    68
        View Model WindowGroup
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    69
        WindowEvent DeviceWorkstation
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    70
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    71
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    72
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    73
!Controller class methodsFor:'instance creation'!
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    74
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    75
new
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    76
    ^ self basicNew initialize
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    77
! !
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    78
99
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    79
!Controller methodsFor:'ST-80 compatibility'!
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    80
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    81
controlInitialize
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    82
    ^ self
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    83
!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    84
99
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    85
open
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    86
    "open my view"
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    87
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    88
    view open
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    89
! !
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    90
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    91
!Controller methodsFor:'ST-80 compatibility events'!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    92
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    93
blueButtonActivity
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    94
    "actually, this should be called 'rightButtonActivity'.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    95
     But for ST-80 compatibility ...."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    96
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    97
    ^ self
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    98
!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    99
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   100
redButtonActivity
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   101
    "actually, this should be called 'leftButtonActivity'.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   102
     But for ST-80 compatibility ...."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   103
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   104
    ^ self
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   105
!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   106
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   107
yellowButtonActivity
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   108
    "actually, this should be called 'middleButtonActivity'.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   109
     But for ST-80 compatibility ...."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   110
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   111
    |menu actionSelector menuPerformer|
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   112
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   113
    "
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   114
     ST/X style static menus - going to be obsoleted ...
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   115
    "
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   116
    (menu := view middleButtonMenu) notNil ifTrue:[
472
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   117
        menu showAtPointer.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   118
        ^ self
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   119
    ].
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   120
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   121
    menu := self yellowButtonMenu.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   122
    menu notNil ifTrue:[
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   123
        menuPerformer := self menuPerformer.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   124
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   125
        "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   126
         got one, launch the menu. It is supposed
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   127
         to return an actionSelector.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   128
        "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   129
        "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   130
         a temporary kludge: subMenus dont know about 
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   131
         actionSelectors yet ...
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   132
        "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   133
        menu receiver isNil ifTrue:[
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   134
            menu receiver:menuPerformer
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   135
        ] ifFalse:[
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   136
            "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   137
             if the menu has an explicit receiver, 
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   138
             thats the one to do the work.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   139
            "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   140
            menuPerformer := menu receiver
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   141
        ].
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   142
        actionSelector := menu startUp.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   143
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   144
        (actionSelector notNil
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   145
        and:[actionSelector isSymbol]) ifTrue:[
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   146
            menuPerformer perform:actionSelector
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   147
        ].
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   148
        ^ self
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   149
    ].
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   150
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   151
    "Modified: 28.2.1996 / 17:32:42 / cg"
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   152
! !
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   153
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   154
!Controller methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   155
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   156
menuHolder 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   157
    "by default, the model has to provide the menu"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   158
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   159
    model isNil ifTrue:[^ view].
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   160
    ^ model
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   161
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   162
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   163
menuPerformer 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   164
    "by default, the model is performing menu actions"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   165
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   166
    model isNil ifTrue:[^ view].
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   167
    ^ model
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   168
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   169
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   170
model
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   171
    "return my model"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   172
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   173
    ^ model
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   174
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   175
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   176
model:aModel
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   177
    "set my model"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   178
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   179
    model notNil ifTrue:[
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   180
	model removeDependent:view
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   181
    ].
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   182
    model := aModel.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   183
"/    model notNil ifTrue:[model addDependent:view]
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   184
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   185
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   186
sensor 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   187
    "return my views sensor"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   188
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   189
    ^ view sensor
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   190
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   191
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   192
view
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   193
    "return my view"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   194
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   195
    ^ view
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   196
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   197
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   198
view:aView
48194c26a46c Initial revision
claus
parents:
diff changeset
   199
    "set my view"
48194c26a46c Initial revision
claus
parents:
diff changeset
   200
48194c26a46c Initial revision
claus
parents:
diff changeset
   201
    view notNil ifTrue:[
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   202
	model notNil ifTrue:[
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   203
	    model removeDependent:view
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   204
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   205
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   206
    view := aView.
48194c26a46c Initial revision
claus
parents:
diff changeset
   207
    model notNil ifTrue:[
127
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
   208
"/        model addDependent:view
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
   209
	view notNil ifTrue:[
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
   210
	    view model:model
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
   211
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   212
    ].
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   213
! !
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   214
86
032006651226 *** empty log message ***
claus
parents: 80
diff changeset
   215
!Controller methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   216
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   217
buttonMotion:buttonMask x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   218
    "mouse was moved with button pressed in my view; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   219
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   220
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   221
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   222
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   223
buttonMultiPress:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   224
    "a mouse button was pressed again shortly after in my view"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   225
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   226
    ^ self buttonPress:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   227
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   228
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   229
buttonPress:button x:x y:y
92
7edb04821bef added redefinable startUp method
claus
parents: 89
diff changeset
   230
    "a mouse button was pressed in my view.
7edb04821bef added redefinable startUp method
claus
parents: 89
diff changeset
   231
     Translate buttonPress events into similar ST-80 type
7edb04821bef added redefinable startUp method
claus
parents: 89
diff changeset
   232
     event messages. This method and/or these ST-80 methods
7edb04821bef added redefinable startUp method
claus
parents: 89
diff changeset
   233
     can be redefined in subclasses"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   234
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   235
    ((button == 1) or:[button == #select]) ifTrue:[
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   236
	self redButtonActivity
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   237
    ].
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   238
    ((button == 2) or:[button == #menu]) ifTrue:[
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   239
	self yellowButtonActivity
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   240
    ].
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   241
    (button == 3) ifTrue:[
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   242
	self blueButtonActivity
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   243
    ]
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   244
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   245
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   246
buttonRelease:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   247
    "a mouse button was released in my view; nothing done here"
118
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   248
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   249
    ^ self
118
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   250
!
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   251
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   252
buttonShiftPress:button x:x y:y
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   253
    "a mouse button was pressed again shortly after in my view"
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   254
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   255
    ^ self buttonPress:button x:x y:y
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   256
!
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   257
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   258
deviceButtonMotion:state x:x y:y
153
claus
parents: 141
diff changeset
   259
    "this is the low-level (untransformed) event as received
claus
parents: 141
diff changeset
   260
     from the device (i.e. coordinates are in device coordinates). 
claus
parents: 141
diff changeset
   261
     If there is a transformation, apply the inverse
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   262
     and send a buttonMotion with the logical coordinates."
153
claus
parents: 141
diff changeset
   263
claus
parents: 141
diff changeset
   264
    |lx ly trans|
claus
parents: 141
diff changeset
   265
claus
parents: 141
diff changeset
   266
    lx := x.
claus
parents: 141
diff changeset
   267
    ly := y.
claus
parents: 141
diff changeset
   268
    (trans := view transformation) notNil ifTrue:[
claus
parents: 141
diff changeset
   269
	lx := trans applyInverseToX:lx.
claus
parents: 141
diff changeset
   270
	ly := trans applyInverseToY:ly.
claus
parents: 141
diff changeset
   271
    ].
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   272
    self buttonMotion:state x:lx y:ly
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   273
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   274
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   275
deviceButtonPress:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   276
    "this is the low-level (untransformed) event as received
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   277
     from the device (i.e. coordinates are in device coordinates). 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   278
     If there is a transformation, apply the inverse
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   279
     and send a buttonPress with the logical coordinates."
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   280
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   281
    |lx ly trans|
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   282
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   283
    lx := x.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   284
    ly := y.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   285
    (trans := view transformation) notNil ifTrue:[
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   286
	lx := trans applyInverseToX:lx.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   287
	ly := trans applyInverseToY:ly.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   288
    ].
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   289
    self buttonPress:button x:lx y:ly
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   290
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   291
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   292
deviceButtonRelease:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   293
    "this is the low-level (untransformed) event as received
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   294
     from the device (i.e. coordinates are in device coordinates). 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   295
     If there is a transformation, apply the inverse
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   296
     and send a buttonRelease with the logical coordinates."
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   297
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   298
    |lx ly trans|
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   299
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   300
    lx := x.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   301
    ly := y.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   302
    (trans := view transformation) notNil ifTrue:[
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   303
	lx := trans applyInverseToX:lx.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   304
	ly := trans applyInverseToY:ly.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   305
    ].
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   306
    self buttonRelease:button x:lx y:ly
153
claus
parents: 141
diff changeset
   307
!
claus
parents: 141
diff changeset
   308
claus
parents: 141
diff changeset
   309
deviceKeyPress:key x:x y:y
claus
parents: 141
diff changeset
   310
    "this is the low-level (untransformed) event as received
claus
parents: 141
diff changeset
   311
     from the device (i.e. coordinates are in device coordinates). 
claus
parents: 141
diff changeset
   312
     If there is a transformation, apply the inverse
claus
parents: 141
diff changeset
   313
     and send a keyPress with the logical coordinates."
claus
parents: 141
diff changeset
   314
claus
parents: 141
diff changeset
   315
    |lx ly trans|
claus
parents: 141
diff changeset
   316
claus
parents: 141
diff changeset
   317
    lx := x.
claus
parents: 141
diff changeset
   318
    ly := y.
claus
parents: 141
diff changeset
   319
    (trans := view transformation) notNil ifTrue:[
claus
parents: 141
diff changeset
   320
	lx := trans applyInverseToX:lx.
claus
parents: 141
diff changeset
   321
	ly := trans applyInverseToY:ly.
claus
parents: 141
diff changeset
   322
    ].
claus
parents: 141
diff changeset
   323
    self keyPress:key x:lx y:ly
claus
parents: 141
diff changeset
   324
!
claus
parents: 141
diff changeset
   325
claus
parents: 141
diff changeset
   326
deviceKeyRelease:key x:x y:y
claus
parents: 141
diff changeset
   327
    "this is the low-level (untransformed) event as received
claus
parents: 141
diff changeset
   328
     from the device (i.e. coordinates are in device coordinates). 
claus
parents: 141
diff changeset
   329
     If there is a transformation, apply the inverse
claus
parents: 141
diff changeset
   330
     and send a keyRelease with the logical coordinates."
claus
parents: 141
diff changeset
   331
claus
parents: 141
diff changeset
   332
    |lx ly trans|
claus
parents: 141
diff changeset
   333
claus
parents: 141
diff changeset
   334
    lx := x.
claus
parents: 141
diff changeset
   335
    ly := y.
claus
parents: 141
diff changeset
   336
    (trans := view transformation) notNil ifTrue:[
claus
parents: 141
diff changeset
   337
	lx := trans applyInverseToX:lx.
claus
parents: 141
diff changeset
   338
	ly := trans applyInverseToY:ly.
claus
parents: 141
diff changeset
   339
    ].
claus
parents: 141
diff changeset
   340
    self keyRelease:key x:lx y:ly
claus
parents: 141
diff changeset
   341
!
claus
parents: 141
diff changeset
   342
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   343
devicePointerEnter:state x:x y:y
153
claus
parents: 141
diff changeset
   344
    "this is the low-level (untransformed) event as received
claus
parents: 141
diff changeset
   345
     from the device (i.e. coordinates are in device coordinates). 
claus
parents: 141
diff changeset
   346
     If there is a transformation, apply the inverse
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   347
     and send a pointerEnter with the logical coordinates."
153
claus
parents: 141
diff changeset
   348
claus
parents: 141
diff changeset
   349
    |lx ly trans|
claus
parents: 141
diff changeset
   350
claus
parents: 141
diff changeset
   351
    lx := x.
claus
parents: 141
diff changeset
   352
    ly := y.
claus
parents: 141
diff changeset
   353
    (trans := view transformation) notNil ifTrue:[
claus
parents: 141
diff changeset
   354
	lx := trans applyInverseToX:lx.
claus
parents: 141
diff changeset
   355
	ly := trans applyInverseToY:ly.
claus
parents: 141
diff changeset
   356
    ].
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   357
    self pointerEnter:state x:lx y:ly
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   358
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   359
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   360
focusIn
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   361
    "my view got the keyboard focus; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   362
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   363
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   364
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   365
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   366
focusOut
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   367
    "my view lost keyboard focus; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   368
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   369
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   370
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   371
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   372
keyPress:key x:x y:y
416
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   373
    "key was pressed in my view; nothing done here,
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   374
     except for Tab keys."
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   375
509
3e4d2800717a resources
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
   376
    <resource: #keyboard (#Tab #FocusNext #FocusPrevious)>
3e4d2800717a resources
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
   377
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   378
    |windowGroup|
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   379
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   380
    windowGroup := view windowGroup.
416
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   381
    key == #Tab ifTrue:[
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   382
        windowGroup notNil ifTrue:[
469
6a263638989c use device shiftDown - NOT sensor shiftDown
Claus Gittinger <cg@exept.de>
parents: 416
diff changeset
   383
            view device shiftDown ifTrue:[
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   384
                windowGroup focusPrevious
416
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   385
            ] ifFalse:[
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   386
                windowGroup focusNext
416
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   387
            ].
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   388
        ]
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   389
    ].
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   390
    key == #FocusNext ifTrue:[
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   391
        windowGroup notNil ifTrue:[
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   392
            windowGroup focusNext.
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   393
        ]
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   394
    ].
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   395
    key == #FocusPrevious ifTrue:[
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   396
        windowGroup notNil ifTrue:[
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   397
            windowGroup focusPrevious.
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   398
        ]
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   399
    ].
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   400
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   401
    ^ self
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   402
509
3e4d2800717a resources
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
   403
    "Modified: 7.3.1996 / 13:14:49 / cg"
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   404
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   405
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   406
keyRelease:key x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   407
    "key was released in my view; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   408
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   409
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   410
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   411
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   412
pointerEnter:state x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   413
    "mouse pointer entered my view; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   414
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   415
    ^ self
153
claus
parents: 141
diff changeset
   416
!
claus
parents: 141
diff changeset
   417
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   418
pointerLeave:state
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   419
    "mouse pointer left my view; nothing done here"
153
claus
parents: 141
diff changeset
   420
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   421
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   422
! !
153
claus
parents: 141
diff changeset
   423
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   424
!Controller methodsFor:'initialize / release'!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   425
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   426
initialize
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   427
    "initialize the controller; subclasses should redefine
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   428
     this and include a super initialize for proper initialization."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   429
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   430
    ^ self
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   431
!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   432
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   433
release
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   434
    "close down the controller; this is sent when the view is destroyed.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   435
     Can be redefined in subclasses to do some cleanup action. However,
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   436
     these redefined methods should do a super release."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   437
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   438
    view notNil ifTrue:[view controller:nil].
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   439
    view := nil.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   440
    model := nil
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   441
!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   442
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   443
startUp 
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   444
    "startup the controller; this is sent when the view realizes,
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   445
     right before it becomes visible.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   446
     Can be redefined in subclasses to do some startup action."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   447
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   448
    self controlInitialize.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   449
! !
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   450
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   451
!Controller methodsFor:'menus'!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   452
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   453
yellowButtonMenu
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   454
    "actually, this should be called 'middleButtonMenu'.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   455
     But for ST-80 compatibility ...."
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   456
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   457
    |sym menuHolder m|
153
claus
parents: 141
diff changeset
   458
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   459
"/    (m := view middleButtonMenu) notNil ifTrue:[
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   460
"/        "/
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   461
"/        "/ has been assigned a static middleButtonMenu
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   462
"/        "/ (or a cached menu)
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   463
"/        "/
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   464
"/        ^ m
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   465
"/    ].
153
claus
parents: 141
diff changeset
   466
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   467
    menuHolder := self menuHolder.
153
claus
parents: 141
diff changeset
   468
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   469
    "
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   470
     try ST-80 style menus first:
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   471
     if there is a model, and a menuMessage is defined,
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   472
     ask model for the menu and launch that if non-nil.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   473
    "
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   474
    (menuHolder notNil 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   475
    and:[(sym := view menuMessage) notNil
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   476
    and:[sym isSymbol]]) ifTrue:[
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   477
	"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   478
	 ask model for the menu
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   479
	"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   480
	^ menuHolder perform:sym.
153
claus
parents: 141
diff changeset
   481
    ].
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   482
    ^ nil
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   483
! !
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   484
252
87bbc0f751d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   485
!Controller class methodsFor:'documentation'!
87bbc0f751d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   486
87bbc0f751d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   487
version
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
   488
    ^ '$Header: /cvs/stx/stx/libview/Controller.st,v 1.34 1996-04-25 16:35:00 cg Exp $'
252
87bbc0f751d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   489
! !