|
Class: Controller
Object
|
+--Controller
|
+--ButtonController
|
+--CodeController
|
+--DialogCompositeController
|
+--ListViewController
|
+--MouseMenuController
|
+--ParagraphEditor
|
+--SelectionInListController
|
+--StandardSystemController
|
+--TextController
|
+--VariablePanelController
|
+--VisualWorks::Controller
- Package:
- stx:libview
- Category:
- Interface-Support-Controllers
- Version:
- rev:
1.64
date: 2023/05/27 10:38:00
- user: cg
- file: Controller.st directory: libview
- module: stx stc-classLibrary: libview
Controllers can be used to control the user-interactions
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 the view has no controller
(i.e. if it's controller instance variable is nil).
Otherwise, the controller gets the event message.
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).
Over time, expect the buttonPress/Release/Motion and keyPress/Release
methods to vanish from the view classes and corresponding controllers to
be appearing.
This migration should be backward compatible.
Device coordinates vs. Logical coordinates:
if the view has a non-identity transformation (for example: drawing
in millimeters or inches), the application/controller may or may not
be interested in device coordinates in button/key events.
Most are not, these will receive logical coordinates transparently
in theyr button/key-Press/Release/Motion methods.
Those which are interested should redefine the corresponding
device-Key/Button-Press/Release/Motion methods.
Of course, it is always possible to map between device and logical
coordinates, using `view transformation applyTo/applyInverseTo:',
if both coordinates are required (which is unlikely).
[Instance variables:]
view <View> the view I control
model <Model> the model which is to be worked on
copyrightCOPYRIGHT (c) 1992 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
instance creation
-
new
-
(comment from inherited method)
return an instance of myself without indexed variables
Compatibility-ST80
-
blueButtonActivity
-
actually, this should be called 'rightButtonActivity'.
But for ST-80 compatibility ....
-
controlInitialize
-
-
isVisualWorksController
-
(comment from inherited method)
Modified (format): / 12-01-2022 / 09:52:56 / cg
-
open
-
open my view
-
poll
-
ST-80 compatibility - ignored here
-
redButtonActivity
-
actually, this should be called 'leftButtonActivity'.
But for ST-80 compatibility ....
-
yellowButtonActivity
-
actually, this should be called 'middleButtonActivity'.
But for ST-80 compatibility ....
accessing
-
menuHolder
-
by default, the model has to provide the menu
-
menuPerformer
-
by default, the model is performing menu actions
-
model
-
return my model
-
model: aModel
-
set my model
-
sensor
-
return my view's sensor
-
view
-
return my view
-
view: aView
-
set my view
event handling
-
buttonMotion: buttonMask x: x y: y
-
mouse was moved with button pressed in my view; nothing done here
-
buttonMultiPress: button x: x y: y
-
a mouse button was pressed again shortly after in my view
-
buttonPress: button x: x y: y
-
a mouse button was pressed in my view.
Translate buttonPress events into similar ST-80 type
event messages. This method and/or these ST-80 methods
can be redefined in subclasses
-
buttonRelease: button x: x y: y
-
a mouse button was released in my view; nothing done here
-
deviceButtonMotion: state x: x y: y
-
this is the low-level (untransformed) event as received
from the device (i.e. coordinates are in device coordinates).
If there is a transformation, apply the inverse
and send a buttonMotion with the logical coordinates.
Controllers which are interested in deviceCoordinates should
redefine this method -
those which are interested in logical coordinates
should redefine #buttonMotion:x:y:
-
deviceButtonMultiPress: button x: x y: y
-
this is the low-level (untransformed) event as received
from the device (i.e. coordinates are in device coordinates).
If there is a transformation, apply the inverse
and send a buttonMultiPress with the logical coordinates.
Controllers which are interested in deviceCoordinates should
redefine this method -
those which are interested in logical coordinates
should redefine #buttonMultiPress:x:y:
-
deviceButtonPress: button x: x y: y
-
this is the low-level (untransformed) event as received
from the device (i.e. coordinates are in device coordinates).
If there is a transformation, apply the inverse
and send a buttonPress with the logical coordinates.
Controllers which are interested in deviceCoordinates should
redefine this method -
those which are interested in logical coordinates
should redefine #buttonPress:x:y:
-
deviceButtonRelease: button x: x y: y
-
this is the low-level (untransformed) event as received
from the device (i.e. coordinates are in device coordinates).
If there is a transformation, apply the inverse
and send a buttonRelease with the logical coordinates.
Controllers which are interested in deviceCoordinates should
redefine this method -
those which are interested in logical coordinates
should redefine #buttonRelease:x:y:
-
deviceKeyPress: key x: x y: y
-
this is the low-level (untransformed) event as received
from the device (i.e. coordinates are in device coordinates).
If there is a transformation, apply the inverse
and send a keyPress with the logical coordinates.
Controllers which are interested in deviceCoordinates should
redefine this method -
those which are interested in logical coordinates
should redefine #keyPress:x:y:
-
deviceKeyRelease: key x: x y: y
-
this is the low-level (untransformed) event as received
from the device (i.e. coordinates are in device coordinates).
If there is a transformation, apply the inverse
and send a keyRelease with the logical coordinates.
Controllers which are interested in deviceCoordinates should
redefine this method -
those which are interested in logical coordinates
should redefine #keyRelease:x:y:
-
devicePointerEnter: state x: x y: y
-
this is the low-level (untransformed) event as received
from the device (i.e. coordinates are in device coordinates).
If there is a transformation, apply the inverse
and send a pointerEnter with the logical coordinates.
Controllers which are interested in deviceCoordinates should
redefine this method -
those which are interested in logical coordinates
should redefine #pointerEnter:x:y:
-
focusIn
-
my view got the keyboard focus; nothing done here
-
focusOut
-
my view lost keyboard focus; nothing done here
-
keyPress: key x: x y: y
-
key was pressed in my view; nothing done here,
except for Tab keys.
-
keyRelease: key x: x y: y
-
key was released in my view; nothing done here
-
mouseWheelMotion: event x: x y: y amount: amount deltaTime: deltaTime
-
a mouse wheel was turned - nothing done here
-
pointerEnter: state x: x y: y
-
mouse pointer entered my view; nothing done here
-
pointerLeave: state
-
mouse pointer left my view; nothing done here
initialization & release
-
initialize
-
initialize the controller; subclasses should redefine
this and include a super initialize for proper initialization.
-
release
-
close down the controller; this is sent when the view is destroyed.
Can be redefined in subclasses to do some cleanup action. However,
these redefined methods should do a super release.
-
startUp
-
startup the controller; this is sent when the view realizes,
right before it becomes visible.
Can be redefined in subclasses to do some startup action.
menus
-
yellowButtonMenu
-
actually, this should be called 'middleButtonMenu'.
But for ST-80 compatibility ....
|