0
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1992-93 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
Object subclass:#Model
|
|
14 |
instanceVariableNames:'dependents'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-Support'
|
|
18 |
!
|
|
19 |
|
|
20 |
Model comment:'
|
|
21 |
|
|
22 |
COPYRIGHT (c) 1992-93 by Claus Gittinger
|
|
23 |
All Rights Reserved
|
|
24 |
|
|
25 |
Model are things that can be displayed in a view. I keep track of
|
|
26 |
which views are dependeent of me and inform them of any changes.
|
|
27 |
I know how to display myself in a GraphicsContext.
|
|
28 |
This was written to be more ST-80 conform.
|
|
29 |
|
|
30 |
Instance variables:
|
|
31 |
dependentViews Collection the views knowing me
|
|
32 |
|
5
|
33 |
$Header: /cvs/stx/stx/libview2/Model.st,v 1.2 1993-10-13 00:46:11 claus Exp $
|
0
|
34 |
written summer 92 by claus
|
|
35 |
'!
|
|
36 |
|
|
37 |
!Model methodsFor:'accessing'!
|
|
38 |
|
|
39 |
addDependent:aView
|
|
40 |
"make the argument, anObject be dependent of the receiver"
|
|
41 |
|
|
42 |
dependents isNil ifTrue:[
|
|
43 |
dependents := IdentitySet new
|
|
44 |
].
|
|
45 |
dependents add:aView
|
|
46 |
!
|
|
47 |
|
|
48 |
removeDependent:anObject
|
|
49 |
"make the argument, anObject be independent of the receiver"
|
|
50 |
|
|
51 |
dependents notNil ifTrue:[
|
|
52 |
dependents remove:anObject ifAbsent:[]
|
|
53 |
]
|
|
54 |
!
|
|
55 |
|
|
56 |
dependents
|
|
57 |
"return a Collection of dependents - nil if there is none"
|
|
58 |
|
|
59 |
^ dependents
|
|
60 |
!
|
|
61 |
|
|
62 |
release
|
|
63 |
"remove all dependencies from the receiver"
|
|
64 |
|
|
65 |
dependents := nil
|
|
66 |
! !
|
|
67 |
|
|
68 |
!Model methodsFor:'events'!
|
|
69 |
|
|
70 |
changed:something with:arguments
|
|
71 |
dependents notNil ifTrue:[
|
|
72 |
dependents do:[:someOne |
|
|
73 |
someOne update:something with:arguments
|
|
74 |
]
|
|
75 |
]
|
|
76 |
!
|
|
77 |
|
|
78 |
changed:something
|
|
79 |
dependents notNil ifTrue:[
|
|
80 |
dependents do:[:someOne |
|
|
81 |
someOne update:something
|
|
82 |
]
|
|
83 |
]
|
|
84 |
!
|
|
85 |
|
|
86 |
changed
|
|
87 |
dependents notNil ifTrue:[
|
|
88 |
dependents do:[:someOne |
|
|
89 |
someOne update:self
|
|
90 |
]
|
|
91 |
]
|
|
92 |
! !
|
|
93 |
|
|
94 |
!Model methodsFor:'drawing'!
|
|
95 |
|
|
96 |
displayOn:aGraphicsContext clippingBox:aRectangle
|
|
97 |
"display a part of me in aGraphicsContext"
|
|
98 |
|
|
99 |
^ self subclassResponsibility
|
|
100 |
!
|
|
101 |
|
|
102 |
displayOn:aGraphicsContext
|
|
103 |
"display myself in aGraphicsContext"
|
|
104 |
|
|
105 |
^ self subclassResponsibility
|
|
106 |
|
|
107 |
! !
|