class: ListModelView
fixed the following redraw bug (which is already fixed in SelectionInListView):
if a colored item is shown with selection, the color attribute should be
removed (or relaxed), to avoid drawing the label invisible.
I.e. if the text color is blue or grey, and the selection bg is blue.
we should draw white-on-blue, instead of blue/grey on blue.
For this to work, the info whether drawing a selection must be passed down
through the renderer to the item's draw routine.
--- a/ListModelView.st Sun Feb 01 14:14:45 2015 +0100
+++ b/ListModelView.st Sun Feb 01 14:15:13 2015 +0100
@@ -11,6 +11,8 @@
"
"{ Package: 'stx:libwidg2' }"
+"{ NameSpace: Smalltalk }"
+
View subclass:#ListModelView
instanceVariableNames:'list listHolder textStartLeft textStartTop viewOrigin enabled
fgColor bgColor lineSpacing widthOfContents computeWidthInRange
@@ -1894,6 +1896,13 @@
!ListModelView::Renderer methodsFor:'displaying'!
display:anItem atX:xLeft y:yTop lineHeight:h
+ "display the item on the view"
+
+ "/ obsolete - for backward compatibility
+ self display:anItem atX:xLeft y:yTop lineHeight:h isHighlightedAsSelected:false
+!
+
+display:anItem atX:xLeft y:yTop lineHeight:h isHighlightedAsSelected:isHighlightedAsSelected
"display the item on the view
"
|x0 y0 label|
@@ -1902,20 +1911,20 @@
y0 := yTop.
anItem isHierarchicalItem ifTrue:[
- anItem displayOn:view x:x0 y:y0 h:h
+ anItem displayOn:view x:x0 y:y0 h:h isHighlightedAsSelected:isHighlightedAsSelected
] ifFalse:[
- anItem isNil ifTrue:[^ self].
-
- y0 := y0 - ((self heightFor:anItem) + 1 - h // 2).
- label := anItem.
-
- label isImageOrForm ifFalse:[
- label isNumber ifTrue:[
- label := label printString
- ].
- y0 := y0 + view font ascent
- ].
- label displayOn:view x:x0 y:y0
+ anItem isNil ifTrue:[^ self].
+
+ y0 := y0 - (((self heightFor:anItem) + 1 - h) // 2).
+ label := anItem.
+
+ label isImageOrForm ifFalse:[
+ label isNumber ifTrue:[
+ label := label printString
+ ].
+ y0 := y0 + view font ascent
+ ].
+ label displayOn:view x:x0 y:y0
].
!
@@ -3385,11 +3394,11 @@
!ListModelView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.148 2014-07-08 21:22:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.149 2015-02-01 13:15:13 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.148 2014-07-08 21:22:21 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/ListModelView.st,v 1.149 2015-02-01 13:15:13 cg Exp $'
! !