--- a/MenuView.st Fri Nov 08 15:31:38 1996 +0100
+++ b/MenuView.st Sat Nov 09 18:37:10 1996 +0100
@@ -10,8 +10,6 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.9 on 9-sep-1996 at 22:52:44' !
-
SelectionInListView subclass:#MenuView
instanceVariableNames:'selectors args receiver enableFlags disabledFgColor onOffFlags
subMenus subMenuShown superMenu checkColor lineLevel lineInset
@@ -27,7 +25,7 @@
category:'Views-Menus'
!
-!MenuView class methodsFor:'documentation'!
+!MenuView class methodsFor:'documentation'!
copyright
"
@@ -142,7 +140,7 @@
"
! !
-!MenuView class methodsFor:'instance creation'!
+!MenuView class methodsFor:'instance creation'!
forMenu:aTopMenu
"create and return a new menuView, which will be contained in
@@ -293,7 +291,7 @@
^ self labels:labels selectors:selArray args:nil receiver:anObject in:aView
! !
-!MenuView class methodsFor:'defaults'!
+!MenuView class methodsFor:'defaults'!
showAcceleratorKeys
^ ShowAcceleratorKeys ~~ false
@@ -458,7 +456,7 @@
|i|
i := self indexOf:indexOrName.
- i ~~ 0 ifTrue:[^ actions at:i].
+ (actions notNil and:[i ~~ 0]) ifTrue:[^ actions at:i ifAbsent:nil].
^ nil
"Created: 24.3.1996 / 17:17:22 / cg"
@@ -1903,15 +1901,17 @@
!
performSelectedAction
- |theSelector theAction isCheck checkOn val idx|
+ |theSelector theAction isCheck checkOn val idx didItHere|
(superView notNil and:[superView isPopUpView]) ifTrue:[superView hide].
superMenu notNil ifTrue:[superMenu submenuTriggered].
idx := selection.
idx notNil ifTrue:[
-
+
(subMenus isNil or:[(subMenus at:idx) isNil]) ifTrue:[
+ didItHere := false.
+
self showActive.
[
superMenu notNil ifTrue:[
@@ -1941,74 +1941,83 @@
self sendChangeMessageWith:val.
"
- either action-block or selectors-array-style
+ item actions or selectors-array
+ "
+ device activePointerGrab == self ifTrue:[
+ device ungrabPointer.
+ ].
+
+ actions notNil ifTrue:[
+ theAction := actions at:idx ifAbsent:nil.
+ ].
+
+ theAction isNil ifTrue: [
+ selectors notNil ifTrue: [
+
+ "/ selectors may be:
+ "/ - a single selector used for all items
+ "/ - an array of selectors used per item
+
+ selectors isSymbol ifTrue:[
+ theSelector := selectors
+ ] ifFalse:[
+ (idx notNil
+ and:[idx <= selectors size]) ifTrue:[
+ theSelector := selectors at:idx
+ ]
+ ].
+ ].
+ ].
+
+ (theSelector notNil
+ or:[theAction notNil]) ifTrue:[
+ AbortSignal handle:[:ex |
+ ex return
+ ] do:[
+ didItHere := true.
+ theAction notNil ifTrue:[
+ theAction numArgs == 0 ifTrue:[
+ theAction value
+ ] ifFalse:[
+ theAction value:val
+ ].
+ ] ifFalse:[
+ receiver isNil ifTrue:[
+ receiver := model
+ ].
+ theSelector numArgs == 0 ifTrue:[
+ receiver perform:theSelector
+ ] ifFalse:[
+ isCheck ifTrue:[
+ self redrawLine:idx.
+ val := checkOn.
+ ].
+
+ receiver perform:theSelector with:val
+ ]
+ ]
+
+ ]
+ ].
+
+ "
+ any action-block ?
"
actionBlock notNil ifTrue:[
AbortSignal handle:[:ex |
ex return
] do:[
+ didItHere ifTrue:[
+ val := nil
+ ].
actionBlock numArgs == 1 ifTrue:[
actionBlock value:val
] ifFalse:[
actionBlock value:self value:val
]
]
- ] ifFalse:[
- device activePointerGrab == self ifTrue:[
- device ungrabPointer.
- ].
-
- actions notNil ifTrue:[
- theAction := actions at:idx ifAbsent:nil.
- ].
-
- theAction isNil ifTrue: [
- selectors notNil ifTrue: [
-
- "/ selectors may be:
- "/ - a single selector used for all items
- "/ - an array of selectors used per item
-
- selectors isSymbol ifTrue:[
- theSelector := selectors
- ] ifFalse:[
- (idx notNil
- and:[idx <= selectors size]) ifTrue:[
- theSelector := selectors at:idx
- ]
- ].
- ].
- ].
-
- (theSelector notNil
- or:[theAction notNil]) ifTrue:[
- AbortSignal handle:[:ex |
- ex return
- ] do:[
- theAction notNil ifTrue:[
- theAction numArgs == 0 ifTrue:[
- theAction value
- ] ifFalse:[
- theAction value:val
- ]
- ] ifFalse:[
- receiver isNil ifTrue:[
- receiver := model
- ].
- theSelector numArgs == 0 ifTrue:[
- receiver perform:theSelector
- ] ifFalse:[
- isCheck ifTrue:[
- self redrawLine:idx.
- val := checkOn.
- ].
-
- receiver perform:theSelector with:val
- ]
- ]
- ]
- ]
].
+
] valueNowOrOnUnwindDo:[
realized ifTrue:[
self showPassive.
@@ -2547,8 +2556,8 @@
"Modified: 25.5.1996 / 12:27:42 / cg"
! !
-!MenuView class methodsFor:'documentation'!
+!MenuView class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.91 1996-09-09 22:59:12 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/MenuView.st,v 1.92 1996-11-09 17:37:10 ca Exp $'
! !