#UI_ENHANCEMENT by cg expecco_18_1_0_6496
authorClaus Gittinger <cg@exept.de>
Fri, 17 Aug 2018 17:36:55 +0200
changeset 5890 99d778b7d1a3
parent 5889 42b2e8de59ef
child 5893 0e4e5bb48484
#UI_ENHANCEMENT by cg class: DSVColumnView draw different icons when disabled (grey) class definition comment/format in: #drawCheckToggleAtX:y:w:state: changed: #drawComboButtonAtX:y:w: #drawRadioButtonAtX:y:w:state: #initStyle class: DSVColumnView class comment/format in: #updateStyleCache
DSVColumnView.st
--- a/DSVColumnView.st	Fri Aug 17 17:29:35 2018 +0200
+++ b/DSVColumnView.st	Fri Aug 17 17:36:55 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
               All Rights Reserved
@@ -24,27 +26,31 @@
 		verticalSpacing horizontalSpacing rowSelectorForm
 		buttonLightColor buttonShadowColor buttonHalfLightColor
 		buttonHalfShadowColor checkToggleExtent checkToggleForm
-		checkToggleActiveImage checkTogglePassiveImage checkToggleLevel
-		radioButtonActiveImage radioButtonPassiveImage comboButtonExtent
-		comboButtonForm comboButtonLevel dropSource columnAdaptor
-		tabAtEndAction tabAtStartAction modifiedChannel autoScroll
-		autoScrollBlock needFitColumns scrollWhenUpdating
-		separatorOneDColor selectionForegroundColor
-		selectionForegroundColorNoFocus selectionBackgroundColor
-		selectionBackgroundColorNoFocus selectionFrameColor
-		selectionFrameColorNoFocus previousExtent selectConditionBlock
-		scrollRowWise autoScrollToColumn cachedPreferredExtent
-		sortListInPlace labelFgColor labelBgColor
+		checkToggleActiveImage checkTogglePassiveImage
+		checkToggleDisabledActiveImage checkToggleDisabledPassiveImage
+		checkToggleLevel radioButtonActiveImage radioButtonPassiveImage
+		radioButtonDisabledActiveImage radioButtonDisabledPassiveImage
+		comboButtonExtent comboButtonForm comboButtonDisabledForm
+		comboButtonLevel dropSource columnAdaptor tabAtEndAction
+		tabAtStartAction modifiedChannel autoScroll autoScrollBlock
+		needFitColumns scrollWhenUpdating separatorOneDColor
+		selectionForegroundColor selectionForegroundColorNoFocus
+		selectionBackgroundColor selectionBackgroundColorNoFocus
+		selectionFrameColor selectionFrameColorNoFocus previousExtent
+		selectConditionBlock scrollRowWise autoScrollToColumn
+		cachedPreferredExtent sortListInPlace labelFgColor labelBgColor
 		updateListHolderWhenSorting ignoreReselect'
 	classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
 		DefaultHilightForegroundColor DefaultHilightBackgroundColor
 		DefaultHilightFrameColor ButtonLightColor ButtonShadowColor
 		CheckToggleActiveImage CheckTogglePassiveImage
+		CheckToggleDisabledActiveImage CheckToggleDisabledPassiveImage
 		ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle
 		CheckToggleForm CheckToggleLevel CheckToggleExtent
-		ComboButtonForm ComboButtonLevel ComboButtonExtent
-		StopRedrawSignal RadioButtonActiveImage RadioButtonPassiveImage
-		PreselectAllWhenOpeningEditor
+		ComboButtonForm ComboButtonDisabledForm ComboButtonLevel
+		ComboButtonExtent StopRedrawSignal RadioButtonActiveImage
+		RadioButtonPassiveImage RadioButtonDisabledActiveImage
+		RadioButtonDisabledPassiveImage PreselectAllWhenOpeningEditor
 		DefaultHilightForegroundColorNoFocus
 		DefaultHilightBackgroundColorNoFocus DefaultLabelForegroundColor
 		DefaultLabelBackgroundColor'
@@ -238,12 +244,17 @@
             CheckToggleActiveImage := nil
         ]
     ].
+    "/ CheckToggleDisabledActiveImage := StyleSheet at:#'checkToggle.disabledActiveImage'.
+    "/ CheckToggleDisabledPassiveImage := StyleSheet at:#'checkToggle.disabledPassiveImage'.
+
     CheckToggleForm   := nil.
     CheckToggleLevel  := nil.
     CheckToggleExtent := nil.
 
     RadioButtonActiveImage := StyleSheet at:#'radioButton.activeImage'.
     RadioButtonPassiveImage := StyleSheet at:#'radioButton.passiveImage'.
+    "/ RadioButtonDisabledActiveImage := StyleSheet at:#'radioButton.disabledActiveImage'.
+    "/ RadioButtonDisabledPassiveImage := StyleSheet at:#'radioButton.disabledPassiveImage'.
     (RadioButtonActiveImage isNil or:[ RadioButtonPassiveImage isNil ]) ifTrue:[
         RadioButtonActiveImage := RadioButton roundOnForm.
         RadioButtonPassiveImage := RadioButton roundOffForm.
@@ -261,6 +272,7 @@
     "
 
     "Modified: / 20-01-2011 / 08:44:28 / cg"
+    "Modified (comment): / 17-08-2018 / 17:06:46 / Claus Gittinger"
 !
 
 verticalSpacing
@@ -2414,7 +2426,7 @@
     checkToggleActiveImage isNil ifTrue:[
         gc paint:bgColor.
         gc fillRectangleX:x y:y width:w height:h.
-        self drawEdgesAtX:x   y:y width:w height:h level:checkToggleLevel on:self.
+        self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self.
 
         state ifFalse:[
             ^ self
@@ -2422,12 +2434,20 @@
         gc paint:fgColor on:bgColor.
         form := checkToggleForm
     ] ifFalse:[
-        form := state
-                    ifTrue:[checkToggleActiveImage]
-                    ifFalse:[checkTogglePassiveImage].
+        form := self isEnabled
+                    ifTrue:[
+                        state
+                            ifTrue:[checkToggleActiveImage]
+                            ifFalse:[checkTogglePassiveImage]] 
+                    ifFalse:[
+                        state
+                            ifTrue:[(checkToggleDisabledActiveImage ? checkToggleActiveImage)]
+                            ifFalse:[(checkToggleDisabledPassiveImage ? checkTogglePassiveImage)]].
     ].
     e := (checkToggleExtent - form extent) // 2.
     gc displayForm:form x:(x + e x) y:(y + e y).
+
+    "Modified: / 17-08-2018 / 17:33:03 / Claus Gittinger"
 !
 
 drawComboButtonAtX:xTop y:yTop w:rowWidth
@@ -2449,7 +2469,15 @@
     gc fillRectangleX:x y:y width:w height:h.
     self drawEdgesAtX:x   y:y width:w height:h level:comboButtonLevel on:self.
     gc paint:fgColor on:bgColor.
-    gc displayForm:comboButtonForm x:(x + e x) y:(y + e y)
+    gc 
+        displayForm:
+            (self isEnabled 
+                ifTrue:[comboButtonForm]
+                ifFalse:[comboButtonDisabledForm ? comboButtonForm])
+        x:(x + e x) 
+        y:(y + e y)
+
+    "Modified: / 17-08-2018 / 17:35:20 / Claus Gittinger"
 !
 
 drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC
@@ -2483,15 +2511,22 @@
     x := xLeft + ((cellWidth - w) // 2).
     h odd ifTrue:[y := y + 1].
 
-    image := (aBooleanOrNil == true)
-                ifTrue:[radioButtonActiveImage]
-                ifFalse:[radioButtonPassiveImage].
+    image := self isEnabled
+                ifTrue:[
+                    (aBooleanOrNil == true)
+                        ifTrue:[radioButtonActiveImage]
+                        ifFalse:[radioButtonPassiveImage]]
+                ifFalse:[
+                    (aBooleanOrNil == true)
+                        ifTrue:[radioButtonDisabledActiveImage ? radioButtonActiveImage]
+                        ifFalse:[radioButtonDisabledPassiveImage ? radioButtonPassiveImage]].
 
     image := image onDevice:device.
 
     self displayForm:image x:x y:y.
 
     "Modified (format): / 04-02-2017 / 21:31:16 / cg"
+    "Modified: / 17-08-2018 / 17:36:23 / Claus Gittinger"
 ! !
 
 !DSVColumnView methodsFor:'enumerating columns'!
@@ -3405,6 +3440,15 @@
 
     checkToggleActiveImage  := CheckToggleActiveImage.
     checkTogglePassiveImage := CheckTogglePassiveImage.
+    
+    CheckToggleDisabledActiveImage isNil ifTrue:[
+        CheckToggleDisabledActiveImage := CheckToggle disabledActiveImage
+    ].    
+    CheckToggleDisabledPassiveImage isNil ifTrue:[
+        CheckToggleDisabledPassiveImage := CheckToggle disabledPassiveImage
+    ].    
+    checkToggleDisabledActiveImage  := CheckToggleDisabledActiveImage.
+    checkToggleDisabledPassiveImage := CheckToggleDisabledPassiveImage.
 
     CheckToggleForm isNil ifTrue:[
         widget            := CheckToggle new.
@@ -3420,6 +3464,15 @@
     radioButtonActiveImage  := RadioButtonActiveImage.
     radioButtonPassiveImage := RadioButtonPassiveImage.
 
+    RadioButtonDisabledActiveImage isNil ifTrue:[
+        RadioButtonDisabledActiveImage := RadioButton disabledActiveForm.
+    ].    
+    RadioButtonDisabledPassiveImage isNil ifTrue:[
+        RadioButtonDisabledPassiveImage := RadioButton disabledPassiveForm.
+    ].    
+    radioButtonDisabledActiveImage  := RadioButtonDisabledActiveImage.
+    radioButtonDisabledPassiveImage := RadioButtonDisabledPassiveImage.
+
     ComboButtonForm isNil ifTrue:[
         widget            := ComboListView new.
         button            := widget menuButton.
@@ -3429,10 +3482,15 @@
     ].
 
     comboButtonForm   := ComboButtonForm.
+    ComboButtonDisabledForm isNil ifTrue:[
+        ComboButtonDisabledForm := ComboView disabledForm
+    ].    
+    comboButtonDisabledForm   := ComboButtonDisabledForm.
     comboButtonLevel  := ComboButtonLevel.
     comboButtonExtent := ComboButtonExtent.
 
     "Modified: / 20-01-2012 / 15:48:13 / cg"
+    "Modified: / 17-08-2018 / 17:33:56 / Claus Gittinger"
 !
 
 initialize