MenuPanel.st
changeset 1048 a8755e51706d
parent 1046 c03b42debacb
child 1051 a448c854fcbb
--- a/MenuPanel.st	Fri Jul 31 20:14:03 1998 +0200
+++ b/MenuPanel.st	Sat Aug 01 07:19:45 1998 +0200
@@ -3157,13 +3157,8 @@
 compareAccessCharacterWith:aKey
     "returns true if key is my access character
     "
-    |s|
-
-    accessCharacterPosition notNil ifTrue:[
-        s := (rawLabel string) at:accessCharacterPosition.
-        s == aKey ifTrue:[^ true ].
-    ].
-  ^ false
+    ^ self accessCharacter == aKey
+
 !
 
 label
@@ -3612,11 +3607,31 @@
 
 !
 
+indicationChanged
+    "called when the indication changed
+    "
+    |indicator|
+
+    isButton ifFalse:[
+        indicator := self indicator.
+
+        indicator = rawLabel icon ifTrue:[
+            ^ self
+        ].
+        rawLabel icon:indicator.
+
+        disabledRawLabel notNil ifTrue:[
+            disabledRawLabel icon:indicator
+        ]
+    ].
+    self redraw
+!
+
 update:something with:aParameter from:changedObject
+    |indicator|
 
     changedObject == self indication ifTrue:[
-        isButton ifFalse: [rawLabel icon:(self indicator)].
-        ^ self redraw
+        ^ self indicationChanged
     ].
 
     changedObject == enableChannel ifTrue:[
@@ -3641,19 +3656,12 @@
     (indicator := self indication) isNil ifTrue:[
         ^ self
     ].
-    menuPanel isPopUpView ifFalse:[
+    (isButton and:[menuPanel isPopUpView]) ifFalse:[
         (self isKindOfValueHolder:indicator) ifTrue:[
             ^ self
         ]
     ].
-
-    (indicator := self indicator) notNil ifTrue:[
-        indicator = rawLabel icon ifFalse:[
-            isButton ifFalse: [rawLabel icon:indicator].
-          ^ self redraw.
-        ]
-    ].
-
+    self indicationChanged
 ! !
 
 !MenuPanel::Item methodsFor:'converting'!
@@ -3748,6 +3756,7 @@
     self isVisible ifFalse:[^ self].
 
     img := rawLabel.
+
     asc := menuPanel font ascent.
     h   := layout height.
     l   := layout left.
@@ -4066,15 +4075,18 @@
     rawImage isNil ifTrue:[
         ^ self
     ].
-
     rawLabel isImage ifTrue:[
         img := menuPanel imageOnDevice:rawImage.
 
         self indicator isNil ifTrue:[
             rawLabel := img.
         ] ifFalse:[
-            form := isButton ifTrue:[nil] ifFalse:[self indicator].
-            rawLabel := LabelAndIcon form:form image:img
+            isButton ifTrue:[
+                rawLabel := LabelAndIcon form:nil image:img.
+            ] ifFalse:[
+                rawLabel := LabelAndIcon form:(self indicator) image:img.
+                label    := LabelAndIcon icon:img string:''.
+            ]
         ]
     ] ifFalse:[
         (rawLabel class == LabelAndIcon and:[isButton not]) ifTrue:[
@@ -4090,9 +4102,14 @@
 !
 
 rawLabelChanged
-
+    "update rawLabel
+    "
     disabledRawLabel := nil.
 
+    rawLabel isNil ifTrue:[
+        ^ self
+    ].
+
     rawLabel isImage ifTrue:[
         rawImage := rawLabel
     ] ifFalse:[
@@ -4705,6 +4722,6 @@
 !MenuPanel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.103 1998-07-31 15:20:10 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.104 1998-08-01 05:19:45 ca Exp $'
 ! !
 MenuPanel initialize!