computeLabelSize refactorings
authorClaus Gittinger <cg@exept.de>
Wed, 21 Oct 2009 16:24:32 +0200
changeset 4000 aa7dd2f07400
parent 3999 f605cc13731e
child 4001 12dc99eb1717
computeLabelSize refactorings
Button.st
--- a/Button.st	Wed Oct 21 16:24:31 2009 +0200
+++ b/Button.st	Wed Oct 21 16:24:32 2009 +0200
@@ -1947,23 +1947,35 @@
     "Modified: / 9.9.1998 / 20:22:01 / cg"
 !
 
-computeLabelSize
-    "compute the extent needed to hold the label (plus the return form)"
-
-    super computeLabelSize.
-    ((isReturnButton or:[defaultable]) and:[shadowForm notNil]) ifTrue:[
-        labelWidth := labelWidth + (hSpace * 2) + shadowForm width.
-        labelHeight := labelHeight max: (shadowForm height "+ vSpace")
-    ]
-
-    "Modified: / 3.11.1997 / 09:15:52 / cg"
-!
-
 getLabelFromLabelChannel
     passiveLogo := labelChannel value.
     super getLabelFromLabelChannel.
 !
 
+rawLabelSizeOf:aLogo
+    "compute the extent needed to hold the label (plus the return form)"
+
+    |ext|
+
+    ext := super rawLabelSizeOf:aLogo.
+
+    (activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
+        ext := ext max:(super rawLabelSizeOf:activeLogo).
+    ].
+    (passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[
+        ext := ext max:(super rawLabelSizeOf:passiveLogo).
+    ].
+
+    ((isReturnButton or:[defaultable]) and:[shadowForm notNil]) ifTrue:[
+        ^ (ext x + (hSpace * 2) + shadowForm width)
+          @
+          (ext y max: (shadowForm height "+ vSpace"))
+    ].
+    ^ ext
+
+    "Modified: / 3.11.1997 / 09:15:52 / cg"
+!
+
 shiftLabelWhenPressed
     ^ self class == Button
 ! !
@@ -2356,5 +2368,9 @@
 !Button class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.144 2009-09-18 12:43:37 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.145 2009-10-21 14:24:32 cg Exp $'
+!
+
+version_CVS
+    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.145 2009-10-21 14:24:32 cg Exp $'
 ! !