bug fixes:
enable/disable of toggles and LabelAndIcons
support of Indicators with label an LabelAndIcon
--- a/MenuPanel.st Fri Jul 31 10:15:28 1998 +0200
+++ b/MenuPanel.st Fri Jul 31 17:20:10 1998 +0200
@@ -3638,6 +3638,15 @@
"
|indicator|
+ (indicator := self indication) isNil ifTrue:[
+ ^ self
+ ].
+ menuPanel isPopUpView ifFalse:[
+ (self isKindOfValueHolder:indicator) ifTrue:[
+ ^ self
+ ]
+ ].
+
(indicator := self indicator) notNil ifTrue:[
indicator = rawLabel icon ifFalse:[
isButton ifFalse: [rawLabel icon:indicator].
@@ -3736,6 +3745,8 @@
"
|y x h l t scKey cLb cLa img fg asc arrow hrzInset buttonLevel isSelected|
+ self isVisible ifFalse:[^ self].
+
img := rawLabel.
asc := menuPanel font ascent.
h := layout height.
@@ -3747,7 +3758,6 @@
self enabled ifTrue:[
fg := isSelected ifTrue:[self activeForegroundColor]
ifFalse:[menuPanel foregroundColor].
-
menuPanel paint:fg
] ifFalse:[
menuPanel paint:(menuPanel disabledForegroundColor).
@@ -3764,23 +3774,20 @@
].
isButton ifTrue:[
- (isSelected or:[self hasIndication and: [self indicationValue]])
- ifTrue:
+ (isSelected or:[self indicationValue == true]) ifTrue:
[
img displayOn:menuPanel x:(l + hrzInset) + 1 y: y + 1.
- buttonLevel := menuPanel buttonActiveLevel
- ]
- ifFalse:
- [
+ buttonLevel := menuPanel buttonActiveLevel.
+ ] ifFalse:[
img displayOn:menuPanel x:(l + hrzInset) y:y.
buttonLevel := menuPanel buttonPassiveLevel
].
- menuPanel drawEdgesInLayout: layout withLevel: buttonLevel
- ]
- ifFalse:
- [
- img displayOn:menuPanel x:(l + hrzInset) y:y.
+ menuPanel drawEdgesInLayout: layout withLevel: buttonLevel.
+ ^ self
].
+
+ img displayOn:menuPanel x:(l + hrzInset) y:y.
+
"/ DRAW SHORTCUT KEY
DisplayShortKey == true ifTrue:[
@@ -4029,14 +4036,22 @@
and:[(rawImage respondsTo:#colorMap)
and:[rawImage colorMap notNil]]
) ifFalse:[
- disabledRawLabel := rawLabel
+ disabledRawLabel := rawLabel.
] ifTrue:[
disabledRawLabel := menuPanel lightenedImageOnDevice:rawImage.
rawLabel class == LabelAndIcon ifTrue:[
- disabledRawLabel := LabelAndIcon form:disabledRawLabel
- image:(rawLabel image)
- string:(rawLabel string)
+ (isButton
+ or:[(self indicator notNil and:[label class == LabelAndIcon])]
+ ) ifTrue:[
+ disabledRawLabel := LabelAndIcon form:(rawLabel icon)
+ image:disabledRawLabel
+ string:(rawLabel string)
+ ] ifFalse:[
+ disabledRawLabel := LabelAndIcon form:disabledRawLabel
+ image:(rawLabel image)
+ string:(rawLabel string)
+ ]
]
]
].
@@ -4063,7 +4078,12 @@
]
] ifFalse:[
(rawLabel class == LabelAndIcon and:[isButton not]) ifTrue:[
- rawLabel icon:(menuPanel imageOnDevice:rawImage)
+ (self indicator notNil and:[label class == LabelAndIcon]) ifTrue:[
+ rawLabel image:(menuPanel imageOnDevice:rawImage).
+ rawLabel icon:self indicator.
+ ] ifFalse:[
+ rawLabel icon:(menuPanel imageOnDevice:rawImage)
+ ]
]
]
@@ -4685,6 +4705,6 @@
!MenuPanel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.102 1998-07-31 08:15:28 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.103 1998-07-31 15:20:10 ca Exp $'
! !
MenuPanel initialize!