MenuPanel.st
changeset 2003 732fbaf5864f
parent 2000 94bc3e5bba84
child 2004 cf701a027108
--- a/MenuPanel.st	Wed Sep 12 17:44:13 2001 +0200
+++ b/MenuPanel.st	Thu Sep 13 16:12:49 2001 +0200
@@ -1762,8 +1762,10 @@
 !
 
 level:anInt
-    super level:anInt.
-    mustRearrange := true
+    anInt ~~ level ifTrue:[
+        super level:anInt.
+        mustRearrange := true
+    ]
 !
 
 rightArrow
@@ -3315,8 +3317,6 @@
 fetchDeviceResources
     "fetch device colors, to avoid reallocation at redraw time"
 
-    |bw lvl|
-
     super fetchDeviceResources.
 
     "/ thats a kludge - will be replaced by values from the styleSheet ...
@@ -3324,15 +3324,6 @@
 
     onLevel := styleSheet at:#'menu.hilightLevel' default:0.
 
-    self isPopUpView ifTrue:[
-        bw  := styleSheet at:#'popup.borderWidth' default:1.
-        lvl := styleSheet at:#'popup.level'       default:0.
-    ] ifFalse:[
-        bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
-    ].
-    self borderWidth:bw.
-    self level:lvl.
-
     superMenu isNil ifTrue:[
         fgColor                   := DefaultForegroundColor         onDevice:device.
         activeBgColor             := DefaultHilightBackgroundColor  onDevice:device.
@@ -3391,7 +3382,7 @@
     fitFirstPanel    := false.
     font             := MenuView defaultFont onDevice:device.
 
-    super level:(styleSheet is3D ifTrue:[1] ifFalse:[0]).
+    self updateLevelAndBorder.
 !
 
 initialize
@@ -3453,6 +3444,7 @@
         super realize.
         self resize.
         self makeFullyVisible.
+"/        self mustRearrange.
         shadowView notNil ifTrue:[
             shadowView realize.
         ].
@@ -3510,6 +3502,21 @@
 
     super unmap.
     shadowView notNil ifTrue:[shadowView unmap].
+!
+
+updateLevelAndBorder
+    "update level & border, when it is known if I am a popUpView"
+
+    |bw lvl|
+
+    self isPopUpView ifTrue:[
+        bw  := styleSheet at:#'popup.borderWidth' default:1.
+        lvl := styleSheet at:#'popup.level'       default:0.
+    ] ifFalse:[
+        bw  := styleSheet is3D ifFalse:[1] ifTrue:[0].
+    ].
+    self borderWidth:bw.
+    self level:lvl.
 ! !
 
 !MenuPanel methodsFor:'keyboard control'!
@@ -3689,7 +3696,7 @@
     "set my supermenu from which i'am activated
     "
     (superMenu := aSuperMenu) notNil ifTrue:[
-        super font:(superMenu font)
+        super font:(superMenu font).
     ].
 !
 
@@ -3990,6 +3997,14 @@
 
 !MenuPanel methodsFor:'queries'!
 
+container:aView
+    super container:aView.
+    aView notNil ifTrue:[
+        "/ I am no longer a popUpView
+        self updateLevelAndBorder
+    ].
+!
+
 containsPoint:aPoint
     "returns true if point is contained by the view
     "
@@ -4122,7 +4137,7 @@
             hlp := ActiveHelp currentHelpListener.
             hlp initiateHelpFor:self atX:nil y:nil now:true.
         ].
-        realized ifTrue:[self rearrangeItems].
+        shown "realized" ifTrue:[self rearrangeItems].
         selection selected:true.
     ].
 !
@@ -6260,6 +6275,6 @@
 !MenuPanel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.270 2001-09-10 15:09:04 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.271 2001-09-13 14:12:49 cg Exp $'
 ! !
 MenuPanel initialize!