TabSpecRuler.st
changeset 36 160b8f0dfd7d
parent 29 b1663ac8f532
child 38 858ec30d05fe
equal deleted inserted replaced
35:556d556efefc 36:160b8f0dfd7d
     7 	 category:'Views-Misc'
     7 	 category:'Views-Misc'
     8 !
     8 !
     9 
     9 
    10 !TabSpecRuler class methodsFor:'documentation'!
    10 !TabSpecRuler class methodsFor:'documentation'!
    11 
    11 
       
    12 documentation
       
    13 "
       
    14      this class is not yet finished.
       
    15 "
       
    16 !
       
    17 
    12 examples
    18 examples
    13 "
    19 "
    14         |top head spec|
    20 	|top head spec|
    15 
    21 
    16         top := View new.
    22 	top := View new.
    17         top extent:300@100.
    23 	top extent:300@100.
    18 
    24 
    19         head := TabSpecRuler in:top.
    25 	head := TabSpecRuler in:top.
    20         head width:1.0.
    26 	head width:1.0.
    21         head level:1.
    27 	head level:1.
    22 
    28 
    23         spec := TabulatorSpecification new.
    29 	spec := TabulatorSpecification new.
    24         spec unit:#inch.
    30 	spec unit:#inch.
    25         spec positions:#(0     1     2.5    3.5    4       5        ).
    31 	spec positions:#(0     1     2.5    3.5    4       5        ).
    26         spec align:    #(#left #left #right #right #center #decimal ).
    32 	spec align:    #(#left #left #right #right #center #decimal ).
    27 
    33 
    28         head tabulatorSpecification:spec.
    34 	head tabulatorSpecification:spec.
    29         top open.
    35 	top open.
    30 "
    36 "
    31 
    37 
    32 ! !
    38 ! !
    33 
    39 
    34 !TabSpecRuler class methodsFor:'defaults'!
    40 !TabSpecRuler class methodsFor:'defaults'!
    42 
    48 
    43 drawHandleAtX:x type:handleType
    49 drawHandleAtX:x type:handleType
    44     "redraw a handle"
    50     "redraw a handle"
    45 
    51 
    46     handleStyle isNil ifTrue:[
    52     handleStyle isNil ifTrue:[
    47         self displayLineFromX:x rounded
    53 	self displayLineFromX:x rounded
    48                             y:0
    54 			    y:0
    49                           toX:x rounded
    55 			  toX:x rounded
    50                             y:height - 1
    56 			    y:height - 1
    51     ]
    57     ]
    52 !
    58 !
    53 
    59 
    54 redraw
    60 redraw
    55     "redraw the handles from by tabSpec"
    61     "redraw the handles from by tabSpec"
    56 
    62 
    57     |x|
    63     |x|
    58 
    64 
    59     tabSpec isNil ifTrue:[^ self].
    65     tabSpec isNil ifTrue:[^ self].
    60     1 to:tabSpec size do:[:i |
    66     1 to:tabSpec size do:[:i |
    61         x := tabSpec positionOfTab:i on:self.
    67 	x := tabSpec positionOfTab:i on:self.
    62         x := x rounded.
    68 	x := x rounded.
    63 
    69 
    64         self drawHandleAtX:x type:(tabSpec typeOfTab:i).
    70 	self drawHandleAtX:x type:(tabSpec typeOfTab:i).
    65     ]
    71     ]
    66 ! !
    72 ! !
    67 
    73 
    68 !TabSpecRuler methodsFor:'initialization'!
    74 !TabSpecRuler methodsFor:'initialization'!
    69 
    75