375
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1997 by eXept Software AG
|
|
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 |
|
355
|
13 |
SimpleView subclass:#NoteBookView
|
375
|
14 |
instanceVariableNames:'tabRaw canvas canvasHolder'
|
355
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Views-Layout'
|
|
18 |
!
|
|
19 |
|
|
20 |
!NoteBookView class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
|
24 |
COPYRIGHT (c) 1997 by eXept Software AG
|
|
25 |
All Rights Reserved
|
|
26 |
|
|
27 |
This software is furnished under a license and may be used
|
|
28 |
only in accordance with the terms of that license and with the
|
|
29 |
inclusion of the above copyright notice. This software may not
|
|
30 |
be provided or otherwise made available to, or used by, any
|
|
31 |
other person. No title to or ownership of the software is
|
|
32 |
hereby transferred.
|
|
33 |
"
|
|
34 |
!
|
|
35 |
|
|
36 |
documentation
|
|
37 |
"
|
|
38 |
this is not yet finished - for now, its a dummy to allow
|
|
39 |
ST-80 applications to be (at least) loaded.
|
|
40 |
"
|
|
41 |
! !
|
|
42 |
|
375
|
43 |
!NoteBookView class methodsFor:'tests'!
|
|
44 |
|
|
45 |
bottom
|
|
46 |
|
|
47 |
|top tab view inset|
|
|
48 |
|
|
49 |
top := StandardSystemView new label:'test'; extent:250@100.
|
|
50 |
view := self origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
|
|
51 |
view direction:#bottom.
|
|
52 |
view list:#( 'Foo' 'Bar' 'Baz' ).
|
|
53 |
view action:[:aName|view direction:#top].
|
|
54 |
|
|
55 |
top open.
|
|
56 |
|
|
57 |
|
|
58 |
!
|
|
59 |
|
|
60 |
left
|
|
61 |
|
|
62 |
|top tab view inset|
|
|
63 |
|
|
64 |
top := StandardSystemView new label:'test'; extent:250@100.
|
|
65 |
view := self origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
|
|
66 |
view direction:#left.
|
|
67 |
view list:#( 'Foo' 'Bar' 'Baz' ).
|
|
68 |
view action:[:aName|Transcript showCR:aName].
|
|
69 |
top open.
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
74 |
!
|
|
75 |
|
|
76 |
right
|
|
77 |
|
|
78 |
|top tab view inset|
|
|
79 |
|
|
80 |
top := StandardSystemView new label:'test'; extent:250@100.
|
|
81 |
view := self origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
|
|
82 |
view direction:#right.
|
|
83 |
view list:#( 'Foo' 'Bar' 'Baz' ).
|
|
84 |
view action:[:aName|Transcript showCR:aName].
|
|
85 |
top open.
|
355
|
86 |
|
375
|
87 |
|
|
88 |
|
|
89 |
!
|
|
90 |
|
|
91 |
top
|
|
92 |
|
|
93 |
|top tab view inset|
|
|
94 |
|
|
95 |
top := StandardSystemView new label:'test'; extent:250@100.
|
|
96 |
view := self origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
|
|
97 |
view direction:#top.
|
|
98 |
view list:#( 'Foo' 'Bar' 'Baz' ).
|
|
99 |
view action:[:aName|Transcript showCR:aName].
|
|
100 |
top open.
|
|
101 |
|
|
102 |
! !
|
|
103 |
|
|
104 |
!NoteBookView methodsFor:'accessing'!
|
355
|
105 |
|
375
|
106 |
canvas
|
|
107 |
"returns canvas; the container view
|
|
108 |
"
|
|
109 |
^ canvas
|
|
110 |
!
|
|
111 |
|
|
112 |
canvas:aCanvas
|
|
113 |
"change canvas; the containter view
|
|
114 |
"
|
|
115 |
|origin corner|
|
|
116 |
|
|
117 |
aCanvas == canvas ifFalse:[
|
|
118 |
origin := canvas origin.
|
|
119 |
corner := canvas corner.
|
|
120 |
canvas destroy.
|
|
121 |
|
|
122 |
(canvas := aCanvas) isNil ifTrue:[canvas := View in:self]
|
|
123 |
ifFalse:[self addSubView:canvas].
|
|
124 |
|
|
125 |
canvas origin:origin corner:corner.
|
|
126 |
]
|
|
127 |
!
|
|
128 |
|
|
129 |
canvasHolder
|
|
130 |
^ canvasHolder
|
355
|
131 |
!
|
|
132 |
|
375
|
133 |
canvasHolder:aValueHolder
|
|
134 |
canvasHolder notNil ifTrue:[
|
|
135 |
canvasHolder removeDependent:self.
|
|
136 |
].
|
|
137 |
canvasHolder := aValueHolder .
|
|
138 |
self canvas:(canvasHolder value).
|
|
139 |
! !
|
|
140 |
|
|
141 |
!NoteBookView methodsFor:'actions'!
|
|
142 |
|
|
143 |
clearCanvas
|
|
144 |
"destroy all subviews in canvas
|
|
145 |
"
|
|
146 |
canvas destroySubViews
|
|
147 |
|
|
148 |
|
|
149 |
! !
|
|
150 |
|
|
151 |
!NoteBookView methodsFor:'change & update'!
|
|
152 |
|
|
153 |
recomputeSizes
|
|
154 |
"recompute sizes dependent on list
|
|
155 |
"
|
|
156 |
|y x tabExt maxExt|
|
|
157 |
|
|
158 |
|
|
159 |
maxExt := self extent.
|
|
160 |
tabExt := tabRaw preferredExtent.
|
|
161 |
|
|
162 |
x := tabExt x.
|
|
163 |
y := tabExt y.
|
|
164 |
|
|
165 |
canvas viewBackground:(tabRaw styleAt:#selectedColor).
|
|
166 |
|
|
167 |
tabRaw isHorizontalDirection ifTrue:[
|
|
168 |
x > (maxExt x) ifTrue:[y := tabRaw preferredSizeXorY].
|
|
169 |
|
|
170 |
tabRaw direction == #top ifTrue:[
|
|
171 |
tabRaw origin:0@0 corner:1.0@y.
|
|
172 |
canvas origin:0@y corner:1.0@1.0.
|
|
173 |
] ifFalse:[
|
|
174 |
y := maxExt y - y.
|
|
175 |
canvas origin:0@0 corner:1.0@y.
|
|
176 |
tabRaw origin:0@y corner:1.0@1.0.
|
|
177 |
]
|
|
178 |
] ifFalse:[
|
|
179 |
y > (maxExt y) ifTrue:[x := tabRaw preferredSizeXorY].
|
|
180 |
|
|
181 |
tabRaw direction == #left ifTrue:[
|
|
182 |
tabRaw origin:0@0 corner:x@1.0.
|
|
183 |
canvas origin:x@0 corner:1.0@1.0.
|
|
184 |
] ifFalse:[
|
|
185 |
x := maxExt x - x.
|
|
186 |
canvas origin:0@0 corner:x@1.0.
|
|
187 |
tabRaw origin:x@0 corner:1.0@1.0.
|
|
188 |
]
|
355
|
189 |
].
|
375
|
190 |
|
|
191 |
|
|
192 |
|
|
193 |
!
|
|
194 |
|
|
195 |
update:something with:aParameter from:changedObject
|
|
196 |
"tabs changed
|
|
197 |
"
|
|
198 |
changedObject == tabRaw ifTrue:[
|
|
199 |
something == #preferredExtent ifFalse:[
|
|
200 |
something == #direction ifFalse:[
|
|
201 |
^ self
|
|
202 |
].
|
|
203 |
tabRaw isHorizontalDirection ifTrue:[
|
|
204 |
tabRaw origin:0.0@0.0 corner:1.0@0.0
|
|
205 |
] ifFalse:[
|
|
206 |
tabRaw origin:0.0@0.0 corner:0.0@1.0
|
|
207 |
]
|
|
208 |
].
|
|
209 |
self recomputeSizes
|
|
210 |
]
|
|
211 |
! !
|
|
212 |
|
|
213 |
!NoteBookView methodsFor:'event handling'!
|
355
|
214 |
|
375
|
215 |
doesNotUnderstand:aMessage
|
|
216 |
(tabRaw respondsTo:(aMessage selector)) ifTrue:[
|
|
217 |
^ aMessage sendTo:tabRaw
|
|
218 |
].
|
|
219 |
^ super doesNotUnderstand:aMessage
|
|
220 |
|
|
221 |
|
|
222 |
! !
|
|
223 |
|
|
224 |
!NoteBookView methodsFor:'initialization'!
|
|
225 |
|
|
226 |
destroy
|
|
227 |
"remove dependancies
|
|
228 |
"
|
|
229 |
canvasHolder notNil ifTrue:[
|
|
230 |
canvasHolder removeDependent:self.
|
|
231 |
].
|
403
|
232 |
tabRaw removeDependent:self.
|
|
233 |
self delegate:self.
|
375
|
234 |
super destroy
|
|
235 |
!
|
|
236 |
|
|
237 |
initialize
|
|
238 |
"initialize tabs and canvas
|
|
239 |
"
|
|
240 |
super initialize.
|
|
241 |
|
|
242 |
tabRaw := TabView origin:0.0@0.0 corner:1.0@0.0 in:self.
|
|
243 |
canvas := View origin:0.0@0.0 corner:1.0@1.0 in:self.
|
|
244 |
tabRaw addDependent:self.
|
|
245 |
self delegate:(KeyboardForwarder from:self toView:tabRaw).
|
386
|
246 |
canvas viewBackground:(tabRaw styleAt:#selectedColor).
|
375
|
247 |
|
|
248 |
|
355
|
249 |
! !
|
|
250 |
|
386
|
251 |
!NoteBookView methodsFor:'selection'!
|
|
252 |
|
|
253 |
setSelection:something
|
|
254 |
tabRaw setSelection:something
|
|
255 |
! !
|
|
256 |
|
355
|
257 |
!NoteBookView class methodsFor:'documentation'!
|
|
258 |
|
|
259 |
version
|
403
|
260 |
^ '$Header: /cvs/stx/stx/libwidg2/NoteBookView.st,v 1.4 1997-06-02 06:02:10 ca Exp $'
|
355
|
261 |
! !
|