TabSpecRuler.st
author claus
Fri, 17 Feb 1995 14:24:24 +0100
changeset 36 160b8f0dfd7d
parent 29 b1663ac8f532
child 38 858ec30d05fe
permissions -rw-r--r--
*** empty log message ***

'From Smalltalk/X, Version:2.10.4 on 18-nov-1994 at 12:07:44'!

View subclass:#TabSpecRuler
	 instanceVariableNames:'tabSpec titleEntry handleStyle'
	 classVariableNames:'DefaultHandleStyle'
	 poolDictionaries:''
	 category:'Views-Misc'
!

!TabSpecRuler class methodsFor:'documentation'!

documentation
"
     this class is not yet finished.
"
!

examples
"
	|top head spec|

	top := View new.
	top extent:300@100.

	head := TabSpecRuler in:top.
	head width:1.0.
	head level:1.

	spec := TabulatorSpecification new.
	spec unit:#inch.
	spec positions:#(0     1     2.5    3.5    4       5        ).
	spec align:    #(#left #left #right #right #center #decimal ).

	head tabulatorSpecification:spec.
	top open.
"

! !

!TabSpecRuler class methodsFor:'defaults'!

updateStyleCache
    DefaultHandleStyle := StyleSheet at:'tabRulerHandleStyle'.

! !

!TabSpecRuler methodsFor:'redrawing'!

drawHandleAtX:x type:handleType
    "redraw a handle"

    handleStyle isNil ifTrue:[
	self displayLineFromX:x rounded
			    y:0
			  toX:x rounded
			    y:height - 1
    ]
!

redraw
    "redraw the handles from by tabSpec"

    |x|

    tabSpec isNil ifTrue:[^ self].
    1 to:tabSpec size do:[:i |
	x := tabSpec positionOfTab:i on:self.
	x := x rounded.

	self drawHandleAtX:x type:(tabSpec typeOfTab:i).
    ]
! !

!TabSpecRuler methodsFor:'initialization'!

initStyle
    super initStyle.

    handleStyle := DefaultHandleStyle


!

initialize
    super initialize.

    self height:(font height + (2 * font descent)). 

    "
     TabSpecRuler new open
    "


!

initEvents
    super initEvents.
    self enableButtonEvents.
    self enableMotionEvents.


! !

!TabSpecRuler methodsFor:'accessing'!

tabulatorSpecification:aTabSpec
    tabSpec := aTabSpec
! !