TextView.st
changeset 5847 8dadbf008f64
parent 5845 40de1cfd6e16
child 5848 bb14cfcbbd0f
--- a/TextView.st	Thu Sep 08 15:47:10 2016 +0200
+++ b/TextView.st	Sat Sep 10 15:06:54 2016 +0200
@@ -14,26 +14,26 @@
 "{ NameSpace: Smalltalk }"
 
 ListView subclass:#TextView
-	instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
-		selectionEndCol clickPos clickStartLine clickStartCol clickLine
-		clickCol clickCount expandingTop wordStartCol wordStartLine
-		wordEndCol wordEndLine selectionFgColor selectionBgColor
-		selectStyle directoryForFileDialog defaultFileNameForFileDialog
-		externalEncoding contentsWasSaved searchAction lastSearchPattern
-		lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
-		lastSearchWasVariableSearch parenthesisSpecification dropSource
-		dragIsActive saveAction st80SelectMode searchBarActionBlock'
-	classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
-		DefaultSelectionBackgroundColor
-		DefaultAlternativeSelectionForegroundColor
-		DefaultAlternativeSelectionBackgroundColor MatchDelayTime
-		WordSelectCatchesBlanks LastSearchPatterns
-		NumRememberedSearchPatterns LastSearchIgnoredCase
-		LastSearchWasMatch DefaultParenthesisSpecification
-		LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
-		LastSearchWasReplace LastSearchReplacedString'
-	poolDictionaries:''
-	category:'Views-Text'
+        instanceVariableNames:'selectionStartLine selectionStartCol selectionEndLine
+                selectionEndCol clickPos clickStartLine clickStartCol clickLine
+                clickCol clickCount expandingTop wordStartCol wordStartLine
+                wordEndCol wordEndLine selectionFgColor selectionBgColor
+                selectStyle directoryForFileDialog defaultFileNameForFileDialog
+                externalEncoding contentsWasSaved searchAction lastSearchPattern
+                lastSearchWasMatch lastSearchIgnoredCase lastSearchDirection
+                lastSearchWasVariableSearch parenthesisSpecification dropSource
+                dragIsActive saveAction st80SelectMode searchBarActionBlock'
+        classVariableNames:'DefaultViewBackground DefaultSelectionForegroundColor
+                DefaultSelectionBackgroundColor
+                DefaultAlternativeSelectionForegroundColor
+                DefaultAlternativeSelectionBackgroundColor MatchDelayTime
+                WordSelectCatchesBlanks LastSearchPatterns
+                NumRememberedSearchPatterns LastSearchIgnoredCase
+                LastSearchWasMatch DefaultParenthesisSpecification
+                LastSearchWasMatchWithRegex LastSearchWasWrapAtEndOfText
+                LastSearchWasReplace LastSearchReplacedString'
+        poolDictionaries:''
+        category:'Views-Text'
 !
 
 !TextView class methodsFor:'documentation'!
@@ -1187,12 +1187,34 @@
     ^ selectionBgColor
 !
 
+selectionBackgroundColor:aColor
+    "set the selection-background color.
+     The default is defined by the styleSheet;
+     typically black-on-green for color displays and white-on-black for b&w displays."
+
+    selectionBgColor := aColor onDevice:device.
+    self hasSelection ifTrue:[
+        self invalidate
+    ]
+!
+
 selectionForegroundColor
     "return the selection-foreground color."
 
     ^ selectionFgColor
 !
 
+selectionForegroundColor:aColor
+    "set the selection-foreground color.
+     The default is defined by the styleSheet;
+     typically black-on-green for color displays and white-on-black for b&w displays."
+
+    selectionFgColor := aColor onDevice:device.
+    self hasSelection ifTrue:[
+        self invalidate
+    ]
+!
+
 selectionForegroundColor:color1 backgroundColor:color2
     "set both the selection-foreground and cursor background colors.
      The default is defined by the styleSheet;