diff -r b898f5762952 -r 196eb68b707c ActiveHelpView.st --- a/ActiveHelpView.st Sat Apr 27 19:59:33 1996 +0200 +++ b/ActiveHelpView.st Mon Apr 29 10:13:30 1996 +0200 @@ -40,10 +40,12 @@ documentation " a talking view. + Instances of myself show up either as a comics-like talking view, or as a simple square popup. This is configured via the - styleSheet; the default is simple-square. To get the fancy cmics - view, add a resource 'activeHelpStyle' with a symbol-value of #cartoon. + styleSheet; the default is simple-square. + To get the fancy comics style, add a resource 'activeHelpStyle' with + a symbol-value of #cartoon. However, be aware that some servers have performance problems with these view-shapes (or do not support shapes at all). @@ -58,6 +60,8 @@ !ActiveHelpView class methodsFor:'instance creation'! for:someText + "create a talking-view for some text" + |helpView textView| helpView := self new. @@ -70,9 +74,13 @@ (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) realize (ActiveHelpView for:'press here\to open a new\SystemBrowser' withCRs) realize " + + "Modified: 27.4.1996 / 15:14:07 / cg" ! with:aView + "create a talking-view wrapping some other view" + ^ self new withView:aView " @@ -80,45 +88,42 @@ (ActiveHelpView with:(TextView new)) open (ActiveHelpView with:(Button label:'ok')) open " + + "Modified: 27.4.1996 / 15:14:18 / cg" ! ! !ActiveHelpView methodsFor:'accessing'! contents:someText + "set the text" + (myView isKindOf:Label) ifTrue:[ - myView label:someText asString. - myView extent:(myView preferredExtent). + myView label:someText asString. + myView extent:(myView preferredExtent). ] ifFalse:[ - myView contents:someText. + myView contents:someText. ]. self resizeToFit -! -createOnTop - ^ true -! - -isPopUpView - ^ true + "Modified: 27.4.1996 / 15:14:56 / cg" ! withView:aView + "set the component view" + (aView isKindOf:Label) ifTrue:[ - aView viewBackground:viewBackground. - aView backgroundColor:viewBackground. + aView viewBackground:viewBackground. + aView backgroundColor:viewBackground. ]. self addSubView:aView. myView := aView. myView borderWidth:0 + + "Modified: 27.4.1996 / 15:16:46 / cg" ! ! !ActiveHelpView methodsFor:'events'! -XXsizeChanged:how - super sizeChanged:how. - self computeShape -! - redraw self fill:White ! ! @@ -151,6 +156,8 @@ !ActiveHelpView methodsFor:'private'! computeShape + "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| @@ -163,17 +170,17 @@ offs := 0. self corner x > self device width ifTrue:[ - mirrorH := true. - self origin:((self origin x - w) @ (self origin y)). - offs := bw * 2. + mirrorH := true. + self origin:((self origin x - w) @ (self origin y)). + offs := bw * 2. ] ifFalse:[ - mirrorH := false + mirrorH := false ]. self corner y > self device height ifTrue:[ - mirrorV := true. - self origin:(self origin x @ (self origin y - h)). + mirrorV := true. + self origin:(self origin x @ (self origin y - h)). ] ifFalse:[ - mirrorV := false + mirrorV := false ]. borderForm := Form width:w height:h. @@ -182,21 +189,21 @@ shapeForm fill:(Color colorId:0). mirrorV ifTrue:[ - myView origin:(w // 7 + offs) @ (h//8) - extent:(w // 7 * 6) @ (h // 3 * 2). - y1 := 0. + 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. + myView origin:(w // 7 + offs) @ (h // 3) + extent:(w // 7 * 6) @ (h // 3 * 2). + y1 := h // 4. ]. borderForm fillArcX:0 - y:y1 - w:w - h:(h // 3 * 2) - from:0 - angle:360. + y:y1 + w:w + h:(h // 3 * 2) + from:0 + angle:360. "/ shapeForm fillArcX:bw y:(h // 4) + bw "/ w:(w - (bw * 2)) @@ -205,37 +212,37 @@ "/ angle:360. mirrorH ifTrue:[ - mirrorV ifTrue:[ - p1 := w @ h. - p2 := ((w * 7 // 8) @ (h // 2)). - p3 := ((w // 2) @ (h // 2)). - pB1 := (w-bw) @ (h-bw). - pB2 := ((w * 7 // 8 - bw) @ (h // 2 - bw)). - pB3 := ((w // 2 + bw) @ (h // 2 - bw)) - ] ifFalse:[ - p1 := w @ 0. - p2 := ((w * 7 // 8) @ (h // 2)). - p3 := ((w // 2) @ (h // 2)). - pB1 := (w-bw) @ bw. - pB2 := ((w * 7 // 8 - bw) @ (h // 2 + bw)). - pB3 := ((w // 2 + bw) @ (h // 2 + bw)) - ] + mirrorV ifTrue:[ + p1 := w @ h. + p2 := ((w * 7 // 8) @ (h // 2)). + p3 := ((w // 2) @ (h // 2)). + pB1 := (w-bw) @ (h-bw). + pB2 := ((w * 7 // 8 - bw) @ (h // 2 - bw)). + pB3 := ((w // 2 + bw) @ (h // 2 - bw)) + ] ifFalse:[ + p1 := w @ 0. + p2 := ((w * 7 // 8) @ (h // 2)). + p3 := ((w // 2) @ (h // 2)). + pB1 := (w-bw) @ bw. + pB2 := ((w * 7 // 8 - bw) @ (h // 2 + bw)). + pB3 := ((w // 2 + bw) @ (h // 2 + bw)) + ] ] ifFalse:[ - mirrorV ifTrue:[ - p1 := 0@h. - p2 := ((w // 8) @ (h // 2)). - p3 := ((w // 2) @ (h // 2)). - pB1 := bw@(h-bw). - pB2 := ((w // 8 + bw) @ (h // 2 - bw)). - pB3 := ((w // 2 - bw) @ (h // 2 - bw)). - ] ifFalse:[ - p1 := 0@0. - p2 := ((w // 8) @ (h // 2)). - p3 := ((w // 2) @ (h // 2)). - pB1 := bw@bw. - pB2 := ((w // 8 + bw) @ (h // 2 + bw)). - pB3 := ((w // 2 - bw) @ (h // 2 + bw)). - ] + mirrorV ifTrue:[ + p1 := 0@h. + p2 := ((w // 8) @ (h // 2)). + p3 := ((w // 2) @ (h // 2)). + pB1 := bw@(h-bw). + pB2 := ((w // 8 + bw) @ (h // 2 - bw)). + pB3 := ((w // 2 - bw) @ (h // 2 - bw)). + ] ifFalse:[ + p1 := 0@0. + p2 := ((w // 8) @ (h // 2)). + p3 := ((w // 2) @ (h // 2)). + pB1 := bw@bw. + pB2 := ((w // 8 + bw) @ (h // 2 + bw)). + pB3 := ((w // 2 - bw) @ (h // 2 + bw)). + ] ]. borderForm fillPolygon:(Array with:p1 with:p2 with:p3). @@ -247,32 +254,56 @@ shapeForm paint:(Color colorId:1). shapeForm fillArcX:bw - y:y1 + bw - w:(w - (bw * 2)) - h:(h // 3 * 2 - (bw * 2)) - from:0 - angle:360. + y:y1 + bw + w:(w - (bw * 2)) + h:(h // 3 * 2 - (bw * 2)) + from:0 + angle:360. self borderShape:borderForm. self viewShape:shapeForm + + "Modified: 27.4.1996 / 15:16:15 / cg" ! resizeToFit + "resize myself to make the component view fit" + |h w| (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[ - h := myView height. "/ heightOfContents. - w := myView width. "/ widthOfContents. - self extent:((w * 0.85) rounded asInteger) - @ - ((h * 2.5) rounded asInteger) + h := myView height. "/ heightOfContents. + w := myView width. "/ widthOfContents. + self extent:((w * 0.85) rounded asInteger) + @ + ((h * 2.5) rounded asInteger) ] ifFalse:[ - self extent:myView extent + self extent:myView extent ] + + "Modified: 27.4.1996 / 15:16:29 / 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" + + ^ true + + "Modified: 27.4.1996 / 15:15:42 / cg" ! ! !ActiveHelpView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.8 1996-04-25 16:32:07 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.9 1996-04-29 08:13:30 cg Exp $' ! !