#REFACTORING
class: ArrowButton
changed:
#direction:
#drawWith:and:
#initStyle
device access
--- a/ArrowButton.st Sat Apr 02 17:11:05 2016 +0200
+++ b/ArrowButton.st Sat Apr 02 17:11:45 2016 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1993 by Claus Gittinger
All Rights Reserved
@@ -824,7 +822,7 @@
|logo activeLogo enteredLogo disabledLogo graphicsDevice|
- graphicsDevice := self graphicsDevice.
+ graphicsDevice := device.
logo := self class
arrowButtonFormForStyle:arrowStyle
@@ -895,31 +893,28 @@
initStyle
"setup viewStyle specifics"
- |graphicsDevice|
-
super initStyle.
- graphicsDevice := self graphicsDevice.
DefaultBackgroundColor notNil ifTrue:[
- bgColor := DefaultBackgroundColor onDevice:graphicsDevice
+ bgColor := DefaultBackgroundColor onDevice:device
].
DefaultForegroundColor notNil ifTrue:[
- fgColor := DefaultForegroundColor onDevice:graphicsDevice
+ fgColor := DefaultForegroundColor onDevice:device
].
DefaultActiveForegroundColor notNil ifTrue:[
- activeFgColor := DefaultActiveForegroundColor onDevice:graphicsDevice
+ activeFgColor := DefaultActiveForegroundColor onDevice:device
].
DefaultActiveBackgroundColor notNil ifTrue:[
- activeBgColor := DefaultActiveBackgroundColor onDevice:graphicsDevice
+ activeBgColor := DefaultActiveBackgroundColor onDevice:device
].
DefaultEnteredForegroundColor notNil ifTrue:[
- enteredFgColor := DefaultEnteredForegroundColor onDevice:graphicsDevice
+ enteredFgColor := DefaultEnteredForegroundColor onDevice:device
].
DefaultEnteredBackgroundColor notNil ifTrue:[
- enteredBgColor := DefaultEnteredBackgroundColor onDevice:graphicsDevice
+ enteredBgColor := DefaultEnteredBackgroundColor onDevice:device
].
DefaultDisabledForegroundColor notNil ifTrue:[
- disabledFgColor := DefaultDisabledForegroundColor onDevice:graphicsDevice
+ disabledFgColor := DefaultDisabledForegroundColor onDevice:device
].
arrowStyle := DefaultArrowStyle.
@@ -962,8 +957,8 @@
self paint:bg.
self fillRectangleX:0 y:0 width:width height:height.
- shadowColor := shadowColor onDevice:self graphicsDevice.
- lightColor := lightColor onDevice:self graphicsDevice.
+ shadowColor := shadowColor onDevice:device.
+ lightColor := lightColor onDevice:device.
controller pressed ifTrue:[
topLeft := shadowColor.
@@ -994,17 +989,17 @@
logo colorMap:colors.
].
logo photometric:#palette.
- logo := logo onDevice:self graphicsDevice.
+ logo := logo onDevice:device.
self displayForm:logo x:labelOriginX y:labelOriginY.
^ self
].
- logo := logo onDevice:self graphicsDevice.
+ logo := logo onDevice:device.
orgX := labelOriginX.
orgY := labelOriginY.
] ifTrue:[
- orgY := height - gc font height // 2 + gc font ascent.
- orgX := width - labelOriginX // 4 - 1.
+ orgY := (height - gc font height) // 2 + gc font ascent.
+ orgX := (width - labelOriginX) // 4 - 1.
].
self paint:topLeft.