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