--- a/MenuPanel.st Thu Feb 05 06:53:39 1998 +0100
+++ b/MenuPanel.st Thu Feb 05 15:31:20 1998 +0100
@@ -17,16 +17,19 @@
menuHolder enabled onLevel offLevel fgColor activeFgColor
lastActiveMenu activeBgColor disabledFgColor groupDividerSize
itemSpace fitFirstPanel rightArrow rightArrowShadow
- buttonFrameColor buttonShadowColor buttonLightColor'
+ selectionFrameBrightColor selectionFrameDarkColor
+ buttonLightColor buttonShadowColor buttonHalfLightColor
+ buttonHalfShadowColor'
classVariableNames:'InitialSelectionQuerySignal DefaultAdornment
DefaultGroupDividerSize DefaultHilightLevel DefaultLevel
DefaultItemSpace DefaultForegroundColor DefaultBackgroundColor
DefaultHilightForegroundColor DefaultHilightBackgroundColor
DefaultDisabledForegroundColor DefaultFitFirstPanel
- RightArrowForm RightArrowShadowForm ButtonActiveLevel
- ButtonPassiveLevel ButtonActiveBackgroundColor
- ButtonPassiveBackgroundColor ButtonFrameColor ButtonShadowColor
- ButtonLightColor'
+ RightArrowForm RightArrowShadowForm SelectionFrameBrightColor
+ SelectionFrameDarkColor ButtonActiveLevel ButtonPassiveLevel
+ ButtonActiveBackgroundColor ButtonPassiveBackgroundColor
+ ButtonLightColor ButtonShadowColor ButtonHalfLightColor
+ ButtonHalfShadowColor ButtonEdgeStyle'
poolDictionaries:''
category:'Views-Menus'
!
@@ -378,18 +381,20 @@
RightArrowShadowForm := nil
].
-
- ButtonActiveLevel := (menuStyle at:'button.activeLevel' default: 2) abs.
- ButtonPassiveLevel := (menuStyle at:'button.passiveLevel' default: 2) abs.
- ButtonActiveBackgroundColor := menuStyle at:'button.activeBackgroundColor' default: DefaultBackgroundColor.
+ SelectionFrameBrightColor := Color white.
+ SelectionFrameDarkColor := Color black.
+
+ ButtonActiveLevel := menuStyle at:'button.activeLevel' default: -2.
+ ButtonPassiveLevel := menuStyle at:'button.passiveLevel' default: 2.
+ ButtonActiveBackgroundColor := menuStyle at:'button.activeBackgroundColor' default: DefaultBackgroundColor.
ButtonPassiveBackgroundColor := (menuStyle at:'button.backgroundColor') ? (menuStyle at:'viewBackground') ? DefaultBackgroundColor.
- ButtonFrameColor := Color black.
- ButtonShadowColor := (menuStyle at:'button.shadowColor') ? (menuStyle at:'button.halfShadowColor') ? (menuStyle at:'shadowColor') ? Color gray.
- ButtonLightColor := (menuStyle at:'button.lightColor') ? (menuStyle at:'button.halfLightColor') ? (menuStyle at:'lightColor') ? Color white.
+ ButtonLightColor := (menuStyle at:'button.lightColor') ? Color white.
+ ButtonShadowColor := (menuStyle at:'button.shadowColor') ? Color gray.
+ ButtonHalfLightColor := menuStyle at:'button.halfLightColor'.
+ ButtonHalfShadowColor := menuStyle at:'button.halfShadowColor'.
+ ButtonEdgeStyle := menuStyle at:'button.edgeStyle'.
Item updateStyleCache
-
- "Modified: / 15.1.1998 / 22:59:44 / stefan"
! !
!MenuPanel class methodsFor:'private'!
@@ -903,10 +908,22 @@
^ButtonActiveBackgroundColor
!
-buttonFrameColor
- "get the drawing color used to frame button
- "
- ^buttonFrameColor
+buttonEdgeStyle
+ "get the button edge style
+ "
+ ^ButtonEdgeStyle
+!
+
+buttonHalfLightColor
+ "get the background drawing color used to half light button frame
+ "
+ ^buttonHalfLightColor
+!
+
+buttonHalfShadowColor
+ "get the background drawing color used to half shadow button frame
+ "
+ ^buttonHalfShadowColor
!
buttonLightColor
@@ -999,6 +1016,18 @@
!
+selectionFrameBrightColor
+ "get the selection frame bright color
+ "
+ ^selectionFrameBrightColor
+!
+
+selectionFrameDarkColor
+ "get the selection frame dark color
+ "
+ ^selectionFrameDarkColor
+!
+
shadowColor
"get the shadowColor
"
@@ -2175,28 +2204,36 @@
super fetchDeviceResources.
superMenu isNil ifTrue:[
- fgColor := DefaultForegroundColor onDevice:device.
- activeBgColor := DefaultHilightBackgroundColor onDevice:device.
- activeFgColor := DefaultHilightForegroundColor onDevice:device.
- disabledFgColor := DefaultDisabledForegroundColor onDevice:device.
- rightArrow := RightArrowForm onDevice:device.
- buttonFrameColor := ButtonFrameColor onDevice:device.
- buttonShadowColor := ButtonShadowColor onDevice:device.
- buttonLightColor := ButtonLightColor onDevice:device.
+ fgColor := DefaultForegroundColor onDevice:device.
+ activeBgColor := DefaultHilightBackgroundColor onDevice:device.
+ activeFgColor := DefaultHilightForegroundColor onDevice:device.
+ disabledFgColor := DefaultDisabledForegroundColor onDevice:device.
+ rightArrow := RightArrowForm onDevice:device.
+ selectionFrameBrightColor := SelectionFrameBrightColor onDevice:device.
+ selectionFrameDarkColor := SelectionFrameDarkColor onDevice:device.
+ buttonLightColor := ButtonLightColor onDevice:device.
+ buttonShadowColor := ButtonShadowColor onDevice:device.
+ ButtonHalfLightColor notNil ifTrue: [
+ buttonHalfLightColor := ButtonHalfLightColor onDevice:device].
+ ButtonHalfShadowColor notNil ifTrue: [
+ buttonHalfShadowColor := ButtonHalfShadowColor onDevice:device].
(rightArrowShadow := RightArrowShadowForm) notNil ifTrue:[
rightArrowShadow := rightArrowShadow onDevice:device
]
] ifFalse:[
- fgColor := superMenu foregroundColor.
- activeBgColor := superMenu activeBackgroundColor.
- activeFgColor := superMenu activeForegroundColor.
- disabledFgColor := superMenu disabledForegroundColor.
- rightArrow := superMenu rightArrow.
- rightArrowShadow := superMenu rightArrowShadow.
- buttonFrameColor := superMenu buttonFrameColor.
- buttonShadowColor := superMenu buttonShadowColor.
- buttonLightColor := superMenu buttonLightColor.
+ fgColor := superMenu foregroundColor.
+ activeBgColor := superMenu activeBackgroundColor.
+ activeFgColor := superMenu activeForegroundColor.
+ disabledFgColor := superMenu disabledForegroundColor.
+ rightArrow := superMenu rightArrow.
+ rightArrowShadow := superMenu rightArrowShadow.
+ selectionFrameBrightColor := superMenu selectionFrameBrightColor.
+ selectionFrameDarkColor := superMenu selectionFrameDarkColor.
+ buttonLightColor := superMenu buttonLightColor.
+ buttonShadowColor := superMenu buttonShadowColor.
+ buttonHalfLightColor := superMenu buttonHalfLightColor.
+ buttonHalfShadowColor := superMenu buttonHalfShadowColor.
].
style := styleSheet name.
@@ -3409,47 +3446,18 @@
drawButtonFrame
"draw a Button frame around the item
"
- |
- isPressed
- buttonLevel "{ Class:SmallInteger }"
- l "{ Class:SmallInteger }"
- t "{ Class:SmallInteger }"
- h "{ Class:SmallInteger }"
- w "{ Class:SmallInteger }"
- |
-
- l := layout left.
- t := layout top.
- h := layout height.
- w := layout width.
-
- isPressed := self isSelected or: [self hasIndication and: [self indicationValue]].
-
- isPressed
- ifFalse:[menuPanel paint: menuPanel buttonLightColor. buttonLevel := menuPanel buttonPassiveLevel]
- ifTrue: [menuPanel paint: menuPanel buttonShadowColor. buttonLevel := menuPanel buttonActiveLevel].
-
- 1 to: buttonLevel do: [:i|
- menuPanel displayLineFromX: l + 1 + i y: t + i toX: l + w - 2 - i y: t + i.
- menuPanel displayLineFromX: l + i y: t + i toX: l + i y: t + h - 1 - i.
- ].
-
- isPressed
- ifFalse: [menuPanel paint: menuPanel buttonShadowColor]
- ifTrue: [menuPanel paint: menuPanel buttonLightColor].
-
- 1 to: buttonLevel do: [:i|
- menuPanel displayLineFromX: l + w - 1 - i y: t + i toX: l + w - 1 - i y: t + h - i.
- menuPanel displayLineFromX: l + i + 1 y: t + h - 1 - i toX: l + w - 1 - i y: t + h - 1 - i.
- ].
-
- menuPanel paint: menuPanel buttonFrameColor.
- menuPanel displayRectangleX: l y: t width: w height: h.
-
-
-
-
-
+ |buttonLevel "{ Class:SmallInteger }"|
+
+ (self isSelected or: [self hasIndication and: [self indicationValue]])
+ ifFalse:[buttonLevel := menuPanel buttonPassiveLevel]
+ ifTrue: [buttonLevel := menuPanel buttonActiveLevel].
+
+ menuPanel drawEdgesForX: layout left y: layout top width: layout width height: layout height level: buttonLevel
+ shadow: menuPanel buttonShadowColor
+ light: menuPanel buttonLightColor
+ halfShadow: menuPanel buttonHalfShadowColor
+ halfLight: menuPanel buttonHalfLightColor
+ style: menuPanel buttonEdgeStyle
!
drawLabel
@@ -3685,11 +3693,11 @@
self drawLabel.
(ownBgCol notNil and:[self isSelected]) ifTrue:[
- ownBgCol brightness > 0.5 ifTrue:[menuPanel paint:(Color black)]
- ifFalse:[menuPanel paint:(Color white)].
+ ownBgCol brightness > 0.5 ifTrue:[menuPanel paint: menuPanel selectionFrameDarkColor]
+ ifFalse:[menuPanel paint: menuPanel selectionFrameBrightColor].
menuPanel displayRectangleX:(l + 1) y:(t + 1) width:(w - 2) height:(h - 2).
- menuPanel displayRectangleX:(l + 2) y:(t + 2) width:(w - 4) height:(h - 4).
+ menuPanel displayRectangleX:(l + 2) y:(t + 2) width:(w - 4) height:(h - 4).
].
menuPanel drawEdgesForX:l y:t width:w height:h isSelected:isSelected.
@@ -4348,6 +4356,6 @@
!MenuPanel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.66 1998-02-05 05:53:39 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.67 1998-02-05 14:31:20 tz Exp $'
! !
MenuPanel initialize!