author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Fri, 14 Jun 2019 12:45:30 +0100 | |
branch | jv |
changeset 6068 | 5e8b7ee23889 |
parent 5391 | 4392c1cf3c16 |
child 5913 | b8dd70aeb192 |
permissions | -rw-r--r-- |
58 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
86
4d7dbb5f1719
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
58
diff
changeset
|
3 |
All Rights Reserved |
58 | 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 |
" |
|
1812 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
5391 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
58 | 16 |
Object subclass:#ListEntry |
123 | 17 |
instanceVariableNames:'' |
18 |
classVariableNames:'' |
|
19 |
poolDictionaries:'' |
|
20 |
category:'Views-Support' |
|
58 | 21 |
! |
22 |
||
23 |
!ListEntry class methodsFor:'documentation'! |
|
24 |
||
25 |
copyright |
|
26 |
" |
|
27 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
86
4d7dbb5f1719
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
58
diff
changeset
|
28 |
All Rights Reserved |
58 | 29 |
|
30 |
This software is furnished under a license and may be used |
|
31 |
only in accordance with the terms of that license and with the |
|
32 |
inclusion of the above copyright notice. This software may not |
|
33 |
be provided or otherwise made available to, or used by, any |
|
34 |
other person. No title to or ownership of the software is |
|
35 |
hereby transferred. |
|
36 |
" |
|
37 |
! |
|
38 |
||
39 |
documentation |
|
40 |
" |
|
41 |
ListEntry is an abstract superclass for objects which can be used |
|
42 |
in place of strings in ListViews or SelectionInListViews. |
|
43 |
||
44 |
If you want to create new subclasses, implement (at least) the methods |
|
45 |
found in the 'required protocol' category. |
|
158 | 46 |
|
47 |
[author:] |
|
48 |
Claus Gittinger |
|
49 |
||
50 |
[see also:] |
|
51 |
ListView |
|
58 | 52 |
" |
53 |
! ! |
|
54 |
||
5391 | 55 |
!ListEntry methodsFor:'comparing'! |
56 |
||
57 |
< aString |
|
58 |
"behave like a string when comparing" |
|
59 |
||
60 |
^ self asString < aString asString |
|
61 |
||
62 |
"Created: 8.2.1996 / 12:01:29 / cg" |
|
63 |
! |
|
64 |
||
65 |
= aString |
|
66 |
"behave like a string when comparing" |
|
67 |
||
68 |
self == aString ifTrue:[^ true]. |
|
69 |
^ self asString = aString asString |
|
70 |
! |
|
71 |
||
72 |
hash |
|
73 |
"return an integer useful for hashing" |
|
74 |
||
75 |
^ self asString hash |
|
76 |
! ! |
|
77 |
||
669 | 78 |
!ListEntry methodsFor:'printing & storing'! |
79 |
||
80 |
printOn:aStream |
|
81 |
||
82 |
aStream nextPutAll:self asString. |
|
83 |
||
84 |
"Created: / 20.1.1998 / 14:11:02 / stefan" |
|
85 |
! |
|
58 | 86 |
|
123 | 87 |
printString |
88 |
^ self asString |
|
89 |
||
90 |
"Created: 8.2.1996 / 11:56:14 / cg" |
|
669 | 91 |
! ! |
92 |
||
93 |
!ListEntry methodsFor:'queries'! |
|
123 | 94 |
|
2655
4b72f593d5ba
hasImage, hasIcon queries added
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
95 |
hasIcon |
4b72f593d5ba
hasImage, hasIcon queries added
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
96 |
^ false |
4b72f593d5ba
hasImage, hasIcon queries added
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
97 |
! |
4b72f593d5ba
hasImage, hasIcon queries added
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
98 |
|
4b72f593d5ba
hasImage, hasIcon queries added
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
99 |
hasImage |
4b72f593d5ba
hasImage, hasIcon queries added
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
100 |
^ false |
4b72f593d5ba
hasImage, hasIcon queries added
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
101 |
! |
4b72f593d5ba
hasImage, hasIcon queries added
Claus Gittinger <cg@exept.de>
parents:
2196
diff
changeset
|
102 |
|
3764 | 103 |
includes:aCharacter |
104 |
"behave like a string when testing" |
|
105 |
||
106 |
^ self string includes:aCharacter |
|
107 |
||
108 |
"Modified: / 30.10.1997 / 15:42:32 / cg" |
|
109 |
! |
|
110 |
||
1820 | 111 |
size |
112 |
"behave like a string when asked for the size" |
|
113 |
||
114 |
^ self string size |
|
115 |
||
116 |
"Created: / 8.2.1996 / 12:54:45 / cg" |
|
117 |
"Modified: / 30.10.1997 / 15:42:19 / cg" |
|
118 |
! |
|
119 |
||
123 | 120 |
species |
121 |
^ String |
|
122 |
||
123 |
"Created: 8.2.1996 / 12:52:38 / cg" |
|
124 |
! |
|
125 |
||
58 | 126 |
string |
127 |
^ self asString |
|
128 |
! ! |
|
129 |
||
130 |
!ListEntry methodsFor:'required protocol'! |
|
131 |
||
132 |
asString |
|
133 |
"return the receiver as a string (for example, to store it in a file)" |
|
134 |
||
135 |
^ self subclassResponsibility |
|
136 |
! |
|
137 |
||
109 | 138 |
displayOn:aGC x:x y:y opaque:opaque |
97 | 139 |
"display the receiver on a GC" |
58 | 140 |
|
141 |
^ self subclassResponsibility |
|
94 | 142 |
! |
58 | 143 |
|
173 | 144 |
heightOn:aGC |
94 | 145 |
"return the height of the receiver when displayed in aGC. |
146 |
Assume the GC's font is taken. If that is not the case in a |
|
147 |
particular subclass, this method is to be redefined there." |
|
148 |
||
821 | 149 |
^ aGC font heightOn:(aGC device) |
94 | 150 |
|
173 | 151 |
"Created: 12.5.1996 / 20:37:06 / cg" |
97 | 152 |
! |
153 |
||
2196 | 154 |
sameStringAndEmphasisAs:aStringOrText |
155 |
||
156 |
^ self subclassResponsibility |
|
157 |
! |
|
158 |
||
173 | 159 |
widthOn:aGC |
97 | 160 |
"return the width (in device units) of the receiver when displayed in aGC" |
161 |
||
162 |
^ self subclassResponsibility |
|
173 | 163 |
|
164 |
"Created: 12.5.1996 / 20:53:09 / cg" |
|
58 | 165 |
! ! |
166 |
||
123 | 167 |
!ListEntry methodsFor:'string protocol'! |
168 |
||
169 |
at:index |
|
600 | 170 |
"behave like a string when accessing characters" |
171 |
||
123 | 172 |
^ self string at:index |
173 |
||
600 | 174 |
"Created: / 8.2.1996 / 12:53:06 / cg" |
175 |
"Modified: / 30.10.1997 / 15:41:47 / cg" |
|
123 | 176 |
! |
177 |
||
178 |
do:aBlock |
|
600 | 179 |
"behave like a string when enumerating characters" |
180 |
||
123 | 181 |
^ self string do:aBlock |
182 |
||
600 | 183 |
"Created: / 8.2.1996 / 12:56:06 / cg" |
184 |
"Modified: / 30.10.1997 / 15:42:06 / cg" |
|
185 |
! ! |
|
186 |
||
98 | 187 |
!ListEntry class methodsFor:'documentation'! |
188 |
||
189 |
version |
|
5391 | 190 |
^ '$Header$' |
3764 | 191 |
! |
192 |
||
193 |
version_CVS |
|
5391 | 194 |
^ '$Header$' |
98 | 195 |
! ! |
5391 | 196 |