author | Claus Gittinger <cg@exept.de> |
Fri, 01 Mar 1996 14:02:46 +0100 | |
changeset 441 | e170bca66a78 |
parent 397 | 7038c3c38ced |
child 485 | 50cbbe748ac9 |
permissions | -rw-r--r-- |
295 | 1 |
" |
2 |
COPYRIGHT (c) 1991 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 |
SimpleView subclass:#VariablePanel |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
14 |
instanceVariableNames:'barHeight barWidth separatingLine shadowForm lightForm showHandle |
295 | 15 |
handlePosition handleColor handleStyle handleLevel noColor |
16 |
trackLine redrawLocked orientation' |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
17 |
classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition |
295 | 18 |
DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor |
19 |
DefaultHandleLevel DefaultVCursor DefaultHCursor' |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
20 |
poolDictionaries:'' |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
21 |
category:'Views-Layout' |
295 | 22 |
! |
23 |
||
24 |
!VariablePanel class methodsFor:'documentation'! |
|
25 |
||
26 |
copyright |
|
27 |
" |
|
28 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
29 |
All Rights Reserved |
|
30 |
||
31 |
This software is furnished under a license and may be used |
|
32 |
only in accordance with the terms of that license and with the |
|
33 |
inclusion of the above copyright notice. This software may not |
|
34 |
be provided or otherwise made available to, or used by, any |
|
35 |
other person. No title to or ownership of the software is |
|
36 |
hereby transferred. |
|
37 |
" |
|
38 |
! |
|
39 |
||
40 |
documentation |
|
41 |
" |
|
42 |
a View to separate its subviews vertically by a movable bar; |
|
43 |
the size-ratios of the subviews can be changed by moving this bar. |
|
44 |
||
45 |
In order to correctly setup this kind of view, the subviews must |
|
46 |
be created with a relative origin & relative corner. |
|
47 |
The panel does not verify the relative subview bounds; |
|
48 |
therefore, it is your responsibility to set those relative sizes to fit |
|
49 |
according the orientation (see bad example below). |
|
50 |
||
51 |
The bar-handle is either an exposed knob (style == #motif) |
|
52 |
or the form defined in Scroller (style ~~ #motif) |
|
53 |
or nothing. |
|
54 |
||
55 |
Typically creation is done as: |
|
56 |
||
57 |
p := VariablePanel in:superView. |
|
58 |
p orientation:#vertical. |
|
59 |
||
60 |
v1 := <someViewClass> origin:0.0 @ 0.0 |
|
61 |
corner:1.0 @ 0.5 |
|
62 |
in:p. |
|
63 |
v2 := <someViewClass> origin:0.0 @ 0.5 |
|
64 |
corner:1.0 @ 0.8 |
|
65 |
in:p. |
|
66 |
v3 := <someViewClass> origin:0.0 @ 0.8 |
|
67 |
corner:1.0 @ 1.0 |
|
68 |
in:p. |
|
69 |
||
70 |
Notice: if it is required to insert a fixed-size view in the panel, |
|
71 |
use an extra view & insets, and place the subview into that extra view. |
|
72 |
||
73 |
see examples. |
|
74 |
" |
|
75 |
! |
|
76 |
||
77 |
examples |
|
78 |
" |
|
79 |
example (setting the orientation later makes it equally space its views): |
|
80 |
||
81 |
|top p v1 v2 v3| |
|
82 |
||
83 |
top := StandardSystemView new. |
|
84 |
top extent:300@300. |
|
85 |
||
86 |
p := VariablePanel |
|
87 |
origin:0.0 @ 0.0 |
|
88 |
corner:1.0 @ 1.0 |
|
89 |
in:top. |
|
90 |
||
91 |
v1 := View in:p. |
|
92 |
v2 := View in:p. |
|
93 |
v3 := View in:p. |
|
94 |
||
95 |
v1 viewBackground:(Color red). |
|
96 |
v2 viewBackground:(Color green). |
|
97 |
v3 viewBackground:(Color yellow). |
|
98 |
||
99 |
p orientation:#vertical. |
|
100 |
top open. |
|
101 |
||
102 |
||
103 |
example (setting orientation first, req's that subviews have relative bounds): |
|
104 |
||
105 |
|top p v1 v2 v3| |
|
106 |
||
107 |
top := StandardSystemView new. |
|
108 |
top extent:300@300. |
|
109 |
||
110 |
p := VariablePanel |
|
111 |
origin:0.0 @ 0.0 |
|
112 |
corner:1.0 @ 1.0 |
|
113 |
in:top. |
|
114 |
p orientation:#vertical. |
|
115 |
||
116 |
v1 := View origin:0.0@0.0 corner:1.0@(1/2) in:p. |
|
117 |
v2 := View origin:0.0@(1/2) corner:1.0@(2/3) in:p. |
|
118 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
119 |
||
120 |
v1 viewBackground:(Color red). |
|
121 |
v2 viewBackground:(Color green). |
|
122 |
v3 viewBackground:(Color yellow). |
|
123 |
||
124 |
top open |
|
125 |
||
126 |
||
127 |
||
128 |
example (change the handles level): |
|
129 |
||
130 |
|top p v1 v2 v3| |
|
131 |
||
132 |
top := StandardSystemView new. |
|
133 |
top extent:300@300. |
|
134 |
||
135 |
p := VariablePanel |
|
136 |
origin:0.0 @ 0.0 |
|
137 |
corner:1.0 @ 1.0 |
|
138 |
in:top. |
|
139 |
p orientation:#vertical. |
|
140 |
p handleLevel:-1. |
|
141 |
||
142 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
|
143 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
144 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
145 |
||
146 |
v1 viewBackground:(Color red). |
|
147 |
v2 viewBackground:(Color green). |
|
148 |
v3 viewBackground:(Color yellow). |
|
149 |
||
150 |
top open |
|
151 |
||
152 |
||
153 |
||
397 | 154 |
example (change the handles style to nil makes it invisible): |
155 |
||
156 |
|top p v1 v2 v3| |
|
157 |
||
158 |
top := StandardSystemView new. |
|
159 |
top extent:300@300. |
|
160 |
||
161 |
p := VariablePanel |
|
162 |
origin:0.0 @ 0.0 |
|
163 |
corner:1.0 @ 1.0 |
|
164 |
in:top. |
|
165 |
p orientation:#vertical. |
|
166 |
p handleStyle:nil. |
|
167 |
||
168 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
|
169 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
170 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
171 |
||
172 |
v1 viewBackground:(Color red). |
|
173 |
v2 viewBackground:(Color green). |
|
174 |
v3 viewBackground:(Color yellow). |
|
175 |
||
176 |
top open |
|
177 |
||
178 |
||
179 |
||
295 | 180 |
example (placing scrolled and unscrolled views into a variablePanel): |
181 |
||
182 |
|top p v1 v2 v3| |
|
183 |
||
184 |
top := StandardSystemView new. |
|
185 |
top extent:300@300. |
|
186 |
||
187 |
p := VariablePanel |
|
188 |
origin:0.0 @ 0.0 |
|
189 |
corner:1.0 @ 1.0 |
|
190 |
in:top. |
|
191 |
p orientation:#vertical. |
|
192 |
||
193 |
v1 := ScrollableView for:SelectionInListView in:p. |
|
194 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
195 |
v1 list:(FileDirectory directoryNamed:'/etc') contents. |
|
196 |
v1 action:[:selNr | |
|
197 |
|fullName stream text| |
|
198 |
fullName := '/etc/' , v1 selectionValue. |
|
199 |
stream := fullName asFilename readStream. |
|
200 |
stream notNil ifTrue:[ |
|
201 |
text := stream contents. |
|
202 |
v2 contents:text. |
|
203 |
v3 contents:text |
|
204 |
] |
|
205 |
]. |
|
206 |
||
207 |
v2 := TextView origin:0.0 @ 0.5 corner:1.0 @ 0.8 in:p. |
|
208 |
||
209 |
v3 := ScrollableView for:TextView in:p. |
|
210 |
v3 origin:0.0 @ 0.8 corner:1.0 @ 1.0. |
|
211 |
top open |
|
212 |
||
213 |
||
214 |
example: (dynamically adding/removing views): |
|
215 |
||
216 |
|top p v1 v2 b| |
|
217 |
||
218 |
top := StandardSystemView new. |
|
219 |
top extent:300@300. |
|
220 |
||
221 |
b := Toggle label:'show' in:top. |
|
222 |
b showLamp:false. |
|
223 |
b origin:0.0 @ 0.0 corner:(1.0 @ 40). |
|
224 |
b action:[:state | |
|
225 |
state ifTrue:[ |
|
226 |
b label:'hide'. |
|
227 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
228 |
v2 := ScrollableView for:EditTextView. |
|
229 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
230 |
v2 contents:'another text'. |
|
231 |
p addSubView:v2. |
|
300 | 232 |
v2 realize. |
295 | 233 |
] ifFalse:[ |
234 |
b label:'show'. |
|
235 |
v2 destroy. |
|
236 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0 |
|
237 |
] |
|
238 |
]. |
|
239 |
||
240 |
p := VariablePanel |
|
241 |
origin:0.0 @ 0.0 |
|
242 |
corner:1.0 @ 1.0 |
|
243 |
in:top. |
|
244 |
p orientation:#vertical. |
|
245 |
p topInset:50. |
|
246 |
||
247 |
v1 := ScrollableView for:EditTextView in:p. |
|
248 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
249 |
v1 contents:'some text'. |
|
250 |
||
251 |
top open |
|
252 |
||
253 |
||
254 |
example: (dynamically flipping orientation): |
|
255 |
Notice: you have to change the relative bounds of the subviews first. |
|
256 |
||
257 |
|top p v1 v2 b| |
|
258 |
||
259 |
top := StandardSystemView new. |
|
260 |
top extent:300@300. |
|
261 |
||
262 |
b := Toggle label:'flip' in:top. |
|
263 |
b showLamp:false. |
|
264 |
b origin:0.0 @ 0.0 corner:(1.0 @ 40). |
|
265 |
b action:[:state | |
|
266 |
state ifTrue:[ |
|
267 |
v1 origin:0.0 @ 0.0 corner:0.5 @ 1.0. |
|
268 |
v2 origin:0.5 @ 0.0 corner:1.0 @ 1.0. |
|
269 |
p orientation:#horizontal. |
|
270 |
] ifFalse:[ |
|
271 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
272 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
273 |
p orientation:#vertical. |
|
274 |
]. |
|
275 |
]. |
|
276 |
||
277 |
p := VariablePanel |
|
278 |
origin:0.0 @ 0.0 |
|
279 |
corner:1.0 @ 1.0 |
|
280 |
in:top. |
|
281 |
p orientation:#vertical. |
|
282 |
p topInset:50. |
|
283 |
||
284 |
v1 := ScrollableView for:EditTextView in:p. |
|
285 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
286 |
v1 contents:'some text'. |
|
287 |
||
288 |
v2 := ScrollableView for:EditTextView in:p. |
|
289 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
290 |
v2 contents:'another text'. |
|
291 |
||
292 |
top open |
|
293 |
||
294 |
||
295 |
example (combining fix-size with variable size): |
|
296 |
(need 3 extra frame-views to place the extra labels into) |
|
297 |
||
298 |
|top p v1 l1 v2 l2 v3 l3 f1 f2 f3| |
|
299 |
||
300 |
top := StandardSystemView new. |
|
301 |
top extent:300@300. |
|
302 |
||
303 |
p := VariablePanel |
|
304 |
origin:0.0 @ 0.0 |
|
305 |
corner:1.0 @ 1.0 |
|
306 |
in:top. |
|
307 |
||
308 |
f1 := View in:p. |
|
309 |
f2 := View in:p. |
|
310 |
f3 := View in:p. |
|
311 |
||
312 |
v1 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f1. |
|
313 |
v2 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f2. |
|
314 |
v3 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f3. |
|
315 |
||
316 |
l1 := Label label:'sub1' in:f1. |
|
317 |
l2 := Label label:'sub2' in:f2. |
|
318 |
l3 := Label label:'sub3' in:f3. |
|
319 |
||
320 |
l1 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
|
321 |
bottomInset:(l1 preferredExtent y negated). |
|
322 |
l2 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
|
323 |
bottomInset:(l2 preferredExtent y negated). |
|
324 |
l3 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
|
325 |
bottomInset:(l3 preferredExtent y negated). |
|
326 |
||
327 |
v1 topInset:(l1 preferredExtent y); level:-1. |
|
328 |
v2 topInset:(l2 preferredExtent y); level:-1. |
|
329 |
v3 topInset:(l3 preferredExtent y); level:-1. |
|
330 |
||
331 |
v1 viewBackground:(Color red). |
|
332 |
v2 viewBackground:(Color green). |
|
333 |
v3 viewBackground:(Color yellow). |
|
334 |
||
335 |
p orientation:#vertical. |
|
336 |
top open |
|
337 |
||
338 |
||
339 |
BAD EXAMPLE (wrong relative sizes - repaired on handle move): |
|
340 |
||
341 |
|top p v1 v2 v3| |
|
342 |
||
343 |
top := StandardSystemView new. |
|
344 |
top extent:300@300. |
|
345 |
||
346 |
p := VariablePanel |
|
347 |
origin:0.0 @ 0.0 |
|
348 |
corner:1.0 @ 1.0 |
|
349 |
in:top. |
|
350 |
p orientation:#vertical. |
|
351 |
||
352 |
v1 := View origin:0.0 @ 0.0 corner:1.0 @ (1/4) in:p. |
|
353 |
v2 := View origin:0.0 @ (1/2) corner:1.0 @ (3/4) in:p. |
|
354 |
v3 := View origin:0.0 @ (3/4) corner:1.0 @ 1.0 in:p. |
|
355 |
||
356 |
v1 viewBackground:(Color red). |
|
357 |
v2 viewBackground:(Color green). |
|
358 |
v3 viewBackground:(Color yellow). |
|
359 |
||
360 |
top open |
|
361 |
" |
|
362 |
! ! |
|
363 |
||
364 |
!VariablePanel class methodsFor:'defaults'! |
|
365 |
||
366 |
lightFormOn:aDisplay |
|
367 |
"use same handle as Scroller" |
|
368 |
||
369 |
^ Scroller handleLightFormOn:aDisplay |
|
370 |
! |
|
371 |
||
372 |
shadowFormOn:aDisplay |
|
373 |
"use same handle as Scroller" |
|
374 |
||
375 |
^ Scroller handleShadowFormOn:aDisplay |
|
376 |
! |
|
377 |
||
378 |
updateStyleCache |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
379 |
"extract values from the styleSheet and cache them in class variables" |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
380 |
|
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
381 |
<resource: #style (#variablePanelShowHandle #variablePanelHandleStyle |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
382 |
#variablePanelHandlePosition #variablePanelHandleLevel |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
383 |
#variablePanelTrackingLine |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
384 |
#variablePanelSeparatingLine #variablePanelHandleColor)> |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
385 |
|
295 | 386 |
DefaultShowHandle := StyleSheet at:'variablePanelShowHandle' default:true. |
387 |
DefaultHandleStyle := StyleSheet at:'variablePanelHandleStyle'. |
|
388 |
DefaultHandlePosition := StyleSheet at:'variablePanelHandlePosition' default:#right. |
|
389 |
DefaultHandleLevel := StyleSheet at:'variablePanelHandleLevel' default:2. |
|
390 |
DefaultTrackingLine := StyleSheet at:'variablePanelTrackingLine' default:false. |
|
391 |
DefaultSeparatingLine := StyleSheet at:'variablePanelSeparatingLine' default:false. |
|
392 |
DefaultHandleColor := StyleSheet colorAt:'variablePanelHandleColor' default:Black. |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
393 |
|
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
394 |
"Modified: 1.3.1996 / 13:51:24 / cg" |
295 | 395 |
! ! |
396 |
||
397 |
!VariablePanel methodsFor:'accessing'! |
|
398 |
||
399 |
addSubView:aView |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
400 |
"a view is added; adjust other subviews sizes" |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
401 |
|
295 | 402 |
super addSubView:aView. |
403 |
realized ifTrue:[ |
|
397 | 404 |
self resizeSubviews. |
295 | 405 |
] |
406 |
||
407 |
"Created: 17.1.1996 / 22:41:00 / cg" |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
408 |
"Modified: 24.2.1996 / 19:05:05 / cg" |
295 | 409 |
! |
410 |
||
411 |
orientation |
|
412 |
^ orientation |
|
413 |
! |
|
414 |
||
415 |
orientation:aSymbol |
|
416 |
orientation := aSymbol. |
|
417 |
self initCursor. |
|
418 |
self anyNonRelativeSubviews ifTrue:[ |
|
419 |
self setupSubviews |
|
420 |
]. |
|
421 |
shown ifTrue:[ |
|
422 |
self cursor:cursor. |
|
423 |
self sizeChanged:nil. |
|
424 |
self redraw. |
|
425 |
] |
|
426 |
! |
|
427 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
428 |
removeSubView:aView |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
429 |
"a view is removed; adjust other subviews sizes" |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
430 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
431 |
super removeSubView:aView. |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
432 |
shown ifTrue:[ |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
433 |
(superView isNil or:[superView shown]) ifTrue:[ |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
434 |
self setupSubviews |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
435 |
] |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
436 |
] |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
437 |
! ! |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
438 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
439 |
!VariablePanel methodsFor:'accessing-look'! |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
440 |
|
295 | 441 |
barHeight |
442 |
"return the height of the separating bar" |
|
443 |
||
444 |
^ barHeight |
|
445 |
! |
|
446 |
||
447 |
barHeight:nPixel |
|
448 |
"set the height of the separating bar" |
|
449 |
||
450 |
barHeight := nPixel. |
|
451 |
||
452 |
"if screen is very low-res, make certain bar is visible and catchable" |
|
453 |
(barHeight < 4) ifTrue:[ |
|
454 |
barHeight := 4 |
|
455 |
]. |
|
456 |
||
457 |
"make it even so spacing is equally spreadable among subviews" |
|
458 |
barHeight odd ifTrue:[ |
|
459 |
barHeight := barHeight + 1 |
|
460 |
] |
|
461 |
! |
|
462 |
||
463 |
handleLevel:aNumber |
|
464 |
"define the 3D level of the handle (only with some styles). |
|
465 |
Normally, this is defined via styleSheet files, but this entry allows |
|
466 |
individual views to be manipulated." |
|
467 |
||
468 |
handleLevel := aNumber |
|
469 |
! |
|
470 |
||
471 |
handlePosition |
|
472 |
"return the position of the handle" |
|
473 |
||
474 |
^ handlePosition |
|
475 |
! |
|
476 |
||
477 |
handlePosition:aSymbol |
|
478 |
"define the position of the handle; the argument aSymbol |
|
479 |
may be one of #left, #right or #center" |
|
480 |
||
481 |
handlePosition := aSymbol |
|
482 |
! |
|
483 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
484 |
handleStyle:styleSymbol |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
485 |
"define the style of the handle; |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
486 |
styleSymbol may be #motif to draw a little knob or |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
487 |
anything else to draw scrollBars handleForm. |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
488 |
Normally, this is defined via styleSheet files, but this entry allows |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
489 |
individual views to be manipulated." |
295 | 490 |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
491 |
(styleSymbol ~~ handleStyle) ifTrue:[ |
397 | 492 |
handleStyle := styleSymbol. |
493 |
handleStyle == #next ifTrue:[ |
|
494 |
shadowForm := self class shadowFormOn:device. |
|
495 |
lightForm := self class lightFormOn:device. |
|
496 |
] ifFalse:[ |
|
497 |
shadowForm := lightForm := nil |
|
498 |
]. |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
499 |
|
397 | 500 |
shadowForm notNil ifTrue:[ |
501 |
(self is3D and:[handleStyle ~~ #motif]) ifTrue:[ |
|
502 |
self barHeight:(shadowForm height + 2). |
|
503 |
barWidth := shadowForm width |
|
504 |
] |
|
505 |
]. |
|
506 |
shown ifTrue:[ |
|
507 |
self resizeSubviews. |
|
508 |
self redraw |
|
509 |
] |
|
295 | 510 |
] |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
511 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
512 |
"Created: 24.2.1996 / 19:04:07 / cg" |
295 | 513 |
! |
514 |
||
515 |
style:styleSymbol |
|
516 |
"define the style of the handle; |
|
517 |
styleSymbol may be #motif to draw a little knob or |
|
518 |
anything else to draw scrollBars handleForm. |
|
519 |
Normally, this is defined via styleSheet files, but this entry allows |
|
520 |
individual views to be manipulated." |
|
521 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
522 |
self handleStyle:styleSymbol |
295 | 523 |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
524 |
"Modified: 24.2.1996 / 19:04:19 / cg" |
295 | 525 |
! ! |
526 |
||
527 |
!VariablePanel methodsFor:'drawing'! |
|
528 |
||
529 |
drawHandleAtX:hx y:hy |
|
530 |
"draw a single handle at hx/hy" |
|
531 |
||
532 |
|h w x y m| |
|
533 |
||
396
973d4a9fa32c
setting handleStyle to nil disables handleDrawing
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
534 |
handleStyle isNil ifTrue:[^ self]. |
973d4a9fa32c
setting handleStyle to nil disables handleDrawing
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
535 |
|
295 | 536 |
shadowForm notNil ifTrue:[ |
397 | 537 |
h := shadowForm height. |
538 |
w := shadowForm width . |
|
295 | 539 |
] ifFalse:[ |
397 | 540 |
h := w := barHeight - 4. |
295 | 541 |
]. |
542 |
||
543 |
self paint:viewBackground. |
|
544 |
orientation == #vertical ifTrue:[ |
|
397 | 545 |
self fillRectangleX:margin y:hy |
546 |
width:(width - margin - margin) |
|
547 |
height:barHeight. |
|
295 | 548 |
|
397 | 549 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[ |
550 |
m := (barHeight - h) // 2. |
|
295 | 551 |
|
397 | 552 |
shadowForm isNil ifTrue:[ |
553 |
y := hy + (barHeight // 2). |
|
295 | 554 |
|
397 | 555 |
separatingLine ifTrue:[ |
556 |
self paint:shadowColor. |
|
557 |
self displayLineFromX:margin y:y toX:(width - margin) y:y. |
|
558 |
y := y + 1. |
|
559 |
self paint:lightColor. |
|
560 |
self displayLineFromX:margin y:y toX:(width - margin) y:y. |
|
561 |
]. |
|
562 |
self paint:viewBackground. |
|
563 |
self fillRectangleX:(hx - barWidth) y:hy |
|
564 |
width:(barWidth + barWidth) |
|
565 |
height:h. |
|
295 | 566 |
|
397 | 567 |
handleStyle == #line ifTrue:[ |
568 |
self paint:handleColor. |
|
569 |
self displayLineFromX:hx - barWidth y:y toX:hx + barWidth y:y |
|
570 |
] ifFalse:[ |
|
571 |
y := hy. |
|
572 |
handleStyle == #st80 ifTrue:[ |
|
573 |
y := y - 1 |
|
574 |
]. |
|
575 |
self drawEdgesForX:(hx - barWidth) |
|
576 |
y:(y + m) |
|
577 |
width:(barWidth + barWidth) |
|
578 |
height:h |
|
579 |
level:handleLevel. |
|
295 | 580 |
|
397 | 581 |
handleStyle == #iris ifTrue:[ |
582 |
self paint:handleColor. |
|
583 |
self fillDeviceRectangleX:(hx - barWidth + 2) |
|
584 |
y:(y + m + 2) |
|
585 |
width:(barWidth + barWidth - 4) |
|
586 |
height:h - 4 |
|
587 |
] |
|
588 |
]. |
|
589 |
] ifFalse:[ |
|
590 |
y := hy. |
|
591 |
self drawHandleFormAtX:hx y:(y + m) |
|
592 |
]. |
|
593 |
handleStyle == #st80 ifTrue:[ |
|
594 |
y := hy - 1. |
|
595 |
self paint:lightColor. |
|
596 |
self displayLineFromX:margin y:y toX:(width - margin - margin - 1) y:y. |
|
597 |
self displayLineFromX:0 y:hy toX:0 y:(hy + barHeight - 1). |
|
598 |
y := hy + barHeight - 2. |
|
599 |
self paint:shadowColor. |
|
600 |
self displayLineFromX:margin y:y toX:(width - margin) y:y. |
|
601 |
"uncomment the -1 if you dont like the notch at the right end" |
|
602 |
" VVV" |
|
603 |
self displayLineFromX:width-1 y:hy" "-1" " toX:width-1 y:(hy + barHeight - 1). |
|
604 |
]. |
|
605 |
] ifFalse:[ |
|
606 |
y := hy + barHeight - 1. |
|
607 |
self paint:handleColor. |
|
608 |
separatingLine ifTrue:[ |
|
609 |
self displayLineFromX:0 y:hy+1 toX:width y:hy+1. |
|
610 |
self displayLineFromX:0 y:y toX:width y:y. |
|
611 |
]. |
|
612 |
self fillRectangleX:hx y:hy width:barWidth height:barHeight |
|
613 |
] |
|
295 | 614 |
] ifFalse:[ |
397 | 615 |
self fillRectangleX:hx y:margin |
616 |
width:barHeight |
|
617 |
height:(height - margin - margin). |
|
618 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[ |
|
619 |
m := (barHeight - w) // 2. |
|
620 |
shadowForm isNil ifTrue:[ |
|
621 |
x := hx + (barHeight // 2). |
|
622 |
separatingLine ifTrue:[ |
|
623 |
self paint:shadowColor. |
|
624 |
self displayLineFromX:x y:margin toX:x y:(height - margin). |
|
625 |
x := x + 1. |
|
626 |
self paint:lightColor. |
|
627 |
self displayLineFromX:x y:margin toX:x y:(height - margin). |
|
628 |
]. |
|
629 |
self paint:viewBackground. |
|
630 |
self fillRectangleX:hx y:(hy - barWidth) |
|
631 |
width:w |
|
632 |
height:(barWidth + barWidth). |
|
295 | 633 |
|
397 | 634 |
handleStyle == #line ifTrue:[ |
635 |
self paint:handleColor. |
|
636 |
self displayLineFromX:x y:hy - barWidth toX:x y:hy + barWidth. |
|
637 |
] ifFalse:[ |
|
638 |
x := hx. |
|
639 |
handleStyle == #st80 ifTrue:[ |
|
640 |
x := x - 1. |
|
641 |
]. |
|
642 |
self drawEdgesForX:(x + m) |
|
643 |
y:(hy - barWidth) |
|
644 |
width:w |
|
645 |
height:(barWidth + barWidth) |
|
646 |
level:handleLevel. |
|
647 |
handleStyle == #iris ifTrue:[ |
|
648 |
self paint:handleColor. |
|
649 |
self fillDeviceRectangleX:(x + m + 2) |
|
650 |
y:(hy - barWidth + 2) |
|
651 |
width:w - 4 |
|
652 |
height:(barWidth + barWidth - 4) |
|
653 |
]. |
|
654 |
] |
|
655 |
] ifFalse:[ |
|
656 |
x := hx. |
|
657 |
self drawHandleFormAtX:(x + m) y:hy |
|
658 |
]. |
|
659 |
handleStyle == #st80 ifTrue:[ |
|
660 |
x := hx - 1. |
|
661 |
self paint:lightColor. |
|
662 |
self displayLineFromX:x y:margin toX:x y:(height - margin). |
|
663 |
self displayLineFromX:hx y:0 toX:(hx + barHeight - 1) y:0. |
|
664 |
x := hx + barHeight - 2. |
|
665 |
self paint:shadowColor. |
|
666 |
self displayLineFromX:x y:margin toX:x y:(height - margin). |
|
667 |
"uncomment the -1 if you dont like the notch at the bottom end" |
|
668 |
" VVV" |
|
669 |
self displayLineFromX:hx" "-1" " y:height-1 toX:(hx + barHeight - 1) y:height-1. |
|
670 |
]. |
|
671 |
] ifFalse:[ |
|
672 |
x := hx + barHeight - 1. |
|
673 |
self paint:handleColor. |
|
674 |
separatingLine ifTrue:[ |
|
675 |
self displayLineFromX:hx+1 y:0 toX:hx+1 y:height. |
|
676 |
self displayLineFromX:x y:0 toX:x y:height. |
|
677 |
]. |
|
678 |
self fillRectangleX:hx y:hy width:barHeight height:barWidth |
|
679 |
] |
|
295 | 680 |
]. |
681 |
||
396
973d4a9fa32c
setting handleStyle to nil disables handleDrawing
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
682 |
"Modified: 24.2.1996 / 19:05:52 / cg" |
295 | 683 |
! |
684 |
||
685 |
drawHandleFormAtX:hx y:hy |
|
686 |
"draw a handles bitmap at hx/hy" |
|
687 |
||
688 |
self paint:shadowColor. |
|
689 |
self displayForm:shadowForm x:hx y:hy. |
|
690 |
self paint:lightColor. |
|
691 |
self displayForm:lightForm x:hx y:hy. |
|
692 |
self paint:viewBackground |
|
693 |
! |
|
694 |
||
695 |
invertHandleBarAtX:hx y:hy |
|
696 |
self noClipByChildren. |
|
697 |
self xoring:[ |
|
698 |
|y x| |
|
699 |
||
700 |
orientation == #vertical ifTrue:[ |
|
701 |
trackLine ifTrue:[ |
|
702 |
y := hy + (barHeight // 2). |
|
703 |
self displayLineFromX:0 y:y toX:width y:y. |
|
704 |
] ifFalse:[ |
|
705 |
self fillRectangleX:0 y:hy width:width height:barHeight |
|
706 |
] |
|
707 |
] ifFalse:[ |
|
708 |
trackLine ifTrue:[ |
|
709 |
x := hx + (barHeight // 2). |
|
710 |
self displayLineFromX:x y:0 toX:x y:height. |
|
711 |
] ifFalse:[ |
|
712 |
self fillRectangleX:hx y:0 width:barHeight height:height |
|
713 |
] |
|
714 |
] |
|
715 |
]. |
|
716 |
self clipByChildren. |
|
717 |
! |
|
718 |
||
719 |
lockRedraw |
|
720 |
redrawLocked := true |
|
721 |
! |
|
722 |
||
723 |
redraw |
|
724 |
"redraw all of the handles" |
|
725 |
||
726 |
redrawLocked ~~ true ifTrue:[ |
|
727 |
self redrawHandlesFrom:1 to:(subViews size) |
|
728 |
] |
|
729 |
! |
|
730 |
||
731 |
redrawHandlesFrom:start to:stop |
|
732 |
"redraw some handles" |
|
733 |
||
734 |
subViews notNil ifTrue:[ |
|
735 |
showHandle ifTrue:[ |
|
736 |
self handleOriginsFrom:start to:stop do:[:hPoint | |
|
737 |
self drawHandleAtX:(hPoint x) y:(hPoint y) |
|
738 |
]. |
|
739 |
] |
|
740 |
] |
|
741 |
! |
|
742 |
||
743 |
unlockRedraw |
|
744 |
redrawLocked := false |
|
745 |
! ! |
|
746 |
||
747 |
!VariablePanel methodsFor:'event handling'! |
|
748 |
||
749 |
sizeChanged:how |
|
750 |
"my size has changed; resize my subviews" |
|
751 |
||
752 |
shown ifTrue:[ |
|
753 |
(how == #smaller) ifTrue:[ |
|
754 |
self resizeSubviews |
|
755 |
] ifFalse:[ |
|
756 |
"/ |
|
757 |
"/ do it in reverse order, to avoid some redraws |
|
758 |
"/ |
|
759 |
self resizeSubviewsFrom:(subViews size) to:1 |
|
760 |
] |
|
761 |
]. |
|
762 |
self changed:#sizeOfView with:how. |
|
763 |
! ! |
|
764 |
||
765 |
!VariablePanel methodsFor:'initializing'! |
|
766 |
||
767 |
defaultControllerClass |
|
768 |
^ VariablePanelController |
|
769 |
! |
|
770 |
||
771 |
fixSize |
|
772 |
extentChanged ifTrue:[ |
|
773 |
super fixSize. |
|
774 |
self resizeSubviews |
|
775 |
] ifFalse:[ |
|
776 |
super fixSize |
|
777 |
] |
|
778 |
! |
|
779 |
||
780 |
initCursor |
|
781 |
"set the cursor - a double arrow" |
|
782 |
||
783 |
orientation == #vertical ifTrue:[ |
|
784 |
DefaultVCursor notNil ifTrue:[ |
|
785 |
cursor := DefaultVCursor |
|
786 |
] ifFalse:[ |
|
787 |
cursor := Cursor sourceForm:(Form fromFile:'VVPanel.xbm') |
|
788 |
maskForm:(Form fromFile:'VVPanel_m.xbm') |
|
789 |
hotX:8 |
|
790 |
hotY:8. |
|
791 |
" |
|
792 |
if bitmaps are not available, use a standard cursor |
|
793 |
" |
|
794 |
cursor isNil ifTrue:[ |
|
795 |
"which one looks better ?" |
|
796 |
cursor := Cursor upDownArrow |
|
797 |
"cursor := Cursor upLimitArrow" |
|
798 |
]. |
|
799 |
DefaultVCursor := cursor |
|
800 |
] |
|
801 |
] ifFalse:[ |
|
802 |
DefaultHCursor notNil ifTrue:[ |
|
803 |
cursor := DefaultHCursor |
|
804 |
] ifFalse:[ |
|
805 |
cursor := Cursor sourceForm:(Form fromFile:'VHPanel.xbm') |
|
806 |
maskForm:(Form fromFile:'VHPanel_m.xbm') |
|
807 |
hotX:8 |
|
808 |
hotY:8. |
|
809 |
" |
|
810 |
if bitmaps are not available, use a standard cursor |
|
811 |
" |
|
812 |
cursor isNil ifTrue:[ |
|
813 |
"which one looks better ?" |
|
814 |
cursor := Cursor leftRightArrow |
|
815 |
"cursor := Cursor leftLimitArrow" |
|
816 |
]. |
|
817 |
DefaultHCursor := cursor |
|
818 |
] |
|
819 |
] |
|
820 |
! |
|
821 |
||
822 |
initStyle |
|
823 |
|mm| |
|
824 |
||
825 |
super initStyle. |
|
826 |
||
827 |
handleColor := DefaultHandleColor on:device. |
|
828 |
handleLevel := DefaultHandleLevel. |
|
829 |
||
830 |
showHandle := DefaultShowHandle. |
|
831 |
||
832 |
DefaultHandleStyle isNil ifTrue:[ |
|
833 |
handleStyle := styleSheet name |
|
834 |
] ifFalse:[ |
|
835 |
handleStyle := DefaultHandleStyle |
|
836 |
]. |
|
837 |
handleStyle == #next ifTrue:[ |
|
838 |
shadowForm := self class shadowFormOn:device. |
|
839 |
lightForm := self class lightFormOn:device. |
|
840 |
||
841 |
self barHeight:(shadowForm height + 2). |
|
842 |
barWidth := shadowForm width. |
|
843 |
] ifFalse:[ |
|
844 |
shadowForm := lightForm := nil. |
|
845 |
]. |
|
846 |
||
847 |
handlePosition := DefaultHandlePosition. |
|
848 |
trackLine := DefaultTrackingLine. |
|
849 |
separatingLine := DefaultSeparatingLine. |
|
850 |
||
851 |
mm := device verticalPixelPerMillimeter. |
|
852 |
self is3D ifTrue:[ |
|
853 |
self barHeight:(3 * mm) rounded |
|
854 |
] ifFalse:[ |
|
855 |
self barHeight:(2 * mm) rounded |
|
856 |
]. |
|
857 |
barWidth := (2 * mm) rounded. "motif style width" |
|
858 |
handleStyle == #mswindows ifTrue:[ |
|
859 |
barWidth := (ArrowButton new direction:#up) width + 1 |
|
860 |
]. |
|
861 |
! |
|
862 |
||
863 |
initialize |
|
864 |
super initialize. |
|
865 |
orientation := #vertical. |
|
866 |
noColor := Color noColor. |
|
867 |
! ! |
|
868 |
||
869 |
!VariablePanel methodsFor:'private'! |
|
870 |
||
871 |
anyNonRelativeSubviews |
|
872 |
"return true, if any of my subviews has no relative origin/extent" |
|
873 |
||
874 |
1 to:(subViews size) do:[:index | |
|
875 |
|view| |
|
876 |
||
877 |
view := subViews at:index. |
|
878 |
view relativeCorner isNil ifTrue:[^ true]. |
|
879 |
view relativeOrigin isNil ifTrue:[^ true] |
|
880 |
]. |
|
881 |
^ false |
|
882 |
! |
|
883 |
||
884 |
handleOriginsDo:aBlock |
|
885 |
"evaluate the argument block for every handle-origin" |
|
886 |
||
887 |
self handleOriginsFrom:1 to:(subViews size) do:aBlock |
|
888 |
! |
|
889 |
||
890 |
handleOriginsFrom:start to:stop do:aBlock |
|
891 |
"evaluate the argument block for some handle-origins" |
|
892 |
||
893 |
|x y hw hh hDelta vDelta |
|
894 |
first "{ Class: SmallInteger }" |
|
895 |
last "{ Class: SmallInteger }"| |
|
896 |
||
897 |
subViews notNil ifTrue:[ |
|
898 |
shadowForm notNil ifTrue:[ |
|
899 |
hw := shadowForm width. |
|
900 |
hh := shadowForm height. |
|
901 |
] ifFalse:[ |
|
902 |
hw := hh := barWidth |
|
903 |
]. |
|
904 |
||
905 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[ |
|
906 |
hDelta := barWidth // 2. |
|
907 |
vDelta := barWidth // 2. |
|
908 |
] ifFalse:[ |
|
909 |
hDelta := vDelta := 0 |
|
910 |
]. |
|
911 |
||
912 |
(handlePosition == #left) ifTrue:[ |
|
913 |
x := hDelta. |
|
914 |
y := vDelta |
|
915 |
] ifFalse:[ |
|
916 |
(handlePosition == #right) ifTrue:[ |
|
917 |
x := width - hw - margin - hDelta. |
|
918 |
y := height - hh - margin - vDelta. |
|
919 |
] ifFalse:[ |
|
920 |
x := width - barWidth // 2. |
|
921 |
y := height - barWidth // 2 |
|
922 |
] |
|
923 |
]. |
|
924 |
first := start + 1. |
|
925 |
last := stop. |
|
926 |
first to:last do:[:index | |
|
927 |
|view| |
|
928 |
||
929 |
view := subViews at:index. |
|
930 |
orientation == #vertical ifTrue:[ |
|
931 |
y := view top "origin y" - barHeight + 1. |
|
932 |
] ifFalse:[ |
|
933 |
x := view left "origin x" - barHeight + 1. |
|
934 |
]. |
|
935 |
aBlock value:(x @ y) |
|
936 |
] |
|
937 |
] |
|
938 |
! |
|
939 |
||
940 |
resizeSubviews |
|
941 |
"readjust size of some subviews" |
|
942 |
||
943 |
self resizeSubviewsFrom:1 to:(subViews size) |
|
944 |
! |
|
945 |
||
946 |
resizeSubviewsFrom:start to:stop |
|
947 |
"readjust size of some subviews" |
|
948 |
||
949 |
|step nSubviews| |
|
950 |
||
951 |
subViews notNil ifTrue:[ |
|
952 |
(start <= stop) ifTrue:[ |
|
953 |
step := 1 |
|
954 |
] ifFalse:[ |
|
955 |
step := -1 |
|
956 |
]. |
|
957 |
nSubviews := subViews size. |
|
958 |
start to:stop by:step do:[:index | |
|
959 |
|bw view o1 o2 relOrg relCorner newOrg newCorner newExt| |
|
960 |
||
961 |
view := subViews at:index. |
|
962 |
bw := view borderWidth. |
|
963 |
||
964 |
index == 1 ifTrue:[ |
|
965 |
o1 := 0. |
|
966 |
] ifFalse:[ |
|
967 |
o1 := barHeight // 2 - bw |
|
968 |
]. |
|
969 |
index == nSubviews ifTrue:[ |
|
970 |
o2 := 0. |
|
971 |
] ifFalse:[ |
|
972 |
o2 := barHeight // 2 - bw |
|
973 |
]. |
|
974 |
||
975 |
" |
|
976 |
relCorner := view relativeCorner. |
|
977 |
relCorner isNil ifTrue:[ |
|
978 |
self error:'subview must have relative corner' |
|
979 |
]. |
|
980 |
newCorner := view cornerFromRelativeCorner. |
|
981 |
newCorner notNil ifTrue:[ |
|
982 |
newCorner y:(newCorner y - o2) |
|
983 |
]. |
|
984 |
||
985 |
relOrg := view relativeOrigin. |
|
986 |
relOrg isNil ifTrue:[ |
|
987 |
self error:'subview must have relative origin' |
|
988 |
]. |
|
989 |
newOrg := view originFromRelativeOrigin. |
|
990 |
newOrg notNil ifTrue:[ |
|
991 |
(index ~~ 1) ifTrue:[ |
|
992 |
newOrg y:(newOrg y + o1) |
|
993 |
]. |
|
994 |
]. |
|
995 |
view pixelOrigin:newOrg corner:newCorner |
|
996 |
" |
|
997 |
newOrg := view computeOrigin. |
|
998 |
newOrg notNil ifTrue:[ |
|
999 |
(index ~~ 1) ifTrue:[ |
|
1000 |
orientation == #vertical ifTrue:[ |
|
1001 |
newOrg y:(newOrg y + o1) |
|
1002 |
] ifFalse:[ |
|
1003 |
newOrg x:(newOrg x + o1) |
|
1004 |
] |
|
1005 |
]. |
|
1006 |
]. |
|
1007 |
newExt := view computeExtent. |
|
1008 |
newExt notNil ifTrue:[ |
|
1009 |
orientation == #vertical ifTrue:[ |
|
1010 |
newExt y:(newExt y - o2 - o1) |
|
1011 |
] ifFalse:[ |
|
1012 |
newExt x:(newExt x - o2 - o1) |
|
1013 |
] |
|
1014 |
]. |
|
1015 |
view pixelOrigin:newOrg extent:newExt. |
|
1016 |
] |
|
1017 |
] |
|
1018 |
! |
|
1019 |
||
1020 |
setupSubviews |
|
1021 |
"setup subviews sizes (in case of non-relative sizes)" |
|
1022 |
||
1023 |
|pos delta| |
|
1024 |
||
300 | 1025 |
"/ setup all subviews to spread evenly ... |
295 | 1026 |
|
300 | 1027 |
pos := 0.0. |
1028 |
delta := 1.0 / (subViews size). |
|
295 | 1029 |
|
300 | 1030 |
1 to:(subViews size) do:[:index | |
1031 |
|view| |
|
295 | 1032 |
|
300 | 1033 |
view := subViews at:index. |
1034 |
orientation == #vertical ifTrue:[ |
|
1035 |
index == subViews size ifTrue:[ |
|
1036 |
view origin:(0.0 @ pos) corner:(1.0 @ 1.0) |
|
295 | 1037 |
] ifFalse:[ |
300 | 1038 |
view origin:(0.0 @ pos) corner:(1.0 @ (pos + delta)) |
295 | 1039 |
]. |
300 | 1040 |
] ifFalse:[ |
1041 |
index == subViews size ifTrue:[ |
|
1042 |
view origin:(pos @ 0.0) corner:(1.0 @ 1.0) |
|
1043 |
] ifFalse:[ |
|
1044 |
view origin:(pos @ 0.0) corner:((pos + delta) @ 1.0) |
|
1045 |
]. |
|
1046 |
]. |
|
1047 |
pos := pos + delta |
|
295 | 1048 |
] |
1049 |
! ! |
|
1050 |
||
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1051 |
!VariablePanel methodsFor:'private tableView protocol'! |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1052 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1053 |
setupSubviewOrigins |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1054 |
"setup subviews origins (SV 16.1.95)" |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1055 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1056 |
|x y e eX eY n "{ Class: SmallInteger }"| |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1057 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1058 |
x := y := 0.0. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1059 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1060 |
n := subViews size. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1061 |
1 to:n do:[:index | |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1062 |
|view| |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1063 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1064 |
view := subViews at:index. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1065 |
e := view relativeExtent. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1066 |
e notNil ifTrue:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1067 |
view relativeExtent:nil. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1068 |
eX := e x. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1069 |
eY := e y. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1070 |
index == n ifTrue:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1071 |
view origin:(x @ y) corner:(1.0 @ 1.0) |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1072 |
] ifFalse:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1073 |
orientation == #vertical ifTrue:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1074 |
view origin:(x @ y) corner:(1.0 @ (y+eY)) |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1075 |
] ifFalse:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1076 |
view origin:(x @ y) corner:((x+eX) @ 1.0) |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1077 |
]. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1078 |
]. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1079 |
orientation == #vertical ifTrue:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1080 |
y := y + eY. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1081 |
] ifFalse:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1082 |
x := x + eX. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1083 |
] |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1084 |
] ifFalse: [ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1085 |
view origin:(x @ y). |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1086 |
orientation == #vertical ifTrue:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1087 |
y := view relativeCorner y. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1088 |
] ifFalse:[ |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1089 |
x := view relativeCorner x. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1090 |
] |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1091 |
]. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1092 |
] |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1093 |
! ! |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1094 |
|
295 | 1095 |
!VariablePanel class methodsFor:'documentation'! |
1096 |
||
1097 |
version |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
1098 |
^ '$Header: /cvs/stx/stx/libwidg/VariablePanel.st,v 1.7 1996-03-01 13:02:46 cg Exp $' |
295 | 1099 |
! ! |