#UI_ENHANCEMENT by cg
class: VariablePanel
class definition
comment/format in: #redrawHandlesFrom:to:
changed:
#initStyle
#pointerEnter:x:y:
#pointerLeave:
class: VariablePanel class
comment/format in: #updateStyleCache
--- a/VariablePanel.st Thu Dec 19 14:30:22 2019 +0100
+++ b/VariablePanel.st Thu Dec 19 15:44:19 2019 +0100
@@ -20,12 +20,13 @@
showHandle showHandleWhenEntered handlePosition handleColor
handleStyle handleLevel noColor trackLine redrawLocked
orientation handleLabels knobHeight realRelativeSizes
- snapAdornment'
+ snapAdornment barSideLineColor'
classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition
DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor
DefaultHandleLevel DefaultVCursor DefaultHCursor
DefaultHandleImage DefaultSnapIcons DefaultSnapHandlePosition
- DefaultShowHandleWhenEntered'
+ DefaultShowHandleWhenEntered DefaultSideLineColor DefaultBarWidth
+ DefaultBackgroundColor'
poolDictionaries:''
category:'Views-Layout'
!
@@ -740,7 +741,9 @@
#'variablePanel.trackingLine'
#'variablePanel.trackingStyle'
#'variablePanel.separatingLine'
- #'variablePanel.handleColor')>
+ #'variablePanel.handleColor'
+ #'variablePanel.backgroundColor'
+ #'variablePanel.barSideLineColor')>
|lineModeBoolean|
@@ -769,7 +772,10 @@
DefaultSeparatingLine := StyleSheet at:#'variablePanel.separatingLine' default:false.
DefaultHandleColor := StyleSheet colorAt:#'variablePanel.handleColor' default:Color black.
- DefaultHandleImage := StyleSheet at:#'variablePanel.handleImage'
+ DefaultHandleImage := StyleSheet at:#'variablePanel.handleImage'.
+ DefaultSideLineColor := StyleSheet colorAt:#'variablePanel.barSideLineColor'.
+ DefaultBarWidth := StyleSheet at:#'variablePanel.barWidth'.
+ DefaultBackgroundColor := StyleSheet colorAt:#'variablePanel.backgroundColor'.
"
VariablePanel updateStyleCache
@@ -1975,14 +1981,26 @@
"redraw some handles and snaps"
subViews size ~~ 0 ifTrue:[
- showHandle ifTrue:[
+ (showHandle or:[barSideLineColor notNil]) ifTrue:[
self handleOriginsWithIndexFrom:start to:stop do:[:hPoint :hIndex |
|hx hy|
hx := hPoint x.
hy := hPoint y.
+
barLevel notNil ifTrue:[
self drawEdgesForX:0 y:hy width:width height:barHeight level:barLevel.
+ ] ifFalse:[
+ barSideLineColor notNil ifTrue:[
+ self paint:barSideLineColor.
+ self isHorizontal ifTrue:[
+ self displayLineFromX:0 y:0 toX:width-1 y:0.
+ self displayLineFromX:0 y:barHeight-1 toX:width-1 y:barHeight-1.
+ ] ifFalse:[
+ self displayLineFromX:0 y:0 toX:0 y:height-1.
+ self displayLineFromX:width-1 y:0 toX:width-1 y:height-1.
+ ].
+ ].
].
"/ do not draw handle, if there is a snapper ...
@@ -2022,7 +2040,7 @@
pointerEnter:buttonState x:x y:y
"/ not called - see controller
- showHandleWhenEntered == true ifTrue:[
+ showHandleWhenEntered ifTrue:[
self showHandle:true
].
super pointerEnter:buttonState x:x y:y.
@@ -2033,7 +2051,7 @@
pointerLeave:buttonState
"/ not called - see controller
- showHandleWhenEntered == true ifTrue:[
+ showHandleWhenEntered ifTrue:[
self showHandle:false
].
super pointerLeave:buttonState.
@@ -2134,10 +2152,11 @@
initStyle
"setup viewStyle specifics"
- |mm|
+ |mm computedBarWidth|
super initStyle.
+ viewBackground := DefaultBackgroundColor ? viewBackground.
handleColor := DefaultHandleColor onDevice:device.
DefaultHandleStyle isNil ifTrue:[
@@ -2148,7 +2167,7 @@
handleLevel := DefaultHandleLevel.
showHandle := DefaultShowHandle.
- showHandleWhenEntered := DefaultShowHandleWhenEntered.
+ showHandleWhenEntered := DefaultShowHandleWhenEntered ? false.
handlePosition := DefaultHandlePosition.
"/ snapHandlePosition := DefaultSnapHandlePosition.
trackLine := DefaultTrackingLine.
@@ -2156,7 +2175,7 @@
DefaultHandleImage notNil ifTrue:[
shadowForm := DefaultHandleImage onDevice:device.
- barWidth := shadowForm width.
+ computedBarWidth := shadowForm width.
] ifFalse:[
handleStyle == #next ifTrue:[
DefaultHandleImage notNil ifTrue:[
@@ -2165,22 +2184,23 @@
shadowForm := self class shadowFormOn:device.
lightForm := self class lightFormOn:device.
].
- barWidth := shadowForm width.
+ computedBarWidth := shadowForm width.
] ifFalse:[
shadowForm := lightForm := nil.
mm := device verticalPixelPerMillimeter.
- barWidth := (1.5 * mm) rounded. "motif style width"
+ computedBarWidth := (1.5 * mm) rounded. "motif style width"
].
].
- barWidth := styleSheet at:#'variablePanel.barWidth' default:barWidth.
-
+ barWidth := DefaultBarWidth ? computedBarWidth.
+ barSideLineColor := DefaultSideLineColor.
+
self computeBarHeight.
handleStyle == #mswindows ifTrue:[
barWidth := (ArrowButton new direction:#up) width + 1
].
- showHandleWhenEntered == true ifTrue:[
+ showHandleWhenEntered ifTrue:[
self enableEnterLeaveEvents
].