'From Squeak3.6alpha of ''17 March 2003'' [latest update: #5205] on 16 May 2003 at 2:43:50 pm'! "Change Set: PLMTextColor-nk Date: 16 May 2003 Author: Ned Konz This adds the following methods to PluggableListMorph: textColor, textColor: answer or set the list text color textHighlightColor, textHighlightColor: answer or set the list highlighted text color "! !PluggableListMorph methodsFor: 'initialization' stamp: 'nk 5/16/2003 14:24'! list: listOfStrings "Set the receiver's list as specified" | morphList h loc index converter item aSelector textColor | scroller removeAllMorphs. list _ listOfStrings ifNil: [Array new]. list isEmpty ifTrue: [self setScrollDeltas. ^ self selectedMorph: nil]. "NOTE: we will want a quick StringMorph init message, possibly even combined with event install and positioning" font ifNil: [font _ Preferences standardListFont]. converter _ self valueOfProperty: #itemConversionMethod. converter ifNil: [converter _ #asStringOrText]. textColor _ self valueOfProperty: #textColor. morphList _ list collect: [:each | | stringMorph | item _ each. item _ item perform: converter. stringMorph _ item isText ifTrue: [StringMorph contents: item font: font emphasis: (item emphasisAt: 1)] ifFalse: [StringMorph contents: item font: font]. textColor ifNotNil: [ stringMorph color: textColor ]. stringMorph ]. (aSelector _ self valueOfProperty: #balloonTextSelectorForSubMorphs) ifNotNil: [morphList do: [:m | m balloonTextSelector: aSelector]]. self highlightSelector ifNotNil: [model perform: self highlightSelector with: list with: morphList]. "Lay items out vertically and install them in the scroller" h _ morphList first height "self listItemHeight". loc _ 0@0. morphList do: [:m | m bounds: (loc extent: 9999@h). loc _ loc + (0@h)]. scroller addAllMorphs: morphList. index _ self getCurrentSelectionIndex. self selectedMorph: ((index = 0 or: [index > morphList size]) ifTrue: [nil] ifFalse: [morphList at: index]). self setScrollDeltas. scrollBar setValue: 0.0! ! !PluggableListMorph methodsFor: 'initialization' stamp: 'nk 5/16/2003 14:41'! textColor "Answer my default text color." ^self valueOfProperty: #textColor ifAbsent: [ Color black ] ! ! !PluggableListMorph methodsFor: 'initialization' stamp: 'nk 5/16/2003 14:37'! textColor: aColor "Set my default text color." self setProperty: #textColor toValue: aColor. ! ! !PluggableListMorph methodsFor: 'initialization' stamp: 'nk 5/16/2003 14:40'! textHighlightColor "Answer my default text highlight color." ^self valueOfProperty: #textHighlightColor ifAbsent: [ Color red ]. ! ! !PluggableListMorph methodsFor: 'initialization' stamp: 'nk 5/16/2003 14:37'! textHighlightColor: aColor "Set my default text highlight color." self setProperty: #textHighlightColor toValue: aColor. ! ! !PluggableListMorph methodsFor: 'drawing' stamp: 'nk 5/16/2003 14:38'! highlightSelection selectedMorph ifNotNil: [selectedMorph color: self textHighlightColor; changed]! ! !PluggableListMorph methodsFor: 'drawing' stamp: 'nk 5/16/2003 14:41'! unhighlightSelection selectedMorph ifNotNil: [selectedMorph color: self textColor; changed]! !