"
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/Attic/ArrButton.st,v 1.4 1994-01-13 00:14:23 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 := UpArrowForm on:Display.
].
^ 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 := DownArrowForm on:Display.
].
^ 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 := LeftArrowForm on:Display.
].
^ 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 := RightArrowForm on:Display.
].
^ 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
|form|
aDirectionSymbol == #up ifTrue:[
form := (self class upArrowButtonForm:style)
].
aDirectionSymbol == #down ifTrue:[
form := (self class downArrowButtonForm:style)
].
aDirectionSymbol == #left ifTrue:[
form := (self class leftArrowButtonForm:style)
].
aDirectionSymbol == #right ifTrue:[
form := (self class rightArrowButtonForm:style)
].
self form:form
! !
!ArrowButton methodsFor:'initialization'!
initStyle
super initStyle.
style == #motif ifTrue:[
onLevel := 0.
offLevel := 0.
self level:0
]
! !
!ArrowButton methodsFor:'redrawing'!
drawWith:fg and:bg
"this is a q&d hack for motif ..."
|topLeft botRight|
style ~~ #motif ifTrue:[
^ super drawWith:fg and:bg.
].
logo notNil ifTrue:[
pressed ifTrue:[
topLeft := shadowColor.
botRight := lightColor
] ifFalse:[
topLeft := lightColor.
botRight := shadowColor
].
self paint:bg.
self clear.
self foreground:(Color noColor) background:(Color allColor) function:#and.
self displayOpaqueForm:logo x:labelOriginX-1 y:labelOriginY - 1 .
self foreground:topLeft background:(Color noColor) function:#or.
self displayOpaqueForm:logo x:labelOriginX-1 y:labelOriginY - 1.
self foreground:(Color noColor) background:(Color allColor) function:#and.
self displayOpaqueForm:logo x:labelOriginX y:labelOriginY - 1 .
self foreground:topLeft background:(Color noColor) function:#or.
self displayOpaqueForm:logo x:labelOriginX y:labelOriginY - 1.
self foreground:(Color noColor) background:(Color allColor) function:#and.
self displayOpaqueForm:logo x:labelOriginX -1 y:labelOriginY .
self foreground:topLeft background:(Color noColor) function:#or.
self displayOpaqueForm:logo x:labelOriginX -1 y:labelOriginY .
self foreground:(Color noColor) background:(Color allColor) function:#and.
self displayOpaqueForm:logo x:labelOriginX + 1 y:labelOriginY .
self foreground:botRight background:(Color noColor) function:#or.
self displayOpaqueForm:logo x:labelOriginX + 1 y:labelOriginY .
self foreground:(Color noColor) background:(Color allColor) function:#and.
self displayOpaqueForm:logo x:labelOriginX + 1 y:labelOriginY + 1 .
self foreground:botRight background:(Color noColor) function:#or.
self displayOpaqueForm:logo x:labelOriginX + 1 y:labelOriginY + 1.
self foreground:(Color noColor) background:(Color allColor) function:#and.
self displayOpaqueForm:logo x:labelOriginX y:labelOriginY .
self foreground:bg background:(Color noColor) function:#or.
self displayOpaqueForm:logo x:labelOriginX y:labelOriginY .
self function:#copy
]
! !