"
COPYRIGHT (c) 1992-93 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.
"
Object subclass:#Model
instanceVariableNames:'dependents'
classVariableNames:''
poolDictionaries:''
category:'Interface-Support'
!
Model comment:'
COPYRIGHT (c) 1992-93 by Claus Gittinger
All Rights Reserved
Model are things that can be displayed in a view. I keep track of
which views are dependeent of me and inform them of any changes.
I know how to display myself in a GraphicsContext.
This was written to be more ST-80 conform.
Instance variables:
dependentViews Collection the views knowing me
%W% %E%
written summer 92 by claus
'!
!Model methodsFor:'accessing'!
addDependent:aView
"make the argument, anObject be dependent of the receiver"
dependents isNil ifTrue:[
dependents := IdentitySet new
].
dependents add:aView
!
removeDependent:anObject
"make the argument, anObject be independent of the receiver"
dependents notNil ifTrue:[
dependents remove:anObject ifAbsent:[]
]
!
dependents
"return a Collection of dependents - nil if there is none"
^ dependents
!
release
"remove all dependencies from the receiver"
dependents := nil
! !
!Model methodsFor:'events'!
changed:something with:arguments
dependents notNil ifTrue:[
dependents do:[:someOne |
someOne update:something with:arguments
]
]
!
changed:something
dependents notNil ifTrue:[
dependents do:[:someOne |
someOne update:something
]
]
!
changed
dependents notNil ifTrue:[
dependents do:[:someOne |
someOne update:self
]
]
! !
!Model methodsFor:'drawing'!
displayOn:aGraphicsContext clippingBox:aRectangle
"display a part of me in aGraphicsContext"
^ self subclassResponsibility
!
displayOn:aGraphicsContext
"display myself in aGraphicsContext"
^ self subclassResponsibility
! !