0
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
IdentityDictionary subclass:#KeyboardMap
|
|
14 |
instanceVariableNames:'current'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-Support'
|
|
18 |
!
|
|
19 |
|
|
20 |
KeyboardMap comment:'
|
|
21 |
|
|
22 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
23 |
All Rights Reserved
|
|
24 |
|
|
25 |
instances of KeyboardMap are used for mapping keystrokes AND sequences
|
|
26 |
of keystrokes to a function key.
|
|
27 |
|
|
28 |
%W% %E%
|
|
29 |
|
|
30 |
written jun 93 by claus
|
|
31 |
'!
|
|
32 |
|
|
33 |
!KeyboardMap methodsFor:'accessing'!
|
|
34 |
|
|
35 |
bindValue:anObject to:aKey
|
|
36 |
self at:aKey put:anObject
|
|
37 |
!
|
|
38 |
|
|
39 |
bindValue:anObject to:key1 followedBy:key2
|
|
40 |
|submap|
|
|
41 |
|
|
42 |
submap := self at:key1.
|
|
43 |
submap isNil ifTrue:[
|
|
44 |
submap := KeyboardMap new.
|
|
45 |
self at:key1 put:submap.
|
|
46 |
].
|
|
47 |
submap at:key2 put:anObject
|
|
48 |
!
|
|
49 |
|
|
50 |
valueFor:aKey
|
|
51 |
|where value|
|
|
52 |
|
|
53 |
where := current notNil ifTrue:[current] ifFalse:[self].
|
|
54 |
|
|
55 |
value := where at:aKey ifAbsent:[aKey].
|
|
56 |
(value isMemberOf:KeyboardMap) ifTrue:[
|
|
57 |
current := value.
|
|
58 |
^ nil.
|
|
59 |
].
|
|
60 |
current := nil.
|
|
61 |
^ value
|
|
62 |
! !
|