38 ! |
38 ! |
39 |
39 |
40 documentation |
40 documentation |
41 " |
41 " |
42 a talking view. |
42 a talking view. |
|
43 |
43 Instances of myself show up either as a comics-like talking |
44 Instances of myself show up either as a comics-like talking |
44 view, or as a simple square popup. This is configured via the |
45 view, or as a simple square popup. This is configured via the |
45 styleSheet; the default is simple-square. To get the fancy cmics |
46 styleSheet; the default is simple-square. |
46 view, add a resource 'activeHelpStyle' with a symbol-value of #cartoon. |
47 To get the fancy comics style, add a resource 'activeHelpStyle' with |
|
48 a symbol-value of #cartoon. |
47 However, be aware that some servers have performance problems with |
49 However, be aware that some servers have performance problems with |
48 these view-shapes (or do not support shapes at all). |
50 these view-shapes (or do not support shapes at all). |
49 |
51 |
50 [author:] |
52 [author:] |
51 Claus Gittinger |
53 Claus Gittinger |
68 |
72 |
69 " |
73 " |
70 (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) realize |
74 (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) realize |
71 (ActiveHelpView for:'press here\to open a new\SystemBrowser' withCRs) realize |
75 (ActiveHelpView for:'press here\to open a new\SystemBrowser' withCRs) realize |
72 " |
76 " |
|
77 |
|
78 "Modified: 27.4.1996 / 15:14:07 / cg" |
73 ! |
79 ! |
74 |
80 |
75 with:aView |
81 with:aView |
|
82 "create a talking-view wrapping some other view" |
|
83 |
76 ^ self new withView:aView |
84 ^ self new withView:aView |
77 |
85 |
78 " |
86 " |
79 (ActiveHelpView with:(TextView new)) realize |
87 (ActiveHelpView with:(TextView new)) realize |
80 (ActiveHelpView with:(TextView new)) open |
88 (ActiveHelpView with:(TextView new)) open |
81 (ActiveHelpView with:(Button label:'ok')) open |
89 (ActiveHelpView with:(Button label:'ok')) open |
82 " |
90 " |
|
91 |
|
92 "Modified: 27.4.1996 / 15:14:18 / cg" |
83 ! ! |
93 ! ! |
84 |
94 |
85 !ActiveHelpView methodsFor:'accessing'! |
95 !ActiveHelpView methodsFor:'accessing'! |
86 |
96 |
87 contents:someText |
97 contents:someText |
|
98 "set the text" |
|
99 |
88 (myView isKindOf:Label) ifTrue:[ |
100 (myView isKindOf:Label) ifTrue:[ |
89 myView label:someText asString. |
101 myView label:someText asString. |
90 myView extent:(myView preferredExtent). |
102 myView extent:(myView preferredExtent). |
91 ] ifFalse:[ |
103 ] ifFalse:[ |
92 myView contents:someText. |
104 myView contents:someText. |
93 ]. |
105 ]. |
94 self resizeToFit |
106 self resizeToFit |
95 ! |
107 |
96 |
108 "Modified: 27.4.1996 / 15:14:56 / cg" |
97 createOnTop |
|
98 ^ true |
|
99 ! |
|
100 |
|
101 isPopUpView |
|
102 ^ true |
|
103 ! |
109 ! |
104 |
110 |
105 withView:aView |
111 withView:aView |
|
112 "set the component view" |
|
113 |
106 (aView isKindOf:Label) ifTrue:[ |
114 (aView isKindOf:Label) ifTrue:[ |
107 aView viewBackground:viewBackground. |
115 aView viewBackground:viewBackground. |
108 aView backgroundColor:viewBackground. |
116 aView backgroundColor:viewBackground. |
109 ]. |
117 ]. |
110 self addSubView:aView. |
118 self addSubView:aView. |
111 myView := aView. |
119 myView := aView. |
112 myView borderWidth:0 |
120 myView borderWidth:0 |
|
121 |
|
122 "Modified: 27.4.1996 / 15:16:46 / cg" |
113 ! ! |
123 ! ! |
114 |
124 |
115 !ActiveHelpView methodsFor:'events'! |
125 !ActiveHelpView methodsFor:'events'! |
116 |
|
117 XXsizeChanged:how |
|
118 super sizeChanged:how. |
|
119 self computeShape |
|
120 ! |
|
121 |
126 |
122 redraw |
127 redraw |
123 self fill:White |
128 self fill:White |
124 ! ! |
129 ! ! |
125 |
130 |
161 w := extent x. |
168 w := extent x. |
162 bw := 4. |
169 bw := 4. |
163 offs := 0. |
170 offs := 0. |
164 |
171 |
165 self corner x > self device width ifTrue:[ |
172 self corner x > self device width ifTrue:[ |
166 mirrorH := true. |
173 mirrorH := true. |
167 self origin:((self origin x - w) @ (self origin y)). |
174 self origin:((self origin x - w) @ (self origin y)). |
168 offs := bw * 2. |
175 offs := bw * 2. |
169 ] ifFalse:[ |
176 ] ifFalse:[ |
170 mirrorH := false |
177 mirrorH := false |
171 ]. |
178 ]. |
172 self corner y > self device height ifTrue:[ |
179 self corner y > self device height ifTrue:[ |
173 mirrorV := true. |
180 mirrorV := true. |
174 self origin:(self origin x @ (self origin y - h)). |
181 self origin:(self origin x @ (self origin y - h)). |
175 ] ifFalse:[ |
182 ] ifFalse:[ |
176 mirrorV := false |
183 mirrorV := false |
177 ]. |
184 ]. |
178 |
185 |
179 borderForm := Form width:w height:h. |
186 borderForm := Form width:w height:h. |
180 shapeForm := Form width:w height:h. |
187 shapeForm := Form width:w height:h. |
181 borderForm fill:(Color colorId:0). |
188 borderForm fill:(Color colorId:0). |
182 shapeForm fill:(Color colorId:0). |
189 shapeForm fill:(Color colorId:0). |
183 |
190 |
184 mirrorV ifTrue:[ |
191 mirrorV ifTrue:[ |
185 myView origin:(w // 7 + offs) @ (h//8) |
192 myView origin:(w // 7 + offs) @ (h//8) |
186 extent:(w // 7 * 6) @ (h // 3 * 2). |
193 extent:(w // 7 * 6) @ (h // 3 * 2). |
187 y1 := 0. |
194 y1 := 0. |
188 ] ifFalse:[ |
195 ] ifFalse:[ |
189 myView origin:(w // 7 + offs) @ (h // 3) |
196 myView origin:(w // 7 + offs) @ (h // 3) |
190 extent:(w // 7 * 6) @ (h // 3 * 2). |
197 extent:(w // 7 * 6) @ (h // 3 * 2). |
191 y1 := h // 4. |
198 y1 := h // 4. |
192 ]. |
199 ]. |
193 |
200 |
194 borderForm fillArcX:0 |
201 borderForm fillArcX:0 |
195 y:y1 |
202 y:y1 |
196 w:w |
203 w:w |
197 h:(h // 3 * 2) |
204 h:(h // 3 * 2) |
198 from:0 |
205 from:0 |
199 angle:360. |
206 angle:360. |
200 |
207 |
201 "/ shapeForm fillArcX:bw y:(h // 4) + bw |
208 "/ shapeForm fillArcX:bw y:(h // 4) + bw |
202 "/ w:(w - (bw * 2)) |
209 "/ w:(w - (bw * 2)) |
203 "/ h:(h // 3 * 2 - (bw * 2)) |
210 "/ h:(h // 3 * 2 - (bw * 2)) |
204 "/ from:0 |
211 "/ from:0 |
205 "/ angle:360. |
212 "/ angle:360. |
206 |
213 |
207 mirrorH ifTrue:[ |
214 mirrorH ifTrue:[ |
208 mirrorV ifTrue:[ |
215 mirrorV ifTrue:[ |
209 p1 := w @ h. |
216 p1 := w @ h. |
210 p2 := ((w * 7 // 8) @ (h // 2)). |
217 p2 := ((w * 7 // 8) @ (h // 2)). |
211 p3 := ((w // 2) @ (h // 2)). |
218 p3 := ((w // 2) @ (h // 2)). |
212 pB1 := (w-bw) @ (h-bw). |
219 pB1 := (w-bw) @ (h-bw). |
213 pB2 := ((w * 7 // 8 - bw) @ (h // 2 - bw)). |
220 pB2 := ((w * 7 // 8 - bw) @ (h // 2 - bw)). |
214 pB3 := ((w // 2 + bw) @ (h // 2 - bw)) |
221 pB3 := ((w // 2 + bw) @ (h // 2 - bw)) |
215 ] ifFalse:[ |
222 ] ifFalse:[ |
216 p1 := w @ 0. |
223 p1 := w @ 0. |
217 p2 := ((w * 7 // 8) @ (h // 2)). |
224 p2 := ((w * 7 // 8) @ (h // 2)). |
218 p3 := ((w // 2) @ (h // 2)). |
225 p3 := ((w // 2) @ (h // 2)). |
219 pB1 := (w-bw) @ bw. |
226 pB1 := (w-bw) @ bw. |
220 pB2 := ((w * 7 // 8 - bw) @ (h // 2 + bw)). |
227 pB2 := ((w * 7 // 8 - bw) @ (h // 2 + bw)). |
221 pB3 := ((w // 2 + bw) @ (h // 2 + bw)) |
228 pB3 := ((w // 2 + bw) @ (h // 2 + bw)) |
222 ] |
229 ] |
223 ] ifFalse:[ |
230 ] ifFalse:[ |
224 mirrorV ifTrue:[ |
231 mirrorV ifTrue:[ |
225 p1 := 0@h. |
232 p1 := 0@h. |
226 p2 := ((w // 8) @ (h // 2)). |
233 p2 := ((w // 8) @ (h // 2)). |
227 p3 := ((w // 2) @ (h // 2)). |
234 p3 := ((w // 2) @ (h // 2)). |
228 pB1 := bw@(h-bw). |
235 pB1 := bw@(h-bw). |
229 pB2 := ((w // 8 + bw) @ (h // 2 - bw)). |
236 pB2 := ((w // 8 + bw) @ (h // 2 - bw)). |
230 pB3 := ((w // 2 - bw) @ (h // 2 - bw)). |
237 pB3 := ((w // 2 - bw) @ (h // 2 - bw)). |
231 ] ifFalse:[ |
238 ] ifFalse:[ |
232 p1 := 0@0. |
239 p1 := 0@0. |
233 p2 := ((w // 8) @ (h // 2)). |
240 p2 := ((w // 8) @ (h // 2)). |
234 p3 := ((w // 2) @ (h // 2)). |
241 p3 := ((w // 2) @ (h // 2)). |
235 pB1 := bw@bw. |
242 pB1 := bw@bw. |
236 pB2 := ((w // 8 + bw) @ (h // 2 + bw)). |
243 pB2 := ((w // 8 + bw) @ (h // 2 + bw)). |
237 pB3 := ((w // 2 - bw) @ (h // 2 + bw)). |
244 pB3 := ((w // 2 - bw) @ (h // 2 + bw)). |
238 ] |
245 ] |
239 ]. |
246 ]. |
240 |
247 |
241 borderForm fillPolygon:(Array with:p1 with:p2 with:p3). |
248 borderForm fillPolygon:(Array with:p1 with:p2 with:p3). |
242 shapeForm fillPolygon:(Array with:pB1 with:pB2 with:pB3). |
249 shapeForm fillPolygon:(Array with:pB1 with:pB2 with:pB3). |
243 |
250 |
245 shapeForm paint:(Color colorId:0). |
252 shapeForm paint:(Color colorId:0). |
246 shapeForm displayPolygon:(Array with:p3 with:p1 with:p2). |
253 shapeForm displayPolygon:(Array with:p3 with:p1 with:p2). |
247 |
254 |
248 shapeForm paint:(Color colorId:1). |
255 shapeForm paint:(Color colorId:1). |
249 shapeForm fillArcX:bw |
256 shapeForm fillArcX:bw |
250 y:y1 + bw |
257 y:y1 + bw |
251 w:(w - (bw * 2)) |
258 w:(w - (bw * 2)) |
252 h:(h // 3 * 2 - (bw * 2)) |
259 h:(h // 3 * 2 - (bw * 2)) |
253 from:0 |
260 from:0 |
254 angle:360. |
261 angle:360. |
255 |
262 |
256 self borderShape:borderForm. |
263 self borderShape:borderForm. |
257 self viewShape:shapeForm |
264 self viewShape:shapeForm |
|
265 |
|
266 "Modified: 27.4.1996 / 15:16:15 / cg" |
258 ! |
267 ! |
259 |
268 |
260 resizeToFit |
269 resizeToFit |
|
270 "resize myself to make the component view fit" |
|
271 |
261 |h w| |
272 |h w| |
262 |
273 |
263 (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[ |
274 (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[ |
264 h := myView height. "/ heightOfContents. |
275 h := myView height. "/ heightOfContents. |
265 w := myView width. "/ widthOfContents. |
276 w := myView width. "/ widthOfContents. |
266 self extent:((w * 0.85) rounded asInteger) |
277 self extent:((w * 0.85) rounded asInteger) |
267 @ |
278 @ |
268 ((h * 2.5) rounded asInteger) |
279 ((h * 2.5) rounded asInteger) |
269 ] ifFalse:[ |
280 ] ifFalse:[ |
270 self extent:myView extent |
281 self extent:myView extent |
271 ] |
282 ] |
|
283 |
|
284 "Modified: 27.4.1996 / 15:16:29 / cg" |
|
285 ! ! |
|
286 |
|
287 !ActiveHelpView methodsFor:'queries'! |
|
288 |
|
289 createOnTop |
|
290 "return true - I always want to popUp onTop of others" |
|
291 |
|
292 ^ true |
|
293 |
|
294 "Modified: 27.4.1996 / 15:15:13 / cg" |
|
295 ! |
|
296 |
|
297 isPopUpView |
|
298 "return true - I am a popUp type of view" |
|
299 |
|
300 ^ true |
|
301 |
|
302 "Modified: 27.4.1996 / 15:15:42 / cg" |
272 ! ! |
303 ! ! |
273 |
304 |
274 !ActiveHelpView class methodsFor:'documentation'! |
305 !ActiveHelpView class methodsFor:'documentation'! |
275 |
306 |
276 version |
307 version |
277 ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.8 1996-04-25 16:32:07 cg Exp $' |
308 ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.9 1996-04-29 08:13:30 cg Exp $' |
278 ! ! |
309 ! ! |