--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ColoredListEntry.st Wed May 17 14:49:25 1995 +0200
@@ -0,0 +1,149 @@
+"
+ 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.
+"
+
+'From Smalltalk/X, Version:2.10.5 on 15-may-1995 at 8:03:34 am'!
+
+ListEntry subclass:#ColoredListEntry
+ instanceVariableNames:'color string'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Views-Support'
+!
+
+!ColoredListEntry 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.
+"
+!
+
+version
+"
+$Header: /cvs/stx/stx/libwidg2/ColoredListEntry.st,v 1.1 1995-05-17 12:48:41 claus Exp $
+"
+!
+
+documentation
+"
+ Instances of ColoredListEntry can be used in place of strings
+ as entries of the list in a ListView or SelectionInListView.
+"
+!
+
+examples
+"
+ putting colored entries into a SelectionInListView
+ (instead of strings)'
+
+ |v e myList tabs|
+
+ myList := OrderedCollection new.
+
+ myList add:(ColoredListEntry string:'red' color:Color red).
+ myList add:(ColoredListEntry string:'green' color:Color green).
+ myList add:(ColoredListEntry string:'blue' color:Color blue).
+ myList add:(ColoredListEntry string:'white' color:Color white).
+ myList add:(ColoredListEntry string:'black' color:Color black).
+ myList add:(ColoredListEntry string:'yellow' color:Color yellow).
+
+ v := SelectionInListView new.
+ v setList:myList expandTabs:false.
+ v open
+
+ in a selectionInList
+
+ |v e myList selList tabs|
+
+ myList := OrderedCollection new.
+
+ myList add:(ColoredListEntry string:'red' color:Color red).
+ myList add:(ColoredListEntry string:'green' color:Color green).
+ myList add:(ColoredListEntry string:'blue' color:Color blue).
+ myList add:(ColoredListEntry string:'white' color:Color white).
+ myList add:(ColoredListEntry string:'black' color:Color black).
+ myList add:(ColoredListEntry string:'yellow' color:Color yellow).
+
+ selList := SelectionInList new list:myList.
+
+ v := SelectionInListView on:selList.
+ v printItems:false.
+ v open
+
+
+ in a popUpList
+
+ |v e myList selList tabs|
+
+ myList := OrderedCollection new.
+
+ myList add:(ColoredListEntry string:'red' color:Color red).
+ myList add:(ColoredListEntry string:'green' color:Color green).
+ myList add:(ColoredListEntry string:'blue' color:Color blue).
+ myList add:(ColoredListEntry string:'white' color:Color white).
+ myList add:(ColoredListEntry string:'black' color:Color black).
+ myList add:(ColoredListEntry string:'yellow' color:Color yellow).
+
+ selList := SelectionInList new list:myList.
+
+ v := PopUpList on:selList.
+ v open
+"
+! !
+
+!ColoredListEntry class methodsFor:'instance creation'!
+
+string:aString color:aColor
+ ^ self new string:aString color:aColor
+! !
+
+!ColoredListEntry methodsFor:'drawing'!
+
+displayOn:aGC x:x y:y
+ "display the receiver on a GC"
+
+ aGC paint:color.
+ aGC displayString:string x:x y:y.
+! !
+
+!ColoredListEntry methodsFor:'accessing'!
+
+string:aString color:aColor
+ string := aString.
+ color := aColor
+! !
+
+!ColoredListEntry methodsFor:'converting'!
+
+string
+ ^ string
+!
+
+asString
+ ^ string
+! !
+
+!ColoredListEntry methodsFor:'queries'!
+
+widthIn:aGC
+ "return the width of the receiver when displayed in aGC"
+
+ ^ aGC font widthOf:string
+! !