--- a/Controller.st Mon Feb 06 01:30:10 1995 +0100
+++ b/Controller.st Mon Feb 06 01:38:04 1995 +0100
@@ -21,7 +21,7 @@
COPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
-$Header: /cvs/stx/stx/libview/Controller.st,v 1.8 1994-11-28 21:00:41 claus Exp $
+$Header: /cvs/stx/stx/libview/Controller.st,v 1.9 1995-02-06 00:35:35 claus Exp $
'!
!Controller class methodsFor:'documentation'!
@@ -42,19 +42,22 @@
version
"
-$Header: /cvs/stx/stx/libview/Controller.st,v 1.8 1994-11-28 21:00:41 claus Exp $
+$Header: /cvs/stx/stx/libview/Controller.st,v 1.9 1995-02-06 00:35:35 claus Exp $
"
!
documentation
"
Controllers can be used to controll the user-interactions
- to a Model which is shown in a view. For very simple views,
+ to a model which is shown in a view. For very simple views,
(and due to the evolution of Smalltalk/X) many view-classes have
the controller function integrated.
To allow both controller and non-controller operation, events are
sent directly to the view, if its controller instance variable
is nil. Otherwise, the controller gets the event.
+ For now (vsn 2.10.4) there are only a few view classes using controllers;
+ however, over time, more will be converted, since separating the controller
+ offers much more flexibility (although view initialization becomes a bit more complex).
Instance variables:
view aView the view I controll
@@ -62,6 +65,12 @@
"
! !
+!Controller class methodsFor:'instance creation'!
+
+new
+ ^ self basicNew initialize
+! !
+
!Controller methodsFor:'initialize / release'!
initialize
@@ -128,7 +137,36 @@
"actually, this should be called 'middleButtonActivity'.
But for ST-80 compatibility ...."
- ^ self
+ |sym menu actionSelector|
+
+ "
+ try ST-80 style menus first:
+ if there is a model, and a menuSymbol is defined,
+ ask model for the menu and launch that if non-nil.
+ "
+ (model notNil
+ and:[(sym := view menuSymbol) notNil
+ and:[sym isSymbol]]) ifTrue:[
+ "
+ ask model for the menu
+ "
+ menu := model perform:sym.
+ menu notNil ifTrue:[
+ "
+ got one, launch the menu. It is supposed
+ to return an actionSelector.
+ "
+ actionSelector := menu startUp.
+ (actionSelector notNil
+ and:[actionSelector isSymbol]) ifTrue:[
+ model perform:actionSelector
+ ]
+ ].
+ ^ self
+ ].
+ view middleButtonMenu notNil ifTrue:[
+ view middleButtonMenu showAtPointer
+ ]
!
blueButtonActivity