author | convert-repo |
Sat, 11 Feb 2017 04:41:47 +0000 | |
changeset 3880 | c4269847c0fe |
parent 2136 | 88cc2d6d4483 |
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 |
|
2090 | 56 |
"returns the value stored under the key or nil" |
57 |
||
880 | 58 |
^ self at:aKey ifAbsent:nil |
59 |
! |
|
60 |
||
61 |
dropSourceFor:aReceiver |
|
2090 | 62 |
"returns the DropSource for a receiver or nil" |
63 |
||
880 | 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 |
|
2090 | 81 |
"returns the DropTarget for a receiver or nil" |
82 |
||
880 | 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:). |
|
2090 | 95 |
^ target |
880 | 96 |
]. |
97 |
^ nil |
|
98 |
! ! |
|
99 |
||
100 |
!PropertyListDictionary methodsFor:'building'! |
|
101 |
||
102 |
actionSelectors |
|
2090 | 103 |
"returns the list of action selectors" |
104 |
||
880 | 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 |
|
2090 | 118 |
"returns the list of aspect selectors or nil" |
119 |
||
880 | 120 |
^ nil |
121 |
! ! |
|
122 |
||
123 |
!PropertyListDictionary methodsFor:'converting'! |
|
124 |
||
125 |
fromLiteralArrayEncoding:aLiteralEncodedArray |
|
2090 | 126 |
"read my values from an encoding" |
127 |
||
880 | 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 |
literalArrayEncoding |
|
139 |
"encode myself as an array, from which a copy of the receiver |
|
2090 | 140 |
can be reconstructed with #decodeAsLiteralArray." |
141 |
||
880 | 142 |
|coll| |
143 |
||
144 |
coll := OrderedCollection new. |
|
2136 | 145 |
coll add:self class name. |
880 | 146 |
|
147 |
self keysAndValuesDo:[:aKey :aVal| |
|
148 |
coll add:aKey; add:(aVal literalArrayEncoding) |
|
149 |
]. |
|
150 |
^ coll asArray |
|
151 |
! ! |
|
152 |
||
153 |
!PropertyListDictionary methodsFor:'queries'! |
|
154 |
||
155 |
canDrag |
|
2090 | 156 |
"returns true if the receiver of the property list is draggable" |
157 |
||
880 | 158 |
^ self includesKey:#dropObjectSelector: |
159 |
! |
|
160 |
||
161 |
canDrop |
|
2090 | 162 |
"returns true if the receiver of the property list is droppable" |
163 |
||
880 | 164 |
^ self includesKey:#dropSelector: |
165 |
! |
|
166 |
||
167 |
isActionSelector:aKey |
|
2090 | 168 |
"returns true if the key is an action selector" |
169 |
||
880 | 170 |
^ ( aKey ~~ #dragArgument: |
171 |
and:[aKey ~~ #dropArgument:] |
|
172 |
) |
|
173 |
! ! |
|
174 |
||
175 |
!PropertyListDictionary class methodsFor:'documentation'! |
|
176 |
||
177 |
version |
|
2136 | 178 |
^ '$Header: /cvs/stx/stx/libview2/PropertyListDictionary.st,v 1.7 2006-07-03 16:10:27 stefan Exp $' |
880 | 179 |
! ! |