enteredlogo
authorClaus Gittinger <cg@exept.de>
Thu, 14 Oct 2004 12:45:30 +0200
changeset 3052 1952f628ae28
parent 3051 960f079de5bf
child 3053 8eb138f13963
enteredlogo
Button.st
--- a/Button.st	Thu Oct 14 11:58:05 2004 +0200
+++ b/Button.st	Thu Oct 14 12:45:30 2004 +0200
@@ -17,7 +17,8 @@
 		disabledFgColor disabledEtchedFgColor activeFgColor activeBgColor
 		enteredFgColor enteredBgColor isReturnButton shadowForm lightForm
 		formColor formShadowColor formLightColor edgeStyle
-		halfShadowColor halfLightColor defaultable enterLevel leaveLevel'
+		halfShadowColor halfLightColor defaultable enterLevel leaveLevel
+		enteredLogo'
 	classVariableNames:'ReturnForm ReturnLightForm ReturnShadowForm DefaultActiveLevel
 		DefaultPassiveLevel DefaultEdgeStyle DefaultBorderWidth
 		DefaultForegroundColor DefaultBackgroundColor
@@ -440,7 +441,7 @@
           top extent:100@100.
 
           b := Button in:top.
-          b passiveLogo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
+          b passiveLogo:(Image fromFile:'../../goodies/bitmaps/xpmBitmaps/misc_tools/email.xpm').
           b activeLogo:'start'.
           b action:[Transcript flash].
           b enteredForegroundColor:(Color red).
@@ -459,32 +460,13 @@
           top extent:100@100.
 
           b := Button in:top.
-          b logo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
+          b logo:(Image fromFile:'../../goodies/bitmaps/xbmBitmaps/TicTacToe.xbm').
           b action:[Transcript flash].
           b foregroundColor:(Color red:0 green:80 blue:20) darkened.
           b backgroundColor:(Color grey:10).
           b enteredForegroundColor:(Color red).
           b activeForegroundColor:(Color red).
-          b activeBackgroundColor:(Color grey:10).
-          top open.
-                                                                        [exEnd]
-
-
-    more playing with colors:
-                                                                        [exBegin]
-          |top b|
-
-          top := StandardSystemView new.
-          top extent:100@100.
-
-          b := Button in:top.
-          b logo:(Image fromFile:'bitmaps/SmalltalkX.xbm').
-          b action:[Transcript flash].
-          b foregroundColor:(Color red:0 green:80 blue:20) darkened.
-          b backgroundColor:(Color grey:10).
-          b enteredBackgroundColor:(Color grey:20).
-          b activeForegroundColor:(Color red).
-          b activeBackgroundColor:(Color grey:20).
+          b activeBackgroundColor:(Color grey:50).
           top open.
                                                                         [exEnd]
 
@@ -1370,6 +1352,17 @@
     enteredFgColor := aColor
 !
 
+enteredLogo:anImageOrString
+    "define the logo to be displayed while the mousePointer is in the button -
+     this is optional; the default is to display the same
+     (logo) in both entered and normal states."
+
+    enteredLogo := anImageOrString.
+    controller entered ifTrue:[
+        self logo:anImageOrString
+    ]
+!
+
 focusLogo:anImageOrString
     "define the logo to be displayed while active -
      this is optional; the default is to display the same
@@ -2128,27 +2121,23 @@
     ].
 
     savLogo := logo.
-    disabledLogo notNil ifTrue:[
-        isEnabled ifFalse:[
-            logo := disabledLogo.
-        ] ifTrue:[
-            controller active ifTrue:[
-                logo := activeLogo
-            ] ifFalse:[
-                logo := passiveLogo
-            ].
-        ].
+
+    (controller active or:[controller pressed]) ifTrue:[
+        logo := activeLogo ? enteredLogo ? savLogo. 
     ] ifFalse:[
-        controller active ifTrue:[
-            logo := activeLogo. 
-        ] ifFalse:[
-            logo := passiveLogo
+        logo := passiveLogo ? savLogo.
+        (enteredLogo notNil and:[controller entered]) ifTrue:[
+            logo := enteredLogo.
         ].
     ].
-    logo := savLogo.
+    (disabledLogo notNil and:[isEnabled not]) ifTrue:[
+        logo := disabledLogo.
+    ].
 
     self drawWith:fg and:bg clearInside:true etchedFg:etchFg.   "this draws the text/image"
 
+    logo := savLogo.
+
     (isReturnButton and:[shadowForm notNil]) ifTrue:[
         y := (height - shadowForm height) // 2.
         x := width - shadowForm width - (hSpace // 2).
@@ -2300,9 +2289,9 @@
     onLevel ~~ level ifTrue:[
         self level:onLevel.
     ].
-    (activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
-        self logo:activeLogo
-    ].
+"/    (activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
+"/        self logo:activeLogo
+"/    ].
     self invalidate
 
     "Modified: 26.5.1996 / 18:08:52 / cg"
@@ -2325,5 +2314,5 @@
 !Button class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.132 2004-09-20 09:27:32 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.133 2004-10-14 10:45:30 cg Exp $'
 ! !