0
|
1 |
"
|
6
|
2 |
COPYRIGHT (c) 1992 by Claus Gittinger
|
35
|
3 |
All Rights Reserved
|
0
|
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:''
|
48
|
17 |
category:'Kernel-Objects'
|
0
|
18 |
!
|
|
19 |
|
|
20 |
Model comment:'
|
21
|
21 |
COPYRIGHT (c) 1992 by Claus Gittinger
|
35
|
22 |
All Rights Reserved
|
23
|
23 |
|
48
|
24 |
$Header: /cvs/stx/stx/libview2/Model.st,v 1.9 1995-03-18 05:11:35 claus Exp $
|
21
|
25 |
'!
|
0
|
26 |
|
21
|
27 |
!Model class methodsFor:'documentation'!
|
|
28 |
|
|
29 |
copyright
|
|
30 |
"
|
|
31 |
COPYRIGHT (c) 1992 by Claus Gittinger
|
35
|
32 |
All Rights Reserved
|
0
|
33 |
|
21
|
34 |
This software is furnished under a license and may be used
|
|
35 |
only in accordance with the terms of that license and with the
|
|
36 |
inclusion of the above copyright notice. This software may not
|
|
37 |
be provided or otherwise made available to, or used by, any
|
|
38 |
other person. No title to or ownership of the software is
|
|
39 |
hereby transferred.
|
|
40 |
"
|
|
41 |
!
|
0
|
42 |
|
21
|
43 |
version
|
|
44 |
"
|
48
|
45 |
$Header: /cvs/stx/stx/libview2/Model.st,v 1.9 1995-03-18 05:11:35 claus Exp $
|
21
|
46 |
"
|
|
47 |
!
|
0
|
48 |
|
21
|
49 |
documentation
|
|
50 |
"
|
|
51 |
Models are things that are presented in views. Instances keep track of
|
35
|
52 |
which views are dependent of them and inform them of any changes.
|
|
53 |
Actually the Model class is not really needed - you can take any object
|
|
54 |
as a model - however instances of Model (and subclasses) keep the dependents
|
|
55 |
in an instance variable; thus speeding up access a bit.
|
|
56 |
|
21
|
57 |
They should know how to display myself in a GraphicsContext.
|
|
58 |
This was written to be more ST-80 conform.
|
|
59 |
|
|
60 |
Instance variables:
|
35
|
61 |
dependents WeakCollection the views depending on me
|
21
|
62 |
"
|
|
63 |
! !
|
0
|
64 |
|
|
65 |
!Model methodsFor:'accessing'!
|
|
66 |
|
|
67 |
dependents
|
|
68 |
"return a Collection of dependents - nil if there is none"
|
|
69 |
|
|
70 |
^ dependents
|
|
71 |
!
|
|
72 |
|
10
|
73 |
dependents:aCollection
|
|
74 |
"set the collection of dependents"
|
0
|
75 |
|
10
|
76 |
dependents := aCollection
|
0
|
77 |
! !
|
|
78 |
|
28
|
79 |
!Model methodsFor:'copying'!
|
|
80 |
|
|
81 |
postCopy
|
|
82 |
"release dependents after copying"
|
|
83 |
|
|
84 |
self dependents:nil
|
|
85 |
! !
|
|
86 |
|
0
|
87 |
!Model methodsFor:'drawing'!
|
|
88 |
|
|
89 |
displayOn:aGraphicsContext clippingBox:aRectangle
|
|
90 |
"display a part of me in aGraphicsContext"
|
|
91 |
|
|
92 |
^ self subclassResponsibility
|
|
93 |
!
|
|
94 |
|
|
95 |
displayOn:aGraphicsContext
|
|
96 |
"display myself in aGraphicsContext"
|
|
97 |
|
|
98 |
^ self subclassResponsibility
|
|
99 |
! !
|