ArrowButton.st
author claus
Wed, 13 Oct 1993 02:04:14 +0100
changeset 3 9d7eefb5e69f
parent 1 3ebee08bea15
child 6 fd1b68b48422
permissions -rw-r--r--
(none)

"
 COPYRIGHT (c) 1993 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.
"

Button subclass:#ArrowButton
	 instanceVariableNames:'passiveForm activeForm'
	 classVariableNames:'DownArrowForm UpArrowForm
			     LeftArrowForm RightArrowForm'
	 poolDictionaries:''
	 category:'Views-Interactors'
!

ArrowButton comment:'

COPYRIGHT (c) 1993 by Claus Gittinger
              All Rights Reserved

Buttons of scrollbars - show arrows.

$Header: /cvs/stx/stx/libwidg/ArrowButton.st,v 1.1 1993-10-13 01:01:05 claus Exp $

written summer 93 by claus
'!

!ArrowButton class methodsFor:'defaults'!

upArrowButtonForm:style
    "answer the form used for the scrollUp Button"

    UpArrowForm isNil ifTrue:[
        UpArrowForm := Form fromFile:(self classResources at:'SCROLL_UP_BUTTON_FORM_FILE'
                                                   default:(style == #mswindows
                                                                 ifTrue:['ScrollUp_win.xbm']
                                                                 ifFalse:['ScrollUp.xbm'])
                                             )
                                  resolution:100
    ].
    UpArrowForm isNil ifTrue:[
        UpArrowForm := Form width:16 height:16 
                                      fromArray:#(2r00000000 2r00000000
                                                  2r00000001 2r10000000
                                                  2r00000010 2r01000000
                                                  2r00000100 2r00100000
                                                  2r00001000 2r00010000
                                                  2r00010000 2r00001000
                                                  2r00100000 2r00000100
                                                  2r01000000 2r00000010
                                                  2r01111000 2r00011110
                                                  2r00001000 2r00010000
                                                  2r00001000 2r00010000
                                                  2r00001000 2r00010000
                                                  2r00001000 2r00010000
                                                  2r00001000 2r00010000
                                                  2r00001111 2r11110000
                                                  2r00000000 2r00000000)
    ].
    ^ UpArrowForm
!

downArrowButtonForm:style
    "retun the form used for the scrollDown Button"

    DownArrowForm  isNil ifTrue:[
        DownArrowForm  := Form fromFile:(self classResources at:'SCROLL_DOWN_BUTTON_FORM_FILE'
                                                    default:(style == #mswindows
                                                                 ifTrue:['ScrollDn_win.xbm']
                                                                 ifFalse:['ScrollDn.xbm'])
                                                )
                                    resolution:100
    ].
    DownArrowForm  isNil ifTrue:[
        DownArrowForm  := Form width:16 height:16 
                                      fromArray:#(2r00000000 2r00000000
                                                  2r00001111 2r11110000
                                                  2r00001000 2r00010000
                                                  2r00001000 2r00010000
                                                  2r00001000 2r00010000
                                                  2r00001000 2r00010000
                                                  2r00001000 2r00010000
                                                  2r01111000 2r00011110
                                                  2r01000000 2r00000010
                                                  2r00100000 2r00000100
                                                  2r00010000 2r00001000
                                                  2r00001000 2r00010000
                                                  2r00000100 2r00100000
                                                  2r00000010 2r01000000
                                                  2r00000001 2r10000000
                                                  2r00000000 2r00000000)
    ].
    ^ DownArrowForm 
!

leftArrowButtonForm:style
    LeftArrowForm isNil ifTrue:[
        LeftArrowForm := Form fromFile:(self classResources at:'SCROLL_LEFT_BUTTON_FORM_FILE'
                                                     default:(style == #mswindows
                                                                 ifTrue:['ScrollLt_win.xbm']
                                                                 ifFalse:['ScrollLt.xbm']))
                                    resolution:100
    ].
    LeftArrowForm isNil ifTrue:[
        LeftArrowForm :=
            Form width:16 height:16 fromArray:#(2r00000000 2r00000000
                                                2r00000001 2r10000000
                                                2r00000010 2r10000000
                                                2r00000100 2r10000000
                                                2r00001000 2r11111110
                                                2r00010000 2r00000010
                                                2r00100000 2r00000010
                                                2r01000000 2r00000010
                                                2r01000000 2r00000010
                                                2r00100000 2r00000010
                                                2r00010000 2r00000010
                                                2r00001000 2r11111110
                                                2r00000100 2r10000000
                                                2r00000010 2r10000000
                                                2r00000001 2r10000000
                                                2r00000000 2r00000000)
    ].
    ^ LeftArrowForm
!

rightArrowButtonForm:style
    RightArrowForm isNil ifTrue:[
        RightArrowForm := Form fromFile:(self classResources at:'SCROLL_RIGHT_BUTTON_FORM_FILE'
                                                      default:(style == #mswindows
                                                                 ifTrue:['ScrollRt_win.xbm']
                                                                 ifFalse:['ScrollRt.xbm']))
                                     resolution:100
    ].
    RightArrowForm isNil ifTrue:[
        RightArrowForm :=
            Form width:16 height:16 fromArray:#(2r00000000 2r00000000
                                                2r00000001 2r10000000
                                                2r00000001 2r01000000
                                                2r00000001 2r00100000
                                                2r01111111 2r00010000
                                                2r01000000 2r00001000
                                                2r01000000 2r00000100
                                                2r01000000 2r00000010
                                                2r01000000 2r00000010
                                                2r01000000 2r00000100
                                                2r01000000 2r00001000
                                                2r01111111 2r00010000
                                                2r00000001 2r00100000
                                                2r00000001 2r01000000
                                                2r00000001 2r10000000
                                                2r00000000 2r00000000)
    ].
    ^ RightArrowForm
! !

!ArrowButton class methodsFor:'instance creation'!

upIn:aView
    ^ (super in:aView) direction:#up
!

downIn:aView
    ^ (super in:aView) direction:#down
!

leftIn:aView
    ^ (super in:aView) direction:#left
!

rightIn:aView
    ^ (super in:aView) direction:#right
! !

!ArrowButton methodsFor:'accessing'!

direction:aDirectionSymbol
    aDirectionSymbol == #up ifTrue:[
        ^ self form:(self class upArrowButtonForm:style)
    ].
    aDirectionSymbol == #down ifTrue:[
        ^ self form:(self class downArrowButtonForm:style)
    ].
    aDirectionSymbol == #left ifTrue:[
        ^ self form:(self class leftArrowButtonForm:style)
    ].
    aDirectionSymbol == #right ifTrue:[
        ^ self form:(self class rightArrowButtonForm:style)
    ].
! !

!ArrowButton methodsFor:'initialization'!

initStyle
    super initStyle.
    style == #motif ifTrue:[
        onLevel := 0.
        offLevel := 0.
        self level:0
    ]
! !