| action |
| disable
|
persist ifFalse:[
animateTime ifNil: [
animateTime := self fadeDelta asFloat / self fadeDelay.
self future: self fadeDelta deferRelative: 0.0 perform: #doFade.
].
].
|
| doFade
|
"reduce color alpha"
| pct |
animateTime ifNil: [^self].
pct := color at: 4.
pct := pct - animateTime.
pct >= 0.0 ifTrue: [
color at: 4 put: pct.
self color: color.
self future: self fadeDelta deferRelative: 0.0 perform: #doFade.
] ifFalse: [
frame solidVisibleTree: false.
frame2 ifNotNil:[frame2 solidVisibleTree: false.].
].
Croquet commit.
|
| doSpin
|
"spin the button"
doSpin := doSpin + deltaSpin.
doSpin <= -360 ifTrue: [doSpin := 0.].
self rotationAroundY: doSpin.
doSpin ~= 0 ifTrue: [ self future: self spinDelta deferRelative: 0.0 perform: #doSpin. ].
Croquet commit.
|
| enable
|
self color: TButton overColor.
switch ifNil:[ frame solidVisibleTree: true. ] ifNotNil:[
frame solidVisibleTree: switch not.
frame2 solidVisibleTree: switch.
].
animateTime _ nil.
|
| fadeDelta
|
^125.0 "1/8 second"
|
| spinDelta
|
^125.0 "1/8 second"
|
| target2: trgt action2: act
|
target2 _ trgt.
action2 _ act.
|
| target: trgt action: act
|
target _ trgt.
action _ act.
|
| events |
| handlesPointerDown: pointer
|
^ true.
|
| handlesPointerOver: pointer
|
^ true.
|
| persist: bool
|
persist _ bool.
persist ifTrue:[
self color: TButton overColor.
self enable.].
persist ifFalse:[self disable.].
|
| pointerDown: pointer
|
self color: TButton downColor.
frame2 ifNotNil:[
switch ifNotNil:[
frame solidVisibleTree: switch not.
frame2 solidVisibleTree: switch.
] ifNil:[
frame solidVisibleTree: false.
frame2 solidVisibleTree: true.
].
].
^ true
|
| pointerEnter: pointer
|
self enable.
self color: TButton hiliteColor.
spin ifTrue:[
deltaSpin _ -1.
doSpin = 0 ifTrue: [self future: self spinDelta deferRelative: 0.0 perform: #doSpin.].
].
^ true.
|
| pointerLeave: pointer
|
self disable.
persist ifTrue:[self color: TButton overColor.]
ifFalse:[self color: TButton normColor.].
spin ifTrue:[
doSpin > -180 ifTrue:[
deltaSpin _ deltaSpin negated.].
].
^ true
|
| pointerMove: pointer
|
pointer doSelect: true.
(pointer pointerPickTree: self) ifTrue:[
self color: TButton downColor.
switch ifNotNil:[
frame solidVisibleTree: switch.
frame2 solidVisibleTree: switch not.
] ifNil:[
frame2 ifNotNil:[
frame solidVisibleTree: false.
frame2 solidVisibleTree: true.
].
].
] ifFalse:[
self color: TButton hiliteColor.
switch ifNotNil:[
frame solidVisibleTree: switch not.
frame2 solidVisibleTree: switch.
] ifNil:[
frame2 ifNotNil:[
frame solidVisibleTree: true.
frame2 solidVisibleTree: false.
].
].
].
pointer doSelect: false.
^ true.
|
| pointerOver: pointer
|
^ true.
|
| pointerUp: pointer
|
| |
pointer doSelect: true.
pointer selectedDistance: Float infinity.
(pointer pointerPickTree: self) ifTrue:[
switch ifNotNil:[
local ifFalse:[self switch: switch not.]
ifTrue:[self switch: switch not.].
switch ifTrue:[target ifNotNil:[ target perform: action with: pointer.].]
ifFalse:[
target2 ifNotNil:[ target2 perform: action2 with: pointer.].].
]
ifNil:[
target ifNotNil:[ target perform: action with:pointer.].
frame solidVisibleTree: true.
frame2 ifNotNil:[ frame2 solidVisibleTree: false.].
].
] ifFalse:[
switch ifNotNil:[
frame solidVisibleTree: switch not.
frame2 solidVisibleTree: switch.
]ifNil:[
frame solidVisibleTree: true.
frame2 ifNotNil:[ frame2 solidVisibleTree: false.].
].
].
pointer doSelect: false.
persist ifTrue:[ self color: TButton overColor] ifFalse:[self color: TButton normColor].
^ true.
|
| switch: bool
|
switch _ bool.
(frame visibleTree or:[frame2 visibleTree])ifTrue:[
frame solidVisibleTree: switch not.
frame2 solidVisibleTree: switch.
].
|