--- a/PopUpMenu.st Sat Mar 18 06:16:33 1995 +0100
+++ b/PopUpMenu.st Sat Mar 18 06:16:50 1995 +0100
@@ -12,7 +12,8 @@
PopUpView subclass:#PopUpMenu
instanceVariableNames:'menuView lastSelection memorize hideOnLeave
- actionLabels actionLines actionValues'
+ actionLabels actionLines actionValues
+ hideOnRelease defaultHideOnRelease'
classVariableNames:''
poolDictionaries:''
category:'Views-Menus'
@@ -22,7 +23,7 @@
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libwidg/PopUpMenu.st,v 1.14 1995-02-28 21:52:21 claus Exp $
+$Header: /cvs/stx/stx/libwidg/PopUpMenu.st,v 1.15 1995-03-18 05:15:37 claus Exp $
'!
!PopUpMenu class methodsFor:'documentation'!
@@ -43,7 +44,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/PopUpMenu.st,v 1.14 1995-02-28 21:52:21 claus Exp $
+$Header: /cvs/stx/stx/libwidg/PopUpMenu.st,v 1.15 1995-03-18 05:15:37 claus Exp $
"
!
@@ -376,15 +377,7 @@
memorize := true.
hideOnLeave := false.
-"/ style == #iris ifTrue:[
-"/ borderWidth := 1
-"/ ].
-"/ (style == #st80) ifTrue:[
-"/ borderWidth := 1.
-"/ level := 0.
-"/ margin := 0.
-"/ shadowView := nil
-"/ ].
+ defaultHideOnRelease := StyleSheet at:#popupHideOnRelease default:true.
!
initEvents
@@ -412,6 +405,7 @@
realize
menuView deselectWithoutRedraw.
super realize.
+ hideOnRelease := defaultHideOnRelease.
! !
!PopUpMenu methodsFor:'private accessing'!
@@ -595,7 +589,7 @@
in:self)
! !
-!PopUpMenu methodsFor:'activation'!
+!PopUpMenu methodsFor:'deactivation'!
hide
"hide the menu - if there are any pop-up-submenus, hide them also"
@@ -690,6 +684,7 @@
((x >= 0) and:[x < width]) ifTrue:[
((y >= 0) and:[y < height]) ifTrue:[
+ hideOnRelease := true.
menuView buttonMotion:button x:x y:y.
^ self
]
@@ -729,7 +724,32 @@
"/ ]
!
+buttonPress:button x:x y:y
+ hideOnRelease ifTrue:[
+ self hide.
+"
+ menuView buttonRelease:button x:x y:y.
+"
+ menuView superMenu notNil ifTrue:[
+ menuView superMenu submenuTriggered
+ ].
+ menuView buttonRelease:button x:x y:y.
+ ] ifFalse:[
+ hideOnRelease := true.
+ ((x >= 0) and:[x < width]) ifTrue:[
+ ((y >= 0) and:[y < height]) ifTrue:[
+ menuView buttonPress:button x:x y:y.
+ ^ self
+ ]
+ ].
+ ].
+!
+
buttonRelease:button x:x y:y
+ hideOnRelease ifFalse:[
+ ^ self
+ ].
+
self hide.
"
menuView buttonRelease:button x:x y:y.