TabSpecRuler.st
author claus
Sat, 18 Feb 1995 21:48:59 +0100
changeset 38 858ec30d05fe
parent 36 160b8f0dfd7d
child 40 2248adab2995
permissions -rw-r--r--
*** empty log message ***

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

View 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.3 1995-02-18 20:48:59 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
    "


!

initEvents
    super initEvents.
    self enableButtonEvents.
    self enableMotionEvents.


! !

!TabSpecRuler methodsFor:'accessing'!

tabulatorSpecification:aTabSpec
    tabSpec := aTabSpec
! !