MenuPanel.st
changeset 680 a4220a7a79c4
parent 671 aadfb8c87b64
child 681 62c7cdaca188
--- a/MenuPanel.st	Sun Jan 25 15:14:42 1998 +0100
+++ b/MenuPanel.st	Mon Jan 26 18:16:08 1998 +0100
@@ -2060,11 +2060,23 @@
     "
     |sensor|
 
+    sensor := self sensor.
+
+    superMenu notNil ifTrue:[
+        superMenu shown ifTrue:[
+            ^ superMenu grabMouseAndKeyboard
+        ]
+    ] ifFalse:[
+        sensor anyButtonPressed ifTrue:[
+            ^ self grabMouseAndKeyboard
+        ]        
+    ].
+
     device activePointerGrab == self ifTrue:[
         device ungrabPointer.
     ].
     device activeKeyboardGrab == self ifTrue:[
-        (sensor := self sensor) notNil ifTrue:[
+        sensor notNil ifTrue:[
             "/ make certain all X events have been received
             device sync.
             "/ now all events have been received.
@@ -2076,9 +2088,6 @@
     (superMenu notNil and:[superMenu shown and:[superMenu isPopUpView]]) ifTrue:[
         superMenu grabMouseAndKeyboard
     ]
-        
-
-
 ! !
 
 !MenuPanel methodsFor:'initialize / release'!
@@ -2091,8 +2100,10 @@
     self do:[:anItem| anItem fetchImages ].
 
     self isPopUpView ifTrue:[
-        shadowView isNil ifTrue:[
-            shadowView := (ShadowView onDevice:device) for:self
+        (PopUpView styleSheet at:'popup.shadow' default:false) ifTrue:[
+            shadowView isNil ifTrue:[
+                shadowView := (ShadowView onDevice:device) for:self
+            ]
         ]
     ] ifFalse:[
         explicitExtent == true ifTrue:[
@@ -2235,17 +2246,16 @@
 realize
     "realize menu and shadowView
     "
-    |bsz|
+    super realize.
 
     self isPopUpView ifTrue:[
         self resize.
-        shadowView isNil ifTrue:[
-            shadowView := (ShadowView onDevice:device) for:self
+        shadowView notNil ifTrue:[
+            shadowView realize.
         ].
-        shadowView realize.
+        self raise.
     ].
-    super realize.
-    self raise.
+
 
 
 !
@@ -2649,7 +2659,7 @@
     "setup defaults
      self updateStyleCache
     "
-    HorizontalInset   := 3.
+    HorizontalInset   := 6 "3".
     VerticalInset     := 3.
     LabelRightOffset  := 15.
     ShortcutKeyOffset := 5.
@@ -3982,7 +3992,7 @@
 openSubmenuAt:aPoint
     "open submenu at a point
     "
-    |windowGrp subMenu|
+    |top windowGrp subMenu|
 
     windowGrp := menuPanel topMenu windowGroup.
     subMenu   := self setupSubmenu.
@@ -3994,13 +4004,19 @@
     subMenu fixSize.
     subMenu origin:aPoint.
     subMenu makeFullyVisible.
+    top := menuPanel topMenu.
 
     subMenu realized ifFalse:[
         subMenu realize. 
     ] ifTrue:[
-        menuPanel topMenu device mapWindow:subMenu id.
+        top device mapWindow:subMenu id.
     ].
 
+"/    (top styleSheet at:'menu.autoSelectFirst') ifTrue:[
+"/        subMenu selectionIndex:1
+"/    ]
+
+
 !
 
 selected:aState
@@ -4088,6 +4104,6 @@
 !MenuPanel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.49 1998-01-21 17:23:08 tz Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.50 1998-01-26 17:16:08 ca Exp $'
 ! !
 MenuPanel initialize!