FramedBox.st
changeset 130 338e856bddc9
parent 125 3ffa271732f7
child 133 e58c7c979f33
--- a/FramedBox.st	Fri May 19 18:41:01 1995 +0200
+++ b/FramedBox.st	Tue Jun 06 06:16:07 1995 +0200
@@ -13,7 +13,7 @@
 'From Smalltalk/X, Version:2.10.5 on 9-may-1995 at 12:04:53 pm'!
 
 SimpleView subclass:#FramedBox
-	 instanceVariableNames:'label layout fgColor showFrame frame3D'
+	 instanceVariableNames:'label labelPosition fgColor showFrame frame3D'
 	 classVariableNames:''
 	 poolDictionaries:''
 	 category:'Views-Layout'
@@ -23,7 +23,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.11 1995-05-09 01:55:43 claus Exp $
+$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.12 1995-06-06 04:13:36 claus Exp $
 '!
 
 !FramedBox class methodsFor:'documentation'!
@@ -44,14 +44,14 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.11 1995-05-09 01:55:43 claus Exp $
+$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.12 1995-06-06 04:13:36 claus Exp $
 "
 !
 
 documentation
 "
     a frame around something. The frame may have a label, whose position
-    is controlled by the layout variable, aSymbol which may be one of:
+    is controlled by the labelPosition variable, aSymbol which may be one of:
     [#topCenter #topLeft #topRight #bottomLeft #bottomCenter #bottomRight]
 
     Its also possible, to not show the frame but only the label, by setting
@@ -237,17 +237,36 @@
 
     labelLen > 0 ifTrue:[
 	labelLen < width ifTrue:[
-	    (#(topLeft topCenter topRight) includes:layout) ifTrue:[
+	    (labelPosition == #topLeft 
+	    or:[labelPosition == #topCenter
+	    or:[labelPosition == #topRight]]) ifTrue:[
+		"
+		 label at top
+		"
 		y := font ascent.
 	    ] ifFalse:[
+		"
+		 label at bottom
+		"
 		y := height - font descent.
 	    ].
-	    (#(topLeft bottomLeft) includes:layout) ifTrue:[
+	    (labelPosition == #topLeft
+	    or:[labelPosition == #bottomLeft]) ifTrue:[
+		"
+		 label at left
+		"
 		x := font height
 	    ] ifFalse:[
-		(#(topRight bottomRight) includes:layout) ifTrue:[
+		(labelPosition == #topRight
+		or:[labelPosition == #bottomRight]) ifTrue:[
+		    "
+		     label at right
+		    "
 		    x := width - labelLen - font height
 		] ifFalse:[
+		    "
+		     label at center
+		    "
 		    x := (width - labelLen) // 2
 		]
 	    ].
@@ -284,7 +303,7 @@
 "/    ^ (sepH @ sepH) extent:((width - sepH - sepH) @ (height - sepV - sepV))
 !
 
-preferedExtent
+preferredExtent
     "redefined to add space for the frame to the default extent" 
 
     |m2 sep|
@@ -293,9 +312,9 @@
     m2 := sep + sep.
 
     showFrame ifFalse:[
-        ^ super preferedExtent + (0 @ m2)
+        ^ super preferredExtent + (0 @ m2)
     ].
-    ^ super preferedExtent+(m2 @ m2)
+    ^ super preferredExtent+(m2 @ m2)
 ! !
 
 !FramedBox methodsFor:'private'!
@@ -365,22 +384,37 @@
     ]
 !
 
-layout
-    "return the current layout, which is a symbol describing
+labelPosition
+    "return the labelPosition, which is a symbol describing
      the labels position."
 
-    ^ layout
+    ^ labelPosition
+!
+
+labelPosition:aSymbol
+    "define the position of the label;
+     aSymbol may be one of: 
+	#topLeft, #topCenter, #topRight;
+        #bottomLeft, #bottomCenter or #bottomRight"
+
+    labelPosition ~~ aSymbol ifTrue:[
+	labelPosition := aSymbol.
+	self redrawIfShown
+    ]
+!
+
+layout
+    "OBSOLETE compatibility interface. Will vanish"
+
+    self obsoleteMethodWarning:'use #labelPosition'.
+    ^ labelPosition
 !
 
 layout:aSymbol
-    "define the position of the label;
-     aSymbol may be: #topLeft, #topCenter, #topRight;
-     #bottomLeft, #bottomCenter or #bottomRight"
+    "OBSOLETE compatibility interface. Will vanish"
 
-    layout ~~ aSymbol ifTrue:[
-	layout := aSymbol.
-	self redrawIfShown
-    ]
+    self obsoleteMethodWarning:'use #labelPosition:'.
+    ^ self labelPosition:aSymbol
 ! !
 
 !FramedBox methodsFor:'initialization'!
@@ -397,7 +431,7 @@
     super initStyle.
 
     fgColor := StyleSheet at:'framedBoxForegroundColor' default:Black.
-    layout := StyleSheet at:'framedBoxLabelPosition' default:#topCenter.
+    labelPosition := StyleSheet at:'framedBoxLabelPosition' default:#topCenter.
     frame3D := StyleSheet at:'framedBox3DFrame' default:true.
 ! !