checkin from browser
authorClaus Gittinger <cg@exept.de>
Thu, 23 Nov 1995 01:53:24 +0100
changeset 195 fb03114fa1c3
parent 194 e46dfa69f864
child 196 7e3c25063173
checkin from browser
FramedBox.st
--- a/FramedBox.st	Thu Nov 23 01:51:27 1995 +0100
+++ b/FramedBox.st	Thu Nov 23 01:53:24 1995 +0100
@@ -10,11 +10,8 @@
  hereby transferred.
 "
 
-'From Smalltalk/X, Version:2.10.5 on 9-may-1995 at 12:04:53 pm'!
-
 SimpleView subclass:#FramedBox
-	 instanceVariableNames:'label labelPosition fgColor showFrame frame3D
-				horizontalSpace'
+	 instanceVariableNames:'label labelPosition fgColor showFrame frame3D horizontalSpace'
 	 classVariableNames:''
 	 poolDictionaries:''
 	 category:'Views-Layout'
@@ -36,10 +33,6 @@
 "
 !
 
-version
-    ^ '$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.16 1995-11-11 16:20:28 cg Exp $'
-!
-
 documentation
 "
     a frame around something. The frame may have a label, whose position
@@ -168,6 +161,140 @@
 	box addOkButton.
 	box open
 "
+!
+
+version
+    ^ '$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.17 1995-11-23 00:53:24 cg Exp $'
+! !
+
+!FramedBox methodsFor:'accessing'!
+
+font:aFont
+    "set the frame labelstrings font"
+
+    (font ~= aFont) ifTrue:[
+	super font:aFont.
+	self redrawIfShown
+    ]
+!
+
+foregroundColor
+    "return the frame labels foreground color"
+
+    ^ fgColor
+!
+
+foregroundColor:aColor
+    "set the frame labels foreground color"
+
+    aColor ~= fgColor ifTrue:[
+	fgColor := aColor.
+	self redrawIfShown
+    ]
+!
+
+frameShown
+    "return true, if frame is shown;
+     if false, oly the label is shown.
+     OBSOLETE; use #showFrame."
+
+    ^ showFrame
+!
+
+horizontalSpace
+    "return the number of pixels by which the frame is inset horizontally.
+     The default, nil, lets the box compute the horizontal inset from the
+     labels font height."
+
+    ^ horizontalSpace
+
+    "Modified: 5.9.1995 / 17:24:21 / claus"
+!
+
+horizontalSpace:aNumber 
+    "set the number of pixels by which the frame is inset horizontally.
+     The default, nil, lets the box compute the horizontal inset from the
+     labels font height."
+
+    horizontalSpace := aNumber
+!
+
+label
+    "return the frames labelstring"
+
+    ^ label
+!
+
+label:aString
+    "set the frames labelstring"
+
+    (label ~= aString) ifTrue:[
+	aString isEmpty ifTrue:[
+	    label := nil
+	] ifFalse:[
+	    label := aString.
+	].
+	self redrawIfShown
+    ]
+
+    "Modified: 5.9.1995 / 17:20:05 / claus"
+!
+
+labelPosition
+    "return the labelPosition, which is a symbol describing
+     the labels position."
+
+    ^ 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:something
+    "OBSOLETE compatibility interface. Will vanish.
+     In the meantime, try to figure out what is meant ... a kludge"
+
+    something isLayout ifTrue:[^ super layout:something].
+
+    self obsoleteMethodWarning:'use #labelPosition:'.
+    ^ self labelPosition:something
+
+    "Modified: 31.8.1995 / 23:07:00 / claus"
+!
+
+showFrame
+    "return if the view shows its frame.
+     If false, only the label is drawn"
+
+    ^ showFrame
+
+    "Modified: 5.9.1995 / 17:21:37 / claus"
+!
+
+showFrame:aBoolean
+    "turn on/off showing of the frame -
+     without a frame, only the label is shown at its position"
+
+    aBoolean ~~ showFrame ifTrue:[
+	showFrame := aBoolean.
+	self redrawIfShown
+    ]
 ! !
 
 !FramedBox methodsFor:'drawing'!
@@ -273,8 +400,57 @@
     ]
 ! !
 
+!FramedBox methodsFor:'event handling'!
+
+sizeChanged:how
+    self redrawIfShown.
+    super sizeChanged:how
+! !
+
+!FramedBox methodsFor:'initialization'!
+
+initStyle
+    "default position is top-center, except for ms-windows, where
+     the text is positioned at top-left"
+
+    super initStyle.
+
+    fgColor := StyleSheet at:'framedBoxForegroundColor' default:Black.
+    labelPosition := StyleSheet at:'framedBoxLabelPosition' default:#topCenter.
+    frame3D := StyleSheet at:'framedBox3DFrame' default:true.
+    borderWidth := 0.
+!
+
+initialize
+    super initialize.
+    showFrame := true
+! !
+
+!FramedBox methodsFor:'private'!
+
+redrawIfShown
+    shown ifTrue:[
+	self clear.
+	self redraw
+    ]
+! !
+
 !FramedBox methodsFor:'queries'!
 
+preferredExtent
+    "redefined to add space for the frame to the default extent" 
+
+    |m2 sep|
+
+    sep := font height.
+    m2 := sep + sep.
+
+    showFrame ifFalse:[
+	^ super preferredExtent + (0 @ m2)
+    ].
+    ^ super preferredExtent+(m2 @ m2)
+!
+
 viewRectangle
     "return the inside area 
      - redefined to save frame from relative computations."
@@ -298,184 +474,5 @@
 "/    ].
 "/    sepH := sepV // 2.
 "/    ^ (sepH @ sepH) extent:((width - sepH - sepH) @ (height - sepV - sepV))
-!
-
-preferredExtent
-    "redefined to add space for the frame to the default extent" 
-
-    |m2 sep|
-
-    sep := font height.
-    m2 := sep + sep.
-
-    showFrame ifFalse:[
-	^ super preferredExtent + (0 @ m2)
-    ].
-    ^ super preferredExtent+(m2 @ m2)
-! !
-
-!FramedBox methodsFor:'private'!
-
-redrawIfShown
-    shown ifTrue:[
-	self clear.
-	self redraw
-    ]
 ! !
 
-!FramedBox methodsFor:'accessing'!
-
-label:aString
-    "set the frames labelstring"
-
-    (label ~= aString) ifTrue:[
-	aString isEmpty ifTrue:[
-	    label := nil
-	] ifFalse:[
-	    label := aString.
-	].
-	self redrawIfShown
-    ]
-
-    "Modified: 5.9.1995 / 17:20:05 / claus"
-!
-
-foregroundColor
-    "return the frame labels foreground color"
-
-    ^ fgColor
-!
-
-foregroundColor:aColor
-    "set the frame labels foreground color"
-
-    aColor ~= fgColor ifTrue:[
-	fgColor := aColor.
-	self redrawIfShown
-    ]
-!
-
-frameShown
-    "return true, if frame is shown;
-     if false, oly the label is shown.
-     OBSOLETE; use #showFrame."
-
-    ^ showFrame
-!
-
-showFrame
-    "return if the view shows its frame.
-     If false, only the label is drawn"
-
-    ^ showFrame
-
-    "Modified: 5.9.1995 / 17:21:37 / claus"
-!
-
-showFrame:aBoolean
-    "turn on/off showing of the frame -
-     without a frame, only the label is shown at its position"
-
-    aBoolean ~~ showFrame ifTrue:[
-	showFrame := aBoolean.
-	self redrawIfShown
-    ]
-!
-
-label
-    "return the frames labelstring"
-
-    ^ label
-!
-
-font:aFont
-    "set the frame labelstrings font"
-
-    (font ~= aFont) ifTrue:[
-	super font:aFont.
-	self redrawIfShown
-    ]
-!
-
-labelPosition
-    "return the labelPosition, which is a symbol describing
-     the labels position."
-
-    ^ 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
-    ]
-!
-
-horizontalSpace:aNumber 
-    "set the number of pixels by which the frame is inset horizontally.
-     The default, nil, lets the box compute the horizontal inset from the
-     labels font height."
-
-    horizontalSpace := aNumber
-!
-
-horizontalSpace
-    "return the number of pixels by which the frame is inset horizontally.
-     The default, nil, lets the box compute the horizontal inset from the
-     labels font height."
-
-    ^ horizontalSpace
-
-    "Modified: 5.9.1995 / 17:24:21 / claus"
-!
-
-layout
-    "OBSOLETE compatibility interface. Will vanish"
-
-    self obsoleteMethodWarning:'use #labelPosition'.
-    ^ labelPosition
-!
-
-layout:something
-    "OBSOLETE compatibility interface. Will vanish.
-     In the meantime, try to figure out what is meant ... a kludge"
-
-    something isLayout ifTrue:[^ super layout:something].
-
-    self obsoleteMethodWarning:'use #labelPosition:'.
-    ^ self labelPosition:something
-
-    "Modified: 31.8.1995 / 23:07:00 / claus"
-! !
-
-!FramedBox methodsFor:'initialization'!
-
-initialize
-    super initialize.
-    showFrame := true
-!
-
-initStyle
-    "default position is top-center, except for ms-windows, where
-     the text is positioned at top-left"
-
-    super initStyle.
-
-    fgColor := StyleSheet at:'framedBoxForegroundColor' default:Black.
-    labelPosition := StyleSheet at:'framedBoxLabelPosition' default:#topCenter.
-    frame3D := StyleSheet at:'framedBox3DFrame' default:true.
-    borderWidth := 0.
-! !
-
-!FramedBox methodsFor:'event handling'!
-
-sizeChanged:how
-    self redrawIfShown.
-    super sizeChanged:how
-! !
-