ActiveHelpView.st
changeset 285 208c1e1ad9a8
parent 261 6d7941a96ad0
child 314 a239541adbc9
--- a/ActiveHelpView.st	Wed May 29 15:12:19 1996 +0200
+++ b/ActiveHelpView.st	Wed May 29 16:08:49 1996 +0200
@@ -13,7 +13,7 @@
 
 
 View subclass:#ActiveHelpView
-	instanceVariableNames:'myView'
+	instanceVariableNames:'myView shapeStyle'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'Interface-Help'
@@ -65,17 +65,20 @@
     |helpView textView|
 
     helpView := self new.
-"/    textView := ListView new.
-    textView := Label new. "/ ListView new.
+
+    textView := Label new.
     textView font:(helpView font on:textView device).
     ^ (helpView withView:textView) contents:someText
 
     "
-     (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) realize
-     (ActiveHelpView for:'press here\to open a new\SystemBrowser' withCRs) realize
+     (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) 
+        shapeStyle:nil; realize
+
+     (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) 
+        shapeStyle:#cartoon; realize
     "
 
-    "Modified: 27.4.1996 / 15:14:07 / cg"
+    "Modified: 29.5.1996 / 15:34:23 / cg"
 !
 
 with:aView
@@ -108,6 +111,18 @@
     "Modified: 27.4.1996 / 15:14:56 / cg"
 !
 
+shapeStyle:aStyleSymbol
+    "set the shapeStyle
+     currently, only nil or #cartoon are supported"
+
+    shapeStyle := aStyleSymbol.
+    self resizeToFit.
+    self computeShape.
+
+    "Created: 29.5.1996 / 15:39:41 / cg"
+    "Modified: 29.5.1996 / 15:43:54 / cg"
+!
+
 withView:aView
     "set the component view"
 
@@ -122,31 +137,37 @@
     "Modified: 27.4.1996 / 15:16:46 / cg"
 ! !
 
-!ActiveHelpView methodsFor:'events'!
-
-redraw
-    self fill:White
-! !
-
 !ActiveHelpView methodsFor:'initialization'!
 
 initStyle
-    <resource: #style (#activeHelpBackgroundColor)>
+    <resource: #style (#activeHelpBackgroundColor
+                       #activeHelpBorderWidth
+                       #activeHelpStyle)>
+
+    |bg|
 
     super initStyle.
 
-    viewBackground := styleSheet colorAt:'activeHelpBackgroundColor' default:viewBackground.
+    shapeStyle := styleSheet at:'activeHelpStyle' default:nil.
+    bg := styleSheet colorAt:'activeHelpBackgroundColor' default:nil.
+    bg notNil ifTrue:[
+        viewBackground := bg
+    ] ifFalse:[
+        shapeStyle == #cartoon ifTrue:[
+            viewBackground := White
+        ]
+    ].
+
     borderWidth := styleSheet at:'activeHelpBorderWidth' default:1.
 
-    "Modified: 30.4.1996 / 17:00:27 / cg"
+    "Modified: 29.5.1996 / 15:48:49 / cg"
 !
 
 initialize
     super initialize.
     font := Font family:'helvetica' size:12.
-    (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[
-	self viewBackground:White
-    ]
+
+    "Modified: 29.5.1996 / 15:37:40 / cg"
 !
 
 realize
@@ -163,9 +184,9 @@
     "compute the shape, based upon the size of my component view"
 
     |extent shapeForm borderForm y1 bw h w mirrorH mirrorV
-     p1 p2 p3 pB1 pB2 pB3 offs|
+     p1 p2 p3 pB1 pB2 pB3 offs hEll|
 
-    (styleSheet at:'activeHelpStyle' default:nil) ~~ #cartoon ifTrue:[^ self].
+    shapeStyle ~~ #cartoon ifTrue:[^ self].
 
     extent := self extent.
     h := extent y.
@@ -192,23 +213,23 @@
     borderForm fill:(Color noColor).
     shapeForm fill:(Color noColor).
 
+    hEll := (h // 3 * 2).
+
     mirrorV ifTrue:[
-        myView origin:(w // 7 + offs) @ (h//8)
-               extent:(w // 7 * 6) @ (h // 3 * 2).
         y1 := 0.
     ] ifFalse:[
-        myView origin:(w // 7 + offs) @ (h // 3)
-               extent:(w // 7 * 6) @ (h // 3 * 2).
         y1 := h // 4.
     ].
 
     borderForm fillArcX:0 
                       y:y1 
                   width:w
-                 height:(h // 3 * 2)
+                 height:hEll
                    from:0
                   angle:360.
 
+    myView origin:(width - myView width // 2) @ (y1 + ((hEll - myView height) // 2)).
+
     mirrorH ifTrue:[
         mirrorV ifTrue:[
             p1 := w @ h. 
@@ -261,37 +282,30 @@
     self borderShape:borderForm.
     self viewShape:shapeForm
 
-    "Modified: 8.5.1996 / 08:39:22 / cg"
+    "Modified: 29.5.1996 / 16:07:43 / cg"
 !
 
 resizeToFit
     "resize myself to make the component view fit"
 
-    |h w|
+    |h w pref|
 
-    (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[
-        h := myView height. "/ heightOfContents.
-        w := myView width. "/ widthOfContents.
-        self extent:((w * 0.85) rounded asInteger)
+    pref := myView preferredExtent.
+    shapeStyle == #cartoon ifTrue:[
+        h := pref y. 
+        w := pref x. 
+        self extent:((w / 0.85) rounded asInteger)
                      @ 
-                    ((h * 2.5) rounded asInteger)
+                    ((h * 4) rounded asInteger)
     ] ifFalse:[
-        self extent:myView extent
+        self extent:pref
     ]
 
-    "Modified: 27.4.1996 / 15:16:29 / cg"
+    "Modified: 29.5.1996 / 15:54:23 / cg"
 ! !
 
 !ActiveHelpView methodsFor:'queries'!
 
-createOnTop
-    "return true - I always want to popUp onTop of others"
-
-    ^ true
-
-    "Modified: 27.4.1996 / 15:15:13 / cg"
-!
-
 isPopUpView
     "return true - I am a popUp type of view (no decoration, pop-to-top)"
 
@@ -303,5 +317,5 @@
 !ActiveHelpView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.13 1996-05-12 20:06:13 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.14 1996-05-29 14:08:49 cg Exp $'
 ! !