author | Claus Gittinger <cg@exept.de> |
Tue, 22 Aug 2000 15:57:05 +0200 | |
changeset 1820 | 9b17f0c15849 |
parent 1812 | c9054636e3ea |
child 2196 | 2d64b9c3bcea |
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 |
|
1820 | 71 |
size |
72 |
"behave like a string when asked for the size" |
|
73 |
||
74 |
^ self string size |
|
75 |
||
76 |
"Created: / 8.2.1996 / 12:54:45 / cg" |
|
77 |
"Modified: / 30.10.1997 / 15:42:19 / cg" |
|
78 |
! |
|
79 |
||
123 | 80 |
species |
81 |
^ String |
|
82 |
||
83 |
"Created: 8.2.1996 / 12:52:38 / cg" |
|
84 |
! |
|
85 |
||
58 | 86 |
string |
87 |
^ self asString |
|
88 |
! ! |
|
89 |
||
90 |
!ListEntry methodsFor:'required protocol'! |
|
91 |
||
92 |
asString |
|
93 |
"return the receiver as a string (for example, to store it in a file)" |
|
94 |
||
95 |
^ self subclassResponsibility |
|
96 |
! |
|
97 |
||
109 | 98 |
displayOn:aGC x:x y:y opaque:opaque |
97 | 99 |
"display the receiver on a GC" |
58 | 100 |
|
101 |
^ self subclassResponsibility |
|
94 | 102 |
! |
58 | 103 |
|
173 | 104 |
heightOn:aGC |
94 | 105 |
"return the height of the receiver when displayed in aGC. |
106 |
Assume the GC's font is taken. If that is not the case in a |
|
107 |
particular subclass, this method is to be redefined there." |
|
108 |
||
821 | 109 |
^ aGC font heightOn:(aGC device) |
94 | 110 |
|
173 | 111 |
"Created: 12.5.1996 / 20:37:06 / cg" |
97 | 112 |
! |
113 |
||
173 | 114 |
widthOn:aGC |
97 | 115 |
"return the width (in device units) of the receiver when displayed in aGC" |
116 |
||
117 |
^ self subclassResponsibility |
|
173 | 118 |
|
119 |
"Created: 12.5.1996 / 20:53:09 / cg" |
|
58 | 120 |
! ! |
121 |
||
123 | 122 |
!ListEntry methodsFor:'string protocol'! |
123 |
||
124 |
< aString |
|
125 |
"behave like a string when comparing" |
|
126 |
||
127 |
^ self asString < aString asString |
|
128 |
||
129 |
"Created: 8.2.1996 / 12:01:29 / cg" |
|
130 |
! |
|
131 |
||
132 |
= aString |
|
133 |
"behave like a string when comparing" |
|
134 |
||
734 | 135 |
self == aString ifTrue:[^ true]. |
1812 | 136 |
^ self asString = aString asString |
123 | 137 |
! |
138 |
||
139 |
at:index |
|
600 | 140 |
"behave like a string when accessing characters" |
141 |
||
123 | 142 |
^ self string at:index |
143 |
||
600 | 144 |
"Created: / 8.2.1996 / 12:53:06 / cg" |
145 |
"Modified: / 30.10.1997 / 15:41:47 / cg" |
|
123 | 146 |
! |
147 |
||
148 |
do:aBlock |
|
600 | 149 |
"behave like a string when enumerating characters" |
150 |
||
123 | 151 |
^ self string do:aBlock |
152 |
||
600 | 153 |
"Created: / 8.2.1996 / 12:56:06 / cg" |
154 |
"Modified: / 30.10.1997 / 15:42:06 / cg" |
|
123 | 155 |
! |
156 |
||
1812 | 157 |
hash |
158 |
"return an integer useful for hashing" |
|
159 |
||
160 |
^ self asString hash |
|
600 | 161 |
! ! |
162 |
||
163 |
!ListEntry methodsFor:'testing'! |
|
164 |
||
165 |
includes:aCharacter |
|
166 |
"behave like a string when testing" |
|
167 |
||
168 |
^ self string includes:aCharacter |
|
169 |
||
170 |
"Modified: / 30.10.1997 / 15:42:32 / cg" |
|
123 | 171 |
! ! |
172 |
||
98 | 173 |
!ListEntry class methodsFor:'documentation'! |
174 |
||
175 |
version |
|
1820 | 176 |
^ '$Header: /cvs/stx/stx/libwidg2/ListEntry.st,v 1.17 2000-08-22 13:56:59 cg Exp $' |
98 | 177 |
! ! |