class: InfoBox
authorClaus Gittinger <cg@exept.de>
Sat, 29 Aug 2015 18:08:03 +0200
changeset 5402 36164fbcd8dc
parent 5401 66cc0e730639
child 5403 569378fb6c8e
child 5404 50b74416cbd4
class: InfoBox class definition changed:6 methods new better geometry by using the inherited verticalPanel
InfoBox.st
--- a/InfoBox.st	Sat Aug 29 16:44:13 2015 +0200
+++ b/InfoBox.st	Sat Aug 29 18:08:03 2015 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "
  COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
@@ -11,8 +13,10 @@
 "
 "{ Package: 'stx:libwidg' }"
 
+"{ NameSpace: Smalltalk }"
+
 DialogBox subclass:#InfoBox
-	instanceVariableNames:'formLabel textLabel'
+	instanceVariableNames:'formAndLabelPanel formLabel textLabel'
 	classVariableNames:'InfoBitmap'
 	poolDictionaries:''
 	category:'Views-DialogBoxes'
@@ -283,6 +287,8 @@
 
     formLabel label:aForm.
     formLabel forceResize.
+    formAndLabelPanel forceResize.
+    verticalPanel forceResize.
     shown ifTrue:[self resize]
 !
 
@@ -306,6 +312,8 @@
     aString ~= textLabel label ifTrue:[
         textLabel label:aString.
         textLabel forceResize.
+        formAndLabelPanel forceResize.
+        verticalPanel forceResize.
         shown ifTrue:[self resize]
     ]
 
@@ -316,13 +324,7 @@
     "set the boxes label string"
 
     self label:windowLabel.
-    aString ~= textLabel label ifTrue:[
-        textLabel label:aString.
-        textLabel forceResize.
-        shown ifTrue:[self resize]
-    ]
-
-    "Created: / 22-12-2010 / 19:32:12 / cg"
+    self title:aString.
 ! !
 
 !InfoBox methodsFor:'initialization'!
@@ -343,10 +345,10 @@
 
     mm := ViewSpacing.
 
-    formLabel := Label in:self.
+    formLabel := Label in:formAndLabelPanel.
     formLabel name: 'formLabel'.
     formLabel borderWidth:0.
-    formLabel origin:(mm @ mm).
+"/    formLabel origin:(mm @ mm).
 
     "Created: / 16-11-1995 / 18:32:32 / cg"
     "Modified: / 22-04-1996 / 18:15:37 / cg"
@@ -361,26 +363,32 @@
 
 "/    label := 'Info'.
 
-    mm := ViewSpacing.
+"/    mm := ViewSpacing.
+
+    formAndLabelPanel := HorizontalPanelView in:self verticalPanel.
 
     self initFormLabel.
     self initFormBitmap.
 
-    textLabel := Label label:'Information' in:self.
+    formLabel width > 500 ifTrue:[
+        textLabel := Label label:'Information' in:verticalPanel.
+    ] ifFalse:[
+        textLabel := Label label:'Information' in:formAndLabelPanel.
+    ].
     textLabel name: 'textLabel'.
     textLabel borderWidth:0.
-    textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm].
+    "/ textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm].
 
-    yPosition := textLabel corner y.
-    formLabel notNil ifTrue:[yPosition := yPosition max:(formLabel corner y)].
-    yPosition := yPosition + ViewSpacing.
+"/    yPosition := textLabel corner y.
+"/    formLabel notNil ifTrue:[yPosition := yPosition max:(formLabel corner y)].
+"/    yPosition := yPosition + ViewSpacing.
 
     (styleSheet at:'infoBoxSeparator' default:false) ifTrue:[
-        sep := Separator in:self.
-        sep origin:[0.0 @ ((formLabel bottom max:textLabel bottom) + mm)].
-        sep extent:(1.0 @ sep preferredHeight).
-        yPosition := yPosition max:(sep corner y).
-        yPosition := yPosition + ViewSpacing.
+        sep := Separator in:self verticalPanel.
+"/        sep origin:[0.0 @ ((formLabel bottom max:textLabel bottom) + mm)].
+        sep width:1.0. "/ extent:(1.0 @ sep preferredHeight).
+"/        yPosition := yPosition max:(sep corner y).
+"/        yPosition := yPosition + ViewSpacing.
     ].
 
     "
@@ -411,6 +419,8 @@
 
     |w h mm|
 
+^ super preferredExtent.
+
     "/ If I have an explicit preferredExtent..
     explicitExtent notNil ifTrue:[
         ^ explicitExtent
@@ -447,10 +457,10 @@
 !InfoBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.52 2014-01-16 14:33:19 stefan Exp $'
+    ^ '$Header$'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.52 2014-01-16 14:33:19 stefan Exp $'
+    ^ '$Header$'
 ! !