style changes
authorClaus Gittinger <cg@exept.de>
Fri, 11 Sep 1998 14:04:52 +0200
changeset 1130 fb79ef4aeec8
parent 1129 3b9e0fd31971
child 1131 ef8f528399aa
style changes
MenuPanel.st
--- a/MenuPanel.st	Wed Sep 09 19:19:00 1998 +0200
+++ b/MenuPanel.st	Fri Sep 11 14:04:52 1998 +0200
@@ -321,11 +321,13 @@
 
     |menuStyle style font|
 
+    MenuView updateStyleCache.        
+
     menuStyle := MenuView styleSheet.
     menuStyle isNil ifTrue:[
-	"make sure that style sheet is present"
-	MenuView updateStyleCache.        
-	menuStyle := MenuView styleSheet.
+        "make sure that style sheet is present"
+        MenuView updateStyleCache.        
+        menuStyle := MenuView styleSheet.
     ].
     style := menuStyle name.
 
@@ -333,48 +335,48 @@
     DefaultForegroundColor := menuStyle colorAt:'pullDownMenu.foregroundColor'.
 
     DefaultForegroundColor isNil ifTrue:[
-	DefaultForegroundColor := menuStyle colorAt:'menu.foregroundColor'
-					    default:Color black.
+        DefaultForegroundColor := menuStyle colorAt:'menu.foregroundColor'
+                                            default:Color black.
     ].
 
     (style == #motif or:[style == #iris]) ifTrue:[
-	DefaultBackgroundColor        := DefaultViewBackgroundColor.
-	DefaultHilightForegroundColor := DefaultForegroundColor.
-	DefaultHilightLevel     := 2.
-	DefaultLevel            := 0.
+        DefaultBackgroundColor        := DefaultViewBackgroundColor.
+        DefaultHilightForegroundColor := DefaultForegroundColor.
+        DefaultHilightLevel     := 2.
+        DefaultLevel            := 0.
     ] ifFalse:[
-	(DefaultHilightLevel := menuStyle at:'pullDownMenu.hilightLevel') isNil ifTrue:[
-	    DefaultHilightLevel := menuStyle at:'menu.hilightLevel' default:0.
-	].
-	DefaultLevel           := menuStyle at:'pullDownMenu.level' default:1.
-	DefaultBackgroundColor := menuStyle colorAt:'pullDownMenu.backgroundColor'.
-
-	DefaultBackgroundColor isNil ifTrue:[
-	    DefaultBackgroundColor := menuStyle colorAt:'menu.backgroundColor'
-						default:DefaultViewBackgroundColor.
-	].
-
-	DefaultHilightForegroundColor := menuStyle colorAt:'pullDownMenu.hilightForegroundColor'.
-	DefaultHilightForegroundColor isNil ifTrue:[
-	    DefaultHilightForegroundColor := menuStyle colorAt:'menu.hilightForegroundColor'
-						       default:DefaultBackgroundColor
-	].
+        (DefaultHilightLevel := menuStyle at:'pullDownMenu.hilightLevel') isNil ifTrue:[
+            DefaultHilightLevel := menuStyle at:'menu.hilightLevel' default:0.
+        ].
+        DefaultLevel           := menuStyle at:'pullDownMenu.level' default:1.
+        DefaultBackgroundColor := menuStyle colorAt:'pullDownMenu.backgroundColor'.
+
+        DefaultBackgroundColor isNil ifTrue:[
+            DefaultBackgroundColor := menuStyle colorAt:'menu.backgroundColor'
+                                                default:DefaultViewBackgroundColor.
+        ].
+
+        DefaultHilightForegroundColor := menuStyle colorAt:'pullDownMenu.hilightForegroundColor'.
+        DefaultHilightForegroundColor isNil ifTrue:[
+            DefaultHilightForegroundColor := menuStyle colorAt:'menu.hilightForegroundColor'
+                                                       default:DefaultBackgroundColor
+        ].
     ].
 
     DefaultDisabledForegroundColor := menuStyle colorAt:'menu.disabledForegroundColor'.
     DefaultDisabledForegroundColor isNil ifTrue:[
-	DefaultDisabledForegroundColor := menuStyle colorAt:'button.disabledForegroundColor'
-						    default:Color darkGray.
+        DefaultDisabledForegroundColor := menuStyle colorAt:'button.disabledForegroundColor'
+                                                    default:Color darkGray.
     ].
 
     style == #motif ifTrue:[
-	DefaultHilightBackgroundColor := DefaultBackgroundColor
+        DefaultHilightBackgroundColor := DefaultBackgroundColor
     ] ifFalse:[
-	DefaultHilightBackgroundColor := menuStyle colorAt:'pullDownMenu.hilightBackgroundColor'.
-	DefaultHilightBackgroundColor isNil ifTrue:[
-	    DefaultHilightBackgroundColor := menuStyle colorAt:'menu.hilightBackgroundColor'
-						       default:(menuStyle is3D ifFalse:[DefaultForegroundColor] ifTrue:[DefaultBackgroundColor]).
-	]
+        DefaultHilightBackgroundColor := menuStyle colorAt:'pullDownMenu.hilightBackgroundColor'.
+        DefaultHilightBackgroundColor isNil ifTrue:[
+            DefaultHilightBackgroundColor := menuStyle colorAt:'menu.hilightBackgroundColor'
+                                                       default:(menuStyle is3D ifFalse:[DefaultForegroundColor] ifTrue:[DefaultBackgroundColor]).
+        ]
     ].
 
     DefaultGroupDividerSize := menuStyle at:'menu.groupDividerSize' default:6.
@@ -391,9 +393,9 @@
     RightArrowForm := SelectionInListView rightArrowFormOn:Display.
 
     (style ~~ #os2 and:[style ~~ #win95]) ifTrue:[
-	RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display.
+        RightArrowShadowForm := SelectionInListView rightArrowShadowFormOn:Display.
     ] ifFalse:[
-	RightArrowShadowForm := nil
+        RightArrowShadowForm := nil
     ].
 
     SelectionFrameBrightColor    := Color white.
@@ -401,11 +403,11 @@
 
     ButtonActiveLevel            :=  menuStyle at:'menu.buttonActiveLevel' default:(menuStyle is3D ifTrue:[-2] ifFalse:[0]).
     ButtonActiveLevel isNil ifTrue:[
-	ButtonActiveLevel        :=  menuStyle at:'button.activeLevel' default:(menuStyle is3D ifTrue:[-2] ifFalse:[0]).
+        ButtonActiveLevel        :=  menuStyle at:'button.activeLevel' default:(menuStyle is3D ifTrue:[-2] ifFalse:[0]).
     ].
     ButtonPassiveLevel           :=  menuStyle at:'menu.buttonPassiveLevel'.
     ButtonPassiveLevel isNil ifTrue:[
-	ButtonPassiveLevel       :=  menuStyle at:'button.passiveLevel' default:(menuStyle is3D ifTrue:[2] ifFalse:[0]).
+        ButtonPassiveLevel       :=  menuStyle at:'button.passiveLevel' default:(menuStyle is3D ifTrue:[2] ifFalse:[0]).
     ].
     ButtonActiveBackgroundColor  :=  menuStyle at:'button.activeBackgroundColor' default: DefaultBackgroundColor.
     ButtonPassiveBackgroundColor := (menuStyle at:'button.backgroundColor') ? (menuStyle at:'viewBackground') ? DefaultBackgroundColor.
@@ -417,8 +419,8 @@
 
     ButtonEnteredBackgroundColor := menuStyle colorAt:'menu.buttonEnteredBackgroundColor'.
     ButtonEnteredBackgroundColor isNil ifTrue:[
-	ButtonEnteredBackgroundColor := menuStyle colorAt:'button.enteredBackgroundColor'
-						  default:ButtonPassiveBackgroundColor.
+        ButtonEnteredBackgroundColor := menuStyle colorAt:'button.enteredBackgroundColor'
+                                                  default:ButtonPassiveBackgroundColor.
     ].
     ButtonEnteredLevel := menuStyle at:'menu.buttonEnteredLevel' default:ButtonPassiveLevel.
 
@@ -428,7 +430,7 @@
      self updateStyleCache
     "
 
-    "Modified: / 20.8.1998 / 19:18:56 / cg"
+    "Modified: / 10.9.1998 / 21:40:32 / cg"
 ! !
 
 !MenuPanel class methodsFor:'image registration'!
@@ -2729,6 +2731,22 @@
 
 !
 
+reinitStyle
+    "handle style change while being open (win32 only - for now)"
+
+    super reinitStyle.
+
+    self fetchDeviceResources.
+    items notNil ifTrue:[
+        items do:[:anItem |
+            anItem reinitSubmenuStyle
+        ]
+    ]
+
+    "Created: / 10.9.1998 / 21:37:05 / cg"
+    "Modified: / 11.9.1998 / 13:20:57 / cg"
+!
+
 unmap
     "unmap view. If we have a popup supermenu, it will get all keyboard and
      mouse events.
@@ -3720,39 +3738,6 @@
 
 !
 
-setupSubmenu
-    |appl recv subm|
-
-    submenuChannel notNil ifTrue:[
-	submenuChannel isSymbol ifFalse:[
-	    subm := submenuChannel
-	] ifTrue:[
-	    appl := menuPanel application.
-
-	    (subm := self findSubMenuIn:appl) isNil ifTrue:[
-		(recv := menuPanel receiver) ~~ appl ifTrue:[
-		    subm := self findSubMenuIn:recv
-		]
-	    ]
-	].
-
-	(subm := subm value) isArray ifTrue:[
-	    subm := Menu new fromLiteralArrayEncoding:subm.
-	    "/ cg: linked menus also may contain translations ...
-	    subm notNil ifTrue:[
-		appl notNil ifTrue:[
-		    subm findGuiResourcesIn:appl.
-		]                
-	    ].
-	].
-	self submenu:subm.
-    ].
-
-    ^ subMenu
-
-    "Modified: / 19.5.1998 / 19:36:56 / cg"
-!
-
 submenuChannel
     "get the submenu channel
     "
@@ -4757,6 +4742,16 @@
     "Created: / 20.8.1998 / 13:11:50 / cg"
 !
 
+reinitSubmenuStyle
+    "returns my submenu or nil
+    "
+    subMenu notNil ifTrue:[
+        subMenu reinitStyle
+    ].
+
+    "Created: / 10.9.1998 / 21:36:09 / cg"
+!
+
 separatorType
     "returns type of separator line or nil
     "
@@ -4776,6 +4771,39 @@
 	c == $= ifTrue:[^ #doubleLine].
     ].
   ^ #blankLine
+!
+
+setupSubmenu
+    |appl recv subm|
+
+    submenuChannel notNil ifTrue:[
+	submenuChannel isSymbol ifFalse:[
+	    subm := submenuChannel
+	] ifTrue:[
+	    appl := menuPanel application.
+
+	    (subm := self findSubMenuIn:appl) isNil ifTrue:[
+		(recv := menuPanel receiver) ~~ appl ifTrue:[
+		    subm := self findSubMenuIn:recv
+		]
+	    ]
+	].
+
+	(subm := subm value) isArray ifTrue:[
+	    subm := Menu new fromLiteralArrayEncoding:subm.
+	    "/ cg: linked menus also may contain translations ...
+	    subm notNil ifTrue:[
+		appl notNil ifTrue:[
+		    subm findGuiResourcesIn:appl.
+		]                
+	    ].
+	].
+	self submenu:subm.
+    ].
+
+    ^ subMenu
+
+    "Modified: / 19.5.1998 / 19:36:56 / cg"
 ! !
 
 !MenuPanel::Item methodsFor:'queries'!
@@ -5193,6 +5221,6 @@
 !MenuPanel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.126 1998-09-08 11:37:09 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.127 1998-09-11 12:04:52 cg Exp $'
 ! !
 MenuPanel initialize!