ListEntry.st
author Claus Gittinger <cg@exept.de>
Thu, 08 Feb 1996 15:09:25 +0100
changeset 123 5ac860f2e7b8
parent 109 88467c13bf31
child 158 431e38dfc5ab
permissions -rw-r--r--
more String mimicri protocol

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

Object subclass:#ListEntry
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'Views-Support'
!

!ListEntry class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    ListEntry is an abstract superclass for objects which can be used
    in place of strings in ListViews or SelectionInListViews.

    If you want to create new subclasses, implement (at least) the methods
    found in the 'required protocol' category.
"
! !

!ListEntry methodsFor:'drawing'!

displayOn:aGC x:x y:y
    "display the receiver on a GC"

    ^ self displayOn:aGC x:x y:y opaque:false 
!

displayOpaqueOn:aGC x:x y:y
    "display the receiver on a GC"

    ^ self displayOn:aGC x:x y:y opaque:true
! !

!ListEntry methodsFor:'queries'!

includes:aCharacter 
    ^ self string includes:aCharacter
!

printString
    ^ self asString

    "Created: 8.2.1996 / 11:56:14 / cg"
!

species
    ^ String

    "Created: 8.2.1996 / 12:52:38 / cg"
!

string
    ^ self asString
! !

!ListEntry methodsFor:'required protocol'!

asString
    "return the receiver as a string (for example, to store it in a file)"

    ^ self subclassResponsibility
!

displayOn:aGC x:x y:y opaque:opaque
    "display the receiver on a GC"

    ^ self subclassResponsibility
!

heightIn:aGC
    "return the height of the receiver when displayed in aGC.
     Assume the GC's font is taken. If that is not the case in a
     particular subclass, this method is to be redefined there."

    ^ aGC font height

    "Created: 23.11.1995 / 00:19:45 / cg"
!

widthIn:aGC
    "return the width (in device units) of the receiver when displayed in aGC"

    ^ self subclassResponsibility
! !

!ListEntry methodsFor:'string protocol'!

< aString
    "behave like a string when comparing"

    ^ self asString < aString asString

    "Created: 8.2.1996 / 12:01:29 / cg"
!

= aString
    "behave like a string when comparing"

    ^ self asString = aString asString

    "Created: 8.2.1996 / 12:01:24 / cg"
!

at:index
    ^ self string at:index

    "Created: 8.2.1996 / 12:53:06 / cg"
!

do:aBlock
    ^ self string do:aBlock

    "Created: 8.2.1996 / 12:56:06 / cg"
!

size
    ^ self string size

    "Created: 8.2.1996 / 12:54:45 / cg"
! !

!ListEntry class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg2/ListEntry.st,v 1.8 1996-02-08 14:09:25 cg Exp $'
! !