PopUpListController.st
author Claus Gittinger <cg@exept.de>
Sat, 09 Dec 1995 23:11:01 +0100
changeset 246 23feabbc76c9
parent 203 8a38b0b03233
child 317 f23de8b78f5e
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
136
claus
parents:
diff changeset
     1
"
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
     3
	      All Rights Reserved
claus
parents:
diff changeset
     4
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    10
 hereby transferred.
claus
parents:
diff changeset
    11
"
claus
parents:
diff changeset
    12
claus
parents:
diff changeset
    13
ButtonController subclass:#PopUpListController
claus
parents:
diff changeset
    14
	 instanceVariableNames:''
claus
parents:
diff changeset
    15
	 classVariableNames:''
claus
parents:
diff changeset
    16
	 poolDictionaries:''
claus
parents:
diff changeset
    17
	 category:'Interface-Support-Controllers'
claus
parents:
diff changeset
    18
!
claus
parents:
diff changeset
    19
claus
parents:
diff changeset
    20
!PopUpListController class methodsFor:'documentation'!
claus
parents:
diff changeset
    21
claus
parents:
diff changeset
    22
copyright
claus
parents:
diff changeset
    23
"
claus
parents:
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
    25
	      All Rights Reserved
claus
parents:
diff changeset
    26
claus
parents:
diff changeset
    27
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    28
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    30
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    31
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    32
 hereby transferred.
claus
parents:
diff changeset
    33
"
claus
parents:
diff changeset
    34
!
claus
parents:
diff changeset
    35
claus
parents:
diff changeset
    36
documentation
claus
parents:
diff changeset
    37
"
claus
parents:
diff changeset
    38
    redefined the behavior on various keys if my view has the focus.
claus
parents:
diff changeset
    39
"
claus
parents:
diff changeset
    40
! !
claus
parents:
diff changeset
    41
claus
parents:
diff changeset
    42
!PopUpListController methodsFor:'event handling'!
claus
parents:
diff changeset
    43
claus
parents:
diff changeset
    44
keyPress:key x:x y:y
claus
parents:
diff changeset
    45
    "pull menu on Return and space, if I am the focusView of my group
claus
parents:
diff changeset
    46
     (i.e. if I got an explicit focus)"
claus
parents:
diff changeset
    47
155
claus
parents: 136
diff changeset
    48
    <resource: #keyboard (#CursorUp #CursorDown)>
claus
parents: 136
diff changeset
    49
136
claus
parents:
diff changeset
    50
    view hasFocus ifTrue:[
246
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    51
        (key == #Return) ifTrue:[
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    52
            view menu shown ifTrue:[
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    53
                self halt:'not yet implemented'.
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    54
                ^ self.
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    55
            ].
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    56
        ].
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    57
        (key == #CursorUp or:[key == #CursorDown]) ifTrue:[
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    58
            view menu shown ifTrue:[
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    59
                key == #CursorUp ifTrue:[view menu selectNext]
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    60
                                 ifFalse:[view menu selectPrevious].
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    61
                ^ self.
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    62
            ].
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    63
        ].
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    64
        (key == #Return or:[key == Character space]) ifTrue:[
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    65
            view menu exclusivePointer:false.
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    66
            view menu hideOnRelease:true.
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    67
            view popMenu.
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    68
            view menu exclusivePointer:true.
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    69
            ^ self.
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    70
        ]
136
claus
parents:
diff changeset
    71
    ].
claus
parents:
diff changeset
    72
    view keyPress:key x:x y:y
246
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    73
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    74
    "Created: 9.12.1995 / 23:06:09 / cg"
136
claus
parents:
diff changeset
    75
! !
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
    76
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    77
!PopUpListController class methodsFor:'documentation'!
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    78
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    79
version
246
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
    80
    ^ '$Header: /cvs/stx/stx/libwidg/PopUpListController.st,v 1.6 1995-12-09 22:11:01 cg Exp $'
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
    81
! !