MiniScroller.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Sep 1997 20:23:08 +0200
changeset 1320 47ff27735939
parent 1305 02af46047b4a
child 1354 c260c896ea66
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.
"

Scroller subclass:#MiniScroller
	instanceVariableNames:''
	classVariableNames:'MiniScrollerSize'
	poolDictionaries:''
	category:'Views-Interactors'
!

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

documentation
"
    like a scroller, but taking less screen space

    [author:]
        Claus Gittinger
"
! !

!MiniScroller class methodsFor:'defaults'!

updateStyleCache
    "extract values from the styleSheet and cache them in class variables"

    <resource: #style (#miniScrollerSize)>

    MiniScrollerSize := StyleSheet at:'miniScrollerSize'.

    "
     self updateStyleCache
    "

    "Created: 15.8.1997 / 01:51:38 / cg"
    "Modified: 15.8.1997 / 01:54:44 / cg"
! !

!MiniScroller methodsFor:'initialization'!

initStyle
    "setup viewStyle specifics"

    |style lvl|

    super initStyle.
    style := StyleSheet name.
    style == #iris ifTrue:[
        tallyLevel := tallyMarks := 0.
        thumbEdgeStyle := nil.
        thumbLevel := thumbActiveLevel := 2.
    ].
    ((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[
        style == #st80 ifTrue:[
            "/ lvl := 1.
            lvl := 0.
        ] ifFalse:[
            lvl := -1.
        ].
        self level:lvl.
        self borderWidth:0
    ].
    shadowForm := lightForm := nil.
    fixThumbHeight := false

    "Modified: 7.3.1997 / 15:52:13 / cg"
!

initialize
    "initialize - setup instvars from defaults"

    orientation isNil ifTrue:[orientation := #vertical].
    super initialize.
! !

!MiniScroller methodsFor:'queries'!

isMiniScroller
    ^ true

    "Created: 7.3.1997 / 16:20:22 / cg"
!

preferredExtent
    "return my preferredExtent - make my width very small"

    |defExt w h mm|

    "/ If I have an explicit preferredExtent ..

    preferredExtent notNil ifTrue:[
        ^ preferredExtent
    ].

    defExt := self class defaultExtent.

    (mm := MiniScrollerSize) isNil ifTrue:[
        mm := (thumbLevel ~~ 0) ifTrue:[2.5] ifFalse:[2.0].
        styleSheet name == #st80 ifTrue:[
            mm := 2.5
        ].
    ].

    w := defExt x.
    h := defExt y.

    orientation == #vertical ifTrue:[
        w := (device horizontalPixelPerMillimeter asFloat * mm) rounded.
    ] ifFalse:[
        h := (device verticalPixelPerMillimeter asFloat * mm) rounded.
    ].

    preferredExtent := w @ h.
    ^ preferredExtent.

    "Modified: 15.8.1997 / 01:54:17 / cg"
! !

!MiniScroller class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libwidg/MiniScroller.st,v 1.17 1997-08-15 11:04:32 cg Exp $'
! !