FramedBox.st
changeset 1019 0d027812861e
parent 993 51cce445b5d5
child 1084 f890ae939e49
--- a/FramedBox.st	Fri Feb 14 19:11:14 1997 +0100
+++ b/FramedBox.st	Mon Feb 17 11:09:46 1997 +0100
@@ -82,6 +82,20 @@
                                                                         [exEnd]
 
 
+    non-string label:
+                                                                        [exBegin]
+        |top frame|
+
+        top := StandardSystemView new.
+        top extent:300@200.
+
+        frame := FramedBox origin:0.0@0.0 corner:1.0@1.0 in:top.
+        frame label:(Image fromFile:'bitmaps/SBrowser.xbm').
+
+        top open
+                                                                        [exEnd]
+
+
     placing something inside:
                                                                         [exBegin]
         |top frame1 frame2 frame3 v1 v2 v3|
@@ -343,14 +357,15 @@
     ^ label
 !
 
-label:aString
-    "set the frames labelstring"
+label:aStringOrImage
+    "set the frames labelstring or labelImage"
 
-    (label ~= aString) ifTrue:[
-        aString isEmpty ifTrue:[
+    (label ~= aStringOrImage) ifTrue:[
+        (aStringOrImage isString 
+        and:[aStringOrImage isEmpty]) ifTrue:[
             label := nil
         ] ifFalse:[
-            label := aString.
+            label := aStringOrImage.
         ].
         shown ifTrue:[
             self invalidate
@@ -358,7 +373,7 @@
     ]
 
     "Modified: 5.9.1995 / 17:20:05 / claus"
-    "Modified: 8.2.1997 / 15:20:19 / cg"
+    "Modified: 17.2.1997 / 11:08:14 / cg"
 !
 
 labelPosition
@@ -403,6 +418,25 @@
     "Modified: 31.8.1995 / 23:07:00 / claus"
 !
 
+setLabel:anImage
+    "set the frames label.
+     same as #label: for ST-80 GroupBox compatibility"
+
+    ^ self label:anImage
+
+    "Created: 17.2.1997 / 11:03:04 / cg"
+    "Modified: 17.2.1997 / 11:03:24 / cg"
+!
+
+setLabelString:anImage
+    "set the frames label.
+     same as #label: for ST-80 GroupBox compatibility"
+
+    ^ self label:anImage
+
+    "Modified: 17.2.1997 / 11:03:19 / cg"
+!
+
 showFrame
     "return if the view shows its frame.
      If false, only the label is drawn"
@@ -460,7 +494,7 @@
     label isNil ifTrue:[
         halfSepX := halfSepY := 2
     ] ifFalse:[
-        halfSepX := halfSepY := (font heightOn:device) // 2.
+        halfSepX := halfSepY := (label heightOn:self) // 2.
     ].
 
     horizontalSpace notNil ifTrue:[
@@ -496,7 +530,7 @@
                      width:w 
                     height:h.
 
-    "Modified: 3.1.1997 / 22:01:48 / cg"
+    "Modified: 17.2.1997 / 11:04:34 / cg"
 !
 
 redraw
@@ -507,9 +541,13 @@
     label isNil ifTrue:[
         labelLen := 0
     ] ifFalse:[
-        l := ' ' , label , ' '.
-        font := font on:device.
-        labelLen := font widthOf:l
+        label isString ifTrue:[
+            l := ' ' , label , ' '.
+            font := font on:device.
+        ] ifFalse:[
+            l := label
+        ].
+        labelLen := label widthOn:self
     ].
 
     showFrame ifTrue:[
@@ -552,11 +590,15 @@
                 ]
             ].
             self paint:fgColor on:viewBackground.
-            self displayOpaqueString:l x:x y:y
+            label isString ifTrue:[
+                self displayOpaqueString:l x:x y:y
+            ] ifFalse:[
+                l displayOpaqueOn:self x:x y:y - font ascent
+            ]
         ]
     ]
 
-    "Modified: 3.1.1997 / 22:02:44 / cg"
+    "Modified: 17.2.1997 / 11:08:42 / cg"
 ! !
 
 !FramedBox methodsFor:'event handling'!
@@ -678,5 +720,5 @@
 !FramedBox class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.32 1997-02-08 14:23:43 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/FramedBox.st,v 1.33 1997-02-17 10:09:46 cg Exp $'
 ! !