Button.st
changeset 1021 73ec8663c4cb
parent 992 62c869350c73
child 1050 2335acd8efb8
--- a/Button.st	Tue Feb 18 13:14:28 1997 +0100
+++ b/Button.st	Tue Feb 18 13:25:53 1997 +0100
@@ -1784,7 +1784,8 @@
 preferredExtent
     "return my preferred extent - this is the minimum size I would like to have"
 
-    |extraH extraV|
+    |extraH extraV oldLogo wActive hActive wPassive hPassive
+     wMax hMax anyLogo|
 
     "/ If I have an explicit preferredExtent ..
 
@@ -1792,7 +1793,37 @@
         ^ preferredExtent
     ].
 
-    logo notNil ifTrue:[
+    "/ compute the max-extent of both passive- and activeLogos
+    "/ (if any)
+
+    wActive := wPassive := labelWidth.
+    hActive := hPassive := labelHeight.
+    oldLogo := logo.
+    anyLogo := false.
+
+    (activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
+        logo := activeLogo.
+        self computeLabelSize.
+        wActive := labelWidth.
+        hActive := labelHeight.
+        anyLogo := true.
+    ].
+    (passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[
+        logo := passiveLogo.
+        self computeLabelSize.
+        wPassive := labelWidth.
+        hPassive := labelHeight.
+        anyLogo := true.
+    ].
+    oldLogo ~~ logo ifTrue:[
+        logo := oldLogo.
+        self computeLabelSize.
+    ].
+
+    wMax := wActive max:wPassive.
+    hMax := hActive max:hPassive.
+
+    anyLogo ifTrue:[
 "
         extraH := extraV := (onLevel abs max:offLevel abs) + ViewSpacing * 2.
 "
@@ -1804,12 +1835,13 @@
             "add space for a frame around"
             extraH := extraH + 2. extraV := extraV + 2.
         ].
-        ^ (labelWidth + extraH) @ (labelHeight + extraV)
+
+        ^ (wMax + extraH) @ (hMax + extraV)
     ].
 
     ^ super preferredExtent
 
-    "Modified: 19.7.1996 / 20:43:42 / cg"
+    "Modified: 18.2.1997 / 13:22:52 / cg"
 !
 
 specClass
@@ -2048,5 +2080,5 @@
 !Button class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.75 1997-02-08 14:23:07 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.76 1997-02-18 12:25:53 cg Exp $'
 ! !