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