TabSpecRuler.st
author claus
Wed, 03 May 1995 02:43:15 +0200
changeset 49 4dd0f5c3353e
parent 40 2248adab2995
child 86 4d7dbb5f1719
permissions -rw-r--r--
.

"
 COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

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

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

!TabSpecRuler class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1994 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

version
"
 $Header: /cvs/stx/stx/libwidg2/TabSpecRuler.st,v 1.5 1995-05-03 00:43:06 claus Exp $
"
!

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
    "
! !

!TabSpecRuler methodsFor:'accessing'!

tabulatorSpecification:aTabSpec
    tabSpec := aTabSpec
! !