DialogBox.st
changeset 2803 9f75a923238d
parent 2801 b40e6ba8bb95
child 2825 b06be3ac7186
--- a/DialogBox.st	Wed Sep 10 17:13:27 2003 +0200
+++ b/DialogBox.st	Wed Sep 10 17:13:48 2003 +0200
@@ -7611,6 +7611,31 @@
     ^ UISpecification from:(self specificationFor:aSelector)
 !
 
+maxPreferredWidthOfAddedComponents
+    "helper for computing my preferred extent.
+     That is the max component width"
+
+    ^ (addedComponents ? #())
+        inject:0 
+        into:[:max :element |
+                |eExt prefWidth scale rel relX|
+
+                prefWidth := element preferredExtent x.
+
+                "/ special (for your convenience)
+                "/ if the element has been added with a relative width,
+                "/ scale it to get at least its preferred width
+
+                (rel := element relativeExtent) notNil ifTrue:[
+                    relX := rel x.
+                    (relX isNil or:[relX isInteger]) ifFalse:[
+                        prefWidth := (prefWidth * (1 / relX)) rounded
+                    ].
+                ].
+                eExt := prefWidth + (element borderWidth * 2). "/ max:element extent x.
+                max max:(eExt + element leftInset + element rightInset)].
+!
+
 positionOffset
     "return the delta, by which the box should be displayed
      from the mouse pointer. Here, an offset is returned, which
@@ -7661,25 +7686,7 @@
     ].
 
     addedComponents notNil ifTrue:[
-        w := addedComponents 
-                inject:0 
-                into:[:max :element |
-                        |eExt prefWidth scale rel relX|
-
-                        prefWidth := element preferredExtent x.
-
-                        "/ special (for your convenience)
-                        "/ if the element has been added with a relative width,
-                        "/ scale it to get at least its preferred width
-
-                        (rel := element relativeExtent) notNil ifTrue:[
-                            relX := rel x.
-                            (relX isNil or:[relX isInteger]) ifFalse:[
-                                prefWidth := (prefWidth * (1 / relX)) rounded
-                            ].
-                        ].
-                        eExt := prefWidth + (element borderWidth * 2). "/ max:element extent x.
-                        max max:(eExt + element leftInset + element rightInset)].
+        w := self maxPreferredWidthOfAddedComponents.
     ] ifFalse:[
         w := super preferredExtent x.
     ].
@@ -7835,7 +7842,7 @@
 !DialogBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.223 2003-09-10 15:02:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/DialogBox.st,v 1.224 2003-09-10 15:13:48 cg Exp $'
 ! !
 
 DialogBox initialize!