eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'Controller':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: Controller


Inheritance:

   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

Description:


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

copyright

COPYRIGHT (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.

Class protocol:

instance creation
o  new
(comment from inherited method)
return an instance of myself without indexed variables


Instance protocol:

Compatibility-ST80
o  blueButtonActivity
actually, this should be called 'rightButtonActivity'.
But for ST-80 compatibility ....

o  controlInitialize

o  isVisualWorksController
(comment from inherited method)
Modified (format): / 12-01-2022 / 09:52:56 / cg

o  open
open my view

o  poll
ST-80 compatibility - ignored here

o  redButtonActivity
actually, this should be called 'leftButtonActivity'.
But for ST-80 compatibility ....

o  yellowButtonActivity
actually, this should be called 'middleButtonActivity'.
But for ST-80 compatibility ....

accessing
o  menuHolder
by default, the model has to provide the menu

o  menuPerformer
by default, the model is performing menu actions

o  model
return my model

o  model: aModel
set my model

o  sensor
return my view's sensor

o  view
return my view

o  view: aView
set my view

event handling
o  buttonMotion: buttonMask x: x y: y
mouse was moved with button pressed in my view; nothing done here

o  buttonMultiPress: button x: x y: y
a mouse button was pressed again shortly after in my view

o  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

o  buttonRelease: button x: x y: y
a mouse button was released in my view; nothing done here

o  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:

o  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:

o  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:

o  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:

o  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:

o  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:

o  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:

o  focusIn
my view got the keyboard focus; nothing done here

o  focusOut
my view lost keyboard focus; nothing done here

o  keyPress: key x: x y: y
key was pressed in my view; nothing done here,
except for Tab keys.

o  keyRelease: key x: x y: y
key was released in my view; nothing done here

o  mouseWheelMotion: event x: x y: y amount: amount deltaTime: deltaTime
a mouse wheel was turned - nothing done here

o  pointerEnter: state x: x y: y
mouse pointer entered my view; nothing done here

o  pointerLeave: state
mouse pointer left my view; nothing done here

initialization & release
o  initialize
initialize the controller; subclasses should redefine
this and include a super initialize for proper initialization.

o  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.

o  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
o  yellowButtonMenu
actually, this should be called 'middleButtonMenu'.
But for ST-80 compatibility ....



ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Thu, 10 Oct 2024 10:52:03 GMT