--- a/MenuPanel.st Sat Nov 17 00:41:06 2018 +0100
+++ b/MenuPanel.st Sat Nov 17 23:42:08 2018 +0100
@@ -670,28 +670,55 @@
<resource: #style (
#'selection.disabledForegroundColor'
- #'pullDownMenu.foregroundColor' #'pullDownMenu.backgroundColor' #'pullDownMenu.level'
- #'menu.itemHorizontalSpace' #'menu.buttonItemHorizontalSpace' #'menu.buttonItemSpace'
- #'menu.itemSpace' #'menu.buttonItemVerticalSpace'
- #'menu.buttonActiveLevel' #'menu.buttonPassiveLevel' #'menu.buttonEnteredLevel'
- #'menu.hilightLevel' #'menu.enteredLevel'
- #'menu.groupDividerSize' #'menu.itemMargin'
- #'menu.disabledEtchedForegroundColor' #'menu.hilightForegroundColor'
- #'menu.enteredBackgroundColor' #'menu.enteredForegroundColor'
- #'menu.disabledForegroundColor' #'menu.buttonEnteredBackgroundColor'
+ #'pullDownMenu.foregroundColor'
+ #'pullDownMenu.backgroundColor'
+ #'pullDownMenu.level'
+ #'menu.itemHorizontalSpace'
+ #'menu.buttonItemHorizontalSpace'
+ #'menu.buttonItemSpace'
+ #'menu.itemSpace'
+ #'menu.buttonItemVerticalSpace'
+ #'menu.buttonActiveLevel'
+ #'menu.buttonPassiveLevel'
+ #'menu.buttonEnteredLevel'
+ #'menu.hilightLevel'
+ #'menu.enteredLevel'
+ #'menu.groupDividerSize'
+ #'menu.itemMargin'
+ #'menu.disabledEtchedForegroundColor'
+ #'menu.hilightForegroundColor'
+ #'menu.enteredBackgroundColor'
+ #'menu.enteredForegroundColor'
+ #'menu.disabledForegroundColor'
+ #'menu.buttonEnteredBackgroundColor'
#'menu.selectionFollowsMouse'
- #'button.disabledEtchedForegroundColor' #'button.disabledForegroundColor'
- #'button.activeBackgroundColor' #'button.backgroundColor' #'button.lightColor'
- #'button.enteredBackgroundColor' #'button.halfLightColor' #'button.halfShadowColor'
- #'button.activeLevel' #'button.passiveLevel' #'button.edgeStyle'
- #'menu.iconIndicationOn' #'menu.iconIndicationOff'
- #'menu.iconIndicationOn.bitmapFile' #'menu.iconIndication.bitmapOffFile'
- #'menu.iconDisabledIndicationOn' #'menu.iconDisabledIndicationOff'
- #'menu.iconDisabledIndicationOn.bitmapFile' #'menu.iconDisabledIndication.bitmapOffFile'
- #'menu.iconRadioOn' #'menu.iconRadioOff'
- #'menu.iconRadioOn.bitmapFile' #'menu.iconRadioOff.bitmapFile'
- #'menu.iconDisabledRadioOn' #'menu.iconDisabledRadioOff'
- #'menu.iconDisabledRadioOn.bitmapFile' #'menu.iconDisabledRadioOff.bitmapFile'
+ #'button.disabledEtchedForegroundColor'
+ #'button.disabledForegroundColor'
+ #'button.activeBackgroundColor'
+ #'button.backgroundColor'
+ #'button.lightColor'
+ #'button.enteredBackgroundColor'
+ #'button.halfLightColor'
+ #'button.halfShadowColor'
+ #'button.activeLevel'
+ #'button.passiveLevel'
+ #'button.edgeStyle'
+ #'menu.iconIndicationOn'
+ #'menu.iconIndicationOff'
+ #'menu.iconIndicationOn.bitmapFile'
+ #'menu.iconIndication.bitmapOffFile'
+ #'menu.iconDisabledIndicationOn'
+ #'menu.iconDisabledIndicationOff'
+ #'menu.iconDisabledIndicationOn.bitmapFile'
+ #'menu.iconDisabledIndication.bitmapOffFile'
+ #'menu.iconRadioOn'
+ #'menu.iconRadioOff'
+ #'menu.iconRadioOn.bitmapFile'
+ #'menu.iconRadioOff.bitmapFile'
+ #'menu.iconDisabledRadioOn'
+ #'menu.iconDisabledRadioOff'
+ #'menu.iconDisabledRadioOn.bitmapFile'
+ #'menu.iconDisabledRadioOff.bitmapFile'
)>
|styleSheet style var foregroundColor backgroundColor buttonPassiveBackgroundColor
@@ -801,6 +828,7 @@
"Modified: / 19-01-2012 / 13:17:59 / cg"
"Modified (format): / 12-02-2017 / 12:04:25 / cg"
+ "Modified: / 17-11-2018 / 10:11:43 / Claus Gittinger"
! !
!MenuPanel class methodsFor:'image registration'!
@@ -3896,7 +3924,7 @@
^ self
].
- "/ self pointerEntersItem:item.
+ self pointerEntersItem:item.
(state == 0 or:[self sensor anyButtonPressed not]) ifTrue:[
(self selectionFollowsMouse
@@ -3942,7 +3970,7 @@
].
"Modified: / 15-03-2017 / 20:41:07 / stefan"
- "Modified (comment): / 28-05-2018 / 09:26:03 / Claus Gittinger"
+ "Modified: / 17-11-2018 / 11:03:05 / Claus Gittinger"
!
handleButtonPress:button atPoint:aPoint
@@ -4283,7 +4311,8 @@
and:[anItemOrNil canSelect
and:[selection isNil
and:[self isPopUpView not]]]) ifTrue:[
- anItemOrNil isButton ifTrue:[
+ (anItemOrNil isButton
+ and:[(styleSheet at:#'menu.ignoreIsButton' ifAbsent:false) not]) ifTrue:[
( self buttonEnteredBackgroundColor ~= self buttonPassiveBackgroundColor
or:[self buttonEnteredLevel ~= self buttonPassiveLevel]
) ifTrue:[
@@ -4310,6 +4339,8 @@
self invalidateItem:enteredItem repairNow:true.
].
].
+
+ "Modified: / 17-11-2018 / 23:12:03 / Claus Gittinger"
!
processHideMenuEvent:ev
@@ -7412,6 +7443,8 @@
"returns whether the item looks like a Button"
^ menuItem isButton
+
+ "Modified: / 17-11-2018 / 16:59:16 / Claus Gittinger"
!
isButton:aBool
@@ -7902,8 +7935,7 @@
x "{ Class:SmallInteger }"
y "{ Class:SmallInteger }"
w "{ Class:SmallInteger }"
- h "{ Class:SmallInteger }"
- |
+ h "{ Class:SmallInteger }" |
self isVisible ifFalse:[^ self].
layout isNil ifTrue:[
@@ -7915,7 +7947,16 @@
self drawSeparator.
^ self
].
- menuItem isButton ifTrue:[
+
+ (menuItem isButton
+ and:[(menuPanel styleSheet at:#'menu.ignoreIsButton' ifAbsent:false) not
+ ]) ifTrue:[
+ self drawButton.
+ ^ self
+ ].
+ (indication notNil
+ and:[(menuPanel styleSheet at:#'menu.ignoreIsButton' ifAbsent:false)
+ ]) ifTrue:[
self drawButton.
^ self
].
@@ -7924,14 +7965,15 @@
isSelected := self isSelected.
bgColor := menuPanel backgroundColor.
- paint := isSelected
- ifTrue:[self activeBackgroundColor]
- ifFalse:[
- (self isEnabled and:[ self isEntered ]) ifTrue:[
- menuPanel enteredBackgroundColor
- ] ifFalse:[
- bgColor
- ]].
+ isSelected ifTrue:[
+ paint := self activeBackgroundColor
+ ] ifFalse:[
+ (self isEnabled and:[ self isEntered ]) ifTrue:[
+ paint := menuPanel enteredBackgroundColor
+ ] ifFalse:[
+ paint := bgColor
+ ]
+ ].
(ownBgCol := self backgroundColorFromLabel) notNil ifTrue:[
paint := ownBgCol
@@ -7961,6 +8003,8 @@
menuPanel displayRectangleX:(x + 2) y:(y + 2) width:(w - 4) height:(h - 4).
].
menuPanel drawLabelEdgeFor:self selected:isSelected.
+
+ "Modified: / 17-11-2018 / 23:25:16 / Claus Gittinger"
!
drawButton
@@ -8066,7 +8110,8 @@
y "{ Class:SmallInteger }"
x "{ Class:SmallInteger }"
t "{ Class:SmallInteger }"
- |
+ isImage|
+
drawObject := displayLabel.
isEnabled := self enabled.
isSelected := self isSelected.
@@ -8099,11 +8144,12 @@
].
drawObject notEmptyOrNil ifTrue:[
+ isImage := drawObject isImageOrForm.
x := x + (menuPanel stringOffsetXfor:self).
-
+
etchFg notNil ifTrue:[
"/ do not draw images twice.. images are shown lightened
- drawObject isImageOrForm ifFalse:[
+ isImage ifFalse:[
self drawRawLabel:drawObject atX:x+1 yOffset:1 paint:etchFg.
].
].
@@ -8147,7 +8193,8 @@
].
].
- "Modified: / 6.9.1998 / 21:48:53 / cg"
+ "Modified: / 06-09-1998 / 21:48:53 / cg"
+ "Modified: / 17-11-2018 / 12:57:41 / Claus Gittinger"
!
drawMenuIndicator
@@ -8173,7 +8220,9 @@
].
bAbsLevel := 0.
- menuItem isButton ifTrue:[
+ (menuItem isButton
+ and:[(menuPanel styleSheet at:#'menu.ignoreIsButton' ifAbsent:false) not]
+ ) ifTrue:[
self isSelected ifTrue:[
x := x + 1.
y := y + 1.
@@ -8198,6 +8247,8 @@
menuPanel paint:menuPanel buttonLightColor.
menuPanel displayLineFromX:x-1 y:layout top+bAbsLevel+1 toX:x-1 y:layout bottom-bAbsLevel-2.
].
+
+ "Modified: / 17-11-2018 / 23:13:05 / Claus Gittinger"
!
drawRawLabel:aLabel atX:x yOffset:yOffset paint:fg
@@ -8386,19 +8437,21 @@
isOn := self indicationValue.
self enabled ifFalse:[
- ^ isOn == true
- ifTrue:[menuPanel iconIndicationDisabledOn]
- ifFalse:[menuPanel iconIndicationDisabledOff]
+ isOn == true
+ ifTrue:[^ menuPanel iconIndicationDisabledOn]
+ ifFalse:[^ menuPanel iconIndicationDisabledOff]
].
"/ self isSelected ifTrue:[
-"/ ^ isOn == true
-"/ ifTrue:[menuPanel iconIndicationEnteredOn]
-"/ ifFalse:[menuPanel iconIndicationEnteredOff]
+"/ isOn == true
+"/ ifTrue:[^ menuPanel iconIndicationEnteredOn]
+"/ ifFalse:[^ menuPanel iconIndicationEnteredOff]
"/ ].
- ^ isOn == true
- ifTrue:[menuPanel iconIndicationOn]
- ifFalse:[menuPanel iconIndicationOff]
+ isOn == true
+ ifTrue:[^ menuPanel iconIndicationOn]
+ ifFalse:[^ menuPanel iconIndicationOff]
+
+ "Modified (comment): / 17-11-2018 / 13:00:20 / Claus Gittinger"
!
invalidate
@@ -8650,6 +8703,7 @@
^ menuPanel backgroundColor
"Modified (comment): / 23-05-2017 / 16:11:41 / mawalch"
+ "Modified: / 17-11-2018 / 11:00:38 / Claus Gittinger"
!
findSubMenuIn:aRecv