|
|
Class: View
Object
|
+--GraphicsContext
|
+--DeviceGraphicsContext
|
+--GraphicsMedium
|
+--DisplaySurface
|
+--SimpleView
|
+--View
|
+--ActiveHelpView
|
+--ApplicationSubView
|
+--BarChartWidget
|
+--CharacterSetView
|
+--ChartDescription
|
+--ComboView
|
+--CompositeView
|
+--DSVColumnView
|
+--DigitalLedDisplay
|
+--EventMonitor::EventMonitorView
|
+--ExtendedComboBox
|
+--GraphColumnView
|
+--HTMLDocumentFrame
|
+--ImageView
|
+--Label
|
+--LabelledEnterField
|
+--ListModelView
|
+--ListView
|
+--MemoryMonitorView
|
+--MenuPanel
|
+--MeterClackCounter
|
+--MeterWidget
|
+--NoteBookView
|
+--ObjectView
|
+--PieChartWidget
|
+--ProgressIndicator
|
+--PullDownMenu
|
+--Scroller
|
+--SimpleFunctionGraphView
|
+--ThumbWheel
|
+--TopView
|
+--TransparentBox
|
+--UpDownButton
|
+--VUMeter
- Package:
- stx:libview
- Category:
- Views-Basic
- Version:
- rev:
1.80
date: 2008/06/28 11:55:50
- user: stefan
- file: View.st directory: libview
- module: stx stc-classLibrary: libview
- Author:
- Claus Gittinger
this class adds provisions for views which show or work on a model.
This functionality used to be in View, but has been extracted into SimpleView and
this new View class, to take some of the stuff out of views which do not need
this functionality (i.e. all views which do only geometry management).
Instances of View are seldom used, most views in the system inherit
from this class.
[Instance variables:]
model <nil | any> the model (if any)
aspectMsg <nil | Symbol> the aspect; typically
dependentViews react on changes
of this aspect and update their contents.
changeMsg <nil | Symbol> the changeMessage; typically
dependentViews send this message to
the model to tell it about changes.
menuMsg <nil | Symbol> the menuMessage; typically
dependentViews send this message to
the model to ask for a popup menu.
menuHolder <any> who has a menu
(default: nil i.e. model has menu)
menuPerformer <any> who performs menu actions
(default: nil i.e. model has menu)
StandardSystemView
TopView
DialogBox
WindowGroup
Model
ValueHolder
[introduction to view programming]
defaults
-
defaultAspectMessage
-
subclasses which by default do NOT want to be informed about changed
models should redefine this to return nil
-
defaultChangeMessage
-
subclasses which by default do NOT want to inform the model
should redefine this to return nil
-
defaultMenuMessage
-
subclasses which by default do NOT want to send menu messages
should return nil
instance creation
-
on: aModel aspect: aspectMsg
-
st-80 style view creation: create a new view, set its model
and selectors for aspect
-
on: aModel aspect: aspectMsg change: changeMsg
-
st-80 style view creation: create a new view, set its model
and selectors for aspect and change
-
on: aModel aspect: aspectMsg change: changeMsg menu: menuMsg
-
st-80 style view creation: create a new view, set its model
and selectors for aspect, change and menu
-
on: aModel aspect: aspectMsg menu: menuMsg
-
st-80 style view creation: create a new view, set its model
and selectors for aspect and menu
accessing-bg & border
-
allViewBackground: something if: condition
-
set the viewBackground to something, a color, image or form,
in myself and recursively in all of my subviews.
However, if I have a backgroundChannel, dont change my own bg.
accessing-channels
-
backgroundChannel
-
return a valueHolder for background color
-
backgroundChannel: aValueHolder
-
set the backgroundChannel - a valueHolder holding a color
-
enableChannel
-
return a valueHolder for enable/disable
-
enableChannel: aValueHolder
-
set the valueHolder, which holds the enable boolean value
-
foregroundChannel
-
return a valueHolder for foreground color
-
foregroundChannel: aValueHolder
-
set the foregroundChannel - a valueHolder holding a color
-
setVisibilityChannel: aValueHolder
-
set the valueHolder, which holds the visible boolean value
accessing-menus
-
menuHolder
-
who has the menu ?
If no explicit menuHolder was defined, its the model if I have one.
Otherwise, its the menuHolder (if nonNil) or mySelf.
The menuHolder is supposed to return a popUpMenu when asked via the
menuMessage.
-
menuHolder: anObject
-
change the one that provides the menu (via menuMsg).
-
menuMessage
-
Return the symbol sent to the model to aquire the menu
-
menuMessage: aSymbol
-
ST-80 style menus: If a views menuSymbol is nonNil, it
will send it to its model when the middleButton is pressed.
That method should return nil or the menu to be shown.
This is useful for very dynamic menus, where it does not
make sense to define an initial menu.
This is the same as #menu: which was added for ST-80 compatibility.
-
menuPerformer
-
who should perform the menu actions ?
If no menuPerformer was defined, its the model if I have one.
Otherwise its the menuPerformer (if nonNil), or myself.
The menuPerformer get messages from the menu
-
menuPerformer: anObject
-
change the one that does the menu actions.
See the comment in SimpleView>>activateMenu on who gets the menus
message.
-
performer: anObject
-
same as #menuPerformer - ST80 compatibility
accessing-mvc
-
addModelInterfaceTo: aDictionary
-
this adds entries for all messages sent to my model
to aDictionary
-
aspect
-
Return the aspect used with changes from/to the model
-
aspectMessage
-
Return the aspect used with changes from/to the model
-
aspectMessage: aspectSymbol
-
ST-80 style updating: If a views aspectSymbol is nonNil,
it will respond to changes of this aspect from the model.
-
change: changeSymbol
-
ST-80 style change notification: If a views changeSymbol is nonNil,
it will send it to its model when something changes.
Alias for changeMessage: for ST-80 compatibility.
-
changeMessage
-
Return the symbol sent to the model if nonNil when something changes.
-
changeMessage: aSymbol
-
ST-80 style change notification: If a views changeSymbol is nonNil,
it will send it to its model when something changes.
This is the same as change: which was added for ST-80 compatibility.
-
controller: aController
-
set the controller
-
menu: menuSymbol
-
ST-80 style menus: If a views menuSymbol is nonNil, it
will send it to its model when the middleButton is pressed.
That method should return nil or the menu to be shown.
This is useful for very dynamic menus, where it does not
make sense to define an initial menu.
Alias for #menuMessage:, for ST-80 compatibility.
-
model
-
return the model, for non-MVC views,
this is nil or the receiver
-
model: aModel
-
Set the model.
Here, if I am my own menuPerformer/menuHolder,
set the menuHolder and menuPerformer to the model.
This is a compatibility kludge,
since typically, ST-80 code expects the model to provide a menu
and perform it. If the model does not support a menu message,
it will be forwarded to the view.
Those apps which want the view to provide the (default) menu have to reset
this by sending #menuHolder: message (again)
-
modelInterface
-
this returns a dictionary of messages sent to my model.
It can be used for builders and wrappers to get information
about the messages sent to my model.
The returned dictionary contains one entry for each get-Msg,
and the recevier will implement corresponding messages (with a colon)
to set the message symbol.
-
on: aModel aspect: aspectSymbol
-
ST-80 compatibility: set model and aspect
messages - needs a view which uses these
-
on: aModel aspect: aspectSymbol change: changeSymbol
-
ST-80 compatibility: set model, aspect and change
messages - needs a view which uses these
-
on: aModel aspect: aspectSymbol change: changeSymbol menu: menuSymbol
-
ST-80 compatibility: set model, aspect, change and menu
messages - needs a view which uses these
-
on: aModel aspect: aspectSymbol menu: menuSymbol
-
ST-80 compatibility: set model, aspect and menu
messages - needs a view which uses these
-
sendChangeMessage: aSelector with: arg
-
tell the model about a change
-
sendChangeMessageWith: arg
-
tell the model about a change
change & update
-
update: something with: aParameter from: changedObject
-
-
updateFromModel
-
to be redefined in subclasses
drawing
-
redraw
-
redraw myself
if there is a model, this one shall redraw itself,
otherwise we cannot do much here - has to be redefined in subclasses
event handling
-
backgroundColorChanged
-
called to update the background color
-
enableStateChanged
-
called to update enable/disable state
-
foregroundColorChanged
-
called to update the foreground color
focus handling
-
wantsFocusWithButtonPress
-
views which do not like to take the keyboard focus
with buttonPress can do so by redefining this
to return false
initialization & release
-
initialize
-
-
release
-
a subView in a topView:
|top v|
top := StandardSystemView new.
v := View new.
v origin:0.25 @ 0.25 corner:0.75 @ 0.75.
top addSubView:v.
top open
|
the same, a bit more compact:
|top v|
top := StandardSystemView new.
v := View origin:0.25 @ 0.25 corner:0.75 @ 0.75 in:top.
top open
|
menuHolder
|top mh|
mh := (PopUpMenu itemList:#( ('foo' foo) (#'bar' bar)) resources:nil) asValue.
top := StandardSystemView extent:200@200.
top menuHolder:mh.
top open
|
menuHolder
|top mh|
mh := (PopUpMenu itemList:#( ('foo' foo) (#'bar' bar)) resources:nil) asValue.
[
Delay waitForSeconds:5.
mh value: (PopUpMenu itemList:#( ('waboo' foo) (#'baz' bar)) resources:nil)
] fork.
top := StandardSystemView extent:200@200.
top menuHolder:mh.
top open
|
|