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