--- a/MenuPanel.st Wed Feb 24 17:01:04 1999 +0100
+++ b/MenuPanel.st Thu Feb 25 19:35:13 1999 +0100
@@ -1701,28 +1701,28 @@
"convert to Menu
"
self disabledRedrawDo:[
- |menu newItems|
-
- self removeAll.
-
- (menu := aMenu) notNil ifTrue:[
- (aMenu isCollection) ifTrue:[
- menu := Menu new.
- menu fromLiteralArrayEncoding:aMenu.
- ] ifFalse:[
- menu receiver notNil ifTrue:[receiver := menu receiver]
- ].
- (newItems := menu menuItems) notNil ifTrue:[
- items := newItems collect:[:ni |
- |i|
-
- i:= Item in:self.
- i menuItem:ni.
- i.
- ].
- ].
- self groupSizes:(menu groupSizes).
- ]
+ |menu newItems|
+
+ self removeAll.
+
+ (menu := aMenu) notNil ifTrue:[
+ (aMenu isCollection) ifTrue:[
+ menu := Menu new.
+ menu fromLiteralArrayEncoding:aMenu.
+ ] ifFalse:[
+ menu receiver notNil ifTrue:[receiver := menu receiver]
+ ].
+ (newItems := menu menuItems) notNil ifTrue:[
+ items := newItems collect:[:ni |
+ |i|
+
+ i:= Item in:self.
+ i menuItem:ni.
+ i.
+ ].
+ ].
+ self groupSizes:(menu groupSizes).
+ ]
]
"Modified: / 8.8.1998 / 02:05:04 / cg"
@@ -1953,6 +1953,18 @@
"Modified: / 19.1.1999 / 16:00:14 / cg"
!
+rearrangeItemsIfItemVisibilityChanged
+ "if I have any items with changing visibility, rearrange"
+
+ items do:[:item |
+ item canChangeVisibility ifTrue:[
+ mustRearrange := true.
+ self rearrangeItems.
+ ^ self
+ ].
+ ]
+!
+
redrawX:x y:y width:w height:h
"redraw a rectangle
"
@@ -3961,22 +3973,24 @@
|indicator|
changedObject == self indication ifTrue:[
- ^ self indicationChanged
+ ^ self indicationChanged
].
changedObject == self choice ifTrue:[
- ^ self choiceChanged
+ ^ self choiceChanged
].
changedObject == enableChannel ifTrue:[
- (rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
- self drawLabel
- ].
- ^ self
+ (rawLabel notNil and:[menuPanel canDrawItem]) ifTrue:[
+ self drawLabel
+ ].
+ ^ self
].
changedObject == isVisible ifTrue:[
- ^ menuPanel mustRearrange
+ menuPanel mustRearrange.
+ menuPanel rearrangeItems.
+ ^ self.
].
super update:something with:aParameter from:changedObject
@@ -4884,6 +4898,13 @@
!MenuPanel::Item methodsFor:'queries'!
+canChangeVisibility
+ "return true if I am not always visible
+ "
+
+ ^ isVisible notNil and:[isVisible ~~ true]
+!
+
canSelect
"returns true if item is selectable
"
@@ -5145,10 +5166,10 @@
openSubmenuAt:aPoint
"open submenu at a point
"
- |top windowGrp subMenu|
+ |top windowGrp|
windowGrp := menuPanel topMenu windowGroup.
- subMenu := self setupSubmenu.
+ self setupSubmenu.
subMenu isNil ifTrue:[
^ self
].
@@ -5162,8 +5183,8 @@
"/ Q&D kludge - if any visibility attributes are blocks;
"/ TODO: only invoke mustRearrange if any are blocks
- "/ (since I react correctly on valueodler changes)
- subMenu mustRearrange.
+ "/ (since I react correctly on valueHolder changes)
+ subMenu rearrangeItemsIfItemVisibilityChanged.
subMenu fixSize.
subMenu origin:aPoint.
@@ -5306,6 +5327,6 @@
!MenuPanel class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.136 1999-02-22 19:15:01 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/MenuPanel.st,v 1.137 1999-02-25 18:35:13 cg Exp $'
! !
MenuPanel initialize!