equal
deleted
inserted
replaced
11 " |
11 " |
12 |
12 |
13 |
13 |
14 |
14 |
15 View subclass:#ActiveHelpView |
15 View subclass:#ActiveHelpView |
16 instanceVariableNames:'myView' |
16 instanceVariableNames:'myView shapeStyle' |
17 classVariableNames:'' |
17 classVariableNames:'' |
18 poolDictionaries:'' |
18 poolDictionaries:'' |
19 category:'Interface-Help' |
19 category:'Interface-Help' |
20 ! |
20 ! |
21 |
21 |
63 "create a talking-view for some text" |
63 "create a talking-view for some text" |
64 |
64 |
65 |helpView textView| |
65 |helpView textView| |
66 |
66 |
67 helpView := self new. |
67 helpView := self new. |
68 "/ textView := ListView new. |
68 |
69 textView := Label new. "/ ListView new. |
69 textView := Label new. |
70 textView font:(helpView font on:textView device). |
70 textView font:(helpView font on:textView device). |
71 ^ (helpView withView:textView) contents:someText |
71 ^ (helpView withView:textView) contents:someText |
72 |
72 |
73 " |
73 " |
74 (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) realize |
74 (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) |
75 (ActiveHelpView for:'press here\to open a new\SystemBrowser' withCRs) realize |
75 shapeStyle:nil; realize |
|
76 |
|
77 (ActiveHelpView for:'hello world\this is an ActiveHelpView' withCRs) |
|
78 shapeStyle:#cartoon; realize |
76 " |
79 " |
77 |
80 |
78 "Modified: 27.4.1996 / 15:14:07 / cg" |
81 "Modified: 29.5.1996 / 15:34:23 / cg" |
79 ! |
82 ! |
80 |
83 |
81 with:aView |
84 with:aView |
82 "create a talking-view wrapping some other view" |
85 "create a talking-view wrapping some other view" |
83 |
86 |
106 self resizeToFit |
109 self resizeToFit |
107 |
110 |
108 "Modified: 27.4.1996 / 15:14:56 / cg" |
111 "Modified: 27.4.1996 / 15:14:56 / cg" |
109 ! |
112 ! |
110 |
113 |
|
114 shapeStyle:aStyleSymbol |
|
115 "set the shapeStyle |
|
116 currently, only nil or #cartoon are supported" |
|
117 |
|
118 shapeStyle := aStyleSymbol. |
|
119 self resizeToFit. |
|
120 self computeShape. |
|
121 |
|
122 "Created: 29.5.1996 / 15:39:41 / cg" |
|
123 "Modified: 29.5.1996 / 15:43:54 / cg" |
|
124 ! |
|
125 |
111 withView:aView |
126 withView:aView |
112 "set the component view" |
127 "set the component view" |
113 |
128 |
114 (aView isKindOf:Label) ifTrue:[ |
129 (aView isKindOf:Label) ifTrue:[ |
115 aView viewBackground:viewBackground. |
130 aView viewBackground:viewBackground. |
120 myView borderWidth:0 |
135 myView borderWidth:0 |
121 |
136 |
122 "Modified: 27.4.1996 / 15:16:46 / cg" |
137 "Modified: 27.4.1996 / 15:16:46 / cg" |
123 ! ! |
138 ! ! |
124 |
139 |
125 !ActiveHelpView methodsFor:'events'! |
|
126 |
|
127 redraw |
|
128 self fill:White |
|
129 ! ! |
|
130 |
|
131 !ActiveHelpView methodsFor:'initialization'! |
140 !ActiveHelpView methodsFor:'initialization'! |
132 |
141 |
133 initStyle |
142 initStyle |
134 <resource: #style (#activeHelpBackgroundColor)> |
143 <resource: #style (#activeHelpBackgroundColor |
|
144 #activeHelpBorderWidth |
|
145 #activeHelpStyle)> |
|
146 |
|
147 |bg| |
135 |
148 |
136 super initStyle. |
149 super initStyle. |
137 |
150 |
138 viewBackground := styleSheet colorAt:'activeHelpBackgroundColor' default:viewBackground. |
151 shapeStyle := styleSheet at:'activeHelpStyle' default:nil. |
|
152 bg := styleSheet colorAt:'activeHelpBackgroundColor' default:nil. |
|
153 bg notNil ifTrue:[ |
|
154 viewBackground := bg |
|
155 ] ifFalse:[ |
|
156 shapeStyle == #cartoon ifTrue:[ |
|
157 viewBackground := White |
|
158 ] |
|
159 ]. |
|
160 |
139 borderWidth := styleSheet at:'activeHelpBorderWidth' default:1. |
161 borderWidth := styleSheet at:'activeHelpBorderWidth' default:1. |
140 |
162 |
141 "Modified: 30.4.1996 / 17:00:27 / cg" |
163 "Modified: 29.5.1996 / 15:48:49 / cg" |
142 ! |
164 ! |
143 |
165 |
144 initialize |
166 initialize |
145 super initialize. |
167 super initialize. |
146 font := Font family:'helvetica' size:12. |
168 font := Font family:'helvetica' size:12. |
147 (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[ |
169 |
148 self viewBackground:White |
170 "Modified: 29.5.1996 / 15:37:40 / cg" |
149 ] |
|
150 ! |
171 ! |
151 |
172 |
152 realize |
173 realize |
153 self create. |
174 self create. |
154 self computeShape. |
175 self computeShape. |
161 |
182 |
162 computeShape |
183 computeShape |
163 "compute the shape, based upon the size of my component view" |
184 "compute the shape, based upon the size of my component view" |
164 |
185 |
165 |extent shapeForm borderForm y1 bw h w mirrorH mirrorV |
186 |extent shapeForm borderForm y1 bw h w mirrorH mirrorV |
166 p1 p2 p3 pB1 pB2 pB3 offs| |
187 p1 p2 p3 pB1 pB2 pB3 offs hEll| |
167 |
188 |
168 (styleSheet at:'activeHelpStyle' default:nil) ~~ #cartoon ifTrue:[^ self]. |
189 shapeStyle ~~ #cartoon ifTrue:[^ self]. |
169 |
190 |
170 extent := self extent. |
191 extent := self extent. |
171 h := extent y. |
192 h := extent y. |
172 w := extent x. |
193 w := extent x. |
173 bw := 4. |
194 bw := 4. |
190 borderForm := Form width:w height:h. |
211 borderForm := Form width:w height:h. |
191 shapeForm := Form width:w height:h. |
212 shapeForm := Form width:w height:h. |
192 borderForm fill:(Color noColor). |
213 borderForm fill:(Color noColor). |
193 shapeForm fill:(Color noColor). |
214 shapeForm fill:(Color noColor). |
194 |
215 |
|
216 hEll := (h // 3 * 2). |
|
217 |
195 mirrorV ifTrue:[ |
218 mirrorV ifTrue:[ |
196 myView origin:(w // 7 + offs) @ (h//8) |
|
197 extent:(w // 7 * 6) @ (h // 3 * 2). |
|
198 y1 := 0. |
219 y1 := 0. |
199 ] ifFalse:[ |
220 ] ifFalse:[ |
200 myView origin:(w // 7 + offs) @ (h // 3) |
|
201 extent:(w // 7 * 6) @ (h // 3 * 2). |
|
202 y1 := h // 4. |
221 y1 := h // 4. |
203 ]. |
222 ]. |
204 |
223 |
205 borderForm fillArcX:0 |
224 borderForm fillArcX:0 |
206 y:y1 |
225 y:y1 |
207 width:w |
226 width:w |
208 height:(h // 3 * 2) |
227 height:hEll |
209 from:0 |
228 from:0 |
210 angle:360. |
229 angle:360. |
|
230 |
|
231 myView origin:(width - myView width // 2) @ (y1 + ((hEll - myView height) // 2)). |
211 |
232 |
212 mirrorH ifTrue:[ |
233 mirrorH ifTrue:[ |
213 mirrorV ifTrue:[ |
234 mirrorV ifTrue:[ |
214 p1 := w @ h. |
235 p1 := w @ h. |
215 p2 := ((w * 7 // 8) @ (h // 2)). |
236 p2 := ((w * 7 // 8) @ (h // 2)). |
259 angle:360. |
280 angle:360. |
260 |
281 |
261 self borderShape:borderForm. |
282 self borderShape:borderForm. |
262 self viewShape:shapeForm |
283 self viewShape:shapeForm |
263 |
284 |
264 "Modified: 8.5.1996 / 08:39:22 / cg" |
285 "Modified: 29.5.1996 / 16:07:43 / cg" |
265 ! |
286 ! |
266 |
287 |
267 resizeToFit |
288 resizeToFit |
268 "resize myself to make the component view fit" |
289 "resize myself to make the component view fit" |
269 |
290 |
270 |h w| |
291 |h w pref| |
271 |
292 |
272 (styleSheet at:'activeHelpStyle' default:nil) == #cartoon ifTrue:[ |
293 pref := myView preferredExtent. |
273 h := myView height. "/ heightOfContents. |
294 shapeStyle == #cartoon ifTrue:[ |
274 w := myView width. "/ widthOfContents. |
295 h := pref y. |
275 self extent:((w * 0.85) rounded asInteger) |
296 w := pref x. |
|
297 self extent:((w / 0.85) rounded asInteger) |
276 @ |
298 @ |
277 ((h * 2.5) rounded asInteger) |
299 ((h * 4) rounded asInteger) |
278 ] ifFalse:[ |
300 ] ifFalse:[ |
279 self extent:myView extent |
301 self extent:pref |
280 ] |
302 ] |
281 |
303 |
282 "Modified: 27.4.1996 / 15:16:29 / cg" |
304 "Modified: 29.5.1996 / 15:54:23 / cg" |
283 ! ! |
305 ! ! |
284 |
306 |
285 !ActiveHelpView methodsFor:'queries'! |
307 !ActiveHelpView methodsFor:'queries'! |
286 |
|
287 createOnTop |
|
288 "return true - I always want to popUp onTop of others" |
|
289 |
|
290 ^ true |
|
291 |
|
292 "Modified: 27.4.1996 / 15:15:13 / cg" |
|
293 ! |
|
294 |
308 |
295 isPopUpView |
309 isPopUpView |
296 "return true - I am a popUp type of view (no decoration, pop-to-top)" |
310 "return true - I am a popUp type of view (no decoration, pop-to-top)" |
297 |
311 |
298 ^ true |
312 ^ true |
301 ! ! |
315 ! ! |
302 |
316 |
303 !ActiveHelpView class methodsFor:'documentation'! |
317 !ActiveHelpView class methodsFor:'documentation'! |
304 |
318 |
305 version |
319 version |
306 ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.13 1996-05-12 20:06:13 cg Exp $' |
320 ^ '$Header: /cvs/stx/stx/libview2/ActiveHelpView.st,v 1.14 1996-05-29 14:08:49 cg Exp $' |
307 ! ! |
321 ! ! |