author | Claus Gittinger <cg@exept.de> |
Wed, 19 Mar 1997 10:27:14 +0100 | |
changeset 1130 | 3c9a9961d225 |
parent 1129 | 17a77892f180 |
child 1131 | 98922cb07e5b |
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 |
871 | 16 |
trackLine redrawLocked orientation handleLabels knobHeight' |
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 |
||
871 | 24 |
!VariablePanel class methodsFor:'documentation'! |
295 | 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 |
||
496 | 57 |
p := VariablePanel in:superView. |
58 |
p orientation:#vertical. |
|
295 | 59 |
|
496 | 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 |
The two subclasses VariableHorizontalPanel and VariableVerticalPanel |
|
71 |
preset the orientation. They are a kept for backward compatibility |
|
72 |
(in previous versions, there used to be no common VariablePanel (super-) class). |
|
295 | 73 |
|
74 |
Notice: if it is required to insert a fixed-size view in the panel, |
|
75 |
use an extra view & insets, and place the subview into that extra view. |
|
76 |
||
77 |
see examples. |
|
496 | 78 |
|
585 | 79 |
[instance Variables:] |
496 | 80 |
|
81 |
barHeight <Integer> the height of the bar (for verticalPanels) |
|
82 |
barWidth <Integer> the width of the bar (for horizontalPanels) |
|
83 |
||
84 |
separatingLine <Boolean> show a separating line (as in motif style) |
|
85 |
||
86 |
shadowForm <Image/Form> form (shadow part) drawn as handle - if nonNil |
|
87 |
||
88 |
lightForm <Image/Form> form (light part) drawn as handle - if nonNil |
|
89 |
||
90 |
showHandle <Boolean> if false, no handle is drawn |
|
91 |
||
92 |
handlePosition <Symbol> where is the handle - one of #left, #center, #right |
|
93 |
||
94 |
handleColor <Color> inside color of handle - defaults to viewBackground |
|
95 |
||
96 |
handleStyle <Symbol> type of handle; one of #next, #motif or nil |
|
97 |
||
98 |
handleLevel <Integer> 3D level of handle (only valid if no form is given) |
|
99 |
||
100 |
trackLine <Boolean> if true, an inverted line is drawn for tracking; |
|
101 |
otherwise, the whole bar is inverted. |
|
102 |
||
103 |
redrawLocked internal - locks redraws while tracking |
|
104 |
||
105 |
orientation <Symbol> one of #horizontal / #vertical |
|
106 |
||
107 |
||
585 | 108 |
[styleSheet values:] |
496 | 109 |
variablePanelShowHandle true/false - should a handle be shown (default:true) |
110 |
||
1096 | 111 |
variablePanelHandleStyle #next / #motif / #iris / #full nil (special handles) |
496 | 112 |
|
113 |
variablePanelHandlePosition #left / #center / #right (default:#right) |
|
114 |
||
115 |
variablePanelHandleLevel 3D level of heandle (default:2) |
|
116 |
||
117 |
variablePanelTrackingLine when moved, track an inverted line (as in motif) |
|
118 |
as opposed to tracking the whole bar (default:false) |
|
119 |
||
120 |
variablePanelSeparatingLine draw a separating line in the bar as in motif (default:false) |
|
121 |
||
122 |
variablePanelHandleColor color of the handle. (default:Black) |
|
123 |
||
124 |
variablePanelHandleEnteredColor color of the handle when the pointer is in the bar (default:nil) |
|
585 | 125 |
|
126 |
[see also:] |
|
127 |
PanelView |
|
128 |
||
129 |
[author:] |
|
130 |
Claus Gittinger |
|
295 | 131 |
" |
132 |
! |
|
133 |
||
134 |
examples |
|
135 |
" |
|
874 | 136 |
example (notice that the subviews MUST have relative bounds): |
593 | 137 |
[exBegin] |
138 |
|top p v1 v2 v3| |
|
295 | 139 |
|
593 | 140 |
top := StandardSystemView new. |
141 |
top extent:300@300. |
|
295 | 142 |
|
593 | 143 |
p := VariablePanel |
144 |
origin:0.0 @ 0.0 |
|
145 |
corner:1.0 @ 1.0 |
|
146 |
in:top. |
|
147 |
p orientation:#vertical. |
|
295 | 148 |
|
593 | 149 |
v1 := View origin:0.0@0.0 corner:1.0@(1/2) in:p. |
150 |
v2 := View origin:0.0@(1/2) corner:1.0@(2/3) in:p. |
|
151 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
295 | 152 |
|
593 | 153 |
v1 viewBackground:(Color red). |
154 |
v2 viewBackground:(Color green). |
|
155 |
v3 viewBackground:(Color yellow). |
|
295 | 156 |
|
593 | 157 |
top open |
158 |
[exEnd] |
|
295 | 159 |
|
160 |
||
161 |
||
876 | 162 |
change the handles level: |
593 | 163 |
[exBegin] |
164 |
|top p v1 v2 v3| |
|
295 | 165 |
|
593 | 166 |
top := StandardSystemView new. |
167 |
top extent:300@300. |
|
295 | 168 |
|
593 | 169 |
p := VariablePanel |
170 |
origin:0.0 @ 0.0 |
|
171 |
corner:1.0 @ 1.0 |
|
172 |
in:top. |
|
173 |
p orientation:#vertical. |
|
174 |
p handleLevel:-1. |
|
295 | 175 |
|
593 | 176 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
177 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
178 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
295 | 179 |
|
593 | 180 |
v1 viewBackground:(Color red). |
181 |
v2 viewBackground:(Color green). |
|
182 |
v3 viewBackground:(Color yellow). |
|
295 | 183 |
|
593 | 184 |
top open |
185 |
[exEnd] |
|
295 | 186 |
|
187 |
||
188 |
||
876 | 189 |
change the handles style to nil makes it invisible: |
593 | 190 |
[exBegin] |
191 |
|top p v1 v2 v3| |
|
397 | 192 |
|
593 | 193 |
top := StandardSystemView new. |
194 |
top extent:300@300. |
|
397 | 195 |
|
593 | 196 |
p := VariablePanel |
197 |
origin:0.0 @ 0.0 |
|
198 |
corner:1.0 @ 1.0 |
|
199 |
in:top. |
|
200 |
p orientation:#vertical. |
|
201 |
p handleStyle:nil. |
|
397 | 202 |
|
593 | 203 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
204 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
205 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
397 | 206 |
|
593 | 207 |
v1 viewBackground:(Color red). |
208 |
v2 viewBackground:(Color green). |
|
209 |
v3 viewBackground:(Color yellow). |
|
397 | 210 |
|
593 | 211 |
top open |
212 |
[exEnd] |
|
397 | 213 |
|
214 |
||
215 |
||
876 | 216 |
define your own handle (-bitmap): |
217 |
[exBegin] |
|
218 |
|top p v1 v2 v3| |
|
219 |
||
220 |
top := StandardSystemView new. |
|
221 |
top extent:300@300. |
|
222 |
||
223 |
p := VariablePanel |
|
224 |
origin:0.0 @ 0.0 |
|
225 |
corner:1.0 @ 1.0 |
|
226 |
in:top. |
|
227 |
p orientation:#vertical. |
|
228 |
p handleImage:(Image fromFile:'bitmaps/ScrollLt.8.xbm'). |
|
229 |
||
230 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
|
231 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
232 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
233 |
||
234 |
v1 viewBackground:(Color red). |
|
235 |
v2 viewBackground:(Color green). |
|
236 |
v3 viewBackground:(Color yellow). |
|
237 |
||
238 |
top open |
|
239 |
[exEnd] |
|
240 |
||
241 |
||
242 |
||
243 |
another handle-bitmap: |
|
244 |
[exBegin] |
|
245 |
|top p v1 v2 v3| |
|
246 |
||
247 |
top := StandardSystemView new. |
|
248 |
top extent:300@300. |
|
249 |
||
250 |
p := VariablePanel |
|
251 |
origin:0.0 @ 0.0 |
|
252 |
corner:1.0 @ 1.0 |
|
253 |
in:top. |
|
254 |
p orientation:#vertical. |
|
255 |
p handleImage:(Form width:9 |
|
256 |
height:11 |
|
257 |
fromArray:#( |
|
258 |
2r00000000 2r00000000 |
|
259 |
2r00001000 2r00000000 |
|
260 |
2r00011100 2r00000000 |
|
261 |
2r00111110 2r00000000 |
|
262 |
2r01111111 2r00000000 |
|
263 |
2r00000000 2r00000000 |
|
264 |
2r01111111 2r00000000 |
|
265 |
2r00111110 2r00000000 |
|
266 |
2r00011100 2r00000000 |
|
267 |
2r00001000 2r00000000 |
|
268 |
2r00000000 2r00000000 |
|
269 |
) |
|
270 |
). |
|
271 |
||
272 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
|
273 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
274 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
275 |
||
276 |
v1 viewBackground:(Color red). |
|
277 |
v2 viewBackground:(Color green). |
|
278 |
v3 viewBackground:(Color yellow). |
|
279 |
||
280 |
top open |
|
281 |
[exEnd] |
|
282 |
||
283 |
placing scrolled and unscrolled views into a variablePanel: |
|
593 | 284 |
[exBegin] |
285 |
|top p v1 v2 v3| |
|
295 | 286 |
|
593 | 287 |
top := StandardSystemView new. |
288 |
top extent:300@300. |
|
295 | 289 |
|
593 | 290 |
p := VariablePanel |
291 |
origin:0.0 @ 0.0 |
|
292 |
corner:1.0 @ 1.0 |
|
293 |
in:top. |
|
294 |
p orientation:#vertical. |
|
295 | 295 |
|
593 | 296 |
v1 := ScrollableView for:SelectionInListView in:p. |
297 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
298 |
v1 list:(FileDirectory directoryNamed:'/etc') contents. |
|
299 |
v1 action:[:selNr | |
|
300 |
|fullName stream text| |
|
301 |
fullName := '/etc/' , v1 selectionValue. |
|
302 |
stream := fullName asFilename readStream. |
|
303 |
stream notNil ifTrue:[ |
|
304 |
text := stream contents. |
|
305 |
v2 contents:text. |
|
306 |
v3 contents:text |
|
307 |
] |
|
308 |
]. |
|
295 | 309 |
|
593 | 310 |
v2 := TextView origin:0.0 @ 0.5 corner:1.0 @ 0.8 in:p. |
295 | 311 |
|
593 | 312 |
v3 := ScrollableView for:TextView in:p. |
313 |
v3 origin:0.0 @ 0.8 corner:1.0 @ 1.0. |
|
314 |
top open |
|
315 |
[exEnd] |
|
295 | 316 |
|
317 |
||
876 | 318 |
dynamically adding/removing views: |
593 | 319 |
[exBegin] |
320 |
|top p v1 v2 b| |
|
295 | 321 |
|
593 | 322 |
top := StandardSystemView new. |
323 |
top extent:300@300. |
|
295 | 324 |
|
593 | 325 |
b := Toggle label:'show' in:top. |
326 |
b showLamp:false. |
|
327 |
b origin:0.0 @ 0.0 corner:(1.0 @ 40). |
|
328 |
b action:[:state | |
|
329 |
state ifTrue:[ |
|
330 |
b label:'hide'. |
|
331 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
332 |
v2 := ScrollableView for:EditTextView. |
|
333 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
334 |
v2 contents:'another text'. |
|
335 |
p addSubView:v2. |
|
336 |
v2 realize. |
|
337 |
] ifFalse:[ |
|
338 |
b label:'show'. |
|
339 |
v2 destroy. |
|
340 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0 |
|
341 |
] |
|
342 |
]. |
|
295 | 343 |
|
593 | 344 |
p := VariablePanel |
345 |
origin:0.0 @ 0.0 |
|
346 |
corner:1.0 @ 1.0 |
|
347 |
in:top. |
|
348 |
p orientation:#vertical. |
|
349 |
p topInset:50. |
|
295 | 350 |
|
593 | 351 |
v1 := ScrollableView for:EditTextView in:p. |
352 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
353 |
v1 contents:'some text'. |
|
295 | 354 |
|
593 | 355 |
top open |
356 |
[exEnd] |
|
295 | 357 |
|
358 |
||
876 | 359 |
dynamically flipping orientation: |
295 | 360 |
Notice: you have to change the relative bounds of the subviews first. |
593 | 361 |
[exBegin] |
362 |
|top p v1 v2 b| |
|
295 | 363 |
|
593 | 364 |
top := StandardSystemView new. |
365 |
top extent:300@300. |
|
295 | 366 |
|
593 | 367 |
b := Toggle label:'flip' in:top. |
368 |
b showLamp:false. |
|
369 |
b origin:0.0 @ 0.0 corner:(1.0 @ 40). |
|
370 |
b action:[:state | |
|
371 |
state ifTrue:[ |
|
372 |
v1 origin:0.0 @ 0.0 corner:0.5 @ 1.0. |
|
373 |
v2 origin:0.5 @ 0.0 corner:1.0 @ 1.0. |
|
374 |
p orientation:#horizontal. |
|
375 |
] ifFalse:[ |
|
376 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
377 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
378 |
p orientation:#vertical. |
|
379 |
]. |
|
380 |
]. |
|
295 | 381 |
|
593 | 382 |
p := VariablePanel |
383 |
origin:0.0 @ 0.0 |
|
384 |
corner:1.0 @ 1.0 |
|
385 |
in:top. |
|
386 |
p orientation:#vertical. |
|
387 |
p topInset:50. |
|
295 | 388 |
|
593 | 389 |
v1 := ScrollableView for:EditTextView in:p. |
390 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
391 |
v1 contents:'some text'. |
|
295 | 392 |
|
593 | 393 |
v2 := ScrollableView for:EditTextView in:p. |
394 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
395 |
v2 contents:'another text'. |
|
295 | 396 |
|
593 | 397 |
top open |
398 |
[exEnd] |
|
295 | 399 |
|
400 |
||
876 | 401 |
combining fix-size with variable size: |
295 | 402 |
(need 3 extra frame-views to place the extra labels into) |
593 | 403 |
[exBegin] |
404 |
|top p v1 l1 v2 l2 v3 l3 f1 f2 f3| |
|
295 | 405 |
|
593 | 406 |
top := StandardSystemView new. |
407 |
top extent:300@300. |
|
295 | 408 |
|
593 | 409 |
p := VariablePanel |
410 |
origin:0.0 @ 0.0 |
|
411 |
corner:1.0 @ 1.0 |
|
412 |
in:top. |
|
295 | 413 |
|
874 | 414 |
p orientation:#vertical. |
415 |
||
416 |
f1 := View origin:0.0@0.0 corner:1.0@0.3 in:p. |
|
417 |
f2 := View origin:0.0@0.3 corner:1.0@0.6 in:p. |
|
418 |
f3 := View origin:0.0@0.6 corner:1.0@1.0 in:p. |
|
295 | 419 |
|
593 | 420 |
v1 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f1. |
421 |
v2 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f2. |
|
422 |
v3 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f3. |
|
295 | 423 |
|
593 | 424 |
l1 := Label label:'sub1' in:f1. |
425 |
l2 := Label label:'sub2' in:f2. |
|
426 |
l3 := Label label:'sub3' in:f3. |
|
295 | 427 |
|
593 | 428 |
l1 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
429 |
bottomInset:(l1 preferredExtent y negated). |
|
430 |
l2 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
|
431 |
bottomInset:(l2 preferredExtent y negated). |
|
432 |
l3 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
|
433 |
bottomInset:(l3 preferredExtent y negated). |
|
295 | 434 |
|
593 | 435 |
v1 topInset:(l1 preferredExtent y); level:-1. |
436 |
v2 topInset:(l2 preferredExtent y); level:-1. |
|
437 |
v3 topInset:(l3 preferredExtent y); level:-1. |
|
295 | 438 |
|
593 | 439 |
v1 viewBackground:(Color red). |
440 |
v2 viewBackground:(Color green). |
|
441 |
v3 viewBackground:(Color yellow). |
|
295 | 442 |
|
874 | 443 |
top open |
444 |
[exEnd] |
|
445 |
||
446 |
VerticalPansels allow a label to be associated with the |
|
447 |
handles; this looks much like the above, but is slightly |
|
448 |
more compact. Notice, no label can be placed above the first |
|
449 |
view - it has no handle. |
|
450 |
[exBegin] |
|
451 |
|top p v1 v2 v3| |
|
452 |
||
453 |
top := StandardSystemView new. |
|
454 |
top extent:300@300. |
|
455 |
||
456 |
p := VariablePanel |
|
457 |
origin:0.0 @ 0.0 |
|
458 |
corner:1.0 @ 1.0 |
|
459 |
in:top. |
|
460 |
||
593 | 461 |
p orientation:#vertical. |
874 | 462 |
p handleLabels:#('ignored' 'sub2' 'sub3'). |
463 |
||
464 |
v1 := View origin:0.0@0.0 corner:1.0@0.3 in:p. |
|
465 |
v2 := View origin:0.0@0.3 corner:1.0@0.6 in:p. |
|
466 |
v3 := View origin:0.0@0.6 corner:1.0@1.0 in:p. |
|
467 |
||
468 |
v1 viewBackground:(Color red). |
|
469 |
v2 viewBackground:(Color green). |
|
470 |
v3 viewBackground:(Color yellow). |
|
471 |
||
593 | 472 |
top open |
473 |
[exEnd] |
|
295 | 474 |
|
874 | 475 |
handle labels can be more than strings .... |
476 |
(however, they should have about the same height, since |
|
477 |
the largest defines heights of all bars; |
|
478 |
retry the example below with a larger bitmap image ...) |
|
479 |
[exBegin] |
|
480 |
|top e p v1 v2 v3| |
|
481 |
||
482 |
top := StandardSystemView new. |
|
483 |
top extent:300@300. |
|
484 |
||
485 |
p := VariablePanel |
|
486 |
origin:0.0 @ 0.0 |
|
487 |
corner:1.0 @ 1.0 |
|
488 |
in:top. |
|
489 |
||
490 |
p orientation:#vertical. |
|
491 |
e := Array with:#bold |
|
492 |
with:#color->Color red. |
|
493 |
||
494 |
p handleLabels:(Array with:nil |
|
495 |
with:('bold and red' asText emphasizeAllWith:e) |
|
496 |
with:(Image fromFile:'ScrollRt.xbm')). |
|
497 |
||
498 |
v1 := View origin:0.0@0.0 corner:1.0@0.3 in:p. |
|
499 |
v2 := View origin:0.0@0.3 corner:1.0@0.6 in:p. |
|
500 |
v3 := View origin:0.0@0.6 corner:1.0@1.0 in:p. |
|
501 |
||
502 |
v1 viewBackground:(Color red). |
|
503 |
v2 viewBackground:(Color green). |
|
504 |
v3 viewBackground:(Color yellow). |
|
505 |
||
506 |
top open |
|
507 |
[exEnd] |
|
508 |
||
509 |
||
295 | 510 |
|
511 |
BAD EXAMPLE (wrong relative sizes - repaired on handle move): |
|
593 | 512 |
[exBegin] |
513 |
|top p v1 v2 v3| |
|
295 | 514 |
|
593 | 515 |
top := StandardSystemView new. |
516 |
top extent:300@300. |
|
295 | 517 |
|
593 | 518 |
p := VariablePanel |
519 |
origin:0.0 @ 0.0 |
|
520 |
corner:1.0 @ 1.0 |
|
521 |
in:top. |
|
522 |
p orientation:#vertical. |
|
295 | 523 |
|
593 | 524 |
v1 := View origin:0.0 @ 0.0 corner:1.0 @ (1/4) in:p. |
525 |
v2 := View origin:0.0 @ (1/2) corner:1.0 @ (3/4) in:p. |
|
526 |
v3 := View origin:0.0 @ (3/4) corner:1.0 @ 1.0 in:p. |
|
295 | 527 |
|
593 | 528 |
v1 viewBackground:(Color red). |
529 |
v2 viewBackground:(Color green). |
|
530 |
v3 viewBackground:(Color yellow). |
|
295 | 531 |
|
593 | 532 |
top open |
533 |
[exEnd] |
|
295 | 534 |
" |
535 |
! ! |
|
536 |
||
871 | 537 |
!VariablePanel class methodsFor:'defaults'! |
295 | 538 |
|
539 |
lightFormOn:aDisplay |
|
540 |
"use same handle as Scroller" |
|
541 |
||
542 |
^ Scroller handleLightFormOn:aDisplay |
|
543 |
! |
|
544 |
||
545 |
shadowFormOn:aDisplay |
|
546 |
"use same handle as Scroller" |
|
547 |
||
548 |
^ Scroller handleShadowFormOn:aDisplay |
|
549 |
! |
|
550 |
||
551 |
updateStyleCache |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
552 |
"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
|
553 |
|
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
554 |
<resource: #style (#variablePanelShowHandle #variablePanelHandleStyle |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
555 |
#variablePanelHandlePosition #variablePanelHandleLevel |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
556 |
#variablePanelTrackingLine #variablePanelTrackingStyle |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
557 |
#variablePanelSeparatingLine #variablePanelHandleColor)> |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
558 |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
559 |
|lineModeBoolean| |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
560 |
|
295 | 561 |
DefaultShowHandle := StyleSheet at:'variablePanelShowHandle' default:true. |
562 |
DefaultHandleStyle := StyleSheet at:'variablePanelHandleStyle'. |
|
563 |
DefaultHandlePosition := StyleSheet at:'variablePanelHandlePosition' default:#right. |
|
564 |
DefaultHandleLevel := StyleSheet at:'variablePanelHandleLevel' default:2. |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
565 |
DefaultTrackingLine := StyleSheet at:'variablePanelTrackingStyle' default:nil. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
566 |
DefaultTrackingLine isNil ifTrue:[ |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
567 |
lineModeBoolean := StyleSheet at:'variablePanelTrackingLine' default:false. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
568 |
lineModeBoolean ifTrue:[ |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
569 |
DefaultTrackingLine := #solidLine |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
570 |
] ifFalse:[ |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
571 |
DefaultTrackingLine := #solidRectangle |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
572 |
] |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
573 |
]. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
574 |
|
295 | 575 |
DefaultSeparatingLine := StyleSheet at:'variablePanelSeparatingLine' default:false. |
576 |
DefaultHandleColor := StyleSheet colorAt:'variablePanelHandleColor' default:Black. |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
577 |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
578 |
" |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
579 |
VariablePanel updateStyleCache |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
580 |
" |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
581 |
|
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
582 |
"Modified: 18.3.1997 / 17:16:10 / cg" |
295 | 583 |
! ! |
584 |
||
585 |
!VariablePanel methodsFor:'accessing'! |
|
586 |
||
587 |
addSubView:aView |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
588 |
"a view is added; adjust other subviews sizes" |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
589 |
|
295 | 590 |
super addSubView:aView. |
1043 | 591 |
|
592 |
"/ (aView relativeOrigin isNil |
|
593 |
"/ or:[aView relativeExtent isNil and:[aView relativeCorner isNil]]) ifTrue:[ |
|
594 |
"/ aView geometryLayout:nil. |
|
595 |
"/ aView origin:0.0@0.0. |
|
596 |
"/ aView extent:1.0@0.5. |
|
597 |
"/ self setupSubviews |
|
598 |
"/ ]. |
|
599 |
||
295 | 600 |
realized ifTrue:[ |
1043 | 601 |
self resizeSubviews. |
295 | 602 |
] |
603 |
||
604 |
"Created: 17.1.1996 / 22:41:00 / cg" |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
605 |
"Modified: 24.2.1996 / 19:05:05 / cg" |
295 | 606 |
! |
607 |
||
608 |
orientation |
|
485 | 609 |
"return my orientation; either #horizontal or #vertical" |
610 |
||
295 | 611 |
^ orientation |
485 | 612 |
|
613 |
"Modified: 6.3.1996 / 18:08:45 / cg" |
|
295 | 614 |
! |
615 |
||
616 |
orientation:aSymbol |
|
485 | 617 |
"change my orientation; aSymbol must be one of #horizontal or #vertical. |
618 |
Changing implies a resize of my subViews." |
|
619 |
||
620 |
aSymbol ~~ orientation ifTrue:[ |
|
621 |
orientation := aSymbol. |
|
622 |
self initCursor. |
|
623 |
self anyNonRelativeSubviews ifTrue:[ |
|
624 |
self setupSubviews |
|
625 |
]. |
|
626 |
shown ifTrue:[ |
|
627 |
self cursor:cursor. |
|
628 |
self sizeChanged:nil. |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
629 |
self invalidate. |
485 | 630 |
] |
295 | 631 |
] |
485 | 632 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
633 |
"Modified: 29.5.1996 / 16:22:35 / cg" |
295 | 634 |
! |
635 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
636 |
removeSubView:aView |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
637 |
"a view is removed; adjust other subviews sizes" |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
638 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
639 |
super removeSubView:aView. |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
640 |
shown ifTrue:[ |
1043 | 641 |
(superView isNil or:[superView shown]) ifTrue:[ |
642 |
self setupSubviews. |
|
643 |
self resizeSubviews. |
|
644 |
] |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
645 |
] |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
646 |
! ! |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
647 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
648 |
!VariablePanel methodsFor:'accessing-look'! |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
649 |
|
295 | 650 |
barHeight |
651 |
"return the height of the separating bar" |
|
652 |
||
653 |
^ barHeight |
|
654 |
! |
|
655 |
||
656 |
barHeight:nPixel |
|
657 |
"set the height of the separating bar" |
|
658 |
||
659 |
barHeight := nPixel. |
|
660 |
||
661 |
"if screen is very low-res, make certain bar is visible and catchable" |
|
662 |
(barHeight < 4) ifTrue:[ |
|
876 | 663 |
barHeight := 4 |
295 | 664 |
]. |
665 |
||
876 | 666 |
"make it even, so spacing is equally spreadable among subviews" |
295 | 667 |
barHeight odd ifTrue:[ |
876 | 668 |
barHeight := barHeight + 1 |
295 | 669 |
] |
876 | 670 |
|
671 |
"Modified: 7.11.1996 / 20:07:11 / cg" |
|
672 |
! |
|
673 |
||
674 |
handleImage:aBitmapOrImage |
|
675 |
"define the handles image" |
|
676 |
||
677 |
shadowForm := aBitmapOrImage. |
|
678 |
lightForm := nil. |
|
679 |
self computeBarHeight. |
|
680 |
||
681 |
"Created: 7.11.1996 / 20:21:10 / cg" |
|
682 |
"Modified: 7.11.1996 / 20:27:22 / cg" |
|
295 | 683 |
! |
684 |
||
871 | 685 |
handleLabels:aCollectionOfLabels |
686 |
orientation == #horizontal ifTrue:[ |
|
687 |
self error:'not allowed for horizontal panels' |
|
688 |
]. |
|
689 |
||
690 |
handleLabels := aCollectionOfLabels. |
|
691 |
self computeBarHeight. |
|
692 |
self resizeSubviews. |
|
693 |
||
694 |
! |
|
695 |
||
295 | 696 |
handleLevel:aNumber |
697 |
"define the 3D level of the handle (only with some styles). |
|
698 |
Normally, this is defined via styleSheet files, but this entry allows |
|
699 |
individual views to be manipulated." |
|
700 |
||
701 |
handleLevel := aNumber |
|
702 |
! |
|
703 |
||
704 |
handlePosition |
|
705 |
"return the position of the handle" |
|
706 |
||
707 |
^ handlePosition |
|
708 |
! |
|
709 |
||
710 |
handlePosition:aSymbol |
|
711 |
"define the position of the handle; the argument aSymbol |
|
712 |
may be one of #left, #right or #center" |
|
713 |
||
714 |
handlePosition := aSymbol |
|
715 |
! |
|
716 |
||
876 | 717 |
handleShadowImage:shadowImage lightImage:lightImage |
718 |
"define the handles image; both shadow and light parts" |
|
719 |
||
720 |
shadowForm := shadowImage. |
|
721 |
lightForm := lightImage. |
|
722 |
self computeBarHeight. |
|
723 |
||
724 |
"Created: 7.11.1996 / 20:21:51 / cg" |
|
725 |
"Modified: 7.11.1996 / 20:27:26 / cg" |
|
726 |
! |
|
727 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
728 |
handleStyle:styleSymbol |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
729 |
"define the style of the handle; |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
730 |
styleSymbol may be #motif to draw a little knob or |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
731 |
anything else to draw scrollBars handleForm. |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
732 |
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
|
733 |
individual views to be manipulated." |
295 | 734 |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
735 |
(styleSymbol ~~ handleStyle) ifTrue:[ |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
736 |
handleStyle := styleSymbol. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
737 |
handleStyle == #next ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
738 |
shadowForm := self class shadowFormOn:device. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
739 |
lightForm := self class lightFormOn:device. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
740 |
] ifFalse:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
741 |
shadowForm := lightForm := nil |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
742 |
]. |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
743 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
744 |
shadowForm notNil ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
745 |
(self is3D and:[handleStyle ~~ #motif]) ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
746 |
self barHeight:(shadowForm height + 2). |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
747 |
barWidth := shadowForm width |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
748 |
] |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
749 |
]. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
750 |
shown ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
751 |
self resizeSubviews. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
752 |
self invalidate |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
753 |
] |
295 | 754 |
] |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
755 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
756 |
"Created: 24.2.1996 / 19:04:07 / cg" |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
757 |
"Modified: 29.5.1996 / 16:22:24 / cg" |
295 | 758 |
! |
759 |
||
760 |
style:styleSymbol |
|
761 |
"define the style of the handle; |
|
762 |
styleSymbol may be #motif to draw a little knob or |
|
763 |
anything else to draw scrollBars handleForm. |
|
764 |
Normally, this is defined via styleSheet files, but this entry allows |
|
765 |
individual views to be manipulated." |
|
766 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
767 |
self handleStyle:styleSymbol |
295 | 768 |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
769 |
"Modified: 24.2.1996 / 19:04:19 / cg" |
295 | 770 |
! ! |
771 |
||
772 |
!VariablePanel methodsFor:'drawing'! |
|
773 |
||
871 | 774 |
drawHandle:hIndex atX:hx y:hy |
295 | 775 |
"draw a single handle at hx/hy" |
776 |
||
1096 | 777 |
|h w x y m lbl maxKnob |
778 |
mar "{ Class: SmallInteger }" |
|
779 |
barWidthInt "{ Class: SmallInteger }" |
|
780 |
barHeightInt "{ Class: SmallInteger }" | |
|
295 | 781 |
|
396
973d4a9fa32c
setting handleStyle to nil disables handleDrawing
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
782 |
handleStyle isNil ifTrue:[^ self]. |
973d4a9fa32c
setting handleStyle to nil disables handleDrawing
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
783 |
|
1096 | 784 |
mar := margin. |
785 |
barHeightInt := barHeight. |
|
786 |
barWidthInt := barWidth. |
|
871 | 787 |
|
295 | 788 |
shadowForm notNil ifTrue:[ |
871 | 789 |
h := shadowForm height. |
790 |
w := shadowForm width . |
|
1096 | 791 |
maxKnob := h min:barHeightInt. |
295 | 792 |
] ifFalse:[ |
1096 | 793 |
maxKnob := knobHeight min: barHeightInt. |
876 | 794 |
maxKnob := maxKnob max:4. |
795 |
w := h := maxKnob - 4. |
|
295 | 796 |
]. |
797 |
||
798 |
self paint:viewBackground. |
|
799 |
orientation == #vertical ifTrue:[ |
|
1096 | 800 |
self fillRectangleX:mar y:hy |
801 |
width:(width - mar - mar) |
|
802 |
height:barHeightInt. |
|
871 | 803 |
|
804 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[ |
|
876 | 805 |
m := (maxKnob - h) // 2. |
871 | 806 |
|
807 |
shadowForm isNil ifTrue:[ |
|
876 | 808 |
|
1096 | 809 |
y := hy + (barHeightInt // 2). "/ center of the bar |
295 | 810 |
|
871 | 811 |
separatingLine ifTrue:[ |
812 |
self paint:shadowColor. |
|
1096 | 813 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
871 | 814 |
y := y + 1. |
815 |
self paint:lightColor. |
|
1096 | 816 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
871 | 817 |
]. |
818 |
self paint:viewBackground. |
|
1096 | 819 |
|
820 |
self fillRectangleX:(hx - barWidthInt) y:hy |
|
821 |
width:(barWidthInt + barWidthInt) |
|
871 | 822 |
height:h. |
295 | 823 |
|
871 | 824 |
handleStyle == #line ifTrue:[ |
825 |
self paint:handleColor. |
|
1096 | 826 |
self displayLineFromX:hx - barWidthInt y:y toX:hx + barWidthInt y:y |
871 | 827 |
] ifFalse:[ |
828 |
y := hy. |
|
829 |
handleStyle == #st80 ifTrue:[ |
|
830 |
y := y - 1 |
|
831 |
]. |
|
876 | 832 |
|
1096 | 833 |
handleStyle == #full ifTrue:[ |
834 |
self drawEdgesForX:0-handleLevel |
|
835 |
y:(y + m) |
|
836 |
width:width+handleLevel+handleLevel |
|
837 |
height:h |
|
838 |
level:handleLevel. |
|
839 |
] ifFalse:[ |
|
840 |
self drawEdgesForX:(hx - barWidthInt) |
|
841 |
y:(y + m) |
|
842 |
width:(barWidthInt + barWidthInt) |
|
843 |
height:h |
|
844 |
level:handleLevel. |
|
295 | 845 |
|
1096 | 846 |
handleStyle == #iris ifTrue:[ |
847 |
self paint:handleColor. |
|
848 |
self fillDeviceRectangleX:(hx - barWidthInt + 2) |
|
849 |
y:(y + m + 2) |
|
850 |
width:(barWidthInt + barWidthInt - 4) |
|
851 |
height:h - 4 |
|
852 |
] |
|
871 | 853 |
] |
854 |
]. |
|
855 |
] ifFalse:[ |
|
856 |
y := hy. |
|
857 |
self drawHandleFormAtX:hx y:(y + m) |
|
858 |
]. |
|
876 | 859 |
|
871 | 860 |
handleStyle == #st80 ifTrue:[ |
861 |
y := hy - 1. |
|
862 |
self paint:lightColor. |
|
1096 | 863 |
self displayLineFromX:mar y:y toX:(width - mar - mar - 1) y:y. |
871 | 864 |
self displayLineFromX:0 y:hy toX:0 y:(hy + knobHeight - 1). |
865 |
y := hy + knobHeight - 2. |
|
866 |
self paint:shadowColor. |
|
1096 | 867 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
871 | 868 |
"uncomment the -1 if you dont like the notch at the right end" |
869 |
" VVV" |
|
1119 | 870 |
self displayLineFromX:width-1 y:hy" "-1" " toX:width-1 y:(hy + knobHeight - 1 - 1). |
871 | 871 |
]. |
872 |
] ifFalse:[ |
|
1096 | 873 |
y := hy + barHeightInt - 1. |
871 | 874 |
self paint:handleColor. |
875 |
separatingLine ifTrue:[ |
|
876 |
self displayLineFromX:0 y:hy+1 toX:width y:hy+1. |
|
877 |
self displayLineFromX:0 y:y toX:width y:y. |
|
878 |
]. |
|
1096 | 879 |
self fillRectangleX:hx y:hy width:barWidthInt height:barHeightInt |
871 | 880 |
]. |
295 | 881 |
|
871 | 882 |
lbl := self handleLabelAt:hIndex. |
883 |
lbl notNil ifTrue:[ |
|
884 |
hIndex ~~ 1 ifTrue:[ |
|
885 |
self paint:Color black. |
|
874 | 886 |
lbl isImageOrForm ifTrue:[ |
1096 | 887 |
lbl displayOn:self x:mar y:hy |
874 | 888 |
] ifFalse:[ |
1096 | 889 |
lbl displayOn:self x:mar y:hy + font ascent + 1 |
874 | 890 |
] |
871 | 891 |
] |
892 |
]. |
|
893 |
||
295 | 894 |
] ifFalse:[ |
1096 | 895 |
self fillRectangleX:hx y:mar |
896 |
width:barHeightInt |
|
897 |
height:(height - mar - mar). |
|
876 | 898 |
|
871 | 899 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[ |
1096 | 900 |
m := (barHeightInt - w) // 2. |
871 | 901 |
shadowForm isNil ifTrue:[ |
1096 | 902 |
x := hx + (barHeightInt // 2). |
871 | 903 |
separatingLine ifTrue:[ |
904 |
self paint:shadowColor. |
|
1096 | 905 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
871 | 906 |
x := x + 1. |
907 |
self paint:lightColor. |
|
1096 | 908 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
871 | 909 |
]. |
910 |
self paint:viewBackground. |
|
1096 | 911 |
self fillRectangleX:hx y:(hy - barWidthInt) |
871 | 912 |
width:w |
1096 | 913 |
height:(barWidthInt + barWidthInt). |
295 | 914 |
|
871 | 915 |
handleStyle == #line ifTrue:[ |
916 |
self paint:handleColor. |
|
1096 | 917 |
self displayLineFromX:x y:hy - barWidthInt toX:x y:hy + barWidthInt. |
871 | 918 |
] ifFalse:[ |
919 |
x := hx. |
|
920 |
handleStyle == #st80 ifTrue:[ |
|
921 |
x := x - 1. |
|
922 |
]. |
|
1096 | 923 |
handleStyle == #full ifTrue:[ |
924 |
self drawEdgesForX:(x + m) |
|
925 |
y:0-handleLevel |
|
926 |
width:w |
|
927 |
height:height+handleLevel+handleLevel |
|
928 |
level:handleLevel. |
|
929 |
] ifFalse:[ |
|
930 |
self drawEdgesForX:(x + m) |
|
931 |
y:(hy - barWidthInt) |
|
932 |
width:w |
|
933 |
height:(barWidthInt + barWidthInt) |
|
934 |
level:handleLevel. |
|
935 |
handleStyle == #iris ifTrue:[ |
|
936 |
self paint:handleColor. |
|
937 |
self fillDeviceRectangleX:(x + m + 2) |
|
938 |
y:(hy - barWidthInt + 2) |
|
939 |
width:w - 4 |
|
940 |
height:(barWidthInt + barWidthInt - 4) |
|
941 |
]. |
|
871 | 942 |
]. |
943 |
] |
|
944 |
] ifFalse:[ |
|
945 |
x := hx. |
|
946 |
self drawHandleFormAtX:(x + m) y:hy |
|
947 |
]. |
|
948 |
handleStyle == #st80 ifTrue:[ |
|
949 |
x := hx - 1. |
|
950 |
self paint:lightColor. |
|
1096 | 951 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
952 |
self displayLineFromX:hx y:0 toX:(hx + barHeightInt - 1) y:0. |
|
953 |
x := hx + barHeightInt - 2. |
|
871 | 954 |
self paint:shadowColor. |
1096 | 955 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
871 | 956 |
"uncomment the -1 if you dont like the notch at the bottom end" |
957 |
" VVV" |
|
1096 | 958 |
self displayLineFromX:hx" "-1" " y:height-1 toX:(hx + barHeightInt - 1) y:height-1. |
871 | 959 |
]. |
960 |
] ifFalse:[ |
|
1096 | 961 |
x := hx + barHeightInt - 1. |
871 | 962 |
self paint:handleColor. |
963 |
separatingLine ifTrue:[ |
|
964 |
self displayLineFromX:hx+1 y:0 toX:hx+1 y:height. |
|
965 |
self displayLineFromX:x y:0 toX:x y:height. |
|
966 |
]. |
|
1096 | 967 |
self fillRectangleX:hx y:hy width:barHeightInt height:barWidthInt |
871 | 968 |
] |
295 | 969 |
]. |
970 |
||
1119 | 971 |
"Modified: 7.3.1997 / 15:40:02 / cg" |
295 | 972 |
! |
973 |
||
974 |
drawHandleFormAtX:hx y:hy |
|
975 |
"draw a handles bitmap at hx/hy" |
|
976 |
||
876 | 977 |
shadowForm notNil ifTrue:[ |
978 |
self paint:shadowColor. |
|
979 |
self displayForm:shadowForm x:hx y:hy. |
|
980 |
]. |
|
981 |
lightForm notNil ifTrue:[ |
|
982 |
self paint:lightColor. |
|
983 |
self displayForm:lightForm x:hx y:hy. |
|
984 |
]. |
|
295 | 985 |
self paint:viewBackground |
876 | 986 |
|
987 |
"Modified: 7.11.1996 / 20:25:33 / cg" |
|
295 | 988 |
! |
989 |
||
990 |
invertHandleBarAtX:hx y:hy |
|
991 |
self noClipByChildren. |
|
992 |
self xoring:[ |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
993 |
|yL xL halfHeight| |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
994 |
|
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
995 |
halfHeight := barHeight // 2. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
996 |
yL := hy + halfHeight. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
997 |
xL := hx + halfHeight. |
295 | 998 |
|
1130 | 999 |
trackLine == #dashedLine ifTrue:[ |
1000 |
self lineStyle:#dashed. |
|
1001 |
]. |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1002 |
orientation == #vertical ifTrue:[ |
1130 | 1003 |
(trackLine == #solidLine |
1004 |
or:[trackLine == #dashedLine]) ifTrue:[ |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1005 |
self displayLineFromX:0 y:yL toX:width y:yL. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1006 |
] ifFalse:[ |
1130 | 1007 |
self fillRectangleX:0 y:hy width:width height:barHeight |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1008 |
] |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1009 |
] ifFalse:[ |
1130 | 1010 |
(trackLine == #solidLine |
1011 |
or:[trackLine == #dashedLine]) ifTrue:[ |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1012 |
self displayLineFromX:xL y:0 toX:xL y:height. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1013 |
] ifFalse:[ |
1130 | 1014 |
self fillRectangleX:hx y:0 width:barHeight height:height |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1015 |
] |
1130 | 1016 |
]. |
1017 |
trackLine == #dashedLine ifTrue:[ |
|
1018 |
self lineStyle:#solid. |
|
1019 |
]. |
|
295 | 1020 |
]. |
1021 |
self clipByChildren. |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1022 |
|
1130 | 1023 |
"Modified: 19.3.1997 / 10:26:55 / cg" |
295 | 1024 |
! |
1025 |
||
1026 |
lockRedraw |
|
1027 |
redrawLocked := true |
|
1028 |
! |
|
1029 |
||
1030 |
redraw |
|
1031 |
"redraw all of the handles" |
|
1032 |
||
1033 |
redrawLocked ~~ true ifTrue:[ |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1034 |
self redrawHandlesFrom:1 to:(self subViews size) |
295 | 1035 |
] |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1036 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1037 |
"Modified: 28.1.1997 / 17:54:15 / cg" |
295 | 1038 |
! |
1039 |
||
1040 |
redrawHandlesFrom:start to:stop |
|
1041 |
"redraw some handles" |
|
1042 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1043 |
(self subViews size > 0) ifTrue:[ |
871 | 1044 |
showHandle ifTrue:[ |
1045 |
self handleOriginsWithIndexFrom:start to:stop do:[:hPoint :hIndex | |
|
1046 |
self drawHandle:hIndex atX:(hPoint x) y:(hPoint y) |
|
1047 |
]. |
|
1048 |
] |
|
295 | 1049 |
] |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1050 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1051 |
"Modified: 28.1.1997 / 17:54:33 / cg" |
295 | 1052 |
! |
1053 |
||
1054 |
unlockRedraw |
|
1055 |
redrawLocked := false |
|
1056 |
! ! |
|
1057 |
||
1058 |
!VariablePanel methodsFor:'event handling'! |
|
1059 |
||
1060 |
sizeChanged:how |
|
1061 |
"my size has changed; resize my subviews" |
|
1062 |
||
1063 |
shown ifTrue:[ |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1064 |
(how == #smaller) ifTrue:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1065 |
self resizeSubviews |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1066 |
] ifFalse:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1067 |
"/ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1068 |
"/ do it in reverse order, to avoid some redraws |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1069 |
"/ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1070 |
self resizeSubviewsFrom:(self subViews size) to:1 |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1071 |
] |
295 | 1072 |
]. |
1073 |
self changed:#sizeOfView with:how. |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1074 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1075 |
"Modified: 28.1.1997 / 17:56:30 / cg" |
295 | 1076 |
! ! |
1077 |
||
1078 |
!VariablePanel methodsFor:'initializing'! |
|
1079 |
||
871 | 1080 |
computeBarHeight |
958 | 1081 |
"compute the height if the separating bar from either the |
1082 |
form or an explicit height given in the styleSheet" |
|
1083 |
||
924
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1084 |
<resource: #style (#variablePanelBarHeight)> |
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1085 |
|
871 | 1086 |
|bH h| |
1087 |
||
876 | 1088 |
shadowForm notNil ifTrue:[ |
871 | 1089 |
bH := shadowForm height + 2. |
1090 |
] ifFalse:[ |
|
1091 |
self is3D ifTrue:[ |
|
1092 |
h := 3 |
|
1093 |
] ifFalse:[ |
|
1094 |
h := 2 |
|
1095 |
]. |
|
924
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1096 |
bH := styleSheet at:#variablePanelBarHeight. |
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1097 |
bH isNil ifTrue:[ |
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1098 |
bH := (h * device verticalPixelPerMillimeter) rounded. |
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1099 |
]. |
871 | 1100 |
]. |
876 | 1101 |
self barHeight:bH. |
871 | 1102 |
knobHeight := bH. |
1103 |
||
1104 |
handleLabels notNil ifTrue:[ |
|
1105 |
font := font on:device. |
|
1106 |
bH := handleLabels inject:bH into:[:maxSoFar :thisLabel | |
|
874 | 1107 |
thisLabel isNil ifTrue:[ |
1108 |
maxSoFar |
|
1109 |
] ifFalse:[ |
|
1110 |
maxSoFar max:(thisLabel heightOn:self) |
|
1111 |
] |
|
1112 |
]. |
|
871 | 1113 |
bH := bH + font descent - 1 |
1114 |
]. |
|
1115 |
||
1116 |
self barHeight:bH. |
|
1117 |
||
958 | 1118 |
"Modified: 17.1.1997 / 23:20:40 / cg" |
871 | 1119 |
! |
1120 |
||
295 | 1121 |
defaultControllerClass |
1122 |
^ VariablePanelController |
|
1123 |
! |
|
1124 |
||
1125 |
fixSize |
|
1126 |
extentChanged ifTrue:[ |
|
1127 |
super fixSize. |
|
1128 |
self resizeSubviews |
|
1129 |
] ifFalse:[ |
|
1130 |
super fixSize |
|
1131 |
] |
|
1132 |
! |
|
1133 |
||
1134 |
initCursor |
|
1135 |
"set the cursor - a double arrow" |
|
1136 |
||
1137 |
orientation == #vertical ifTrue:[ |
|
900 | 1138 |
DefaultVCursor notNil ifTrue:[ |
1139 |
cursor := DefaultVCursor |
|
1140 |
] ifFalse:[ |
|
1141 |
cursor := Cursor |
|
1142 |
sourceForm:(Image fromFile:'bitmaps/VVPanel.xbm') |
|
1143 |
maskForm:(Image fromFile:'bitmaps/VVPanel_m.xbm') |
|
1144 |
hotX:8 |
|
1145 |
hotY:8. |
|
1146 |
" |
|
1147 |
if bitmaps are not available, use a standard cursor |
|
1148 |
" |
|
1149 |
cursor isNil ifTrue:[ |
|
1150 |
"which one looks better ?" |
|
1151 |
cursor := Cursor upDownArrow |
|
1152 |
"cursor := Cursor upLimitArrow" |
|
1153 |
]. |
|
1154 |
DefaultVCursor := cursor |
|
1155 |
] |
|
295 | 1156 |
] ifFalse:[ |
900 | 1157 |
DefaultHCursor notNil ifTrue:[ |
1158 |
cursor := DefaultHCursor |
|
1159 |
] ifFalse:[ |
|
1160 |
cursor := Cursor |
|
1161 |
sourceForm:(Image fromFile:'bitmaps/VHPanel.xbm') |
|
1162 |
maskForm:(Image fromFile:'bitmaps/VHPanel_m.xbm') |
|
1163 |
hotX:8 |
|
1164 |
hotY:8. |
|
1165 |
" |
|
1166 |
if bitmaps are not available, use a standard cursor |
|
1167 |
" |
|
1168 |
cursor isNil ifTrue:[ |
|
1169 |
"which one looks better ?" |
|
1170 |
cursor := Cursor leftRightArrow |
|
1171 |
"cursor := Cursor leftLimitArrow" |
|
1172 |
]. |
|
1173 |
DefaultHCursor := cursor |
|
1174 |
] |
|
295 | 1175 |
] |
900 | 1176 |
|
1177 |
"Modified: 19.12.1996 / 13:50:18 / cg" |
|
295 | 1178 |
! |
1179 |
||
1180 |
initStyle |
|
966 | 1181 |
"setup viewStyle specifics" |
1182 |
||
871 | 1183 |
|mm| |
295 | 1184 |
|
1185 |
super initStyle. |
|
1186 |
||
1187 |
handleColor := DefaultHandleColor on:device. |
|
1188 |
||
1189 |
DefaultHandleStyle isNil ifTrue:[ |
|
496 | 1190 |
handleStyle := styleSheet name |
295 | 1191 |
] ifFalse:[ |
496 | 1192 |
handleStyle := DefaultHandleStyle |
295 | 1193 |
]. |
1194 |
||
496 | 1195 |
handleLevel := DefaultHandleLevel. |
1196 |
showHandle := DefaultShowHandle. |
|
295 | 1197 |
handlePosition := DefaultHandlePosition. |
1198 |
trackLine := DefaultTrackingLine. |
|
1199 |
separatingLine := DefaultSeparatingLine. |
|
1200 |
||
496 | 1201 |
handleStyle == #next ifTrue:[ |
1202 |
shadowForm := self class shadowFormOn:device. |
|
1203 |
lightForm := self class lightFormOn:device. |
|
1204 |
||
1205 |
barWidth := shadowForm width. |
|
295 | 1206 |
] ifFalse:[ |
496 | 1207 |
shadowForm := lightForm := nil. |
1208 |
||
1209 |
mm := device verticalPixelPerMillimeter. |
|
1210 |
barWidth := (2 * mm) rounded. "motif style width" |
|
295 | 1211 |
]. |
871 | 1212 |
self computeBarHeight. |
496 | 1213 |
|
295 | 1214 |
handleStyle == #mswindows ifTrue:[ |
496 | 1215 |
barWidth := (ArrowButton new direction:#up) width + 1 |
295 | 1216 |
]. |
496 | 1217 |
|
966 | 1218 |
"Modified: 22.1.1997 / 11:57:58 / cg" |
295 | 1219 |
! |
1220 |
||
1221 |
initialize |
|
496 | 1222 |
orientation isNil ifTrue:[orientation := #vertical]. |
295 | 1223 |
super initialize. |
496 | 1224 |
|
1225 |
"Modified: 7.3.1996 / 14:08:25 / cg" |
|
295 | 1226 |
! ! |
1227 |
||
1228 |
!VariablePanel methodsFor:'private'! |
|
1229 |
||
1230 |
anyNonRelativeSubviews |
|
1231 |
"return true, if any of my subviews has no relative origin/extent" |
|
1232 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1233 |
self subViews do:[:aComponent | |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1234 |
aComponent relativeCorner isNil ifTrue:[^ true]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1235 |
aComponent relativeOrigin isNil ifTrue:[^ true] |
295 | 1236 |
]. |
1237 |
^ false |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1238 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1239 |
"Modified: 28.1.1997 / 17:57:26 / cg" |
295 | 1240 |
! |
1241 |
||
871 | 1242 |
handleLabelAt:hIndex |
1243 |
handleLabels notNil ifTrue:[ |
|
1244 |
^ handleLabels at:hIndex ifAbsent:nil |
|
1245 |
]. |
|
1246 |
^ nil |
|
1247 |
! |
|
1248 |
||
1249 |
handleOriginsWithIndexDo:aBlock |
|
295 | 1250 |
"evaluate the argument block for every handle-origin" |
1251 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1252 |
self handleOriginsWithIndexFrom:1 to:(self subViews size) do:aBlock |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1253 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1254 |
"Modified: 28.1.1997 / 17:53:44 / cg" |
295 | 1255 |
! |
1256 |
||
871 | 1257 |
handleOriginsWithIndexFrom:start to:stop do:aBlock |
295 | 1258 |
"evaluate the argument block for some handle-origins" |
1259 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1260 |
|x y hw hh hDelta vDelta subViews |
295 | 1261 |
first "{ Class: SmallInteger }" |
1262 |
last "{ Class: SmallInteger }"| |
|
1263 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1264 |
(subViews := self subViews) notNil ifTrue:[ |
871 | 1265 |
shadowForm notNil ifTrue:[ |
1266 |
hw := shadowForm width. |
|
1267 |
hh := shadowForm height. |
|
1268 |
] ifFalse:[ |
|
1269 |
hw := hh := barWidth |
|
1270 |
]. |
|
295 | 1271 |
|
871 | 1272 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[ |
1273 |
hDelta := barWidth // 2. |
|
1274 |
vDelta := barWidth // 2. |
|
1275 |
] ifFalse:[ |
|
1276 |
hDelta := vDelta := 0 |
|
1277 |
]. |
|
295 | 1278 |
|
871 | 1279 |
(handlePosition == #left) ifTrue:[ |
1280 |
x := hDelta. |
|
1281 |
y := vDelta |
|
1282 |
] ifFalse:[ |
|
1283 |
(handlePosition == #right) ifTrue:[ |
|
1284 |
x := width - hw - margin - hDelta. |
|
1285 |
y := height - hh - margin - vDelta. |
|
1286 |
] ifFalse:[ |
|
1287 |
x := width - barWidth // 2. |
|
1288 |
y := height - barWidth // 2 |
|
1289 |
] |
|
1290 |
]. |
|
1291 |
first := start + 1. |
|
1292 |
last := stop. |
|
1293 |
first to:last do:[:index | |
|
1294 |
|view| |
|
295 | 1295 |
|
871 | 1296 |
view := subViews at:index. |
1297 |
orientation == #vertical ifTrue:[ |
|
1298 |
y := view top "origin y" - barHeight + 1. |
|
1299 |
] ifFalse:[ |
|
1300 |
x := view left "origin x" - barHeight + 1. |
|
1301 |
]. |
|
1302 |
aBlock value:(x @ y) value:index |
|
1303 |
] |
|
295 | 1304 |
] |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1305 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1306 |
"Modified: 28.1.1997 / 17:54:07 / cg" |
295 | 1307 |
! |
1308 |
||
1309 |
resizeSubviews |
|
1310 |
"readjust size of some subviews" |
|
1311 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1312 |
self resizeSubviewsFrom:1 to:(self subViews size) |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1313 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1314 |
"Modified: 28.1.1997 / 17:54:42 / cg" |
295 | 1315 |
! |
1316 |
||
1317 |
resizeSubviewsFrom:start to:stop |
|
1318 |
"readjust size of some subviews" |
|
1319 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1320 |
|step nSubviews subViews| |
295 | 1321 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1322 |
(subViews := self subViews) size > 0 ifTrue:[ |
871 | 1323 |
(start <= stop) ifTrue:[ |
1324 |
step := 1 |
|
1325 |
] ifFalse:[ |
|
1326 |
step := -1 |
|
1327 |
]. |
|
1328 |
nSubviews := subViews size. |
|
1329 |
start to:stop by:step do:[:index | |
|
1330 |
|bw view o1 o2 relOrg relCorner newOrg newCorner newExt| |
|
295 | 1331 |
|
871 | 1332 |
view := subViews at:index. |
1333 |
bw := view borderWidth. |
|
295 | 1334 |
|
871 | 1335 |
index == 1 ifTrue:[ |
1336 |
o1 := 0. |
|
1337 |
] ifFalse:[ |
|
1338 |
o1 := barHeight // 2 - bw |
|
1339 |
]. |
|
1340 |
index == nSubviews ifTrue:[ |
|
1341 |
o2 := 0. |
|
1342 |
] ifFalse:[ |
|
1343 |
o2 := barHeight // 2 - bw |
|
1344 |
]. |
|
295 | 1345 |
|
1346 |
" |
|
871 | 1347 |
relCorner := view relativeCorner. |
1348 |
relCorner isNil ifTrue:[ |
|
1349 |
self error:'subview must have relative corner' |
|
1350 |
]. |
|
1351 |
newCorner := view cornerFromRelativeCorner. |
|
1352 |
newCorner notNil ifTrue:[ |
|
1353 |
newCorner y:(newCorner y - o2) |
|
1354 |
]. |
|
295 | 1355 |
|
871 | 1356 |
relOrg := view relativeOrigin. |
1357 |
relOrg isNil ifTrue:[ |
|
1358 |
self error:'subview must have relative origin' |
|
1359 |
]. |
|
1360 |
newOrg := view originFromRelativeOrigin. |
|
1361 |
newOrg notNil ifTrue:[ |
|
1362 |
(index ~~ 1) ifTrue:[ |
|
1363 |
newOrg y:(newOrg y + o1) |
|
1364 |
]. |
|
1365 |
]. |
|
1366 |
view pixelOrigin:newOrg corner:newCorner |
|
295 | 1367 |
" |
871 | 1368 |
newOrg := view computeOrigin. |
1369 |
newOrg notNil ifTrue:[ |
|
1370 |
(index ~~ 1) ifTrue:[ |
|
1371 |
orientation == #vertical ifTrue:[ |
|
1372 |
newOrg y:(newOrg y + o1) |
|
1373 |
] ifFalse:[ |
|
1374 |
newOrg x:(newOrg x + o1) |
|
1375 |
] |
|
1376 |
]. |
|
1377 |
]. |
|
1378 |
newExt := view computeExtent. |
|
1379 |
newExt notNil ifTrue:[ |
|
1380 |
orientation == #vertical ifTrue:[ |
|
1381 |
newExt y:(newExt y - o2 - o1) |
|
1382 |
] ifFalse:[ |
|
1383 |
newExt x:(newExt x - o2 - o1) |
|
1384 |
] |
|
1385 |
]. |
|
1386 |
view pixelOrigin:newOrg extent:newExt. |
|
1387 |
] |
|
295 | 1388 |
] |
873 | 1389 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1390 |
"Modified: 28.1.1997 / 17:55:03 / cg" |
295 | 1391 |
! |
1392 |
||
1393 |
setupSubviews |
|
1394 |
"setup subviews sizes (in case of non-relative sizes)" |
|
1395 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1396 |
|pos delta subViews nSubViews "{ Class: SmallInteger }"| |
295 | 1397 |
|
300 | 1398 |
"/ setup all subviews to spread evenly ... |
295 | 1399 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1400 |
subViews := self subViews. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1401 |
nSubViews := subViews size. |
1043 | 1402 |
nSubViews == 0 ifTrue:[^ self]. |
295 | 1403 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1404 |
pos := 0.0. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1405 |
delta := 1.0 / nSubViews. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1406 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1407 |
1 to:nSubViews do:[:index | |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1408 |
|view| |
295 | 1409 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1410 |
view := subViews at:index. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1411 |
orientation == #vertical ifTrue:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1412 |
index == subViews size ifTrue:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1413 |
view origin:(0.0 @ pos) corner:(1.0 @ 1.0) |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1414 |
] ifFalse:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1415 |
view origin:(0.0 @ pos) corner:(1.0 @ (pos + delta)) |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1416 |
]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1417 |
] ifFalse:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1418 |
index == subViews size ifTrue:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1419 |
view origin:(pos @ 0.0) corner:(1.0 @ 1.0) |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1420 |
] ifFalse:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1421 |
view origin:(pos @ 0.0) corner:((pos + delta) @ 1.0) |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1422 |
]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1423 |
]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1424 |
pos := pos + delta |
295 | 1425 |
] |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1426 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1427 |
"Modified: 28.1.1997 / 17:56:20 / cg" |
295 | 1428 |
! ! |
1429 |
||
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1430 |
!VariablePanel methodsFor:'private tableView protocol'! |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1431 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1432 |
setupSubviewOrigins |
826 | 1433 |
"setup subviews origins |
1434 |
if we only have relative extents |
|
1435 |
(Variable Panels need relative origins and corners!!) (SV 16.1.95)" |
|
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1436 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1437 |
|x y e eX eY subViews n "{ Class: SmallInteger }"| |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1438 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1439 |
x := y := 0.0. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1440 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1441 |
subViews := self subViews. |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1442 |
n := subViews size. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1443 |
1 to:n do:[:index | |
826 | 1444 |
|view| |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1445 |
|
826 | 1446 |
view := subViews at:index. |
1447 |
e := view relativeExtent. |
|
1448 |
e notNil ifTrue:[ |
|
1449 |
view relativeExtent:nil. |
|
1450 |
eX := e x. |
|
1451 |
eY := e y. |
|
1452 |
index == n ifTrue:[ |
|
1453 |
view origin:(x @ y) corner:(1.0 @ 1.0) |
|
1454 |
] ifFalse:[ |
|
1455 |
orientation == #vertical ifTrue:[ |
|
1456 |
view origin:(x @ y) corner:(1.0 @ (y+eY)) |
|
1457 |
] ifFalse:[ |
|
1458 |
view origin:(x @ y) corner:((x+eX) @ 1.0) |
|
1459 |
]. |
|
1460 |
]. |
|
1461 |
orientation == #vertical ifTrue:[ |
|
1462 |
y := y + eY. |
|
1463 |
] ifFalse:[ |
|
1464 |
x := x + eX. |
|
1465 |
] |
|
1466 |
] ifFalse: [ |
|
1467 |
view origin:(x @ y). |
|
1468 |
orientation == #vertical ifTrue:[ |
|
1469 |
y := view relativeCorner y. |
|
1470 |
] ifFalse:[ |
|
1471 |
x := view relativeCorner x. |
|
1472 |
] |
|
1473 |
]. |
|
1474 |
] |
|
1475 |
||
1476 |
"Modified: 21.8.1996 / 10:01:29 / stefan" |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1477 |
"Modified: 28.1.1997 / 17:55:21 / cg" |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1478 |
! ! |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
1479 |
|
871 | 1480 |
!VariablePanel class methodsFor:'documentation'! |
295 | 1481 |
|
1482 |
version |
|
1130 | 1483 |
^ '$Header: /cvs/stx/stx/libwidg/Attic/VarPanel.st,v 1.27 1997-03-19 09:27:14 cg Exp $' |
295 | 1484 |
! ! |