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