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