Controller.st
author Stefan Vogel <sv@exept.de>
Mon, 14 Oct 1996 23:26:45 +0200
changeset 1073 75fafd486819
parent 1054 b7e7ed0c35f6
child 1112 9c5c18330d61
permissions -rw-r--r--
Rename misspelled "interrest" to "interest".
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
1012
e408830caf2d no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
    20
!Controller  class methodsFor:'documentation'!
46
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
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    59
    Device coordinates vs. Logical coordinates:
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    60
        if the view has a non-identity transformation (for example: drawing
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    61
        in millimeters or inches), the application/controller may or may not
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
    62
        be interested in device coordinates in button/key events.
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    63
        Most are not, these will receive logical coordinates transparently
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    64
        in theyr button/key-Press/Release/Motion methods.
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
    65
        Those which are interested should redefine the corresponding
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    66
        device-Key/Button-Press/Release/Motion methods.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    67
        Of course, it is always possible to map between device and logical
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    68
        coordinates, using `view transformation applyTo/applyInverseTo:',
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    69
        if both coordinates are required (which is unlikely).
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    70
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    71
    [Instance variables:]
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    72
        view        <View>               the view I control
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    73
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    74
        model       <Model>              the model which is to be worked on
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    75
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
    76
612
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    77
    [author:]
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    78
        Claus Gittinger
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    79
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    80
    [see also:]
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    81
        View Model WindowGroup
8758d0c9933e documentation
Claus Gittinger <cg@exept.de>
parents: 509
diff changeset
    82
        WindowEvent DeviceWorkstation
46
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    83
"
7b331e9012fd *** empty log message ***
claus
parents: 12
diff changeset
    84
! !
0
48194c26a46c Initial revision
claus
parents:
diff changeset
    85
1012
e408830caf2d no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
    86
!Controller  class methodsFor:'instance creation'!
89
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    87
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    88
new
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    89
    ^ self basicNew initialize
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    90
! !
ea2bf46eb669 *** empty log message ***
claus
parents: 86
diff changeset
    91
99
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    92
!Controller methodsFor:'ST-80 compatibility'!
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    93
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    94
controlInitialize
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
    95
    ^ self
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
99
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    98
open
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
    99
    "open my view"
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
   100
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
   101
    view open
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
   102
! !
c40b8a508283 *** empty log message ***
claus
parents: 92
diff changeset
   103
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   104
!Controller methodsFor:'ST-80 compatibility events'!
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
blueButtonActivity
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   107
    "actually, this should be called 'rightButtonActivity'.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   108
     But for ST-80 compatibility ...."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   109
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   110
    ^ self
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   111
!
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
redButtonActivity
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   114
    "actually, this should be called 'leftButtonActivity'.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   115
     But for ST-80 compatibility ...."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   116
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   117
    ^ self
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   118
!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   119
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   120
yellowButtonActivity
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   121
    "actually, this should be called 'middleButtonActivity'.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   122
     But for ST-80 compatibility ...."
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   123
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   124
    |menu actionSelector menuPerformer|
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   125
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   126
    "
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   127
     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
   128
    "
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   129
    (menu := view middleButtonMenu) notNil ifTrue:[
472
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   130
        menu showAtPointer.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   131
        ^ self
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
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   134
    menu := self yellowButtonMenu.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   135
    menu notNil ifTrue:[
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   136
        menuPerformer := self menuPerformer.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   137
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   138
        "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   139
         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
   140
         to return an actionSelector.
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
        "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   143
         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
   144
         actionSelectors yet ...
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   145
        "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   146
        menu receiver isNil ifTrue:[
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   147
            menu receiver:menuPerformer
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   148
        ] ifFalse:[
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
             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
   151
             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
   152
            "
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   153
            menuPerformer := menu receiver
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   154
        ].
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   155
        actionSelector := menu startUp.
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   156
1037
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   157
        actionSelector notNil notNil ifTrue:[
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   158
            actionSelector isSymbol ifTrue:[
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   159
                menuPerformer perform:actionSelector
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   160
            ] ifFalse:[
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   161
                (actionSelector isArray 
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   162
                and:[actionSelector size == 2
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   163
                and:[(actionSelector at:1) isSymbol]]) ifTrue:[
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   164
                    menuPerformer 
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   165
                        perform:(actionSelector at:1) 
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   166
                        with:(actionSelector at:2)
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   167
                ]
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   168
            ]
472
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   169
        ].
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   170
        ^ self
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   171
    ].
621c17076f00 static menus override dynamic ones (is this good ?)
Claus Gittinger <cg@exept.de>
parents: 469
diff changeset
   172
1037
8bb234162a7d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1036
diff changeset
   173
    "Modified: 22.8.1996 / 09:17:16 / cg"
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   174
! !
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   175
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   176
!Controller methodsFor:'accessing'!
48194c26a46c Initial revision
claus
parents:
diff changeset
   177
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   178
menuHolder 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   179
    "by default, the model has to provide the menu"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   180
1036
e4b2a5b5b0df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1012
diff changeset
   181
    model isNil ifTrue:[
e4b2a5b5b0df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1012
diff changeset
   182
        ^ view menuHolder
e4b2a5b5b0df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1012
diff changeset
   183
    ].
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   184
    ^ model
1036
e4b2a5b5b0df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1012
diff changeset
   185
e4b2a5b5b0df checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1012
diff changeset
   186
    "Modified: 22.8.1996 / 09:11:43 / cg"
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   187
!
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
menuPerformer 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   190
    "by default, the model is performing menu actions"
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
    model isNil ifTrue:[^ view].
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   193
    ^ model
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
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   196
model
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   197
    "return my model"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   198
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   199
    ^ model
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   200
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   201
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   202
model:aModel
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   203
    "set my model"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   204
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   205
    model notNil ifTrue:[
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   206
	model removeDependent:view
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   207
    ].
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   208
    model := aModel.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   209
"/    model notNil ifTrue:[model addDependent:view]
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   210
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   211
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   212
sensor 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   213
    "return my views sensor"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   214
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   215
    ^ view sensor
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   216
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   217
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   218
view
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   219
    "return my view"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   220
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   221
    ^ view
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
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   224
view:aView
48194c26a46c Initial revision
claus
parents:
diff changeset
   225
    "set my view"
48194c26a46c Initial revision
claus
parents:
diff changeset
   226
48194c26a46c Initial revision
claus
parents:
diff changeset
   227
    view notNil ifTrue:[
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   228
	model notNil ifTrue:[
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   229
	    model removeDependent:view
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   230
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   231
    ].
48194c26a46c Initial revision
claus
parents:
diff changeset
   232
    view := aView.
48194c26a46c Initial revision
claus
parents:
diff changeset
   233
    model notNil ifTrue:[
127
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
   234
"/        model addDependent:view
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
   235
	view notNil ifTrue:[
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
   236
	    view model:model
98b0725782bd *** empty log message ***
claus
parents: 125
diff changeset
   237
	]
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   238
    ].
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   239
! !
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   240
86
032006651226 *** empty log message ***
claus
parents: 80
diff changeset
   241
!Controller methodsFor:'event handling'!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   242
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   243
buttonMotion:buttonMask x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   244
    "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
   245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   246
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   247
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   248
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   249
buttonMultiPress:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   250
    "a mouse button was pressed again shortly after in my view"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   251
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   252
    ^ self buttonPress:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   253
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   254
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   255
buttonPress:button x:x y:y
92
7edb04821bef added redefinable startUp method
claus
parents: 89
diff changeset
   256
    "a mouse button was pressed in my view.
7edb04821bef added redefinable startUp method
claus
parents: 89
diff changeset
   257
     Translate buttonPress events into similar ST-80 type
7edb04821bef added redefinable startUp method
claus
parents: 89
diff changeset
   258
     event messages. This method and/or these ST-80 methods
7edb04821bef added redefinable startUp method
claus
parents: 89
diff changeset
   259
     can be redefined in subclasses"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   260
80
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   261
    ((button == 1) or:[button == #select]) ifTrue:[
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   262
	self redButtonActivity
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   263
    ].
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   264
    ((button == 2) or:[button == #menu]) ifTrue:[
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   265
	self yellowButtonActivity
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   266
    ].
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   267
    (button == 3) ifTrue:[
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   268
	self blueButtonActivity
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   269
    ]
eb8373679a9f *** empty log message ***
claus
parents: 54
diff changeset
   270
!
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   271
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   272
buttonRelease:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   273
    "a mouse button was released in my view; nothing done here"
118
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   274
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   275
    ^ self
118
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   276
!
25e775072a89 *** empty log message ***
claus
parents: 109
diff changeset
   277
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   278
deviceButtonMotion:state x:x y:y
153
claus
parents: 141
diff changeset
   279
    "this is the low-level (untransformed) event as received
claus
parents: 141
diff changeset
   280
     from the device (i.e. coordinates are in device coordinates). 
claus
parents: 141
diff changeset
   281
     If there is a transformation, apply the inverse
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   282
     and send a buttonMotion with the logical coordinates.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   283
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   284
     Controllers which are interested in deviceCoordinates should
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   285
     redefine this method - 
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   286
     those which are interested in logical coordinates
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   287
     should redefine #buttonMotion:x:y:"
153
claus
parents: 141
diff changeset
   288
claus
parents: 141
diff changeset
   289
    |lx ly trans|
claus
parents: 141
diff changeset
   290
claus
parents: 141
diff changeset
   291
    lx := x.
claus
parents: 141
diff changeset
   292
    ly := y.
claus
parents: 141
diff changeset
   293
    (trans := view transformation) notNil ifTrue:[
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   294
        lx := trans applyInverseToX:lx.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   295
        ly := trans applyInverseToY:ly.
153
claus
parents: 141
diff changeset
   296
    ].
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   297
    self buttonMotion:state x:lx y:ly
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   298
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   299
    "Modified: 13.5.1996 / 11:24:11 / cg"
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   300
    "Modified: 14.10.1996 / 22:23:56 / stefan"
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   301
!
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   302
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   303
deviceButtonMultiPress:button x:x y:y
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   304
    "this is the low-level (untransformed) event as received
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   305
     from the device (i.e. coordinates are in device coordinates). 
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   306
     If there is a transformation, apply the inverse
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   307
     and send a buttonMultiPress with the logical coordinates.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   308
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   309
     Controllers which are interested in deviceCoordinates should
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   310
     redefine this method - 
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   311
     those which are interested in logical coordinates
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   312
     should redefine #buttonMultiPress:x:y:"
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   313
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   314
    |lx ly trans|
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   315
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   316
    lx := x.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   317
    ly := y.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   318
    (trans := view transformation) notNil ifTrue:[
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   319
        lx := trans applyInverseToX:lx.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   320
        ly := trans applyInverseToY:ly.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   321
    ].
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   322
    self buttonMultiPress:button x:lx y:ly
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   323
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   324
    "Modified: 13.5.1996 / 11:23:54 / cg"
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   325
    "Modified: 14.10.1996 / 22:24:06 / stefan"
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   326
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   327
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   328
deviceButtonPress:button x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   329
    "this is the low-level (untransformed) event as received
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   330
     from the device (i.e. coordinates are in device coordinates). 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   331
     If there is a transformation, apply the inverse
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   332
     and send a buttonPress with the logical coordinates.
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   333
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   334
     Controllers which are interested in deviceCoordinates should
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   335
     redefine this method - 
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   336
     those which are interested in logical coordinates
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   337
     should redefine #buttonPress:x:y:"
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   338
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   339
    |lx ly trans|
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   340
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   341
    lx := x.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   342
    ly := y.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   343
    (trans := view transformation) notNil ifTrue:[
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   344
        lx := trans applyInverseToX:lx.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   345
        ly := trans applyInverseToY:ly.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   346
    ].
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   347
    self buttonPress:button x:lx y:ly
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   348
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   349
    "Modified: 13.5.1996 / 11:24:23 / cg"
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   350
    "Modified: 14.10.1996 / 22:24:17 / stefan"
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   351
!
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   352
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   353
deviceButtonRelease:button x:x y:y
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   354
    "this is the low-level (untransformed) event as received
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   355
     from the device (i.e. coordinates are in device coordinates). 
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   356
     If there is a transformation, apply the inverse
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   357
     and send a buttonRelease with the logical coordinates.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   358
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   359
     Controllers which are interested in deviceCoordinates should
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   360
     redefine this method - 
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   361
     those which are interested in logical coordinates
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   362
     should redefine #buttonRelease:x:y:"
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   363
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   364
    |lx ly trans|
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   365
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   366
    lx := x.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   367
    ly := y.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   368
    (trans := view transformation) notNil ifTrue:[
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   369
        lx := trans applyInverseToX:lx.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   370
        ly := trans applyInverseToY:ly.
245
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
    self buttonRelease:button x:lx y:ly
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   373
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   374
    "Modified: 13.5.1996 / 11:24:33 / cg"
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   375
    "Modified: 14.10.1996 / 22:24:28 / stefan"
153
claus
parents: 141
diff changeset
   376
!
claus
parents: 141
diff changeset
   377
claus
parents: 141
diff changeset
   378
deviceKeyPress:key x:x y:y
claus
parents: 141
diff changeset
   379
    "this is the low-level (untransformed) event as received
claus
parents: 141
diff changeset
   380
     from the device (i.e. coordinates are in device coordinates). 
claus
parents: 141
diff changeset
   381
     If there is a transformation, apply the inverse
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   382
     and send a keyPress with the logical coordinates.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   383
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   384
     Controllers which are interested in deviceCoordinates should
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   385
     redefine this method - 
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   386
     those which are interested in logical coordinates
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   387
     should redefine #keyPress:x:y:"
153
claus
parents: 141
diff changeset
   388
claus
parents: 141
diff changeset
   389
    |lx ly trans|
claus
parents: 141
diff changeset
   390
claus
parents: 141
diff changeset
   391
    lx := x.
claus
parents: 141
diff changeset
   392
    ly := y.
claus
parents: 141
diff changeset
   393
    (trans := view transformation) notNil ifTrue:[
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   394
        lx := trans applyInverseToX:lx.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   395
        ly := trans applyInverseToY:ly.
153
claus
parents: 141
diff changeset
   396
    ].
claus
parents: 141
diff changeset
   397
    self keyPress:key x:lx y:ly
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   398
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   399
    "Modified: 13.5.1996 / 11:24:43 / cg"
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   400
    "Modified: 14.10.1996 / 22:24:36 / stefan"
153
claus
parents: 141
diff changeset
   401
!
claus
parents: 141
diff changeset
   402
claus
parents: 141
diff changeset
   403
deviceKeyRelease:key x:x y:y
claus
parents: 141
diff changeset
   404
    "this is the low-level (untransformed) event as received
claus
parents: 141
diff changeset
   405
     from the device (i.e. coordinates are in device coordinates). 
claus
parents: 141
diff changeset
   406
     If there is a transformation, apply the inverse
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   407
     and send a keyRelease with the logical coordinates.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   408
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   409
     Controllers which are interested in deviceCoordinates should
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   410
     redefine this method - 
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   411
     those which are interested in logical coordinates
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   412
     should redefine #keyRelease:x:y:"
153
claus
parents: 141
diff changeset
   413
claus
parents: 141
diff changeset
   414
    |lx ly trans|
claus
parents: 141
diff changeset
   415
claus
parents: 141
diff changeset
   416
    lx := x.
claus
parents: 141
diff changeset
   417
    ly := y.
claus
parents: 141
diff changeset
   418
    (trans := view transformation) notNil ifTrue:[
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   419
        lx := trans applyInverseToX:lx.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   420
        ly := trans applyInverseToY:ly.
153
claus
parents: 141
diff changeset
   421
    ].
claus
parents: 141
diff changeset
   422
    self keyRelease:key x:lx y:ly
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   423
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   424
    "Modified: 13.5.1996 / 11:24:51 / cg"
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   425
    "Modified: 14.10.1996 / 22:24:46 / stefan"
153
claus
parents: 141
diff changeset
   426
!
claus
parents: 141
diff changeset
   427
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   428
devicePointerEnter:state x:x y:y
153
claus
parents: 141
diff changeset
   429
    "this is the low-level (untransformed) event as received
claus
parents: 141
diff changeset
   430
     from the device (i.e. coordinates are in device coordinates). 
claus
parents: 141
diff changeset
   431
     If there is a transformation, apply the inverse
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   432
     and send a pointerEnter with the logical coordinates.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   433
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   434
     Controllers which are interested in deviceCoordinates should
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   435
     redefine this method - 
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   436
     those which are interested in logical coordinates
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   437
     should redefine #pointerEnter:x:y:"
153
claus
parents: 141
diff changeset
   438
claus
parents: 141
diff changeset
   439
    |lx ly trans|
claus
parents: 141
diff changeset
   440
claus
parents: 141
diff changeset
   441
    lx := x.
claus
parents: 141
diff changeset
   442
    ly := y.
claus
parents: 141
diff changeset
   443
    (trans := view transformation) notNil ifTrue:[
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   444
        lx := trans applyInverseToX:lx.
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   445
        ly := trans applyInverseToY:ly.
153
claus
parents: 141
diff changeset
   446
    ].
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   447
    self pointerEnter:state x:lx y:ly
681
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   448
bf6770d3d032 comments
Claus Gittinger <cg@exept.de>
parents: 612
diff changeset
   449
    "Modified: 13.5.1996 / 11:24:59 / cg"
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   450
    "Modified: 14.10.1996 / 22:24:54 / stefan"
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   451
!
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
focusIn
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   454
    "my view got the keyboard focus; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   455
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   456
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   457
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   458
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   459
focusOut
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   460
    "my view lost keyboard focus; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   461
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   462
    ^ self
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
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   465
keyPress:key x:x y:y
416
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   466
    "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
   467
     except for Tab keys."
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   468
509
3e4d2800717a resources
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
   469
    <resource: #keyboard (#Tab #FocusNext #FocusPrevious)>
3e4d2800717a resources
Claus Gittinger <cg@exept.de>
parents: 502
diff changeset
   470
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   471
    |windowGroup|
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   472
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   473
    windowGroup := view windowGroup.
416
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   474
    key == #Tab ifTrue:[
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   475
        windowGroup notNil ifTrue:[
744
db883c9b74b8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   476
            view graphicsDevice shiftDown ifTrue:[
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   477
                windowGroup focusPrevious
416
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   478
            ] ifFalse:[
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   479
                windowGroup focusNext
416
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   480
            ].
0f08407c955e use sensor shiftDown (instead of device shiftDown)
Claus Gittinger <cg@exept.de>
parents: 413
diff changeset
   481
        ]
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   482
    ].
502
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   483
    key == #FocusNext ifTrue:[
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   484
        windowGroup notNil ifTrue:[
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   485
            windowGroup focusNext.
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   486
        ]
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   487
    ].
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   488
    key == #FocusPrevious ifTrue:[
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   489
        windowGroup notNil ifTrue:[
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   490
            windowGroup focusPrevious.
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   491
        ]
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   492
    ].
0df8d2b173e4 focusKey handling now done here & in TopView
Claus Gittinger <cg@exept.de>
parents: 472
diff changeset
   493
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   494
    ^ self
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   495
744
db883c9b74b8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   496
    "Modified: 28.5.1996 / 20:21:41 / cg"
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   497
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   498
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   499
keyRelease:key x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   500
    "key was released in my view; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   501
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   502
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   503
!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   504
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   505
pointerEnter:state x:x y:y
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   506
    "mouse pointer entered my view; nothing done here"
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   507
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   508
    ^ self
153
claus
parents: 141
diff changeset
   509
!
claus
parents: 141
diff changeset
   510
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   511
pointerLeave:state
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   512
    "mouse pointer left my view; nothing done here"
153
claus
parents: 141
diff changeset
   513
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   514
    ^ self
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   515
! !
153
claus
parents: 141
diff changeset
   516
413
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   517
!Controller methodsFor:'initialize / release'!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   518
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   519
initialize
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   520
    "initialize the controller; subclasses should redefine
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   521
     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
   522
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   523
    ^ self
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   524
!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   525
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   526
release
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   527
    "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
   528
     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
   529
     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
   530
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   531
    view notNil ifTrue:[view controller:nil].
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   532
    view := nil.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   533
    model := nil
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   534
!
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   535
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   536
startUp 
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   537
    "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
   538
     right before it becomes visible.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   539
     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
   540
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   541
    self controlInitialize.
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   542
! !
2bd84440febd forward Tab to the views windowGroup (if any)
Claus Gittinger <cg@exept.de>
parents: 252
diff changeset
   543
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   544
!Controller methodsFor:'menus'!
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   545
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   546
yellowButtonMenu
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   547
    "actually, this should be called 'middleButtonMenu'.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   548
     But for ST-80 compatibility ...."
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   549
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   550
    |sym menuHolder m|
153
claus
parents: 141
diff changeset
   551
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   552
"/    (m := view middleButtonMenu) notNil ifTrue:[
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   553
"/        "/
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   554
"/        "/ has been assigned a static middleButtonMenu
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   555
"/        "/ (or a cached menu)
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   556
"/        "/
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   557
"/        ^ m
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   558
"/    ].
153
claus
parents: 141
diff changeset
   559
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   560
    menuHolder := self menuHolder.
153
claus
parents: 141
diff changeset
   561
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   562
    "
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   563
     try ST-80 style menus first:
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   564
     if there is a model, and a menuMessage is defined,
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   565
     ask model for the menu and launch that if non-nil.
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   566
    "
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   567
    (menuHolder notNil 
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   568
    and:[(sym := view menuMessage) notNil
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   569
    and:[sym isSymbol]]) ifTrue:[
1054
b7e7ed0c35f6 dont ask valueHolders for a menu ...
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   570
        "
b7e7ed0c35f6 dont ask valueHolders for a menu ...
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   571
         ask menuHolder (model) for the menu
b7e7ed0c35f6 dont ask valueHolders for a menu ...
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   572
        "
b7e7ed0c35f6 dont ask valueHolders for a menu ...
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   573
        (menuHolder respondsTo:sym) ifTrue:[
b7e7ed0c35f6 dont ask valueHolders for a menu ...
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   574
            ^ menuHolder perform:sym.
b7e7ed0c35f6 dont ask valueHolders for a menu ...
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   575
        ]
153
claus
parents: 141
diff changeset
   576
    ].
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   577
    ^ nil
1054
b7e7ed0c35f6 dont ask valueHolders for a menu ...
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   578
b7e7ed0c35f6 dont ask valueHolders for a menu ...
Claus Gittinger <cg@exept.de>
parents: 1037
diff changeset
   579
    "Modified: 14.9.1996 / 13:19:34 / cg"
0
48194c26a46c Initial revision
claus
parents:
diff changeset
   580
! !
245
86a1f74b2306 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 222
diff changeset
   581
1012
e408830caf2d no longer send buttonShiftPress messages (has to be done in the
Claus Gittinger <cg@exept.de>
parents: 744
diff changeset
   582
!Controller  class methodsFor:'documentation'!
252
87bbc0f751d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   583
87bbc0f751d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   584
version
1073
75fafd486819 Rename misspelled "interrest" to "interest".
Stefan Vogel <sv@exept.de>
parents: 1054
diff changeset
   585
    ^ '$Header: /cvs/stx/stx/libview/Controller.st,v 1.41 1996-10-14 21:26:45 stefan Exp $'
252
87bbc0f751d7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 245
diff changeset
   586
! !