8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 Object subclass:#TabulatorSpecification |
13 Model subclass:#TabulatorSpecification |
14 instanceVariableNames:'tabUnit unitReference tabPositions tabTypes' |
14 instanceVariableNames:'tabUnit unitReference tabPositions tabTypes' |
15 classVariableNames:'' |
15 classVariableNames:'' |
16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'Views-Support' |
17 category:'Views-Support' |
18 ! |
18 ! |
205 |
205 |
206 top := StandardSystemView extent:300@300. |
206 top := StandardSystemView extent:300@300. |
207 |
207 |
208 ruler := TabSpecRuler origin:0.0@0.0 corner:1.0@20 in:top. |
208 ruler := TabSpecRuler origin:0.0@0.0 corner:1.0@20 in:top. |
209 ruler level:0. |
209 ruler level:0. |
|
210 ruler tabsAreVariable:false. |
|
211 |
210 listView := ListView in:top. |
212 listView := ListView in:top. |
211 listView origin:0.0@0.0 corner:1.0@1.0. |
213 listView origin:0.0@0.0 corner:1.0@1.0. |
212 listView topInset:20. |
214 listView topInset:20. |
213 |
215 |
214 tabSpec := TabulatorSpecification new. |
216 tabSpec := TabulatorSpecification new. |
250 colAt:6 put:'1234.56'. |
252 colAt:6 put:'1234.56'. |
251 |
253 |
252 listView at:3 put:entry. |
254 listView at:3 put:entry. |
253 top open |
255 top open |
254 [exEnd] |
256 [exEnd] |
|
257 |
|
258 much like previous example, but allow some tab positions to be |
|
259 changed (with synchronousOperation): |
|
260 [exBegin] |
|
261 |top ruler listView tabSpec entry| |
|
262 |
|
263 top := StandardSystemView extent:300@300. |
|
264 |
|
265 ruler := TabSpecRuler origin:0.0@0.0 corner:1.0@20 in:top. |
|
266 ruler level:0. |
|
267 ruler fixedTabs:#(1). |
|
268 ruler synchronousOperation:true. |
|
269 |
|
270 listView := ListView in:top. |
|
271 listView origin:0.0@0.0 corner:1.0@1.0. |
|
272 listView topInset:20. |
|
273 |
|
274 tabSpec := TabulatorSpecification new. |
|
275 tabSpec unit:#inch. |
|
276 tabSpec positions:#(0 1 2.5 3.5 4 5 ). |
|
277 tabSpec align: #(#left #left #left #left #left #decimal ). |
|
278 |
|
279 ruler tabulatorSpecification:tabSpec. |
|
280 |
|
281 entry := MultiColListEntry new. |
|
282 entry tabulatorSpecification:tabSpec. |
|
283 entry colAt:1 put:'left'; |
|
284 colAt:2 put:'left'; |
|
285 colAt:3 put:'left'; |
|
286 colAt:4 put:'left'; |
|
287 colAt:5 put:'left'; |
|
288 colAt:6 put:'.decimal'. |
|
289 |
|
290 listView at:1 put:entry. |
|
291 |
|
292 entry := MultiColListEntry new. |
|
293 entry tabulatorSpecification:tabSpec. |
|
294 entry colAt:1 put:'col1'; |
|
295 colAt:2 put:'col2'; |
|
296 colAt:3 put:'col3'; |
|
297 colAt:4 put:'col4'; |
|
298 colAt:5 put:'col5'; |
|
299 colAt:6 put:'col6'. |
|
300 |
|
301 listView at:2 put:entry. |
|
302 |
|
303 entry := MultiColListEntry new. |
|
304 entry tabulatorSpecification:tabSpec. |
|
305 entry colAt:1 put:'foo'; |
|
306 colAt:2 put:'fooBar'; |
|
307 colAt:3 put:'bar'; |
|
308 colAt:4 put:'barFoo'; |
|
309 colAt:5 put:'baz'; |
|
310 colAt:6 put:'1234.56'. |
|
311 |
|
312 listView at:3 put:entry. |
|
313 |
|
314 entry := MultiColListEntry new. |
|
315 entry tabulatorSpecification:tabSpec. |
|
316 entry colAt:1 put:'hello'; |
|
317 colAt:2 put:'world'; |
|
318 colAt:3 put:'how'; |
|
319 colAt:4 put:'about'; |
|
320 colAt:5 put:'this'; |
|
321 colAt:6 put:'0.2345'. |
|
322 listView at:4 put:entry. |
|
323 |
|
324 tabSpec onChangeSend:#redraw to:listView. |
|
325 top open |
|
326 [exEnd] |
255 " |
327 " |
256 ! ! |
328 ! ! |
257 |
329 |
258 !TabulatorSpecification class methodsFor:'instance creation'! |
330 !TabulatorSpecification class methodsFor:'instance creation'! |
259 |
331 |
361 ! ! |
442 ! ! |
362 |
443 |
363 !TabulatorSpecification methodsFor:'queries'! |
444 !TabulatorSpecification methodsFor:'queries'! |
364 |
445 |
365 pixelsPerUnitOn:aGC |
446 pixelsPerUnitOn:aGC |
|
447 "return the number of device pixels one unit of my tabs |
|
448 takes on aGC" |
|
449 |
366 |device mm| |
450 |device mm| |
367 |
451 |
368 " |
|
369 return the number of device pixels one unit of my tabs |
|
370 takes on aGC |
|
371 " |
|
372 tabUnit isNil ifTrue:[ |
452 tabUnit isNil ifTrue:[ |
373 tabUnit := #col |
453 tabUnit := #col |
374 ]. |
454 ]. |
375 tabUnit == #relative ifTrue:[ |
455 tabUnit == #relative ifTrue:[ |
376 ^ unitReference width |
456 ^ unitReference width |