author | Claus Gittinger <cg@exept.de> |
Tue, 09 Sep 2003 11:43:30 +0200 | |
changeset 1810 | 61452e83a4e1 |
parent 1803 | d69cb54a3b56 |
child 2090 | 025a61199960 |
permissions | -rw-r--r-- |
1803 | 1 |
" |
2 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
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 |
||
1459 | 13 |
"{ Package: 'stx:libview2' }" |
14 |
||
880 | 15 |
IdentityDictionary subclass:#PropertyListDictionary |
16 |
instanceVariableNames:'' |
|
17 |
classVariableNames:'' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Interface-Support-UI' |
|
20 |
! |
|
21 |
||
22 |
!PropertyListDictionary class methodsFor:'documentation'! |
|
23 |
||
1803 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1998 by eXept Software AG |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
880 | 38 |
documentation |
39 |
" |
|
40 |
Instances are used temporarily by the UISpecification to keep dynamic |
|
41 |
properties for a view. |
|
42 |
For example, all the callbacks used by the drag & drop operation are |
|
43 |
stored. |
|
44 |
||
45 |
[author:] |
|
46 |
Claus Atzkern |
|
47 |
||
48 |
[see also:] |
|
49 |
UISpecification |
|
50 |
" |
|
51 |
! ! |
|
52 |
||
53 |
!PropertyListDictionary methodsFor:'accessing'! |
|
54 |
||
55 |
at:aKey |
|
56 |
"returns the value stored under the key or nil |
|
57 |
" |
|
58 |
^ self at:aKey ifAbsent:nil |
|
59 |
! |
|
60 |
||
61 |
dropSourceFor:aReceiver |
|
62 |
"returns the DropSource for a receiver or nil |
|
63 |
" |
|
64 |
|source| |
|
65 |
||
66 |
self canDrag ifTrue:[ |
|
1730 | 67 |
source := DropSource |
68 |
receiver:aReceiver |
|
69 |
argument:(self at:#dragArgument:) |
|
70 |
dropObjectSelector:(self at:#dropObjectSelector:) |
|
71 |
displayObjectSelector:(self at:#displayObjectSelector:) |
|
72 |
dropFeedBackSelector:(self at:#feedBackSelector:). |
|
880 | 73 |
|
74 |
source startDragSelector:(self at:#startDragSelector:). |
|
75 |
^ source |
|
76 |
]. |
|
77 |
^ nil |
|
78 |
! |
|
79 |
||
80 |
dropTargetFor:aReceiver |
|
81 |
"returns the DropTarget for a receiver or nil |
|
82 |
" |
|
83 |
|target| |
|
84 |
||
85 |
self canDrop ifTrue:[ |
|
1730 | 86 |
target := DropTarget |
87 |
receiver:aReceiver |
|
88 |
argument:(self at:#dropArgument:) |
|
89 |
dropSelector:(self at:#dropSelector:) |
|
90 |
canDropSelector:(self at:#canDropSelector:). |
|
880 | 91 |
|
92 |
target enterSelector:(self at:#enterSelector:). |
|
93 |
target overSelector:(self at:#overSelector:). |
|
94 |
target leaveSelector:(self at:#leaveSelector:). |
|
95 |
^ target |
|
96 |
]. |
|
97 |
^ nil |
|
98 |
! ! |
|
99 |
||
100 |
!PropertyListDictionary methodsFor:'building'! |
|
101 |
||
102 |
actionSelectors |
|
103 |
"returns the list of action selectors |
|
104 |
" |
|
105 |
|list| |
|
106 |
||
107 |
list := OrderedCollection new. |
|
108 |
||
109 |
self keysAndValuesDo:[:aKey :aVal| |
|
110 |
(aVal isSymbol and:[self isActionSelector:aKey]) ifTrue:[ |
|
111 |
list add:aVal |
|
112 |
] |
|
113 |
]. |
|
114 |
^ list |
|
115 |
! |
|
116 |
||
117 |
aspectSelectors |
|
118 |
"returns the list of aspect selectors or nil |
|
119 |
" |
|
120 |
^ nil |
|
121 |
! ! |
|
122 |
||
123 |
!PropertyListDictionary methodsFor:'converting'! |
|
124 |
||
125 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
|
126 |
"read my values from an encoding |
|
127 |
" |
|
128 |
|key val| |
|
129 |
||
1810
61452e83a4e1
oops - fromLiteralArrayEncoding was broken
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
130 |
2 to:aLiteralEncodedArray size-1 by:2 do:[:i | |
880 | 131 |
key := aLiteralEncodedArray at:i. |
132 |
val := (aLiteralEncodedArray at:i+1) decodeAsLiteralArray. |
|
133 |
||
134 |
self at:key put:val |
|
135 |
] |
|
136 |
||
137 |
! |
|
138 |
||
139 |
literalArrayEncoding |
|
140 |
"encode myself as an array, from which a copy of the receiver |
|
141 |
can be reconstructed with #decodeAsLiteralArray. |
|
142 |
" |
|
143 |
|coll| |
|
144 |
||
145 |
coll := OrderedCollection new. |
|
146 |
coll add:(self class name asSymbol). |
|
147 |
||
148 |
self keysAndValuesDo:[:aKey :aVal| |
|
149 |
coll add:aKey; add:(aVal literalArrayEncoding) |
|
150 |
]. |
|
151 |
^ coll asArray |
|
152 |
||
153 |
! ! |
|
154 |
||
155 |
!PropertyListDictionary methodsFor:'queries'! |
|
156 |
||
157 |
canDrag |
|
158 |
"returns true if the receiver of the property list is draggable |
|
159 |
" |
|
160 |
^ self includesKey:#dropObjectSelector: |
|
161 |
! |
|
162 |
||
163 |
canDrop |
|
164 |
"returns true if the receiver of the property list is droppable |
|
165 |
" |
|
166 |
^ self includesKey:#dropSelector: |
|
167 |
! |
|
168 |
||
169 |
isActionSelector:aKey |
|
170 |
"returns true if the key is an action selector |
|
171 |
" |
|
172 |
^ ( aKey ~~ #dragArgument: |
|
173 |
and:[aKey ~~ #dropArgument:] |
|
174 |
) |
|
175 |
! ! |
|
176 |
||
177 |
!PropertyListDictionary class methodsFor:'documentation'! |
|
178 |
||
179 |
version |
|
1810
61452e83a4e1
oops - fromLiteralArrayEncoding was broken
Claus Gittinger <cg@exept.de>
parents:
1803
diff
changeset
|
180 |
^ '$Header: /cvs/stx/stx/libview2/PropertyListDictionary.st,v 1.5 2003-09-09 09:43:30 cg Exp $' |
880 | 181 |
! ! |