RadioButton.st
changeset 1954 dc1e397855dc
parent 1892 110a6e458b5a
child 1958 9d53df393af1
--- a/RadioButton.st	Wed Jul 07 22:56:09 1999 +0200
+++ b/RadioButton.st	Thu Jul 08 11:30:35 1999 +0200
@@ -14,8 +14,9 @@
 	instanceVariableNames:'buttonStyle buttonOnLevel buttonOffLevel buttonOffImage
 		buttonOnImage'
 	classVariableNames:'DefaultButtonStyle DefaultActiveLevel DefaultPassiveLevel
-		MotifCheckBotForm MotifCheckTopForm Round3DCheckBotForm
-		Round3DCheckTopForm RoundHalfLightForm RoundOffForm RoundOnForm'
+		MotifCheckBotForm MotifCheckTopForm MotifCheckInnerForm
+		Round3DCheckBotForm Round3DCheckTopForm Round3DCheckInnerForm
+		RoundHalfLightForm RoundOffForm RoundOnForm'
 	poolDictionaries:''
 	category:'Views-Interactors'
 !
@@ -149,24 +150,24 @@
 motifCheckBotForm
     MotifCheckBotForm isNil ifTrue:[
         MotifCheckBotForm := Form 
-            width:15 
-            height:15 
-            fromArray:#[2r00000000 2r00000000
-                        2r00000000 2r00000000
-                        2r00000000 2r00000000
-                        2r00000000 2r00000000
-                        2r00000000 2r00000000
-                        2r00000000 2r00000000
-                        2r00000000 2r00000000
-                        2r00000000 2r00001110
-                        2r01110000 2r00011100
-                        2r00111000 2r00111000
-                        2r00011100 2r01110000
-                        2r00001110 2r11100000
-                        2r00000111 2r11000000
-                        2r00000011 2r10000000
-                        2r00000001 2r00000000
-                       ].
+                                width:15 
+                                height:15 
+                                fromArray:#[2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00001110
+                                            2r01110000 2r00011100
+                                            2r00111000 2r00111000
+                                            2r00011100 2r01110000
+                                            2r00001110 2r11100000
+                                            2r00000111 2r11000000
+                                            2r00000011 2r10000000
+                                            2r00000001 2r00000000
+                                           ].
         MotifCheckBotForm := MotifCheckBotForm onDevice:Display.
     ].
     ^ MotifCheckBotForm
@@ -175,6 +176,35 @@
     "Modified: / 30.7.1998 / 21:27:53 / cg"
 !
 
+motifCheckInnerForm
+    MotifCheckInnerForm isNil ifTrue:[
+        MotifCheckInnerForm := Form 
+                                width:15 
+                                height:15 
+                                fromArray:#[2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000001 2r00000000
+                                            2r00000011 2r10000000
+                                            2r00000111 2r11000000
+                                            2r00001111 2r11100000
+                                            2r00011111 2r11110000
+                                            2r00001111 2r11100000
+                                            2r00000111 2r11000000
+                                            2r00000011 2r10000000
+                                            2r00000001 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                           ].
+        MotifCheckInnerForm := MotifCheckInnerForm onDevice:Display
+    ].
+    ^ MotifCheckInnerForm
+
+    "Created: / 3.11.1997 / 12:06:45 / cg"
+    "Modified: / 30.7.1998 / 21:28:45 / cg"
+!
+
 motifCheckTopForm
     MotifCheckTopForm isNil ifTrue:[
         MotifCheckTopForm := Form 
@@ -233,6 +263,36 @@
     "Modified: / 30.7.1998 / 21:29:57 / cg"
 !
 
+round3DCheckInnerForm
+    Round3DCheckInnerForm isNil ifTrue:[
+        Round3DCheckInnerForm := Form 
+                                width:15 
+                                height:15 
+                                fromArray:#[2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                            2r00000111 2r11000000
+                                            2r00001111 2r11100000
+                                            2r00011111 2r11110000
+                                            2r00111111 2r11111000
+                                            2r00111111 2r11111000
+                                            2r00111111 2r11111000
+                                            2r00111111 2r11111000
+                                            2r00111111 2r11111000
+                                            2r00011111 2r11110000
+                                            2r00001111 2r11100000
+                                            2r00000111 2r11000000
+                                            2r00000000 2r00000000
+                                            2r00000000 2r00000000
+                                           ].
+
+        Round3DCheckInnerForm := Round3DCheckInnerForm onDevice:Display.
+    ].
+    ^ Round3DCheckInnerForm
+
+    "Created: / 3.11.1997 / 14:29:45 / cg"
+    "Modified: / 30.7.1998 / 21:30:47 / cg"
+!
+
 round3DCheckTopForm
     Round3DCheckTopForm isNil ifTrue:[
         Round3DCheckTopForm := Form 
@@ -329,9 +389,28 @@
 roundOffForm
     RoundOffForm isNil ifTrue:[
         RoundOffForm := Form 
-            width:15 
-            height:15 
-            fromArray:#[2r00000011 2r10000000
+            width:16 
+            height:16 
+            fromArray:#[
+
+"/                        2r00000011 2r10000000
+"/                        2r00001111 2r11100000
+"/                        2r00111100 2r01111000
+"/                        2r00110000 2r00011000
+"/                        2r01100000 2r00001100
+"/                        2r01100000 2r00001100
+"/                        2r11000000 2r00000110
+"/                        2r11000000 2r00000110
+"/                        2r11000000 2r00000110
+"/                        2r01100000 2r00001100
+"/                        2r01100000 2r00001100
+"/                        2r00110000 2r00011000
+"/                        2r00111100 2r01111000
+"/                        2r00001111 2r11100000
+"/                        2r00000011 2r10000000
+"/                        2r00000000 2r00000000
+
+                        2r00000011 2r10000000
                         2r00001100 2r01100000
                         2r00010000 2r00010000
                         2r00100000 2r00001000
@@ -346,24 +425,8 @@
                         2r00010000 2r00010000
                         2r00001100 2r01100000
                         2r00000011 2r10000000
+                        2r00000000 2r00000000
                        ].
-
-"/        fromArray:#[2r00000011 2r10000000
-"/                    2r00001111 2r11100000
-"/                    2r00111100 2r01111000
-"/                    2r00110000 2r00011000
-"/                    2r01100000 2r00001100
-"/                    2r01100000 2r00001100
-"/                    2r11000000 2r00000110
-"/                    2r11000000 2r00000110
-"/                    2r11000000 2r00000110
-"/                    2r01100000 2r00001100
-"/                    2r01100000 2r00001100
-"/                    2r00110000 2r00011000
-"/                    2r00111100 2r01111000
-"/                    2r00001111 2r11100000
-"/                    2r00000011 2r10000000
-"/                   ]
         RoundOffForm := RoundOffForm onDevice:Display.
     ].
     ^ RoundOffForm
@@ -375,25 +438,28 @@
 roundOnForm
     RoundOnForm isNil ifTrue:[
         RoundOnForm := Form 
-                        width:15 
-                        height:15 
-"/        fromArray:#[2r00000000 2r00000000
-"/                    2r00000000 2r00000000
-"/                    2r00000000 2r00000000
-"/                    2r00000111 2r11000000
-"/                    2r00001111 2r11100000
-"/                    2r00011111 2r11110000
-"/                    2r00011111 2r11110000
-"/                    2r00011111 2r11110000
-"/                    2r00011111 2r11110000
-"/                    2r00011111 2r11110000
-"/                    2r00001111 2r11100000
-"/                    2r00000111 2r11000000
-"/                    2r00000000 2r00000000
-"/                    2r00000000 2r00000000
-"/                    2r00000000 2r00000000
-"/                   ]
-                        fromArray:#[2r00000000 2r00000000
+                        width:16 
+                        height:16 
+                        fromArray:#[
+
+"/                                    2r00000000 2r00000000
+"/                                    2r00000000 2r00000000
+"/                                    2r00000000 2r00000000
+"/                                    2r00000111 2r11000000
+"/                                    2r00001111 2r11100000
+"/                                    2r00011111 2r11110000
+"/                                    2r00011111 2r11110000
+"/                                    2r00011111 2r11110000
+"/                                    2r00011111 2r11110000
+"/                                    2r00011111 2r11110000
+"/                                    2r00001111 2r11100000
+"/                                    2r00000111 2r11000000
+"/                                    2r00000000 2r00000000
+"/                                    2r00000000 2r00000000
+"/                                    2r00000000 2r00000000
+"/                                    2r00000000 2r00000000
+
+                                    2r00000000 2r00000000
                                     2r00000000 2r00000000
                                     2r00000000 2r00000000
                                     2r00000000 2r00000000
@@ -408,13 +474,13 @@
                                     2r00000000 2r00000000
                                     2r00000000 2r00000000
                                     2r00000000 2r00000000
+                                    2r00000000 2r00000000
                                    ].
         RoundOnForm := RoundOnForm onDevice:Display.
     ].
     ^ RoundOnForm
 
-    "Created: / 3.11.1997 / 12:41:17 / cg"
-    "Modified: / 30.7.1998 / 21:33:39 / cg"
+    "RoundOnForm := nil. self updateStyleCache"
 !
 
 updateStyleCache
@@ -435,7 +501,8 @@
     DefaultButtonStyle == #motif ifTrue:[l := 1].
     DefaultPassiveLevel := StyleSheet at:#'radioButton.passiveLevel' default:l.
 
-    RoundOnForm := nil.
+    RoundOnForm := RoundOffForm := nil.
+
     f := StyleSheet at:#'radioButton.activeImageFile'.
     f notNil ifTrue:[
         f := Image fromFile:f.
@@ -446,7 +513,6 @@
         RoundOnForm := f onDevice:Display
     ].
 
-    RoundOffForm := nil.
     f := StyleSheet at:#'radioButton.passiveImageFile'.
     f notNil ifTrue:[
         f := Image fromFile:f.
@@ -466,6 +532,19 @@
 
 !RadioButton methodsFor:'accessing'!
 
+allViewBackground:something
+    "redefined here"
+
+    self backgroundColor:something.
+
+    (buttonStyle == #motif 
+    or:[buttonStyle == #round3D
+    or:[buttonStyle == #image]]) ifTrue:[
+        enteredBgColor := something.
+        activeBgColor := something.
+    ]
+!
+
 forceRadioButtonStyle
     "force the radioButton to be displayed as round/motif radio button -
      even if the styleSheet defaults differently.
@@ -496,7 +575,7 @@
 drawToggleImage
     "drawing of the radio image is done here."
 
-    |x y clrTop clrBot img1 img2 imgH imgOn threeD lvl
+    |x y clrTop clrBot imgTop imgBot imgInside imgH imgOn threeD lvl
      isActive|
 
     buttonStyle isNil ifTrue:[
@@ -507,12 +586,16 @@
 
     threeD := true.
     buttonStyle == #motif ifTrue:[
-        img1 := self class motifCheckTopForm.
-        img2 := self class motifCheckBotForm.
+        "/ square rotated by 45 degrees ...
+        imgTop := self class motifCheckTopForm.
+        imgBot := self class motifCheckBotForm.
+        imgInside := self class motifCheckInnerForm.
     ] ifFalse:[
         buttonStyle == #round3D ifTrue:[
-            img1 := self class round3DCheckTopForm.
-            img2 := self class round3DCheckBotForm.
+            "/ round 3D button ...
+            imgTop := self class round3DCheckTopForm.
+            imgBot := self class round3DCheckBotForm.
+            imgInside := self class round3DCheckInnerForm.
             imgH := self class roundHalfLightForm.
             buttonOnLevel == buttonOffLevel ifTrue:[
                 isActive ifTrue:[
@@ -521,12 +604,14 @@
             ].
         ] ifFalse:[
             buttonStyle == #image ifTrue:[
-                img1 := buttonOffImage.
+                "/ bitmap images ...
+                imgTop := buttonOffImage.
                 isActive ifTrue:[
                     imgOn := buttonOnImage.
                 ].
             ] ifFalse:[    
-                img1 := self class roundOffForm.
+                "/ round 2D ...
+                imgTop := self class roundOffForm.
                 isActive ifTrue:[
                     imgOn := self class roundOnForm.
                 ].
@@ -535,17 +620,18 @@
         ]
     ].
 
-    img1 notNil ifTrue:[img1 := img1 onDevice:device].
-    img2 notNil ifTrue:[img2 := img2 onDevice:device].
+    imgTop notNil ifTrue:[imgTop := imgTop onDevice:device].
+    imgBot notNil ifTrue:[imgBot := imgBot onDevice:device].
+    imgInside notNil ifTrue:[imgInside := imgInside onDevice:device].
     imgH notNil ifTrue:[imgH := imgH onDevice:device].
     imgOn notNil ifTrue:[imgOn := imgOn onDevice:device].
 
     x := hSpace + margin.
-    y := (height - img1 height) // 2.
+    y := (height - imgTop height) // 2.
 
     threeD ifFalse:[
         self paint:fgColor.
-        self displayForm:img1 x:x y:y.
+        self displayForm:imgTop x:x y:y.
         isActive ifTrue:[
             self paint:(lampColor ? activeFgColor).
             self displayForm:imgOn x:x y:y
@@ -561,18 +647,22 @@
             clrBot := shadowColor.
         ].
         self paint:clrTop.
-        self displayForm:img1 x:x y:y.
+        self displayForm:imgTop x:x y:y.
         self paint:clrBot.
-        self displayForm:img2 x:x y:y.
+        self displayForm:imgBot x:x y:y.
+
         (imgH notNil and:[halfShadowColor notNil]) ifTrue:[
             self paint:halfShadowColor.
             self displayForm:imgH x:x y:y
         ].
-        isActive ifTrue:[
-            imgOn notNil ifTrue:[
-                self paint:lampColor.
-                self displayForm:imgOn x:x y:y
-            ]
+
+        imgInside notNil ifTrue:[
+            self paint:(View defaultViewBackgroundColor).
+            self displayForm:imgInside x:x y:y
+        ].
+        (isActive and:[imgOn notNil]) ifTrue:[
+            self paint:lampColor.
+            self displayForm:imgOn x:x y:y
         ]
     ]
 
@@ -696,5 +786,5 @@
 !RadioButton class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/RadioButton.st,v 1.29 1999-04-29 20:07:39 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/RadioButton.st,v 1.30 1999-07-08 09:29:50 cg Exp $'
 ! !