author | Claus Gittinger <cg@exept.de> |
Fri, 09 Feb 1996 02:42:03 +0100 | |
changeset 125 | db1c1a8e0384 |
parent 86 | 4d7dbb5f1719 |
child 200 | e1ba0782f37c |
permissions | -rw-r--r-- |
38 | 1 |
" |
2 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
29 | 13 |
'From Smalltalk/X, Version:2.10.4 on 18-nov-1994 at 12:07:44'! |
14 |
||
49 | 15 |
SimpleView subclass:#TabSpecRuler |
29 | 16 |
instanceVariableNames:'tabSpec titleEntry handleStyle' |
17 |
classVariableNames:'DefaultHandleStyle' |
|
18 |
poolDictionaries:'' |
|
19 |
category:'Views-Misc' |
|
20 |
! |
|
21 |
||
22 |
!TabSpecRuler class methodsFor:'documentation'! |
|
23 |
||
38 | 24 |
copyright |
25 |
" |
|
26 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
version |
|
86
4d7dbb5f1719
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
49
diff
changeset
|
39 |
^ '$Header: /cvs/stx/stx/libwidg2/TabSpecRuler.st,v 1.6 1995-11-11 16:29:29 cg Exp $' |
38 | 40 |
! |
41 |
||
36 | 42 |
documentation |
43 |
" |
|
44 |
this class is not yet finished. |
|
45 |
" |
|
46 |
! |
|
47 |
||
29 | 48 |
examples |
49 |
" |
|
36 | 50 |
|top head spec| |
29 | 51 |
|
36 | 52 |
top := View new. |
53 |
top extent:300@100. |
|
29 | 54 |
|
36 | 55 |
head := TabSpecRuler in:top. |
56 |
head width:1.0. |
|
57 |
head level:1. |
|
29 | 58 |
|
36 | 59 |
spec := TabulatorSpecification new. |
60 |
spec unit:#inch. |
|
61 |
spec positions:#(0 1 2.5 3.5 4 5 ). |
|
62 |
spec align: #(#left #left #right #right #center #decimal ). |
|
29 | 63 |
|
36 | 64 |
head tabulatorSpecification:spec. |
65 |
top open. |
|
29 | 66 |
" |
67 |
||
68 |
! ! |
|
69 |
||
70 |
!TabSpecRuler class methodsFor:'defaults'! |
|
71 |
||
72 |
updateStyleCache |
|
73 |
DefaultHandleStyle := StyleSheet at:'tabRulerHandleStyle'. |
|
74 |
||
75 |
! ! |
|
76 |
||
77 |
!TabSpecRuler methodsFor:'redrawing'! |
|
78 |
||
79 |
drawHandleAtX:x type:handleType |
|
80 |
"redraw a handle" |
|
81 |
||
82 |
handleStyle isNil ifTrue:[ |
|
36 | 83 |
self displayLineFromX:x rounded |
84 |
y:0 |
|
85 |
toX:x rounded |
|
86 |
y:height - 1 |
|
29 | 87 |
] |
88 |
! |
|
89 |
||
90 |
redraw |
|
91 |
"redraw the handles from by tabSpec" |
|
92 |
||
93 |
|x| |
|
94 |
||
95 |
tabSpec isNil ifTrue:[^ self]. |
|
96 |
1 to:tabSpec size do:[:i | |
|
36 | 97 |
x := tabSpec positionOfTab:i on:self. |
98 |
x := x rounded. |
|
29 | 99 |
|
36 | 100 |
self drawHandleAtX:x type:(tabSpec typeOfTab:i). |
29 | 101 |
] |
102 |
! ! |
|
103 |
||
104 |
!TabSpecRuler methodsFor:'initialization'! |
|
105 |
||
106 |
initStyle |
|
107 |
super initStyle. |
|
108 |
||
109 |
handleStyle := DefaultHandleStyle |
|
110 |
! |
|
111 |
||
112 |
initialize |
|
113 |
super initialize. |
|
114 |
||
115 |
self height:(font height + (2 * font descent)). |
|
116 |
||
117 |
" |
|
118 |
TabSpecRuler new open |
|
119 |
" |
|
120 |
! ! |
|
121 |
||
122 |
!TabSpecRuler methodsFor:'accessing'! |
|
123 |
||
124 |
tabulatorSpecification:aTabSpec |
|
125 |
tabSpec := aTabSpec |
|
126 |
! ! |
|
127 |