PopUpListController.st
author Claus Gittinger <cg@exept.de>
Sat, 20 Jun 2009 10:47:07 +0200
changeset 3901 113dd960ba11
parent 3003 74d174a0e52a
child 3919 9a5d0db0c12e
permissions -rw-r--r--
*** empty log message ***
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
2263
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    13
"{ Package: 'stx:libwidg' }"
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    14
136
claus
parents:
diff changeset
    15
ButtonController subclass:#PopUpListController
349
e4382398fc59 ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
    16
	instanceVariableNames:''
e4382398fc59 ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
    17
	classVariableNames:''
e4382398fc59 ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
    18
	poolDictionaries:''
e4382398fc59 ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
    19
	category:'Interface-Support-Controllers'
136
claus
parents:
diff changeset
    20
!
claus
parents:
diff changeset
    21
claus
parents:
diff changeset
    22
!PopUpListController class methodsFor:'documentation'!
claus
parents:
diff changeset
    23
claus
parents:
diff changeset
    24
copyright
claus
parents:
diff changeset
    25
"
claus
parents:
diff changeset
    26
 COPYRIGHT (c) 1995 by Claus Gittinger
claus
parents:
diff changeset
    27
	      All Rights Reserved
claus
parents:
diff changeset
    28
claus
parents:
diff changeset
    29
 This software is furnished under a license and may be used
claus
parents:
diff changeset
    30
 only in accordance with the terms of that license and with the
claus
parents:
diff changeset
    31
 inclusion of the above copyright notice.   This software may not
claus
parents:
diff changeset
    32
 be provided or otherwise made available to, or used by, any
claus
parents:
diff changeset
    33
 other person.  No title to or ownership of the software is
claus
parents:
diff changeset
    34
 hereby transferred.
claus
parents:
diff changeset
    35
"
claus
parents:
diff changeset
    36
!
claus
parents:
diff changeset
    37
claus
parents:
diff changeset
    38
documentation
claus
parents:
diff changeset
    39
"
claus
parents:
diff changeset
    40
    redefined the behavior on various keys if my view has the focus.
582
e151eeae2c9a documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    41
e151eeae2c9a documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    42
    [author:]
e151eeae2c9a documentation
Claus Gittinger <cg@exept.de>
parents: 491
diff changeset
    43
        Claus Gittinger
136
claus
parents:
diff changeset
    44
"
claus
parents:
diff changeset
    45
! !
claus
parents:
diff changeset
    46
claus
parents:
diff changeset
    47
!PopUpListController methodsFor:'event handling'!
claus
parents:
diff changeset
    48
977
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    49
buttonPress:button x:x y:y
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    50
    "redefined to not send any change message to the model when
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    51
     pressed (this is done by the popped menu)"
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    52
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    53
    (button == 1 or:[button == #select]) ifFalse:[
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    54
        ^ super buttonPress:button x:x y:y
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    55
    ].
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    56
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    57
    enableChannel value ifTrue:[
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    58
        pressed ifFalse:[
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    59
            pressed := true.
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    60
            view showActive.
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    61
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    62
            (pressActionBlock notNil or:[model notNil]) ifTrue:[
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    63
                "
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    64
                 force output - so that button is drawn correctly in case
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    65
                 of any long-computation (at high priority)
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    66
                "
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    67
                view flush.
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    68
            ].
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    69
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    70
            pressActionBlock value.
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    71
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    72
        ]
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    73
    ]
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    74
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    75
    "Created: 27.1.1997 / 17:22:16 / cg"
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    76
    "Modified: 27.1.1997 / 17:23:17 / cg"
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    77
!
82696bdd308a oops - need fix, since order of model-notification vs. actionBlock
Claus Gittinger <cg@exept.de>
parents: 582
diff changeset
    78
136
claus
parents:
diff changeset
    79
keyPress:key x:x y:y
claus
parents:
diff changeset
    80
    "pull menu on Return and space, if I am the focusView of my group
claus
parents:
diff changeset
    81
     (i.e. if I got an explicit focus)"
claus
parents:
diff changeset
    82
3003
74d174a0e52a Resource definition
Stefan Vogel <sv@exept.de>
parents: 2263
diff changeset
    83
    <resource: #keyboard (#Return #CursorUp #CursorDown #Space)>
155
claus
parents: 136
diff changeset
    84
2263
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    85
    |menu|
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    86
136
claus
parents:
diff changeset
    87
    view hasFocus ifTrue:[
317
f23de8b78f5e Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    88
"/        (key == #Return) ifTrue:[
f23de8b78f5e Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    89
"/            view menu shown ifTrue:[
f23de8b78f5e Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    90
"/                self halt:'not yet implemented'.
f23de8b78f5e Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    91
"/                ^ self.
f23de8b78f5e Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    92
"/            ].
f23de8b78f5e Escape closes pullDownMenus & PopUpLists
Claus Gittinger <cg@exept.de>
parents: 246
diff changeset
    93
"/        ].
2263
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    94
        menu := view menu.
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    95
        (menu notNil and:[menu isView]) ifTrue:[
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    96
            (key == #CursorUp or:[key == #CursorDown]) ifTrue:[
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    97
                menu shown ifTrue:[
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    98
                    key == #CursorUp ifTrue:[menu selectNext]
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
    99
                                     ifFalse:[menu selectPrevious].
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   100
                    ^ self.
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   101
                ].
349
e4382398fc59 ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   102
            ].
2263
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   103
            (key == Character space) ifTrue:[
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   104
                menu exclusivePointer:false.
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   105
                menu hideOnRelease:true.
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   106
                view popMenu.
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   107
                view menu exclusivePointer:true.
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   108
                ^ self.
7ce448c9ca35 care for Gui-builder menu (do ask if shown)
Claus Gittinger <cg@exept.de>
parents: 977
diff changeset
   109
            ]
349
e4382398fc59 ignore Return key - its meant to close a box
Claus Gittinger <cg@exept.de>
parents: 317
diff changeset
   110
        ]
136
claus
parents:
diff changeset
   111
    ].
claus
parents:
diff changeset
   112
    view keyPress:key x:x y:y
246
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
   113
23feabbc76c9 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 203
diff changeset
   114
    "Created: 9.12.1995 / 23:06:09 / cg"
491
7b376aaa06d5 resources
Claus Gittinger <cg@exept.de>
parents: 349
diff changeset
   115
    "Modified: 7.3.1996 / 13:17:46 / cg"
136
claus
parents:
diff changeset
   116
! !
200
aa3e56929a5a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 174
diff changeset
   117
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   118
!PopUpListController class methodsFor:'documentation'!
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   119
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   120
version
3003
74d174a0e52a Resource definition
Stefan Vogel <sv@exept.de>
parents: 2263
diff changeset
   121
    ^ '$Header: /cvs/stx/stx/libwidg/PopUpListController.st,v 1.13 2004-07-13 11:59:27 stefan Exp $'
203
8a38b0b03233 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 200
diff changeset
   122
! !