Added `MenuItem >> receiver` to allow overriding item's receiver
...per-menu-item bases. This is useful when one assembles menu from
different sources, like part of the list menu is item-defined
and part of the menu is application-specific).
--- a/MenuItem.st Sat Sep 30 22:41:09 2017 +0100
+++ b/MenuItem.st Mon Feb 05 12:41:00 2018 +0000
@@ -20,7 +20,7 @@
labelImage accessCharacterPosition argument choice choiceValue
font auxValue showBusyCursorWhilePerforming keepLinkedMenu
horizontalLayout sendToOriginator ignoreMnemonicKeys
- ignoreShortcutKeys isMenuSlice uuid'
+ ignoreShortcutKeys isMenuSlice uuid receiver'
classVariableNames:''
poolDictionaries:''
category:'Views-Support'
@@ -560,6 +560,22 @@
"Created: 25.2.1997 / 19:11:02 / cg"
!
+receiver
+ "Returns an object that will be used to resolve 'aspects'
+ and as a receiver of 'action' selectors."
+ ^ receiver
+
+ "Modified (comment): / 05-02-2018 / 12:09:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+receiver:anObject
+ "Set an object that will be used to resolve 'aspects'
+ and as a receiver of 'action' selectors."
+ receiver := anObject.
+
+ "Modified (comment): / 05-02-2018 / 12:09:22 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
resourceRetriever
|retriever|
@@ -964,7 +980,7 @@
self triggerOnDown ifFalse:[ coll add:#triggerOnDown ].
self hideMenuOnActivated ifTrue:[ coll add:#hideMenuOnActivated].
nameKey isNil ifTrue:[ coll add:#nameKey ].
- (self isVisible ? true) ifTrue:[coll add:#isVisible].
+ (self isVisible isNil) ifTrue:[coll add:#isVisible].
(startGroup isNil or:[startGroup == #left]) ifTrue:[coll add:#startGroup].
itemValue isNil ifTrue:[ coll add:#itemValue].
activeHelpKey isNil ifTrue:[ coll add:#activeHelpKey].
@@ -993,6 +1009,7 @@
^ coll
"Modified: / 22-08-2012 / 21:22:20 / cg"
+ "Modified: / 05-02-2018 / 12:23:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!MenuItem methodsFor:'encoding & decoding'!