880
|
1 |
IdentityDictionary subclass:#PropertyListDictionary
|
|
2 |
instanceVariableNames:''
|
|
3 |
classVariableNames:''
|
|
4 |
poolDictionaries:''
|
|
5 |
category:'Interface-Support-UI'
|
|
6 |
!
|
|
7 |
|
|
8 |
!PropertyListDictionary class methodsFor:'documentation'!
|
|
9 |
|
|
10 |
documentation
|
|
11 |
"
|
|
12 |
Instances are used temporarily by the UISpecification to keep dynamic
|
|
13 |
properties for a view.
|
|
14 |
For example, all the callbacks used by the drag & drop operation are
|
|
15 |
stored.
|
|
16 |
|
|
17 |
[author:]
|
|
18 |
Claus Atzkern
|
|
19 |
|
|
20 |
[see also:]
|
|
21 |
UISpecification
|
|
22 |
"
|
|
23 |
! !
|
|
24 |
|
|
25 |
!PropertyListDictionary methodsFor:'accessing'!
|
|
26 |
|
|
27 |
at:aKey
|
|
28 |
"returns the value stored under the key or nil
|
|
29 |
"
|
|
30 |
^ self at:aKey ifAbsent:nil
|
|
31 |
!
|
|
32 |
|
|
33 |
dropSourceFor:aReceiver
|
|
34 |
"returns the DropSource for a receiver or nil
|
|
35 |
"
|
|
36 |
|source|
|
|
37 |
|
|
38 |
self canDrag ifTrue:[
|
|
39 |
source := DropSource receiver:aReceiver
|
|
40 |
argument:(self at:#dragArgument:)
|
|
41 |
dropObjectSelector:(self at:#dropObjectSelector:)
|
|
42 |
displayObjectSelector:(self at:#displayObjectSelector:)
|
|
43 |
feedBackSelector:(self at:#feedBackSelector:).
|
|
44 |
|
|
45 |
source startDragSelector:(self at:#startDragSelector:).
|
|
46 |
^ source
|
|
47 |
].
|
|
48 |
^ nil
|
|
49 |
!
|
|
50 |
|
|
51 |
dropTargetFor:aReceiver
|
|
52 |
"returns the DropTarget for a receiver or nil
|
|
53 |
"
|
|
54 |
|target|
|
|
55 |
|
|
56 |
self canDrop ifTrue:[
|
|
57 |
target := DropTarget receiver:aReceiver
|
|
58 |
argument:(self at:#dropArgument:)
|
|
59 |
dropSelector:(self at:#dropSelector:)
|
|
60 |
canDropSelector:(self at:#canDropSelector:).
|
|
61 |
|
|
62 |
target enterSelector:(self at:#enterSelector:).
|
|
63 |
target overSelector:(self at:#overSelector:).
|
|
64 |
target leaveSelector:(self at:#leaveSelector:).
|
|
65 |
^ target
|
|
66 |
].
|
|
67 |
^ nil
|
|
68 |
|
|
69 |
! !
|
|
70 |
|
|
71 |
!PropertyListDictionary methodsFor:'building'!
|
|
72 |
|
|
73 |
actionSelectors
|
|
74 |
"returns the list of action selectors
|
|
75 |
"
|
|
76 |
|list|
|
|
77 |
|
|
78 |
list := OrderedCollection new.
|
|
79 |
|
|
80 |
self keysAndValuesDo:[:aKey :aVal|
|
|
81 |
(aVal isSymbol and:[self isActionSelector:aKey]) ifTrue:[
|
|
82 |
list add:aVal
|
|
83 |
]
|
|
84 |
].
|
|
85 |
^ list
|
|
86 |
!
|
|
87 |
|
|
88 |
aspectSelectors
|
|
89 |
"returns the list of aspect selectors or nil
|
|
90 |
"
|
|
91 |
^ nil
|
|
92 |
! !
|
|
93 |
|
|
94 |
!PropertyListDictionary methodsFor:'converting'!
|
|
95 |
|
|
96 |
fromLiteralArrayEncoding:aLiteralEncodedArray
|
|
97 |
"read my values from an encoding
|
|
98 |
"
|
|
99 |
|key val|
|
|
100 |
|
|
101 |
2 to:aLiteralEncodedArray size by:2 do:[:i |
|
|
102 |
key := aLiteralEncodedArray at:i.
|
|
103 |
val := (aLiteralEncodedArray at:i+1) decodeAsLiteralArray.
|
|
104 |
|
|
105 |
self at:key put:val
|
|
106 |
]
|
|
107 |
|
|
108 |
!
|
|
109 |
|
|
110 |
literalArrayEncoding
|
|
111 |
"encode myself as an array, from which a copy of the receiver
|
|
112 |
can be reconstructed with #decodeAsLiteralArray.
|
|
113 |
"
|
|
114 |
|coll|
|
|
115 |
|
|
116 |
coll := OrderedCollection new.
|
|
117 |
coll add:(self class name asSymbol).
|
|
118 |
|
|
119 |
self keysAndValuesDo:[:aKey :aVal|
|
|
120 |
coll add:aKey; add:(aVal literalArrayEncoding)
|
|
121 |
].
|
|
122 |
^ coll asArray
|
|
123 |
|
|
124 |
! !
|
|
125 |
|
|
126 |
!PropertyListDictionary methodsFor:'queries'!
|
|
127 |
|
|
128 |
canDrag
|
|
129 |
"returns true if the receiver of the property list is draggable
|
|
130 |
"
|
|
131 |
^ self includesKey:#dropObjectSelector:
|
|
132 |
!
|
|
133 |
|
|
134 |
canDrop
|
|
135 |
"returns true if the receiver of the property list is droppable
|
|
136 |
"
|
|
137 |
^ self includesKey:#dropSelector:
|
|
138 |
!
|
|
139 |
|
|
140 |
isActionSelector:aKey
|
|
141 |
"returns true if the key is an action selector
|
|
142 |
"
|
|
143 |
^ ( aKey ~~ #dragArgument:
|
|
144 |
and:[aKey ~~ #dropArgument:]
|
|
145 |
)
|
|
146 |
! !
|
|
147 |
|
|
148 |
!PropertyListDictionary class methodsFor:'documentation'!
|
|
149 |
|
|
150 |
version
|
|
151 |
^ '$Header: /cvs/stx/stx/libview2/PropertyListDictionary.st,v 1.1 1998-03-31 07:48:29 ca Exp $'
|
|
152 |
! !
|