--- a/MenuView.st Sat Dec 08 14:29:15 2001 +0100
+++ b/MenuView.st Mon Dec 10 15:47:16 2001 +0100
@@ -13,12 +13,14 @@
"{ Package: 'stx:libwidg' }"
SelectionInListView subclass:#MenuView
- instanceVariableNames:'selectors args receiver enableFlags disabledFgColor onOffFlags
- subMenus subMenuShown superMenu checkColor lineLevel lineInset
- masterView needResize hideOnRelease sizeFixed shortKeys
- maxShortKeyStringLen actions checkOnImage checkOffImage'
+ instanceVariableNames:'selectors args receiver enableFlags disabledFgColor
+ disabledEtchedFgColor onOffFlags subMenus subMenuShown superMenu
+ checkColor lineLevel lineInset masterView needResize
+ hideOnRelease sizeFixed shortKeys maxShortKeyStringLen actions
+ checkOnImage checkOffImage'
classVariableNames:'DefaultCheckColor DefaultViewBackground DefaultForegroundColor
DefaultBackgroundColor DefaultDisabledForegroundColor
+ DefaultDisabledEtchedForegroundColor
DefaultHilightForegroundColor DefaultHilightBackgroundColor
DefaultHilightLevel DefaultHilightStyle DefaultHilightFrameColor
DefaultLineLevel DefaultLineInset DefaultShadowColor
@@ -47,8 +49,8 @@
documentation
"
Notice:
- MenuView is going to be obsoleted - use Menu & MenuItem for
- new applications.
+ MenuView is going to be obsoleted - use Menu & MenuItem,
+ and display them in a MenuPanel for new applications.
a menu view used for both pull-down-menus and pop-up-menus (and also,
for nonModal menus, such as the OldLaunchers click-menu).
@@ -341,6 +343,10 @@
DefaultLineLevel := StyleSheet at:#'menu.separatingLineLevel'.
DefaultLineInset := StyleSheet at:#'menu.separatingLineInset'.
DefaultDisabledForegroundColor := StyleSheet colorAt:#'menu.disabledForegroundColor' default:Color darkGray.
+ DefaultDisabledEtchedForegroundColor := StyleSheet colorAt:#'menu.disabledEtchedForegroundColor'.
+ DefaultDisabledEtchedForegroundColor isNil ifTrue:[
+ DefaultDisabledEtchedForegroundColor := StyleSheet colorAt:#'button.disabledEtchedForegroundColor'.
+ ].
DefaultCheckColor := StyleSheet colorAt:#'menu.checkColor'.
DefaultCheckOnImage := StyleSheet at:#'menu.checkOnImage'.
DefaultCheckOffImage := StyleSheet at:#'menu.checkOffImage'.
@@ -1815,6 +1821,7 @@
checkColor := fgColor.
].
disabledFgColor := DefaultDisabledForegroundColor.
+ disabledEtchedFgColor := DefaultDisabledEtchedForegroundColor.
DefaultForegroundColor notNil ifTrue:[
fgColor := DefaultForegroundColor onDevice:device
@@ -2536,45 +2543,55 @@
redrawVisibleLine:visLineNr
"redefined from normal list-line drawing, to handle special
lines. These are:
- lines consisting of '-' only: draw a horizontal separating line
- lines consisting of '=' only: draw double separating line
- empty line : leave blank
+ lines consisting of '-' only: draw a horizontal separating line
+ lines consisting of '=' only: draw double separating line
+ empty line : leave blank
there may be more in the future.
"
|line lineNr y isSpecial isSeparatingLine
- isDoubleLine right clr1 clr2|
+ isDoubleLine right clr1 clr2 text|
line := self visibleAt:visLineNr.
isSpecial := isDoubleLine := isSeparatingLine := false.
(line = '-') ifTrue:[
- isSeparatingLine := isSpecial := true.
+ isSeparatingLine := isSpecial := true.
] ifFalse:[
- (line = '=') ifTrue:[
- isSeparatingLine := isSpecial := isDoubleLine := true.
- ] ifFalse:[
- (line = '') ifTrue:[
- isSpecial := true
- ]
- ]
+ (line = '=') ifTrue:[
+ isSeparatingLine := isSpecial := isDoubleLine := true.
+ ] ifFalse:[
+ (line = '') ifTrue:[
+ isSpecial := true
+ ]
+ ]
].
isSpecial ifFalse:[
- lineNr := self visibleLineToListLine:visLineNr.
- (enableFlags at:lineNr) ifFalse:[
- self drawVisibleLine:visLineNr with:disabledFgColor and:bgColor
- ] ifTrue:[
- super redrawVisibleLine:visLineNr
- ].
-
- "/
- "/ is there a submenu ?
- "/
- (subMenus notNil and:[(subMenus at:lineNr ifAbsent:nil) notNil]) ifTrue:[
- self drawRightArrowInVisibleLine:visLineNr
- ].
- ^ self
+ lineNr := self visibleLineToListLine:visLineNr.
+ (enableFlags at:lineNr) ifFalse:[
+ text := self visibleAt:visLineNr.
+ disabledEtchedFgColor notNil ifTrue:[
+ text := text asText emphasisAllAdd:(#etchColor -> disabledEtchedFgColor)
+ ].
+ self
+ drawLine:text
+ atX:(textStartLeft - viewOrigin x)
+ inVisible:visLineNr
+ with:disabledFgColor
+ and:bgColor.
+ "/ self drawVisibleLine:visLineNr with:disabledFgColor and:bgColor
+ ] ifTrue:[
+ super redrawVisibleLine:visLineNr
+ ].
+
+ "/
+ "/ is there a submenu ?
+ "/
+ (subMenus notNil and:[(subMenus at:lineNr ifAbsent:nil) notNil]) ifTrue:[
+ self drawRightArrowInVisibleLine:visLineNr
+ ].
+ ^ self
].
"/
@@ -2587,44 +2604,44 @@
self fillRectangleX:0 y:y width:width height:fontHeight.
isSeparatingLine ifTrue:[
- y := y + (fontHeight // 2).
- isDoubleLine ifTrue:[
- y := y - (fontHeight // 8).
- ].
-
- right := width - 1 - lineInset.
-
- lineLevel == 0 ifTrue:[
- self paint:fgColor.
- self displayLineFromX:lineInset y:y toX:right y:y.
- isDoubleLine ifTrue:[
- y := y + (fontHeight // 4).
- self displayLineFromX:lineInset y:y toX:right y:y
- ]
- ] ifFalse:[
- "the inset on each side"
-
- lineLevel < 0 ifTrue:[
- clr1 := shadowColor.
- clr2 := lightColor.
- ] ifFalse:[
- clr1 := lightColor.
- clr2 := shadowColor.
- ].
-
- self paint:clr1.
- self displayLineFromX:lineInset y:y toX:right y:y.
- self paint:clr2.
- y := y + 1.
- self displayLineFromX:lineInset y:y toX:right y:y.
- isDoubleLine ifTrue:[
- y := y + (fontHeight // 4).
- self displayLineFromX:lineInset y:y toX:right y:y.
- y := y - 1.
- self paint:clr1.
- self displayLineFromX:lineInset y:y toX:right y:y.
- ]
- ]
+ y := y + (fontHeight // 2).
+ isDoubleLine ifTrue:[
+ y := y - (fontHeight // 8).
+ ].
+
+ right := width - 1 - lineInset.
+
+ lineLevel == 0 ifTrue:[
+ self paint:fgColor.
+ self displayLineFromX:lineInset y:y toX:right y:y.
+ isDoubleLine ifTrue:[
+ y := y + (fontHeight // 4).
+ self displayLineFromX:lineInset y:y toX:right y:y
+ ]
+ ] ifFalse:[
+ "the inset on each side"
+
+ lineLevel < 0 ifTrue:[
+ clr1 := shadowColor.
+ clr2 := lightColor.
+ ] ifFalse:[
+ clr1 := lightColor.
+ clr2 := shadowColor.
+ ].
+
+ self paint:clr1.
+ self displayLineFromX:lineInset y:y toX:right y:y.
+ self paint:clr2.
+ y := y + 1.
+ self displayLineFromX:lineInset y:y toX:right y:y.
+ isDoubleLine ifTrue:[
+ y := y + (fontHeight // 4).
+ self displayLineFromX:lineInset y:y toX:right y:y.
+ y := y - 1.
+ self paint:clr1.
+ self displayLineFromX:lineInset y:y toX:right y:y.
+ ]
+ ]
]
"Modified: 2.3.1996 / 14:48:08 / cg"
@@ -2735,5 +2752,5 @@
!MenuView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.132 2001-10-10 13:08:58 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.133 2001-12-10 14:47:16 cg Exp $'
! !