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