author | Claus Gittinger <cg@exept.de> |
Mon, 06 Mar 2006 10:00:45 +0100 | |
changeset 3278 | a898d63d521e |
parent 2743 | 65b5445cb984 |
child 3463 | 8408a4c800db |
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 |
||
2179 | 13 |
"{ Package: 'stx:libwidg' }" |
14 |
||
295 | 15 |
SimpleView subclass:#VariablePanel |
2623 | 16 |
instanceVariableNames:'barHeight barWidth barLevel separatingLine shadowForm lightForm |
17 |
showHandle handlePosition handleColor handleStyle handleLevel |
|
18 |
noColor trackLine redrawLocked orientation handleLabels |
|
19 |
knobHeight realRelativeSizes snapAdornment' |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
20 |
classVariableNames:'DefaultShowHandle DefaultHandleStyle DefaultHandlePosition |
295 | 21 |
DefaultTrackingLine DefaultSeparatingLine DefaultHandleColor |
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
22 |
DefaultHandleLevel DefaultVCursor DefaultHCursor |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
23 |
DefaultHandleImage DefaultSnapIcons DefaultSnapHandlePosition' |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
24 |
poolDictionaries:'' |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
25 |
category:'Views-Layout' |
295 | 26 |
! |
27 |
||
871 | 28 |
!VariablePanel class methodsFor:'documentation'! |
295 | 29 |
|
30 |
copyright |
|
31 |
" |
|
32 |
COPYRIGHT (c) 1991 by Claus Gittinger |
|
33 |
All Rights Reserved |
|
34 |
||
35 |
This software is furnished under a license and may be used |
|
36 |
only in accordance with the terms of that license and with the |
|
37 |
inclusion of the above copyright notice. This software may not |
|
38 |
be provided or otherwise made available to, or used by, any |
|
39 |
other person. No title to or ownership of the software is |
|
40 |
hereby transferred. |
|
41 |
" |
|
42 |
! |
|
43 |
||
44 |
documentation |
|
45 |
" |
|
46 |
a View to separate its subviews vertically by a movable bar; |
|
47 |
the size-ratios of the subviews can be changed by moving this bar. |
|
48 |
||
49 |
In order to correctly setup this kind of view, the subviews must |
|
50 |
be created with a relative origin & relative corner. |
|
51 |
The panel does not verify the relative subview bounds; |
|
52 |
therefore, it is your responsibility to set those relative sizes to fit |
|
53 |
according the orientation (see bad example below). |
|
54 |
||
55 |
The bar-handle is either an exposed knob (style == #motif) |
|
56 |
or the form defined in Scroller (style ~~ #motif) |
|
57 |
or nothing. |
|
58 |
||
59 |
Typically creation is done as: |
|
60 |
||
496 | 61 |
p := VariablePanel in:superView. |
62 |
p orientation:#vertical. |
|
295 | 63 |
|
496 | 64 |
v1 := <someViewClass> origin:0.0 @ 0.0 |
65 |
corner:1.0 @ 0.5 |
|
66 |
in:p. |
|
67 |
v2 := <someViewClass> origin:0.0 @ 0.5 |
|
68 |
corner:1.0 @ 0.8 |
|
69 |
in:p. |
|
70 |
v3 := <someViewClass> origin:0.0 @ 0.8 |
|
71 |
corner:1.0 @ 1.0 |
|
72 |
in:p. |
|
73 |
||
74 |
The two subclasses VariableHorizontalPanel and VariableVerticalPanel |
|
75 |
preset the orientation. They are a kept for backward compatibility |
|
76 |
(in previous versions, there used to be no common VariablePanel (super-) class). |
|
295 | 77 |
|
78 |
Notice: if it is required to insert a fixed-size view in the panel, |
|
79 |
use an extra view & insets, and place the subview into that extra view. |
|
1381 | 80 |
See examples. |
496 | 81 |
|
585 | 82 |
[instance Variables:] |
496 | 83 |
|
84 |
barHeight <Integer> the height of the bar (for verticalPanels) |
|
85 |
barWidth <Integer> the width of the bar (for horizontalPanels) |
|
86 |
||
87 |
separatingLine <Boolean> show a separating line (as in motif style) |
|
88 |
||
89 |
shadowForm <Image/Form> form (shadow part) drawn as handle - if nonNil |
|
90 |
||
91 |
lightForm <Image/Form> form (light part) drawn as handle - if nonNil |
|
92 |
||
93 |
showHandle <Boolean> if false, no handle is drawn |
|
94 |
||
95 |
handlePosition <Symbol> where is the handle - one of #left, #center, #right |
|
96 |
||
97 |
handleColor <Color> inside color of handle - defaults to viewBackground |
|
98 |
||
99 |
handleStyle <Symbol> type of handle; one of #next, #motif or nil |
|
100 |
||
101 |
handleLevel <Integer> 3D level of handle (only valid if no form is given) |
|
102 |
||
103 |
trackLine <Boolean> if true, an inverted line is drawn for tracking; |
|
104 |
otherwise, the whole bar is inverted. |
|
105 |
||
106 |
redrawLocked internal - locks redraws while tracking |
|
107 |
||
108 |
orientation <Symbol> one of #horizontal / #vertical |
|
109 |
||
110 |
||
585 | 111 |
[styleSheet values:] |
1381 | 112 |
variablePanel.showHandle true/false - should a handle be shown (default:true) |
496 | 113 |
|
1381 | 114 |
variablePanel.handleStyle #next / #motif / #iris / #full / nil (special handles) |
496 | 115 |
|
1381 | 116 |
variablePanel.handlePosition #left / #center / #right (default:#right) |
496 | 117 |
|
1381 | 118 |
variablePanel.handleLevel 3D level of heandle (default:2) |
496 | 119 |
|
1381 | 120 |
variablePanel.trackingLine when moved, track an inverted line (as in motif) |
496 | 121 |
as opposed to tracking the whole bar (default:false) |
1381 | 122 |
(obsoleted by trackingStyle) |
496 | 123 |
|
1381 | 124 |
variablePanel.trackingStyle #solidRectangle / #solidLine / #dashedLine |
125 |
detailed control over how to draw tracking |
|
126 |
(obsoletes trackingLine above) |
|
496 | 127 |
|
1381 | 128 |
variablePanel.separatingLine draw a separating line in the bar as in motif (default:false) |
496 | 129 |
|
1381 | 130 |
variablePanel.handleColor color of the handle. (default:Black) |
131 |
||
132 |
variablePanel.handleEnteredColor |
|
133 |
color of the handle when the pointer is in the bar (default:nil) |
|
585 | 134 |
|
135 |
[see also:] |
|
136 |
PanelView |
|
137 |
||
138 |
[author:] |
|
139 |
Claus Gittinger |
|
295 | 140 |
" |
141 |
! |
|
142 |
||
143 |
examples |
|
144 |
" |
|
874 | 145 |
example (notice that the subviews MUST have relative bounds): |
593 | 146 |
[exBegin] |
147 |
|top p v1 v2 v3| |
|
295 | 148 |
|
593 | 149 |
top := StandardSystemView new. |
150 |
top extent:300@300. |
|
295 | 151 |
|
593 | 152 |
p := VariablePanel |
153 |
origin:0.0 @ 0.0 |
|
154 |
corner:1.0 @ 1.0 |
|
155 |
in:top. |
|
156 |
p orientation:#vertical. |
|
295 | 157 |
|
593 | 158 |
v1 := View origin:0.0@0.0 corner:1.0@(1/2) in:p. |
159 |
v2 := View origin:0.0@(1/2) corner:1.0@(2/3) in:p. |
|
160 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
295 | 161 |
|
593 | 162 |
v1 viewBackground:(Color red). |
163 |
v2 viewBackground:(Color green). |
|
164 |
v3 viewBackground:(Color yellow). |
|
295 | 165 |
|
593 | 166 |
top open |
167 |
[exEnd] |
|
295 | 168 |
|
169 |
||
170 |
||
876 | 171 |
change the handles level: |
593 | 172 |
[exBegin] |
173 |
|top p v1 v2 v3| |
|
295 | 174 |
|
593 | 175 |
top := StandardSystemView new. |
176 |
top extent:300@300. |
|
295 | 177 |
|
593 | 178 |
p := VariablePanel |
179 |
origin:0.0 @ 0.0 |
|
180 |
corner:1.0 @ 1.0 |
|
181 |
in:top. |
|
182 |
p orientation:#vertical. |
|
183 |
p handleLevel:-1. |
|
295 | 184 |
|
593 | 185 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
186 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
187 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
295 | 188 |
|
593 | 189 |
v1 viewBackground:(Color red). |
190 |
v2 viewBackground:(Color green). |
|
191 |
v3 viewBackground:(Color yellow). |
|
295 | 192 |
|
593 | 193 |
top open |
194 |
[exEnd] |
|
295 | 195 |
|
196 |
||
197 |
||
876 | 198 |
change the handles style to nil makes it invisible: |
593 | 199 |
[exBegin] |
200 |
|top p v1 v2 v3| |
|
397 | 201 |
|
593 | 202 |
top := StandardSystemView new. |
203 |
top extent:300@300. |
|
397 | 204 |
|
593 | 205 |
p := VariablePanel |
206 |
origin:0.0 @ 0.0 |
|
207 |
corner:1.0 @ 1.0 |
|
208 |
in:top. |
|
209 |
p orientation:#vertical. |
|
210 |
p handleStyle:nil. |
|
397 | 211 |
|
593 | 212 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
213 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
214 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
397 | 215 |
|
593 | 216 |
v1 viewBackground:(Color red). |
217 |
v2 viewBackground:(Color green). |
|
218 |
v3 viewBackground:(Color yellow). |
|
397 | 219 |
|
593 | 220 |
top open |
221 |
[exEnd] |
|
397 | 222 |
|
223 |
||
224 |
||
876 | 225 |
define your own handle (-bitmap): |
226 |
[exBegin] |
|
227 |
|top p v1 v2 v3| |
|
228 |
||
229 |
top := StandardSystemView new. |
|
230 |
top extent:300@300. |
|
231 |
||
232 |
p := VariablePanel |
|
233 |
origin:0.0 @ 0.0 |
|
234 |
corner:1.0 @ 1.0 |
|
235 |
in:top. |
|
236 |
p orientation:#vertical. |
|
237 |
p handleImage:(Image fromFile:'bitmaps/ScrollLt.8.xbm'). |
|
238 |
||
239 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
|
240 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
241 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
242 |
||
243 |
v1 viewBackground:(Color red). |
|
244 |
v2 viewBackground:(Color green). |
|
245 |
v3 viewBackground:(Color yellow). |
|
246 |
||
247 |
top open |
|
248 |
[exEnd] |
|
249 |
||
250 |
||
251 |
||
252 |
another handle-bitmap: |
|
253 |
[exBegin] |
|
254 |
|top p v1 v2 v3| |
|
255 |
||
256 |
top := StandardSystemView new. |
|
257 |
top extent:300@300. |
|
258 |
||
259 |
p := VariablePanel |
|
260 |
origin:0.0 @ 0.0 |
|
261 |
corner:1.0 @ 1.0 |
|
262 |
in:top. |
|
263 |
p orientation:#vertical. |
|
264 |
p handleImage:(Form width:9 |
|
265 |
height:11 |
|
266 |
fromArray:#( |
|
267 |
2r00000000 2r00000000 |
|
268 |
2r00001000 2r00000000 |
|
269 |
2r00011100 2r00000000 |
|
270 |
2r00111110 2r00000000 |
|
271 |
2r01111111 2r00000000 |
|
272 |
2r00000000 2r00000000 |
|
273 |
2r01111111 2r00000000 |
|
274 |
2r00111110 2r00000000 |
|
275 |
2r00011100 2r00000000 |
|
276 |
2r00001000 2r00000000 |
|
277 |
2r00000000 2r00000000 |
|
278 |
) |
|
279 |
). |
|
280 |
||
281 |
v1 := View origin:0.0@0.0 corner:1.0@(1/3) in:p. |
|
282 |
v2 := View origin:0.0@(1/3) corner:1.0@(2/3) in:p. |
|
283 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
284 |
||
285 |
v1 viewBackground:(Color red). |
|
286 |
v2 viewBackground:(Color green). |
|
287 |
v3 viewBackground:(Color yellow). |
|
288 |
||
289 |
top open |
|
290 |
[exEnd] |
|
291 |
||
292 |
placing scrolled and unscrolled views into a variablePanel: |
|
593 | 293 |
[exBegin] |
294 |
|top p v1 v2 v3| |
|
295 | 295 |
|
593 | 296 |
top := StandardSystemView new. |
297 |
top extent:300@300. |
|
295 | 298 |
|
593 | 299 |
p := VariablePanel |
300 |
origin:0.0 @ 0.0 |
|
301 |
corner:1.0 @ 1.0 |
|
302 |
in:top. |
|
303 |
p orientation:#vertical. |
|
295 | 304 |
|
593 | 305 |
v1 := ScrollableView for:SelectionInListView in:p. |
306 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
307 |
v1 list:(FileDirectory directoryNamed:'/etc') contents. |
|
308 |
v1 action:[:selNr | |
|
309 |
|fullName stream text| |
|
310 |
fullName := '/etc/' , v1 selectionValue. |
|
311 |
stream := fullName asFilename readStream. |
|
312 |
stream notNil ifTrue:[ |
|
313 |
text := stream contents. |
|
314 |
v2 contents:text. |
|
315 |
v3 contents:text |
|
316 |
] |
|
317 |
]. |
|
295 | 318 |
|
593 | 319 |
v2 := TextView origin:0.0 @ 0.5 corner:1.0 @ 0.8 in:p. |
295 | 320 |
|
593 | 321 |
v3 := ScrollableView for:TextView in:p. |
322 |
v3 origin:0.0 @ 0.8 corner:1.0 @ 1.0. |
|
323 |
top open |
|
324 |
[exEnd] |
|
295 | 325 |
|
326 |
||
876 | 327 |
dynamically adding/removing views: |
593 | 328 |
[exBegin] |
329 |
|top p v1 v2 b| |
|
295 | 330 |
|
593 | 331 |
top := StandardSystemView new. |
332 |
top extent:300@300. |
|
295 | 333 |
|
593 | 334 |
b := Toggle label:'show' in:top. |
335 |
b showLamp:false. |
|
336 |
b origin:0.0 @ 0.0 corner:(1.0 @ 40). |
|
337 |
b action:[:state | |
|
338 |
state ifTrue:[ |
|
339 |
b label:'hide'. |
|
340 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
341 |
v2 := ScrollableView for:EditTextView. |
|
342 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
343 |
v2 contents:'another text'. |
|
344 |
p addSubView:v2. |
|
345 |
v2 realize. |
|
346 |
] ifFalse:[ |
|
347 |
b label:'show'. |
|
348 |
v2 destroy. |
|
349 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0 |
|
350 |
] |
|
351 |
]. |
|
295 | 352 |
|
593 | 353 |
p := VariablePanel |
354 |
origin:0.0 @ 0.0 |
|
355 |
corner:1.0 @ 1.0 |
|
356 |
in:top. |
|
357 |
p orientation:#vertical. |
|
358 |
p topInset:50. |
|
295 | 359 |
|
593 | 360 |
v1 := ScrollableView for:EditTextView in:p. |
361 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
362 |
v1 contents:'some text'. |
|
295 | 363 |
|
593 | 364 |
top open |
365 |
[exEnd] |
|
295 | 366 |
|
367 |
||
876 | 368 |
dynamically flipping orientation: |
295 | 369 |
Notice: you have to change the relative bounds of the subviews first. |
593 | 370 |
[exBegin] |
371 |
|top p v1 v2 b| |
|
295 | 372 |
|
593 | 373 |
top := StandardSystemView new. |
374 |
top extent:300@300. |
|
295 | 375 |
|
593 | 376 |
b := Toggle label:'flip' in:top. |
377 |
b showLamp:false. |
|
378 |
b origin:0.0 @ 0.0 corner:(1.0 @ 40). |
|
379 |
b action:[:state | |
|
380 |
state ifTrue:[ |
|
381 |
v1 origin:0.0 @ 0.0 corner:0.5 @ 1.0. |
|
382 |
v2 origin:0.5 @ 0.0 corner:1.0 @ 1.0. |
|
383 |
p orientation:#horizontal. |
|
384 |
] ifFalse:[ |
|
385 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
386 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
387 |
p orientation:#vertical. |
|
388 |
]. |
|
389 |
]. |
|
295 | 390 |
|
593 | 391 |
p := VariablePanel |
392 |
origin:0.0 @ 0.0 |
|
393 |
corner:1.0 @ 1.0 |
|
394 |
in:top. |
|
395 |
p orientation:#vertical. |
|
396 |
p topInset:50. |
|
295 | 397 |
|
593 | 398 |
v1 := ScrollableView for:EditTextView in:p. |
399 |
v1 origin:0.0 @ 0.0 corner:1.0 @ 0.5. |
|
400 |
v1 contents:'some text'. |
|
295 | 401 |
|
593 | 402 |
v2 := ScrollableView for:EditTextView in:p. |
403 |
v2 origin:0.0 @ 0.5 corner:1.0 @ 1.0. |
|
404 |
v2 contents:'another text'. |
|
295 | 405 |
|
593 | 406 |
top open |
407 |
[exEnd] |
|
295 | 408 |
|
409 |
||
876 | 410 |
combining fix-size with variable size: |
295 | 411 |
(need 3 extra frame-views to place the extra labels into) |
593 | 412 |
[exBegin] |
413 |
|top p v1 l1 v2 l2 v3 l3 f1 f2 f3| |
|
295 | 414 |
|
593 | 415 |
top := StandardSystemView new. |
416 |
top extent:300@300. |
|
295 | 417 |
|
593 | 418 |
p := VariablePanel |
419 |
origin:0.0 @ 0.0 |
|
420 |
corner:1.0 @ 1.0 |
|
421 |
in:top. |
|
295 | 422 |
|
874 | 423 |
p orientation:#vertical. |
424 |
||
425 |
f1 := View origin:0.0@0.0 corner:1.0@0.3 in:p. |
|
426 |
f2 := View origin:0.0@0.3 corner:1.0@0.6 in:p. |
|
427 |
f3 := View origin:0.0@0.6 corner:1.0@1.0 in:p. |
|
295 | 428 |
|
593 | 429 |
v1 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f1. |
430 |
v2 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f2. |
|
431 |
v3 := View origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:f3. |
|
295 | 432 |
|
593 | 433 |
l1 := Label label:'sub1' in:f1. |
434 |
l2 := Label label:'sub2' in:f2. |
|
435 |
l3 := Label label:'sub3' in:f3. |
|
295 | 436 |
|
593 | 437 |
l1 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
438 |
bottomInset:(l1 preferredExtent y negated). |
|
439 |
l2 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
|
440 |
bottomInset:(l2 preferredExtent y negated). |
|
441 |
l3 origin:0.0 @ 0.0 corner:1.0 @ 0.0 ; |
|
442 |
bottomInset:(l3 preferredExtent y negated). |
|
295 | 443 |
|
593 | 444 |
v1 topInset:(l1 preferredExtent y); level:-1. |
445 |
v2 topInset:(l2 preferredExtent y); level:-1. |
|
446 |
v3 topInset:(l3 preferredExtent y); level:-1. |
|
295 | 447 |
|
593 | 448 |
v1 viewBackground:(Color red). |
449 |
v2 viewBackground:(Color green). |
|
450 |
v3 viewBackground:(Color yellow). |
|
295 | 451 |
|
874 | 452 |
top open |
453 |
[exEnd] |
|
454 |
||
455 |
VerticalPansels allow a label to be associated with the |
|
456 |
handles; this looks much like the above, but is slightly |
|
457 |
more compact. Notice, no label can be placed above the first |
|
458 |
view - it has no handle. |
|
459 |
[exBegin] |
|
460 |
|top p v1 v2 v3| |
|
461 |
||
462 |
top := StandardSystemView new. |
|
463 |
top extent:300@300. |
|
464 |
||
465 |
p := VariablePanel |
|
466 |
origin:0.0 @ 0.0 |
|
467 |
corner:1.0 @ 1.0 |
|
468 |
in:top. |
|
469 |
||
593 | 470 |
p orientation:#vertical. |
874 | 471 |
p handleLabels:#('ignored' 'sub2' 'sub3'). |
472 |
||
473 |
v1 := View origin:0.0@0.0 corner:1.0@0.3 in:p. |
|
474 |
v2 := View origin:0.0@0.3 corner:1.0@0.6 in:p. |
|
475 |
v3 := View origin:0.0@0.6 corner:1.0@1.0 in:p. |
|
476 |
||
477 |
v1 viewBackground:(Color red). |
|
478 |
v2 viewBackground:(Color green). |
|
479 |
v3 viewBackground:(Color yellow). |
|
480 |
||
593 | 481 |
top open |
482 |
[exEnd] |
|
295 | 483 |
|
874 | 484 |
handle labels can be more than strings .... |
485 |
(however, they should have about the same height, since |
|
486 |
the largest defines heights of all bars; |
|
487 |
retry the example below with a larger bitmap image ...) |
|
488 |
[exBegin] |
|
489 |
|top e p v1 v2 v3| |
|
490 |
||
491 |
top := StandardSystemView new. |
|
492 |
top extent:300@300. |
|
493 |
||
494 |
p := VariablePanel |
|
495 |
origin:0.0 @ 0.0 |
|
496 |
corner:1.0 @ 1.0 |
|
497 |
in:top. |
|
498 |
||
499 |
p orientation:#vertical. |
|
500 |
e := Array with:#bold |
|
501 |
with:#color->Color red. |
|
502 |
||
503 |
p handleLabels:(Array with:nil |
|
504 |
with:('bold and red' asText emphasizeAllWith:e) |
|
505 |
with:(Image fromFile:'ScrollRt.xbm')). |
|
506 |
||
507 |
v1 := View origin:0.0@0.0 corner:1.0@0.3 in:p. |
|
508 |
v2 := View origin:0.0@0.3 corner:1.0@0.6 in:p. |
|
509 |
v3 := View origin:0.0@0.6 corner:1.0@1.0 in:p. |
|
510 |
||
511 |
v1 viewBackground:(Color red). |
|
512 |
v2 viewBackground:(Color green). |
|
513 |
v3 viewBackground:(Color yellow). |
|
514 |
||
515 |
top open |
|
516 |
[exEnd] |
|
517 |
||
518 |
||
295 | 519 |
|
520 |
BAD EXAMPLE (wrong relative sizes - repaired on handle move): |
|
593 | 521 |
[exBegin] |
522 |
|top p v1 v2 v3| |
|
295 | 523 |
|
593 | 524 |
top := StandardSystemView new. |
525 |
top extent:300@300. |
|
295 | 526 |
|
593 | 527 |
p := VariablePanel |
528 |
origin:0.0 @ 0.0 |
|
529 |
corner:1.0 @ 1.0 |
|
530 |
in:top. |
|
531 |
p orientation:#vertical. |
|
295 | 532 |
|
593 | 533 |
v1 := View origin:0.0 @ 0.0 corner:1.0 @ (1/4) in:p. |
534 |
v2 := View origin:0.0 @ (1/2) corner:1.0 @ (3/4) in:p. |
|
535 |
v3 := View origin:0.0 @ (3/4) corner:1.0 @ 1.0 in:p. |
|
295 | 536 |
|
593 | 537 |
v1 viewBackground:(Color red). |
538 |
v2 viewBackground:(Color green). |
|
539 |
v3 viewBackground:(Color yellow). |
|
295 | 540 |
|
593 | 541 |
top open |
542 |
[exEnd] |
|
2179 | 543 |
|
544 |
example with snapMode: |
|
545 |
[exBegin] |
|
546 |
|top p v1 v2 v3| |
|
547 |
||
548 |
top := StandardSystemView new. |
|
549 |
top extent:300@300. |
|
550 |
||
551 |
p := VariablePanel |
|
552 |
origin:0.0 @ 0.0 |
|
553 |
corner:1.0 @ 1.0 |
|
554 |
in:top. |
|
555 |
p orientation:#vertical. |
|
556 |
p snapMode:#min. |
|
557 |
||
558 |
v1 := View origin:0.0@0.0 corner:1.0@(1/2) in:p. |
|
559 |
v2 := View origin:0.0@(1/2) corner:1.0@(2/3) in:p. |
|
560 |
v3 := View origin:0.0@(2/3) corner:1.0@1.0 in:p. |
|
561 |
||
562 |
v1 viewBackground:(Color red). |
|
563 |
v2 viewBackground:(Color green). |
|
564 |
v3 viewBackground:(Color yellow). |
|
565 |
||
566 |
top open |
|
567 |
[exEnd] |
|
568 |
||
295 | 569 |
" |
570 |
! ! |
|
571 |
||
871 | 572 |
!VariablePanel class methodsFor:'defaults'! |
295 | 573 |
|
1158
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
574 |
cursorForOrientation:orientation |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
575 |
"return an appropriate cursor" |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
576 |
|
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
577 |
^ self cursorForOrientation:orientation onDevice:Display. |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
578 |
|
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
579 |
"Modified: / 30.9.1998 / 18:21:10 / cg" |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
580 |
! |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
581 |
|
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
582 |
cursorForOrientation:orientation onDevice:device |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
583 |
"return an appropriate cursor" |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
584 |
|
1158
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
585 |
|cursor| |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
586 |
|
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
587 |
orientation == #vertical ifTrue:[ |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
588 |
DefaultVCursor notNil ifTrue:[ |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
589 |
cursor := DefaultVCursor |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
590 |
] ifFalse:[ |
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
591 |
device platformName = 'WIN32' ifFalse:[ |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
592 |
cursor := Cursor |
2073 | 593 |
sourceForm:(Smalltalk imageFromFileNamed:'VVPanel.xbm' forClass:self) |
594 |
maskForm:(Smalltalk imageFromFileNamed:'VVPanel_m.xbm' forClass:self) |
|
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
595 |
hotX:8 |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
596 |
hotY:8. |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
597 |
]. |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
598 |
|
1158
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
599 |
" |
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
600 |
if bitmaps are not available or under Win95, |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
601 |
use a standard cursor |
1158
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
602 |
" |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
603 |
cursor isNil ifTrue:[ |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
604 |
"which one looks better ?" |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
605 |
cursor := Cursor upDownArrow |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
606 |
"cursor := Cursor upLimitArrow" |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
607 |
]. |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
608 |
DefaultVCursor := cursor |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
609 |
] |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
610 |
] ifFalse:[ |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
611 |
DefaultHCursor notNil ifTrue:[ |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
612 |
cursor := DefaultHCursor |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
613 |
] ifFalse:[ |
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
614 |
device platformName = 'WIN32' ifFalse:[ |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
615 |
cursor := Cursor |
2073 | 616 |
sourceForm:(Smalltalk imageFromFileNamed:'VHPanel.xbm' forClass:self) |
617 |
maskForm:(Smalltalk imageFromFileNamed:'VHPanel_m.xbm' forClass:self) |
|
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
618 |
hotX:8 |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
619 |
hotY:8. |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
620 |
]. |
1158
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
621 |
" |
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
622 |
if bitmaps are not available or under Win95, |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
623 |
use a standard cursor |
1158
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
624 |
" |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
625 |
cursor isNil ifTrue:[ |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
626 |
"which one looks better ?" |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
627 |
cursor := Cursor leftRightArrow |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
628 |
"cursor := Cursor leftLimitArrow" |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
629 |
]. |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
630 |
DefaultHCursor := cursor |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
631 |
] |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
632 |
]. |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
633 |
|
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
634 |
^ cursor |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
635 |
|
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
636 |
" |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
637 |
DefaultVCursor := DefaultHCursor := nil. |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
638 |
" |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
639 |
|
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
640 |
"Created: / 30.9.1998 / 18:20:41 / cg" |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
641 |
"Modified: / 30.9.1998 / 18:23:07 / cg" |
1158
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
642 |
! |
225c0d52068d
cursor default is now a class method.
Claus Gittinger <cg@exept.de>
parents:
1151
diff
changeset
|
643 |
|
295 | 644 |
lightFormOn:aDisplay |
645 |
"use same handle as Scroller" |
|
646 |
||
647 |
^ Scroller handleLightFormOn:aDisplay |
|
648 |
! |
|
649 |
||
650 |
shadowFormOn:aDisplay |
|
651 |
"use same handle as Scroller" |
|
652 |
||
653 |
^ Scroller handleShadowFormOn:aDisplay |
|
654 |
! |
|
655 |
||
2179 | 656 |
snapIcons |
657 |
"returns dictionary of snapIcons |
|
658 |
" |
|
659 |
|upIcon snapIcons| |
|
660 |
||
661 |
DefaultSnapIcons isNil ifTrue:[ |
|
662 |
DefaultSnapIcons := IdentityDictionary new. |
|
2269 | 663 |
|
664 |
DefaultSnapIcons at:#iconUp put:self snapIconUp. |
|
665 |
DefaultSnapIcons at:#iconRight put:self snapIconRight. |
|
666 |
DefaultSnapIcons at:#iconDown put:self snapIconDown. |
|
667 |
DefaultSnapIcons at:#iconLeft put:self snapIconLeft. |
|
2236 | 668 |
|
669 |
DefaultSnapIcons at:#iconUpDown put:self snapIconUpDown. |
|
2269 | 670 |
DefaultSnapIcons at:#iconLeftRight put:self snapIconLeftRight. |
2179 | 671 |
]. |
672 |
^ DefaultSnapIcons |
|
673 |
" |
|
2236 | 674 |
DefaultSnapIcons := nil. |
675 |
self snapIcons |
|
2179 | 676 |
" |
677 |
! |
|
678 |
||
295 | 679 |
updateStyleCache |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
680 |
"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
|
681 |
|
1388 | 682 |
<resource: #style (#'variablePanel.showHandle' |
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
683 |
#'variablePanel.handleStyle' |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
684 |
#'variablePanel.handleImage' |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
685 |
#'variablePanel.handlePosition' |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
686 |
#'variablePanel.handleLevel' |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
687 |
#'variablePanel.snapHandlePosition' |
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
688 |
#'variablePanel.trackingLine' |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
689 |
#'variablePanel.trackingStyle' |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
690 |
#'variablePanel.separatingLine' |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
691 |
#'variablePanel.handleColor')> |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
692 |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
693 |
|lineModeBoolean| |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
694 |
|
2084 | 695 |
DefaultVCursor := DefaultHCursor := nil. |
696 |
||
1869 | 697 |
DefaultShowHandle := StyleSheet at:#'variablePanel.showHandle' default:true. |
698 |
DefaultHandleStyle := StyleSheet at:#'variablePanel.handleStyle'. |
|
699 |
DefaultHandlePosition := StyleSheet at:#'variablePanel.handlePosition' "default:#right". |
|
1381 | 700 |
DefaultHandlePosition isNil ifTrue:[ |
701 |
DefaultHandlePosition := ScrollableView defaultScrollBarPosition. |
|
702 |
]. |
|
2252 | 703 |
DefaultSnapHandlePosition := StyleSheet at:#'variablePanel.snapHandlePosition' default:DefaultHandlePosition. |
1869 | 704 |
DefaultHandleLevel := StyleSheet at:#'variablePanel.handleLevel' default:2. |
705 |
DefaultTrackingLine := StyleSheet at:#'variablePanel.trackingStyle'. |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
706 |
DefaultTrackingLine isNil ifTrue:[ |
1869 | 707 |
lineModeBoolean := StyleSheet at:#'variablePanel.trackingLine' default:false. |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
708 |
lineModeBoolean ifTrue:[ |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
709 |
DefaultTrackingLine := #solidLine |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
710 |
] ifFalse:[ |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
711 |
DefaultTrackingLine := #solidRectangle |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
712 |
] |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
713 |
]. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
714 |
|
1869 | 715 |
DefaultSeparatingLine := StyleSheet at:#'variablePanel.separatingLine' default:false. |
716 |
DefaultHandleColor := StyleSheet colorAt:#'variablePanel.handleColor' default:Black. |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
397
diff
changeset
|
717 |
|
1869 | 718 |
DefaultHandleImage := StyleSheet at:#'variablePanel.handleImage' |
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
719 |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
720 |
" |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
721 |
VariablePanel updateStyleCache |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
722 |
" |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
723 |
|
2084 | 724 |
"Modified: / 13.12.1999 / 12:08:33 / cg" |
295 | 725 |
! ! |
726 |
||
2269 | 727 |
!VariablePanel class methodsFor:'image specs'! |
728 |
||
729 |
snapIconDown |
|
730 |
"This resource specification was automatically generated |
|
731 |
by the ImageEditor of ST/X." |
|
732 |
||
733 |
"Do not manually edit this!! If it is corrupted, |
|
734 |
the ImageEditor may not be able to read the specification." |
|
735 |
||
736 |
" |
|
737 |
self snapIconDown inspect |
|
738 |
ImageEditor openOnClass:self andSelector:#snapIconDown |
|
739 |
" |
|
740 |
||
741 |
<resource: #image> |
|
742 |
||
743 |
^Icon |
|
2590 | 744 |
constantNamed:#'VariablePanel class snapIconDown' |
745 |
ifAbsentPut:[(Depth2Image new) width: 62; height: 5; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@B(J *F(Z!!*F(Z!!*@@@@@@@!!BDHQ!!FDXQ!!FDXP@@H@@@EPUATEPUATEPUAT@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 68 68 68 255 255 255]; mask:((Depth1Image new) width: 62; height: 5; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@A?LX1#FLX3>C8)R%JT)R''0GA#FLX1#FN@H@@@@@@@@P@@a') ; yourself); yourself] |
|
2482 | 746 |
! |
2269 | 747 |
|
748 |
snapIconLeft |
|
749 |
"This resource specification was automatically generated |
|
750 |
by the ImageEditor of ST/X." |
|
751 |
||
752 |
"Do not manually edit this!! If it is corrupted, |
|
753 |
the ImageEditor may not be able to read the specification." |
|
754 |
||
755 |
" |
|
756 |
self snapIconLeft inspect |
|
757 |
ImageEditor openOnClass:self andSelector:#snapIconLeft |
|
758 |
" |
|
759 |
||
760 |
<resource: #image> |
|
761 |
||
762 |
^Icon |
|
2590 | 763 |
constantNamed:#'VariablePanel class snapIconLeft' |
764 |
ifAbsentPut:[(Depth2Image new) width: 5; height: 62; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
765 |
@C @B@@@@@@@@@@@@@@@@@@P@C@)@BD@IP@@@@@BJP@!!@BT@@@@@@B$HHP %@@@@AP@)@BD@IP@@D@T0JP@!!@BT@@@@ED2$@HP@%@@@@AP@)ARDHIP@@@@T@ |
|
766 |
JP@!!@BT@@A@ELB @HP@E@@@@@C\@@@@@@@@@@@@@@@T@B@@a') ; colorMapFromArray:#[0 0 0 68 68 68 255 255 255]; mask:((Depth1Image new) width: 5; height: 62; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@A@0\OA0LA@D@6UPL@@@XE@0@@A TC@@@FAPL@@@XE@0@@A UCLD@FAPL@@@XE@0@@A TC@@DCA0=''T0D@@b') ; yourself); yourself] |
|
2482 | 767 |
! |
2269 | 768 |
|
769 |
snapIconLeftRight |
|
770 |
"This resource specification was automatically generated |
|
771 |
by the ImageEditor of ST/X." |
|
772 |
||
773 |
"Do not manually edit this!! If it is corrupted, |
|
774 |
the ImageEditor may not be able to read the specification." |
|
775 |
||
776 |
" |
|
777 |
self snapIconLeftRight inspect |
|
778 |
ImageEditor openOnClass:self andSelector:#snapIconLeftRight |
|
779 |
" |
|
780 |
||
781 |
<resource: #image> |
|
782 |
||
783 |
^Icon |
|
2590 | 784 |
constantNamed:#'VariablePanel class snapIconLeftRight' |
785 |
ifAbsentPut:[(Depth2Image new) width: 5; height: 62; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
786 |
@@@@@@@K@AH@@@@@@AX@L@@@@@@(@BD@AQD@B@@FJ#@!!@AT@@@@@@J*@@@@@DP@H@AD*LBD@EP@@@@@@J"\!!B1T@@@@@E"(0HP@U@@@@@@B*$P@H@@X@L@@@ |
|
787 |
J @!!@AT@@@@@@B(RHP UDP@0@@@@@@@@@@@@I0@K@@@@@@@a') ; colorMapFromArray:#[0 0 0 68 68 68 255 255 255]; mask:((Depth1Image new) width: 5; height: 62; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' LC <NK@ @@A@&QPLP@@XE@0@@C<A? A@VAPL@@@XE@0@@A TCL@@O @>@@BXE@0@PY$TCD@@A@0\OA0LAXb') ; yourself); yourself] |
|
2482 | 788 |
! |
2269 | 789 |
|
790 |
snapIconRight |
|
791 |
"This resource specification was automatically generated |
|
792 |
by the ImageEditor of ST/X." |
|
793 |
||
794 |
"Do not manually edit this!! If it is corrupted, |
|
795 |
the ImageEditor may not be able to read the specification." |
|
796 |
||
797 |
" |
|
798 |
self snapIconRight inspect |
|
799 |
ImageEditor openOnClass:self andSelector:#snapIconRight |
|
800 |
" |
|
801 |
||
802 |
<resource: #image> |
|
803 |
||
804 |
^Icon |
|
2590 | 805 |
constantNamed:#'VariablePanel class snapIconRight' |
806 |
ifAbsentPut:[(Depth2Image new) width: 5; height: 62; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
807 |
@@L@@@@@@@@@@@@@@AT@B@@@J@@!!@@T@E@@@@B(QHS@U@AP@@@@*@BD@EP@T@@@@J L!!@AT@E@@@DB(0HP@U@AP@@@@*J"D@EP@T@@@@J @!!B!!TH@@@@@B(@ |
|
808 |
HP@U@@@@@A@*LBD@EP@@@@@@@@X@@@@@@@@@@@@@@@ @B@@a') ; colorMapFromArray:#[0 0 0 68 68 68 255 255 255]; mask:((Depth1Image new) width: 5; height: 62; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@4A \G%2X4@AXE@0@@A TC@E@6AQL@@@XE@0@@A TC@@@6APL@@@XEL0@@A UC\@@VAPL@@@PFA0^''M PP@b') ; yourself); yourself] |
|
2482 | 809 |
! |
2269 | 810 |
|
811 |
snapIconUp |
|
812 |
"This resource specification was automatically generated |
|
813 |
by the ImageEditor of ST/X." |
|
814 |
||
815 |
"Do not manually edit this!! If it is corrupted, |
|
816 |
the ImageEditor may not be able to read the specification." |
|
817 |
||
818 |
" |
|
819 |
self snapIconUp inspect |
|
820 |
ImageEditor openOnClass:self andSelector:#snapIconUp |
|
821 |
" |
|
822 |
||
823 |
<resource: #image> |
|
824 |
||
825 |
^Icon |
|
2590 | 826 |
constantNamed:#'VariablePanel class snapIconUp' |
827 |
ifAbsentPut:[(Depth2Image new) width: 62; height: 5; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@J *B(J *B(J (B @@@@@@BEHT!!REHT!!RDHP!!@@@@@@@EPUATEPUATE@TAP@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 68 68 68 255 255 255]; mask:((Depth1Image new) width: 62; height: 5; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'B@@@@@@@@D@\X1#FLX1 8C9R%JT)R%G0_3FLX1#FL? @@@@@@@@@@@@a') ; yourself); yourself] |
|
2482 | 828 |
! |
2269 | 829 |
|
830 |
snapIconUpDown |
|
831 |
"This resource specification was automatically generated |
|
832 |
by the ImageEditor of ST/X." |
|
833 |
||
834 |
"Do not manually edit this!! If it is corrupted, |
|
835 |
the ImageEditor may not be able to read the specification." |
|
836 |
||
837 |
" |
|
838 |
self snapIconUpDown inspect |
|
839 |
ImageEditor openOnClass:self andSelector:#snapIconUpDown |
|
2590 | 840 |
Icon flushCachedIcons |
2269 | 841 |
" |
842 |
||
843 |
<resource: #image> |
|
844 |
||
845 |
^Icon |
|
2590 | 846 |
constantNamed:#'VariablePanel class snapIconUpDown' |
847 |
ifAbsentPut:[(Depth2Image new) width: 62; height: 5; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@H@@@@@@ @@@@@@@@@B J@BB J@(@HJ@(@@@@@@@!!BDD !!BDHPBBDHP@@@@@@APE@HAPE@T@ E@T@@@@@@@@@@B@@@@@@H@@@@@@@b') ; colorMapFromArray:#[0 0 0 68 68 68 255 255 255]; mask:((Depth1Image new) width: 62; height: 5; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@J@@B @@@PLX)#FJX1?C )R%JT)R#8_A#JLX2#FGC>@@(@@J@@H@@a') ; yourself); yourself] |
|
2482 | 848 |
! ! |
2269 | 849 |
|
295 | 850 |
!VariablePanel methodsFor:'accessing'! |
851 |
||
2650 | 852 |
isHorizontal |
853 |
^ orientation == #horizontal |
|
854 |
! |
|
855 |
||
295 | 856 |
orientation |
485 | 857 |
"return my orientation; either #horizontal or #vertical" |
858 |
||
295 | 859 |
^ orientation |
485 | 860 |
|
861 |
"Modified: 6.3.1996 / 18:08:45 / cg" |
|
295 | 862 |
! |
863 |
||
864 |
orientation:aSymbol |
|
485 | 865 |
"change my orientation; aSymbol must be one of #horizontal or #vertical. |
866 |
Changing implies a resize of my subViews." |
|
867 |
||
868 |
aSymbol ~~ orientation ifTrue:[ |
|
869 |
orientation := aSymbol. |
|
870 |
self initCursor. |
|
871 |
self anyNonRelativeSubviews ifTrue:[ |
|
872 |
self setupSubviews |
|
873 |
]. |
|
874 |
shown ifTrue:[ |
|
875 |
self cursor:cursor. |
|
876 |
self sizeChanged:nil. |
|
2623 | 877 |
self redrawIfShown. |
485 | 878 |
] |
295 | 879 |
] |
485 | 880 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
881 |
"Modified: 29.5.1996 / 16:22:35 / cg" |
2650 | 882 |
! |
883 |
||
884 |
relativeCorners |
|
885 |
^ self subViews |
|
886 |
collect:[:eachView | |
|
887 |
self isHorizontal ifTrue:[ |
|
888 |
eachView relativeCorner x |
|
889 |
] ifFalse:[ |
|
890 |
eachView relativeCorner y |
|
891 |
] |
|
892 |
] |
|
893 |
! |
|
894 |
||
895 |
relativeCorners:aCollection |
|
896 |
|pos| |
|
897 |
||
3278 | 898 |
aCollection size == self subViews size ifFalse:[^ self ]. |
899 |
||
2650 | 900 |
pos := 0.0. |
901 |
self subViews with:aCollection |
|
902 |
do:[:eachView :eachCorner | |
|
903 |
self isHorizontal ifTrue:[ |
|
904 |
eachView origin:(pos @ 0.0) corner:(eachCorner @ 1.0) |
|
905 |
] ifFalse:[ |
|
906 |
eachView origin:(0.0 @ pos) corner:(1.0 @ eachCorner) |
|
907 |
]. |
|
908 |
pos := eachCorner |
|
909 |
] |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
910 |
! ! |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
911 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
912 |
!VariablePanel methodsFor:'accessing-look'! |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
913 |
|
295 | 914 |
barHeight |
915 |
"return the height of the separating bar" |
|
916 |
||
917 |
^ barHeight |
|
918 |
! |
|
919 |
||
920 |
barHeight:nPixel |
|
921 |
"set the height of the separating bar" |
|
922 |
||
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
923 |
|bH| |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
924 |
|
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
925 |
bH := nPixel. |
295 | 926 |
|
1207 | 927 |
"make certain bar is visible and catchable" |
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
928 |
(bH < 4) ifTrue:[ |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
929 |
bH := 4 |
295 | 930 |
]. |
931 |
||
876 | 932 |
"make it even, so spacing is equally spreadable among subviews" |
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
933 |
bH odd ifTrue:[ |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
934 |
bH := bH + 1 |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
935 |
]. |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
936 |
self setBarHeight:bH |
876 | 937 |
|
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
938 |
"Modified: / 28.4.1997 / 14:30:33 / dq" |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
939 |
"Modified: / 30.1.2000 / 22:31:32 / cg" |
876 | 940 |
! |
941 |
||
2623 | 942 |
barLevel:level |
943 |
"set the 3D level of the separating bar" |
|
944 |
||
945 |
barLevel ~~ level ifTrue:[ |
|
946 |
barLevel := level. |
|
947 |
self redrawIfShown. |
|
948 |
] |
|
949 |
! |
|
950 |
||
876 | 951 |
handleImage:aBitmapOrImage |
952 |
"define the handles image" |
|
953 |
||
954 |
shadowForm := aBitmapOrImage. |
|
955 |
lightForm := nil. |
|
956 |
self computeBarHeight. |
|
957 |
||
958 |
"Created: 7.11.1996 / 20:21:10 / cg" |
|
959 |
"Modified: 7.11.1996 / 20:27:22 / cg" |
|
295 | 960 |
! |
961 |
||
871 | 962 |
handleLabels:aCollectionOfLabels |
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
963 |
"define special handle labels - typically a collection of |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
964 |
bitmap images. Notice, that the first handle is not |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
965 |
drawn, that is, the first element if the argument is useless." |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
966 |
|
871 | 967 |
orientation == #horizontal ifTrue:[ |
968 |
self error:'not allowed for horizontal panels' |
|
969 |
]. |
|
970 |
||
971 |
handleLabels := aCollectionOfLabels. |
|
972 |
self computeBarHeight. |
|
973 |
self resizeSubviews. |
|
974 |
||
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
975 |
" |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
976 |
|top panel v1 v2| |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
977 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
978 |
top := StandardSystemView new. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
979 |
panel := VariableVerticalPanel origin:0.0@0.0 corner:1.0@1.0 in:top. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
980 |
panel add:(EditTextView origin:0.0@0.0 corner:1.0@0.5). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
981 |
panel add:(EditTextView origin:0.0@0.5 corner:1.0@1.0). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
982 |
panel handleStyle:nil. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
983 |
panel handleLabels:#('foo' 'bar'). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
984 |
top open |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
985 |
" |
871 | 986 |
! |
987 |
||
295 | 988 |
handleLevel:aNumber |
989 |
"define the 3D level of the handle (only with some styles). |
|
990 |
Normally, this is defined via styleSheet files, but this entry allows |
|
991 |
individual views to be manipulated." |
|
992 |
||
2244 | 993 |
handleLevel ~~ aNumber ifTrue:[ |
994 |
handleLevel := aNumber. |
|
2623 | 995 |
self redrawIfShown. |
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
996 |
] |
295 | 997 |
! |
998 |
||
999 |
handlePosition |
|
1000 |
"return the position of the handle" |
|
1001 |
||
1002 |
^ handlePosition |
|
1003 |
! |
|
1004 |
||
1005 |
handlePosition:aSymbol |
|
1006 |
"define the position of the handle; the argument aSymbol |
|
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1007 |
may be one of #left, #right or #center. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1008 |
If never set by the program, the position is controlled by the styleSheet." |
295 | 1009 |
|
2244 | 1010 |
handlePosition ~~ aSymbol ifTrue:[ |
1011 |
handlePosition := aSymbol ? DefaultHandlePosition. |
|
2623 | 1012 |
self redrawIfShown. |
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1013 |
] |
295 | 1014 |
! |
1015 |
||
876 | 1016 |
handleShadowImage:shadowImage lightImage:lightImage |
1017 |
"define the handles image; both shadow and light parts" |
|
1018 |
||
1019 |
shadowForm := shadowImage. |
|
1020 |
lightForm := lightImage. |
|
1021 |
self computeBarHeight. |
|
1022 |
||
1023 |
"Created: 7.11.1996 / 20:21:51 / cg" |
|
1024 |
"Modified: 7.11.1996 / 20:27:26 / cg" |
|
1025 |
! |
|
1026 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1027 |
handleStyle:styleSymbol |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1028 |
"define the style of the handle; |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1029 |
styleSymbol may be #motif to draw a little knob or |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1030 |
anything else to draw scrollBars handleForm. |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1031 |
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
|
1032 |
individual views to be manipulated." |
295 | 1033 |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1034 |
(styleSymbol ~~ handleStyle) ifTrue:[ |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1035 |
handleStyle := styleSymbol. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1036 |
handleStyle == #next ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1037 |
shadowForm := self class shadowFormOn:device. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1038 |
lightForm := self class lightFormOn:device. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1039 |
] ifFalse:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1040 |
shadowForm := lightForm := nil |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1041 |
]. |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1042 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1043 |
shadowForm notNil ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1044 |
(self is3D and:[handleStyle ~~ #motif]) ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1045 |
self barHeight:(shadowForm height + 2). |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1046 |
barWidth := shadowForm width |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1047 |
] |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1048 |
]. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1049 |
shown ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1050 |
self resizeSubviews. |
2623 | 1051 |
self redrawIfShown. |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1052 |
] |
295 | 1053 |
] |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1054 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1055 |
"Created: 24.2.1996 / 19:04:07 / cg" |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1056 |
"Modified: 29.5.1996 / 16:22:24 / cg" |
295 | 1057 |
! |
1058 |
||
1948 | 1059 |
setBarHeight:nPixel |
2179 | 1060 |
"check whether snap matches to extent of bar otherwise disable snap |
1061 |
" |
|
1062 |
snapAdornment notNil ifTrue:[ |
|
1063 |
barHeight := nPixel max:(snapAdornment at:#height ifAbsent:0) |
|
1064 |
] ifFalse:[ |
|
1065 |
barHeight := nPixel max:0 |
|
1066 |
]. |
|
1948 | 1067 |
|
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
1068 |
realized ifTrue:[ |
2179 | 1069 |
self resizeSubviews |
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
1070 |
] |
1948 | 1071 |
|
1072 |
! |
|
1073 |
||
2114 | 1074 |
showHandle |
1075 |
"return the the handle-drawing flag; aBoolean" |
|
1076 |
||
1077 |
^ showHandle |
|
1078 |
! |
|
1079 |
||
1080 |
showHandle:aBoolean |
|
1081 |
"enabled/disable the handle-drawing" |
|
1082 |
||
2244 | 1083 |
showHandle ~~ aBoolean ifTrue:[ |
1084 |
showHandle := aBoolean ? DefaultShowHandle. |
|
2623 | 1085 |
self redrawIfShown |
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1086 |
] |
2114 | 1087 |
! |
1088 |
||
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1089 |
snapHandlePosition |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1090 |
"return the position of the snap-handle" |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1091 |
|
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1092 |
^ self handlePosition. "/ ^ snapHandlePosition |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1093 |
! |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1094 |
|
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1095 |
snapHandlePosition:aSymbol |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1096 |
"define the position of the snap-handle; the argument aSymbol |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1097 |
may be one of #left, #right or #center. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1098 |
If never set by the program, the position is controlled by the styleSheet." |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1099 |
|
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1100 |
self handlePosition:aSymbol. |
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1101 |
|
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1102 |
"/ snapHandlePosition := aSymbol. |
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1103 |
"/ realized ifTrue:[ |
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1104 |
"/ self invalidate |
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1105 |
"/ ] |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1106 |
! |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1107 |
|
2179 | 1108 |
snapMode |
1109 |
"allowed modes are: |
|
1110 |
nil no snap |
|
1111 |
||
1112 |
#max on press the view is increased to bottom(vertical) or right(horizontal) |
|
1113 |
#min on press the view is decreased to top (vertical) or left (horizontal) |
|
1114 |
#maxMin on press the view is increased or decreased dependent on its current extent |
|
1115 |
#minMax on press the view is increased or decreased dependent on its current extent |
|
1116 |
" |
|
1117 |
snapAdornment notNil ifTrue:[ |
|
1118 |
^ snapAdornment at:#mode ifAbsent:nil |
|
1119 |
]. |
|
1120 |
^ nil |
|
1121 |
||
1122 |
! |
|
1123 |
||
1124 |
snapMode:aMode |
|
1125 |
"allowed modes are: |
|
1126 |
nil no snap |
|
1127 |
||
1128 |
#max on press the view is increased to bottom(vertical) or right(horizontal) |
|
1129 |
#min on press the view is decreased to top (vertical) or left (horizontal) |
|
1130 |
#maxMin on press the view is increased or decreased dependent on its current extent |
|
1131 |
#minMax on press the view is increased or decreased dependent on its current extent |
|
1132 |
" |
|
1133 |
|oldHeight oldMode| |
|
1134 |
||
1135 |
aMode notNil ifTrue:[ |
|
2236 | 1136 |
( #( max min maxMin minMax both) includes:aMode) ifFalse:[ |
2179 | 1137 |
^ self error:('unknown snapMode: ', aMode printString). |
1138 |
] |
|
1139 |
]. |
|
1140 |
(oldMode := self snapMode) == aMode ifTrue:[^ self]. |
|
1141 |
||
1142 |
(snapAdornment notNil and:[aMode notNil]) ifTrue:[ |
|
1143 |
"must only redraw" |
|
1144 |
snapAdornment at:#mode put:aMode |
|
1145 |
] ifFalse:[ |
|
1146 |
"must recompute barHeight and redraw" |
|
1147 |
||
1148 |
aMode isNil ifTrue:[ |
|
1149 |
snapAdornment := nil |
|
1150 |
] ifFalse:[ |
|
1151 |
self initSnapAdornment. |
|
1152 |
snapAdornment at:#mode put:aMode. |
|
1153 |
]. |
|
1154 |
oldHeight := barHeight. |
|
1155 |
||
1156 |
self computeBarHeight. |
|
1157 |
||
1158 |
oldHeight ~~ barHeight ifTrue:[ |
|
1159 |
"must recompute subViews" |
|
1160 |
self setupSubviews. |
|
1161 |
self resizeSubviews. |
|
1162 |
] |
|
1163 |
]. |
|
2623 | 1164 |
self redrawIfShown. |
2179 | 1165 |
! |
1166 |
||
295 | 1167 |
style:styleSymbol |
1168 |
"define the style of the handle; |
|
1169 |
styleSymbol may be #motif to draw a little knob or |
|
1170 |
anything else to draw scrollBars handleForm. |
|
1171 |
Normally, this is defined via styleSheet files, but this entry allows |
|
1172 |
individual views to be manipulated." |
|
1173 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1174 |
self handleStyle:styleSymbol |
295 | 1175 |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1176 |
"Modified: 24.2.1996 / 19:04:19 / cg" |
295 | 1177 |
! ! |
1178 |
||
2288 | 1179 |
!VariablePanel methodsFor:'adding & removing components'! |
1180 |
||
1181 |
addSubView:aView |
|
1182 |
"a view is added; adjust other subviews sizes" |
|
1183 |
||
1184 |
super addSubView:aView. |
|
1185 |
||
1186 |
realized ifTrue:[ |
|
2482 | 1187 |
self setupSubviews. |
2288 | 1188 |
self resizeSubviews. |
2483 | 1189 |
aView beVisible. |
2288 | 1190 |
] |
1191 |
||
1192 |
"Created: 17.1.1996 / 22:41:00 / cg" |
|
1193 |
"Modified: 24.2.1996 / 19:05:05 / cg" |
|
1194 |
! |
|
1195 |
||
1196 |
removeSubView:aView |
|
1197 |
"a view is removed; adjust other subviews sizes" |
|
1198 |
||
2483 | 1199 |
aView beInvisible. |
2288 | 1200 |
super removeSubView:aView. |
2483 | 1201 |
shown ifTrue:[ |
1202 |
realized |
|
1203 |
"/ (superView isNil or:[superView shown]) |
|
1204 |
ifTrue:[ |
|
2288 | 1205 |
self setupSubviews. |
1206 |
self resizeSubviews. |
|
1207 |
] |
|
1208 |
] |
|
1209 |
! ! |
|
1210 |
||
295 | 1211 |
!VariablePanel methodsFor:'drawing'! |
1212 |
||
871 | 1213 |
drawHandle:hIndex atX:hx y:hy |
295 | 1214 |
"draw a single handle at hx/hy" |
1215 |
||
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1216 |
|h w x y m xm ym lbl maxKnob |
1096 | 1217 |
mar "{ Class: SmallInteger }" |
1218 |
barWidthInt "{ Class: SmallInteger }" |
|
1219 |
barHeightInt "{ Class: SmallInteger }" | |
|
295 | 1220 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1221 |
((handleStyle isNil or:[handleStyle == #none]) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1222 |
and:[handleLabels isNil]) ifTrue:[^ self]. |
396
973d4a9fa32c
setting handleStyle to nil disables handleDrawing
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
1223 |
|
1096 | 1224 |
mar := margin. |
1225 |
barHeightInt := barHeight. |
|
1226 |
barWidthInt := barWidth. |
|
871 | 1227 |
|
295 | 1228 |
shadowForm notNil ifTrue:[ |
871 | 1229 |
h := shadowForm height. |
1230 |
w := shadowForm width . |
|
1096 | 1231 |
maxKnob := h min:barHeightInt. |
295 | 1232 |
] ifFalse:[ |
1096 | 1233 |
maxKnob := knobHeight min: barHeightInt. |
876 | 1234 |
maxKnob := maxKnob max:4. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1235 |
handleStyle == #full ifTrue:[ |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1236 |
w := h := maxKnob |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1237 |
] ifFalse:[ |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1238 |
w := h := maxKnob - 4. |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1239 |
] |
295 | 1240 |
]. |
1241 |
||
1242 |
self paint:viewBackground. |
|
1131 | 1243 |
self lineStyle:#solid. |
1244 |
||
295 | 1245 |
orientation == #vertical ifTrue:[ |
1096 | 1246 |
self fillRectangleX:mar y:hy |
1247 |
width:(width - mar - mar) |
|
1248 |
height:barHeightInt. |
|
2623 | 1249 |
(handleStyle notNil |
1250 |
and:[handleStyle ~~ #none]) ifTrue:[ |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1251 |
(handleStyle ~~ #normal |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1252 |
and:[handleStyle ~~ #mswindows]) ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1253 |
m := (maxKnob - h) // 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1254 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1255 |
shadowForm isNil ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1256 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1257 |
y := hy + (barHeightInt // 2). "/ center of the bar |
871 | 1258 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1259 |
separatingLine ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1260 |
self paint:shadowColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1261 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1262 |
y := y + 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1263 |
self paint:lightColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1264 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1265 |
self paint:viewBackground. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1266 |
]. |
876 | 1267 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1268 |
self fillRectangleX:(hx - barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1269 |
y:hy |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1270 |
width:(barWidthInt + barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1271 |
height:h. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1272 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1273 |
handleStyle == #line ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1274 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1275 |
self displayLineFromX:hx - barWidthInt y:y toX:hx + barWidthInt y:y |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1276 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1277 |
y := hy. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1278 |
handleStyle == #st80 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1279 |
y := y - 1 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1280 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1281 |
ym := y + m. |
295 | 1282 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1283 |
handleStyle == #full ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1284 |
handleLevel ~~ 0 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1285 |
self |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1286 |
drawEdgesForX:0 "/ -(handleLevel abs) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1287 |
y:ym "/-1 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1288 |
width:width "/+(handleLevel+handleLevel)abs |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1289 |
height:h-2 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1290 |
level:handleLevel |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1291 |
shadow:shadowColor |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1292 |
light:lightColor |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1293 |
halfShadow:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1294 |
halfLight:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1295 |
style:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1296 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1297 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1298 |
handleLevel ~~ 0 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1299 |
self drawEdgesForX:(hx - barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1300 |
y:ym |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1301 |
width:(barWidthInt + barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1302 |
height:h |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1303 |
level:handleLevel. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1304 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1305 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1306 |
handleStyle == #iris ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1307 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1308 |
self fillDeviceRectangleX:(hx - barWidthInt + 2) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1309 |
y:(ym + 2) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1310 |
width:(barWidthInt + barWidthInt - 4) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1311 |
height:h - 4 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1312 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1313 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1314 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1315 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1316 |
y := hy. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1317 |
(shadowForm notNil or:[lightForm notNil]) ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1318 |
self drawHandleFormAtX:hx y:(y + m) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1319 |
] |
871 | 1320 |
]. |
1096 | 1321 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1322 |
handleStyle == #st80 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1323 |
y := hy - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1324 |
self paint:lightColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1325 |
self displayLineFromX:mar y:y toX:(width - mar - mar - 1) y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1326 |
self displayLineFromX:0 y:hy toX:0 y:(hy + knobHeight - 1). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1327 |
y := hy + knobHeight - 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1328 |
self paint:shadowColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1329 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1330 |
"uncomment the -1 if you dont like the notch at the right end" |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1331 |
" VVV" |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1332 |
self displayLineFromX:width-1 y:hy" "-1" " toX:width-1 y:(hy + knobHeight - 1 - 1). |
871 | 1333 |
]. |
1334 |
] ifFalse:[ |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1335 |
y := hy + barHeightInt - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1336 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1337 |
separatingLine ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1338 |
self displayLineFromX:0 y:hy+1 toX:width y:hy+1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1339 |
self displayLineFromX:0 y:y toX:width y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1340 |
]. |
2623 | 1341 |
self fillRectangleX:hx y:hy width:barWidthInt height:barHeightInt. |
871 | 1342 |
]. |
1343 |
]. |
|
1344 |
lbl := self handleLabelAt:hIndex. |
|
1345 |
lbl notNil ifTrue:[ |
|
1346 |
hIndex ~~ 1 ifTrue:[ |
|
1347 |
self paint:Color black. |
|
2734
ba7f56186e88
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2650
diff
changeset
|
1348 |
lbl displayOn:self x:mar y:hy + (lbl ascentOn:self) |
ba7f56186e88
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2650
diff
changeset
|
1349 |
"/ lbl isImageOrForm ifTrue:[ |
ba7f56186e88
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2650
diff
changeset
|
1350 |
"/ lbl displayOn:self x:mar y:hy |
ba7f56186e88
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2650
diff
changeset
|
1351 |
"/ ] ifFalse:[ |
ba7f56186e88
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2650
diff
changeset
|
1352 |
"/ lbl displayOn:self x:mar y:hy + font ascent + 1 |
ba7f56186e88
correct use of ascentOn: for display
Claus Gittinger <cg@exept.de>
parents:
2650
diff
changeset
|
1353 |
"/ ] |
871 | 1354 |
] |
1355 |
]. |
|
1356 |
||
295 | 1357 |
] ifFalse:[ |
1096 | 1358 |
self fillRectangleX:hx y:mar |
1359 |
width:barHeightInt |
|
1360 |
height:(height - mar - mar). |
|
876 | 1361 |
|
2623 | 1362 |
(handleStyle notNil |
1363 |
and:[handleStyle ~~ #none]) ifTrue:[ |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1364 |
(handleStyle ~~ #normal |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1365 |
and:[handleStyle ~~ #mswindows]) ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1366 |
m := (barHeightInt - w) // 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1367 |
m := (maxKnob - w) // 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1368 |
shadowForm isNil ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1369 |
x := hx + (barHeightInt // 2). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1370 |
separatingLine ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1371 |
self paint:shadowColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1372 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1373 |
x := x + 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1374 |
self paint:lightColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1375 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1376 |
self paint:viewBackground. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1377 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1378 |
self fillRectangleX:hx y:(hy - barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1379 |
width:w |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1380 |
height:(barWidthInt + barWidthInt). |
295 | 1381 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1382 |
handleStyle == #line ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1383 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1384 |
self displayLineFromX:x y:hy - barWidthInt toX:x y:hy + barWidthInt. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1385 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1386 |
x := hx. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1387 |
handleStyle == #st80 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1388 |
x := x - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1389 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1390 |
xm := x + m. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1391 |
handleStyle == #full ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1392 |
handleLevel ~~ 0 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1393 |
self |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1394 |
drawEdgesForX:xm "/-1 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1395 |
y:0 "/ -handleLevel |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1396 |
width:w-2 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1397 |
height:height "/ +handleLevel+handleLevel |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1398 |
level:handleLevel |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1399 |
shadow:shadowColor |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1400 |
light:lightColor |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1401 |
halfShadow:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1402 |
halfLight:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1403 |
style:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1404 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1405 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1406 |
handleLevel ~~ 0 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1407 |
self drawEdgesForX:xm |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1408 |
y:(hy - barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1409 |
width:w |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1410 |
height:(barWidthInt + barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1411 |
level:handleLevel. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1412 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1413 |
handleStyle == #iris ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1414 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1415 |
self fillDeviceRectangleX:(xm + 2) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1416 |
y:(hy - barWidthInt + 2) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1417 |
width:w - 4 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1418 |
height:(barWidthInt + barWidthInt - 4) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1419 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1420 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1421 |
] |
871 | 1422 |
] ifFalse:[ |
1423 |
x := hx. |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1424 |
(shadowForm notNil or:[lightForm notNil]) ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1425 |
self drawHandleFormAtX:(x + m) y:hy |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1426 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1427 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1428 |
handleStyle == #st80 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1429 |
x := hx - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1430 |
self paint:lightColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1431 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1432 |
self displayLineFromX:hx y:0 toX:(hx + barHeightInt - 1) y:0. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1433 |
x := hx + barHeightInt - 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1434 |
self paint:shadowColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1435 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1436 |
"uncomment the -1 if you dont like the notch at the bottom end" |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1437 |
" VVV" |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1438 |
self displayLineFromX:hx" "-1" " y:height-1 toX:(hx + barHeightInt - 1) y:height-1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1439 |
]. |
871 | 1440 |
] ifFalse:[ |
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1441 |
x := hx + barHeightInt - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1442 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1443 |
separatingLine ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1444 |
self displayLineFromX:hx+1 y:0 toX:hx+1 y:height. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1445 |
self displayLineFromX:x y:0 toX:x y:height. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1446 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1447 |
self fillRectangleX:hx y:hy width:barHeightInt height:barWidthInt |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1448 |
] |
871 | 1449 |
] |
295 | 1450 |
]. |
1451 |
||
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1452 |
"Modified: / 29.7.1998 / 22:48:33 / cg" |
295 | 1453 |
! |
1454 |
||
1455 |
drawHandleFormAtX:hx y:hy |
|
1456 |
"draw a handles bitmap at hx/hy" |
|
1457 |
||
876 | 1458 |
shadowForm notNil ifTrue:[ |
1459 |
self paint:shadowColor. |
|
1460 |
self displayForm:shadowForm x:hx y:hy. |
|
1461 |
]. |
|
1462 |
lightForm notNil ifTrue:[ |
|
1463 |
self paint:lightColor. |
|
1464 |
self displayForm:lightForm x:hx y:hy. |
|
1465 |
]. |
|
295 | 1466 |
self paint:viewBackground |
876 | 1467 |
|
1468 |
"Modified: 7.11.1996 / 20:25:33 / cg" |
|
295 | 1469 |
! |
1470 |
||
2179 | 1471 |
drawSnapAt:anIndex |
1472 |
"draw the snap for a handle at an index |
|
1473 |
" |
|
2238 | 1474 |
|layout icon level offLevel paint canChangeExtent |
2179 | 1475 |
left "{ Class:SmallInteger }" |
1476 |
top "{ Class:SmallInteger }" |
|
1477 |
width "{ Class:SmallInteger }" |
|
1478 |
height "{ Class:SmallInteger }" |
|
2238 | 1479 |
snapMode leftEdge wEdge topEdge hEdge part wPart hPart |
2179 | 1480 |
| |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1481 |
|
2179 | 1482 |
(layout := self snapLayoutAt:anIndex) isNil ifTrue:[ |
1483 |
"snap disabled" |
|
1484 |
^ self |
|
1485 |
]. |
|
1486 |
||
1487 |
left := layout left. |
|
1488 |
top := layout top. |
|
1489 |
width := layout width. |
|
1490 |
height := layout height. |
|
2236 | 1491 |
snapMode := self snapMode. |
2179 | 1492 |
|
2238 | 1493 |
offLevel := level := snapAdornment at:#level ifAbsent:0. |
1494 |
||
2179 | 1495 |
canChangeExtent := self canChangeExtentOfViewAt:anIndex. |
1496 |
canChangeExtent ifTrue:[ |
|
1497 |
(controller isSnapEntered:anIndex) ifTrue:[ |
|
1498 |
controller isSnapPressed ifTrue:[ |
|
1499 |
level := #selectedLevel. |
|
1500 |
paint := #selectedBgColor. |
|
1501 |
] ifFalse:[ |
|
1502 |
level := #enterLevel. |
|
1503 |
paint := #enterBgColor. |
|
2238 | 1504 |
]. |
1505 |
level := snapAdornment at:level ifAbsent:0. |
|
2179 | 1506 |
] |
1507 |
]. |
|
1508 |
paint notNil ifTrue:[ |
|
1509 |
paint := snapAdornment at:paint ifAbsent:viewBackground |
|
1510 |
] ifFalse:[ |
|
1511 |
paint := viewBackground |
|
1512 |
]. |
|
1513 |
self paint:paint. |
|
1514 |
||
2238 | 1515 |
level == 0 ifTrue:[ |
1516 |
]. |
|
1517 |
||
1518 |
self fillRectangleX:left+1 y:top+1 width:width-2 height:height-2. |
|
2179 | 1519 |
|
1520 |
level ~~ 0 ifTrue:[ |
|
2236 | 1521 |
leftEdge := left + 1. |
2240 | 1522 |
wEdge := wPart := width - 2. |
2236 | 1523 |
topEdge := top + 1. |
2240 | 1524 |
hEdge := hPart := height - 2. |
2236 | 1525 |
|
2238 | 1526 |
orientation == #vertical ifTrue:[ |
1527 |
wPart := width // 3. |
|
1528 |
] ifFalse:[ |
|
1529 |
hPart := height // 3. |
|
1530 |
]. |
|
1531 |
||
2236 | 1532 |
level < 0 ifTrue:[ |
1533 |
part := (self subViews at:anIndex) objectAttributeAt:#snapPart. |
|
1534 |
part == #left ifTrue:[ |
|
2238 | 1535 |
self drawEdgesForX:leftEdge y:topEdge width:wEdge height:hEdge level:offLevel. |
2243 | 1536 |
wPart := wPart + 1. |
2236 | 1537 |
] ifFalse:[ |
1538 |
part == #middle ifTrue:[ |
|
2238 | 1539 |
self drawEdgesForX:leftEdge y:topEdge width:wEdge height:hEdge level:offLevel. |
2240 | 1540 |
orientation == #vertical ifTrue:[ |
1541 |
leftEdge := leftEdge + wPart. |
|
1542 |
] ifFalse:[ |
|
1543 |
topEdge := topEdge + hPart. |
|
1544 |
] |
|
2236 | 1545 |
] ifFalse:[ |
1546 |
part == #right ifTrue:[ |
|
2238 | 1547 |
self drawEdgesForX:leftEdge y:topEdge width:wEdge height:hEdge level:offLevel. |
2240 | 1548 |
orientation == #vertical ifTrue:[ |
2243 | 1549 |
leftEdge := leftEdge + (width - wPart - 1). |
2240 | 1550 |
] ifFalse:[ |
2243 | 1551 |
topEdge := topEdge + (height - hPart - 1). |
1552 |
]. |
|
1553 |
wPart := wPart - 1. |
|
2236 | 1554 |
] |
1555 |
] |
|
1556 |
]. |
|
2240 | 1557 |
wEdge := wPart. |
1558 |
hEdge := hPart. |
|
2236 | 1559 |
]. |
1560 |
self drawEdgesForX:leftEdge y:topEdge width:wEdge height:hEdge level:level. |
|
2179 | 1561 |
]. |
1562 |
||
1563 |
canChangeExtent ifFalse:[^ self]. |
|
1564 |
||
2236 | 1565 |
snapMode == #both ifTrue:[ |
1566 |
icon := orientation == #vertical ifTrue:[#iconUpDown] ifFalse:[#iconLeftRight] |
|
2179 | 1567 |
] ifFalse:[ |
2236 | 1568 |
(self snapAtIndexWillGrow:anIndex) ifTrue:[ |
1569 |
icon := orientation == #vertical ifTrue:[#iconDown] ifFalse:[#iconRight] |
|
1570 |
] ifFalse:[ |
|
1571 |
icon := orientation == #vertical ifTrue:[#iconUp] ifFalse:[#iconLeft] |
|
1572 |
]. |
|
2179 | 1573 |
]. |
1574 |
icon := snapAdornment at:icon ifAbsent:nil. |
|
1575 |
||
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1576 |
icon displayOn:self x:(left + (width - icon width // 2)) |
2179 | 1577 |
y:(top + (height - icon height // 2)). |
1578 |
! |
|
1579 |
||
295 | 1580 |
invertHandleBarAtX:hx y:hy |
1894 | 1581 |
|doLine oldStyle| |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1582 |
|
1894 | 1583 |
doLine := (trackLine == #solidLine |
1584 |
or:[trackLine == #dashedLine |
|
1585 |
or:[trackLine == #dottedLine]]). |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1586 |
|
1131 | 1587 |
trackLine == #dashedLine ifTrue:[ |
1894 | 1588 |
oldStyle := lineStyle. |
1131 | 1589 |
self lineStyle:#dashed. |
1894 | 1590 |
] ifFalse:[ |
1591 |
trackLine == #dottedLine ifTrue:[ |
|
1592 |
oldStyle := lineStyle. |
|
1593 |
self lineStyle:#dotted. |
|
1594 |
] |
|
1131 | 1595 |
]. |
1596 |
||
1220 | 1597 |
self clippedByChildren:false. |
1131 | 1598 |
|
295 | 1599 |
self xoring:[ |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1600 |
|yL xL halfHeight| |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1601 |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1602 |
halfHeight := (barHeight // 2) - 1. |
295 | 1603 |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1604 |
orientation == #vertical ifTrue:[ |
1894 | 1605 |
yL := hy + halfHeight. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1606 |
doLine ifTrue:[ |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1607 |
self displayLineFromX:0 y:yL toX:width y:yL. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1608 |
] ifFalse:[ |
1130 | 1609 |
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
|
1610 |
] |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1611 |
] ifFalse:[ |
1894 | 1612 |
xL := hx + halfHeight. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1613 |
doLine ifTrue:[ |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1614 |
self displayLineFromX:xL y:0 toX:xL y:height. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1615 |
] ifFalse:[ |
1130 | 1616 |
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
|
1617 |
] |
1130 | 1618 |
]. |
295 | 1619 |
]. |
1220 | 1620 |
self clippedByChildren:true. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1621 |
|
1894 | 1622 |
oldStyle notNil ifTrue:[ |
1623 |
self lineStyle:oldStyle. |
|
1131 | 1624 |
]. |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1625 |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1626 |
"Modified: / 28.4.1997 / 14:56:26 / dq" |
1894 | 1627 |
"Modified: / 3.5.1999 / 18:49:04 / cg" |
295 | 1628 |
! |
1629 |
||
1630 |
lockRedraw |
|
1631 |
redrawLocked := true |
|
1632 |
! |
|
1633 |
||
1634 |
redrawHandlesFrom:start to:stop |
|
2179 | 1635 |
"redraw some handles and snaps |
1636 |
" |
|
1637 |
subViews size ~~ 0 ifTrue:[ |
|
2236 | 1638 |
"/ do not draw handle, if there is a snapper ... |
2623 | 1639 |
self handleOriginsWithIndexFrom:start to:stop do:[:hPoint :hIndex | |
1640 |
|hx hy| |
|
1641 |
||
1642 |
hx := hPoint x. |
|
1643 |
hy := hPoint y. |
|
1644 |
barLevel notNil ifTrue:[ |
|
1645 |
self drawEdgesForX:0 y:hy width:width height:barHeight level:barLevel. |
|
1646 |
]. |
|
1647 |
(showHandle and:[snapAdornment isNil]) ifTrue:[ |
|
1648 |
self drawHandle:hIndex atX:hx y:hy. |
|
1649 |
]. |
|
1650 |
snapAdornment notNil ifTrue:[ |
|
1651 |
self drawSnapAt:hIndex-1 |
|
2179 | 1652 |
] |
1653 |
]. |
|
1654 |
]. |
|
295 | 1655 |
! |
1656 |
||
1657 |
unlockRedraw |
|
1658 |
redrawLocked := false |
|
1659 |
! ! |
|
1660 |
||
1159 | 1661 |
!VariablePanel methodsFor:'enumerating subviews'! |
1662 |
||
1663 |
changeSequenceOrderFor:aSubView to:anIndex |
|
1416 | 1664 |
"change a subview's position in the subviews collection. |
1159 | 1665 |
" |
1666 |
|success| |
|
1667 |
||
1668 |
success := super changeSequenceOrderFor:aSubView to:anIndex. |
|
1669 |
success ifTrue:[ |
|
1670 |
self setupSubviews. |
|
1671 |
self resizeSubviews. |
|
1672 |
]. |
|
1673 |
^ success |
|
1674 |
! ! |
|
1675 |
||
295 | 1676 |
!VariablePanel methodsFor:'event handling'! |
1677 |
||
1678 |
sizeChanged:how |
|
1679 |
"my size has changed; resize my subviews" |
|
1680 |
||
2123
33fda8594eee
must resize children if realized;
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
1681 |
realized ifTrue:[ |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1682 |
(how == #smaller) ifTrue:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1683 |
self resizeSubviews |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1684 |
] ifFalse:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1685 |
"/ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1686 |
"/ 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
|
1687 |
"/ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1688 |
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
|
1689 |
] |
295 | 1690 |
]. |
1691 |
self changed:#sizeOfView with:how. |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1692 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1693 |
"Modified: 28.1.1997 / 17:56:30 / cg" |
295 | 1694 |
! ! |
1695 |
||
1821
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1696 |
!VariablePanel methodsFor:'focus handling'! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1697 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1698 |
wantsFocusWithButtonPress |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1699 |
"no, do not catch the keyboard focus on button click" |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1700 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1701 |
^ false |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1702 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1703 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1704 |
! ! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1705 |
|
2288 | 1706 |
!VariablePanel methodsFor:'initialization & release'! |
295 | 1707 |
|
871 | 1708 |
computeBarHeight |
958 | 1709 |
"compute the height if the separating bar from either the |
1710 |
form or an explicit height given in the styleSheet" |
|
1711 |
||
1550 | 1712 |
<resource: #style (#'variablePanel.barHeight' |
1713 |
#'variablePanel.barHeightMM')> |
|
924
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1714 |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1715 |
|bH h lvl| |
871 | 1716 |
|
876 | 1717 |
shadowForm notNil ifTrue:[ |
871 | 1718 |
bH := shadowForm height + 2. |
1719 |
] ifFalse:[ |
|
1869 | 1720 |
bH := styleSheet at:#'variablePanel.barHeight'. |
924
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1721 |
bH isNil ifTrue:[ |
1869 | 1722 |
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
|
1723 |
bH := (h * device verticalPixelPerMillimeter) rounded. |
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1724 |
]. |
871 | 1725 |
]. |
1869 | 1726 |
lvl := styleSheet at:#'variablePanel.barLevel' default:0. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1727 |
lvl ~~ 0 ifTrue:[ |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1728 |
bH := bH + (lvl abs * 2). |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1729 |
]. |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1730 |
|
876 | 1731 |
self barHeight:bH. |
871 | 1732 |
knobHeight := bH. |
1733 |
||
1734 |
handleLabels notNil ifTrue:[ |
|
1987 | 1735 |
font := font onDevice:device. |
871 | 1736 |
bH := handleLabels inject:bH into:[:maxSoFar :thisLabel | |
874 | 1737 |
thisLabel isNil ifTrue:[ |
1738 |
maxSoFar |
|
1739 |
] ifFalse:[ |
|
1740 |
maxSoFar max:(thisLabel heightOn:self) |
|
1741 |
] |
|
1742 |
]. |
|
871 | 1743 |
bH := bH + font descent - 1 |
1744 |
]. |
|
1745 |
||
1746 |
self barHeight:bH. |
|
1747 |
||
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1748 |
"Modified: / 29.7.1998 / 14:47:21 / cg" |
871 | 1749 |
! |
1750 |
||
295 | 1751 |
defaultControllerClass |
1752 |
^ VariablePanelController |
|
1753 |
! |
|
1754 |
||
1755 |
initCursor |
|
1756 |
"set the cursor - a double arrow" |
|
1757 |
||
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
1758 |
cursor := self class |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
1759 |
cursorForOrientation:orientation |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
1760 |
onDevice:device |
900 | 1761 |
|
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
1762 |
"Modified: / 30.9.1998 / 18:20:35 / cg" |
295 | 1763 |
! |
1764 |
||
1765 |
initStyle |
|
966 | 1766 |
"setup viewStyle specifics" |
1767 |
||
871 | 1768 |
|mm| |
295 | 1769 |
|
1770 |
super initStyle. |
|
1771 |
||
1987 | 1772 |
handleColor := DefaultHandleColor onDevice:device. |
295 | 1773 |
|
1774 |
DefaultHandleStyle isNil ifTrue:[ |
|
496 | 1775 |
handleStyle := styleSheet name |
295 | 1776 |
] ifFalse:[ |
496 | 1777 |
handleStyle := DefaultHandleStyle |
295 | 1778 |
]. |
1779 |
||
496 | 1780 |
handleLevel := DefaultHandleLevel. |
1781 |
showHandle := DefaultShowHandle. |
|
295 | 1782 |
handlePosition := DefaultHandlePosition. |
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1783 |
"/ snapHandlePosition := DefaultSnapHandlePosition. |
295 | 1784 |
trackLine := DefaultTrackingLine. |
1785 |
separatingLine := DefaultSeparatingLine. |
|
1786 |
||
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1787 |
DefaultHandleImage notNil ifTrue:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1788 |
shadowForm := DefaultHandleImage onDevice:device. |
496 | 1789 |
barWidth := shadowForm width. |
295 | 1790 |
] ifFalse:[ |
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1791 |
handleStyle == #next ifTrue:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1792 |
DefaultHandleImage notNil ifTrue:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1793 |
shadowForm := DefaultHandleImage onDevice:device. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1794 |
] ifFalse:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1795 |
shadowForm := self class shadowFormOn:device. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1796 |
lightForm := self class lightFormOn:device. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1797 |
]. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1798 |
barWidth := shadowForm width. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1799 |
] ifFalse:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1800 |
shadowForm := lightForm := nil. |
496 | 1801 |
|
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1802 |
mm := device verticalPixelPerMillimeter. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1803 |
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
|
1804 |
]. |
295 | 1805 |
]. |
871 | 1806 |
self computeBarHeight. |
496 | 1807 |
|
295 | 1808 |
handleStyle == #mswindows ifTrue:[ |
496 | 1809 |
barWidth := (ArrowButton new direction:#up) width + 1 |
295 | 1810 |
]. |
496 | 1811 |
|
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1812 |
"Modified: / 19.5.1998 / 16:21:02 / cg" |
295 | 1813 |
! |
1814 |
||
1815 |
initialize |
|
496 | 1816 |
orientation isNil ifTrue:[orientation := #vertical]. |
295 | 1817 |
super initialize. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1818 |
self bitGravity:nil. |
496 | 1819 |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1820 |
"Modified: / 29.7.1998 / 16:07:23 / cg" |
295 | 1821 |
! ! |
1822 |
||
1823 |
!VariablePanel methodsFor:'private'! |
|
1824 |
||
1825 |
anyNonRelativeSubviews |
|
1826 |
"return true, if any of my subviews has no relative origin/extent" |
|
1827 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1828 |
self subViews do:[:aComponent | |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1829 |
aComponent relativeCorner isNil ifTrue:[^ true]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1830 |
aComponent relativeOrigin isNil ifTrue:[^ true] |
295 | 1831 |
]. |
1832 |
^ false |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1833 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1834 |
"Modified: 28.1.1997 / 17:57:26 / cg" |
295 | 1835 |
! |
1836 |
||
1655 | 1837 |
expandSubView:expandedView |
1838 |
"expand one of my subviews to full size" |
|
1839 |
||
1840 |
|pos subViews| |
|
1841 |
||
1842 |
realRelativeSizes notNil ifTrue:[ |
|
1843 |
"/ already expanded .. |
|
1844 |
^ self |
|
1845 |
]. |
|
1846 |
||
1847 |
pos := 0.0. |
|
1848 |
subViews := self subViews. |
|
1849 |
||
1850 |
orientation == #vertical ifTrue:[ |
|
1851 |
realRelativeSizes := subViews collect:[:v | v relativeCorner y - v relativeOrigin y]. |
|
1852 |
] ifFalse:[ |
|
1853 |
realRelativeSizes := subViews collect:[:v | v relativeCorner x - v relativeOrigin x]. |
|
1854 |
]. |
|
1855 |
||
1856 |
subViews do:[:aSubView | |
|
1857 |
aSubView == expandedView ifTrue:[ |
|
1858 |
aSubView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
1859 |
pos := 1.0 |
|
1860 |
] ifFalse:[ |
|
1861 |
orientation == #vertical ifTrue:[ |
|
1862 |
aSubView origin:(0.0 @ pos) corner:(1.0 @ pos) |
|
1863 |
] ifFalse:[ |
|
1864 |
aSubView origin:(pos @ 0.0) corner:(pos @ 1.0) |
|
1865 |
] |
|
1866 |
] |
|
1867 |
]. |
|
1868 |
self resizeSubviews. |
|
1869 |
||
1870 |
"Modified: 28.1.1997 / 17:56:20 / cg" |
|
1871 |
! |
|
1872 |
||
871 | 1873 |
handleLabelAt:hIndex |
1874 |
handleLabels notNil ifTrue:[ |
|
1875 |
^ handleLabels at:hIndex ifAbsent:nil |
|
1876 |
]. |
|
1877 |
^ nil |
|
1878 |
! |
|
1879 |
||
1880 |
handleOriginsWithIndexDo:aBlock |
|
295 | 1881 |
"evaluate the argument block for every handle-origin" |
1882 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1883 |
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
|
1884 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1885 |
"Modified: 28.1.1997 / 17:53:44 / cg" |
295 | 1886 |
! |
1887 |
||
871 | 1888 |
handleOriginsWithIndexFrom:start to:stop do:aBlock |
295 | 1889 |
"evaluate the argument block for some handle-origins" |
1890 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1891 |
|x y hw hh hDelta vDelta subViews |
295 | 1892 |
first "{ Class: SmallInteger }" |
1893 |
last "{ Class: SmallInteger }"| |
|
1894 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1895 |
(subViews := self subViews) notNil ifTrue:[ |
871 | 1896 |
shadowForm notNil ifTrue:[ |
1897 |
hw := shadowForm width. |
|
1898 |
hh := shadowForm height. |
|
1899 |
] ifFalse:[ |
|
1900 |
hw := hh := barWidth |
|
1901 |
]. |
|
295 | 1902 |
|
871 | 1903 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[ |
1904 |
hDelta := barWidth // 2. |
|
1905 |
vDelta := barWidth // 2. |
|
1906 |
] ifFalse:[ |
|
1907 |
hDelta := vDelta := 0 |
|
1908 |
]. |
|
295 | 1909 |
|
871 | 1910 |
(handlePosition == #left) ifTrue:[ |
1911 |
x := hDelta. |
|
1381 | 1912 |
y := vDelta. |
1913 |
||
1914 |
orientation == #vertical ifTrue:[ |
|
1915 |
x := x + barWidth |
|
1916 |
] ifFalse:[ |
|
1917 |
y := y + barWidth |
|
1918 |
]. |
|
1919 |
margin ~~ 0 ifTrue:[ |
|
1920 |
x := x + 2 |
|
1921 |
]. |
|
871 | 1922 |
] ifFalse:[ |
1923 |
(handlePosition == #right) ifTrue:[ |
|
1924 |
x := width - hw - margin - hDelta. |
|
1925 |
y := height - hh - margin - vDelta. |
|
1926 |
] ifFalse:[ |
|
1927 |
x := width - barWidth // 2. |
|
1928 |
y := height - barWidth // 2 |
|
1929 |
] |
|
1930 |
]. |
|
1931 |
first := start + 1. |
|
1932 |
last := stop. |
|
1381 | 1933 |
|
871 | 1934 |
first to:last do:[:index | |
1935 |
|view| |
|
295 | 1936 |
|
871 | 1937 |
view := subViews at:index. |
1938 |
orientation == #vertical ifTrue:[ |
|
1939 |
y := view top "origin y" - barHeight + 1. |
|
1940 |
] ifFalse:[ |
|
1941 |
x := view left "origin x" - barHeight + 1. |
|
1942 |
]. |
|
1943 |
aBlock value:(x @ y) value:index |
|
1944 |
] |
|
295 | 1945 |
] |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1946 |
|
1381 | 1947 |
"Modified: / 1.11.1997 / 11:53:40 / cg" |
295 | 1948 |
! |
1949 |
||
2623 | 1950 |
redrawIfShown |
1951 |
shown ifTrue:[ |
|
1952 |
self clear. |
|
1953 |
]. |
|
1954 |
self invalidate |
|
1955 |
! |
|
1956 |
||
2026
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1957 |
resizeSubViewsTo:relativeSizeList |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1958 |
"change subviews sizes as defined in the argument list |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1959 |
(a collection of relative sizes)" |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1960 |
|
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1961 |
|pos subViews| |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1962 |
|
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1963 |
subViews := self subViews. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1964 |
|
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1965 |
pos := 0.0. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1966 |
subViews with:relativeSizeList do:[:aSubView :relSize | |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1967 |
orientation == #vertical ifTrue:[ |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1968 |
aSubView origin:(0.0 @ pos) corner:(1.0 @ (pos + relSize)) |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1969 |
] ifFalse:[ |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1970 |
aSubView origin:(pos @ 0.0) corner:((pos + relSize) @ 1.0) |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1971 |
]. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1972 |
pos := pos + relSize. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1973 |
]. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1974 |
self resizeSubviews. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1975 |
|
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1976 |
! |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1977 |
|
295 | 1978 |
resizeSubviews |
1151
94aff1c7b0aa
Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents:
1131
diff
changeset
|
1979 |
"readjust size of all subviews" |
295 | 1980 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1981 |
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
|
1982 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1983 |
"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
|
1984 |
"Modified: 22.3.1997 / 01:01:31 / stefan" |
295 | 1985 |
! |
1986 |
||
1987 |
resizeSubviewsFrom:start to:stop |
|
1988 |
"readjust size of some subviews" |
|
1989 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1990 |
|step nSubviews subViews| |
295 | 1991 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1992 |
(subViews := self subViews) size > 0 ifTrue:[ |
871 | 1993 |
(start <= stop) ifTrue:[ |
1994 |
step := 1 |
|
1995 |
] ifFalse:[ |
|
1996 |
step := -1 |
|
1997 |
]. |
|
1998 |
nSubviews := subViews size. |
|
1999 |
start to:stop by:step do:[:index | |
|
2026
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
2000 |
|bw view o1 o2 newOrg newCorner newExt| |
295 | 2001 |
|
871 | 2002 |
view := subViews at:index. |
2003 |
bw := view borderWidth. |
|
295 | 2004 |
|
871 | 2005 |
index == 1 ifTrue:[ |
2006 |
o1 := 0. |
|
2007 |
] ifFalse:[ |
|
2008 |
o1 := barHeight // 2 - bw |
|
2009 |
]. |
|
2010 |
index == nSubviews ifTrue:[ |
|
2011 |
o2 := 0. |
|
2012 |
] ifFalse:[ |
|
2013 |
o2 := barHeight // 2 - bw |
|
2014 |
]. |
|
295 | 2015 |
|
871 | 2016 |
newOrg := view computeOrigin. |
2017 |
newOrg notNil ifTrue:[ |
|
2018 |
(index ~~ 1) ifTrue:[ |
|
2019 |
orientation == #vertical ifTrue:[ |
|
2020 |
newOrg y:(newOrg y + o1) |
|
2021 |
] ifFalse:[ |
|
2022 |
newOrg x:(newOrg x + o1) |
|
2023 |
] |
|
2024 |
]. |
|
2025 |
]. |
|
2026 |
newExt := view computeExtent. |
|
2027 |
newExt notNil ifTrue:[ |
|
2028 |
orientation == #vertical ifTrue:[ |
|
2029 |
newExt y:(newExt y - o2 - o1) |
|
2030 |
] ifFalse:[ |
|
2031 |
newExt x:(newExt x - o2 - o1) |
|
2032 |
] |
|
2033 |
]. |
|
2034 |
view pixelOrigin:newOrg extent:newExt. |
|
1550 | 2035 |
]. |
1551 | 2036 |
shown ifTrue:[ |
2037 |
"/ must clear, since handles are copied automatically (by bitGravity) |
|
2038 |
self clear. |
|
2039 |
self invalidate. |
|
2040 |
] |
|
295 | 2041 |
] |
873 | 2042 |
|
2160 | 2043 |
"Modified: / 22.3.1997 / 01:02:21 / stefan" |
2044 |
"Modified: / 23.2.2000 / 18:32:37 / cg" |
|
295 | 2045 |
! |
2046 |
||
1655 | 2047 |
restoreSubViewRatios |
2048 |
"restore my subviews sizes to the state before the full-expand" |
|
2049 |
||
2050 |
|pos subViews | |
|
2051 |
||
2052 |
realRelativeSizes == nil ifTrue:[ |
|
2053 |
"/ not expanded - ignore |
|
2054 |
^ self |
|
2055 |
]. |
|
2056 |
||
2057 |
pos := 0.0. |
|
2058 |
self subViews with:realRelativeSizes do:[:aSubView :aRelativeSize | |
|
2059 |
orientation == #vertical ifTrue:[ |
|
2060 |
aSubView origin:(0.0 @ pos) corner:(1.0 @ (pos+aRelativeSize)) |
|
2061 |
] ifFalse:[ |
|
2062 |
aSubView origin:(pos @ 0.0) corner:((pos+aRelativeSize) @ 1.0) |
|
2063 |
]. |
|
2064 |
pos := pos + aRelativeSize |
|
2065 |
]. |
|
2066 |
realRelativeSizes := nil. |
|
2067 |
self resizeSubviews. |
|
2068 |
||
2069 |
"Modified: 28.1.1997 / 17:56:20 / cg" |
|
2070 |
! |
|
2071 |
||
295 | 2072 |
setupSubviews |
2073 |
"setup subviews sizes (in case of non-relative sizes)" |
|
2074 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2075 |
|pos delta subViews nSubViews "{ Class: SmallInteger }"| |
295 | 2076 |
|
300 | 2077 |
"/ setup all subviews to spread evenly ... |
295 | 2078 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2079 |
subViews := self subViews. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2080 |
nSubViews := subViews size. |
1043 | 2081 |
nSubViews == 0 ifTrue:[^ self]. |
295 | 2082 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2083 |
pos := 0.0. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2084 |
delta := 1.0 / nSubViews. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2085 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2086 |
1 to:nSubViews do:[:index | |
2160 | 2087 |
|view org corn| |
295 | 2088 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2089 |
view := subViews at:index. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2090 |
orientation == #vertical ifTrue:[ |
2160 | 2091 |
org := (0.0 @ pos). |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2092 |
index == subViews size ifTrue:[ |
2160 | 2093 |
corn := (1.0 @ 1.0) |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2094 |
] ifFalse:[ |
2160 | 2095 |
corn := (1.0 @ (pos + delta)) |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2096 |
]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2097 |
] ifFalse:[ |
2160 | 2098 |
org := (pos @ 0.0). |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2099 |
index == subViews size ifTrue:[ |
2160 | 2100 |
corn := (1.0 @ 1.0) |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2101 |
] ifFalse:[ |
2160 | 2102 |
corn := ((pos + delta) @ 1.0) |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2103 |
]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2104 |
]. |
2160 | 2105 |
view origin:org corner:corn. |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2106 |
pos := pos + delta |
295 | 2107 |
] |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2108 |
|
2160 | 2109 |
"Modified: / 23.2.2000 / 18:14:01 / cg" |
295 | 2110 |
! ! |
2111 |
||
2743 | 2112 |
!VariablePanel methodsFor:'private-snap queries'! |
2179 | 2113 |
|
2114 |
canChangeExtentOfViewAt:anIndex |
|
2115 |
"returns true if extent at an index is changable |
|
2116 |
" |
|
2117 |
|view| |
|
2118 |
||
2119 |
view := subViews at:anIndex ifAbsent:[^ false]. |
|
2120 |
||
2121 |
orientation == #vertical ifTrue:[ |
|
2122 |
view height > 2 ifFalse:[ |
|
2123 |
view := subViews at:(anIndex + 1) ifAbsent:[^ false]. |
|
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2124 |
^ view height > 2 |
2179 | 2125 |
]. |
2126 |
^ true |
|
2127 |
]. |
|
2128 |
||
2129 |
view width > 2 ifFalse:[ |
|
2130 |
view := subViews at:(anIndex + 1) ifAbsent:[^ false]. |
|
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2131 |
^ view width > 2 |
2179 | 2132 |
]. |
2133 |
^ true |
|
2134 |
! |
|
2135 |
||
2136 |
initSnapAdornment |
|
2137 |
|num icon level enterLevel selectedLevel color| |
|
2138 |
||
2139 |
snapAdornment notNil ifTrue:[^ snapAdornment ]. |
|
2140 |
||
2141 |
snapAdornment := IdentityDictionary new. |
|
2142 |
||
2143 |
level := styleSheet at:#'variablePanel.snapLevel' default:1. |
|
2144 |
enterLevel := styleSheet at:#'variablePanel.snapEnterLevel' default:level. |
|
2145 |
selectedLevel := styleSheet at:#'variablePanel.selectedLevel' default:(level negated). |
|
2146 |
||
2147 |
snapAdornment at:#level put:level. |
|
2148 |
snapAdornment at:#enterLevel put:enterLevel. |
|
2149 |
snapAdornment at:#selectedLevel put:selectedLevel. |
|
2150 |
snapAdornment at:#mode put:#min. |
|
2151 |
||
2152 |
color := styleSheet colorAt:#'variablePanel.snapSelectedBgColor' |
|
2153 |
default:(StyleSheet colorAt:#'button.activeBackgroundColor'). |
|
2154 |
color notNil ifTrue:[ |
|
2155 |
snapAdornment at:#selectedBgColor put:(color onDevice:device) |
|
2156 |
]. |
|
2157 |
||
2158 |
color := StyleSheet colorAt:#'variablePanel.snapEnterBgColor' |
|
2159 |
default:(StyleSheet colorAt:#'button.enteredBackgroundColor'). |
|
2160 |
color notNil ifTrue:[ |
|
2161 |
snapAdornment at:#enterBgColor put:(color onDevice:device) |
|
2162 |
]. |
|
2163 |
||
2164 |
self class snapIcons keysAndValuesDo:[:aKey :anIcon| |
|
2279 | 2165 |
anIcon device == device ifTrue:[ |
2166 |
icon := anIcon |
|
2167 |
] ifFalse:[ |
|
2168 |
icon := anIcon copy onDevice:device. |
|
2169 |
icon clearMaskedPixels. |
|
2170 |
device == Display ifTrue:[ |
|
2171 |
self class snapIcons at:aKey put:icon. |
|
2172 |
] |
|
2173 |
]. |
|
2179 | 2174 |
snapAdornment at:aKey put:icon |
2175 |
]. |
|
2176 |
"compute required snap extent including level and margins ..." |
|
2177 |
||
2178 |
num := level abs max:(enterLevel abs). |
|
2179 |
num := num max:(selectedLevel abs). |
|
2180 |
num := num + 2 "margin into handle := 1" * 2. |
|
2181 |
icon := snapAdornment at:#iconUp. |
|
2182 |
||
2183 |
snapAdornment at:#height put:(icon height + num). |
|
2184 |
snapAdornment at:#width put:(icon width + num). |
|
2185 |
||
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2186 |
^ snapAdornment |
2179 | 2187 |
! |
2188 |
||
2189 |
snapAtIndexWillGrow:anIndex |
|
2190 |
"returns true if the view assigned to the snap at an index will grow |
|
2191 |
if pressing the snap |
|
2192 |
" |
|
2193 |
|view mode| |
|
2194 |
||
2195 |
(mode := self snapMode) notNil ifTrue:[ |
|
2196 |
(mode == #max or:[mode == #maxMin]) ifTrue:[ |
|
2197 |
"on press the view is increased to bottom(vertical) or right(horizontal)" |
|
2198 |
view := subViews at:(anIndex + 1) ifAbsent:[^ false]. |
|
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2199 |
^ orientation == #vertical ifTrue:[view height > 2] ifFalse:[view width > 2] |
2179 | 2200 |
]. |
2201 |
||
2202 |
(mode == #min or:[mode == #minMax]) ifTrue:[ |
|
2203 |
"on press the view is decreased to top(vertical) or left (horizontal)" |
|
2204 |
view := subViews at:anIndex ifAbsent:[^ false]. |
|
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2205 |
^ orientation == #vertical ifTrue:[view height <= 2] ifFalse:[view width <= 2] |
2236 | 2206 |
]. |
2207 |
||
2269 | 2208 |
self error:'unexepected snapMode state'. |
2179 | 2209 |
]. |
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2210 |
^ false "snap is disabled" |
2179 | 2211 |
! |
2212 |
||
2213 |
snapLayoutAt:anIndex |
|
2214 |
"returns the layout of the snap at an index |
|
2215 |
or nil if snaps are disabled |
|
2216 |
" |
|
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2217 |
|v1 v2 left top right bot w snapX snapY| |
2179 | 2218 |
|
2219 |
snapAdornment isNil ifTrue:[^ nil]. "snap disabled" |
|
2220 |
||
2221 |
v1 := subViews at:anIndex ifAbsent:[^ nil]. |
|
2222 |
v2 := subViews at:anIndex + 1 ifAbsent:[^ nil]. |
|
2223 |
w := snapAdornment at:#width ifAbsent:0. |
|
2224 |
||
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
2225 |
handlePosition "snapHandlePosition" == #left ifTrue:[ |
2241
d9c7f1486b7a
draw snap at very left of panel
Claus Gittinger <cg@exept.de>
parents:
2240
diff
changeset
|
2226 |
snapX := snapY := margin. "/ ViewSpacing. |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2227 |
] ifFalse:[ |
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
2228 |
handlePosition "snapHandlePosition" == #right ifTrue:[ |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2229 |
snapX := width - w. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2230 |
snapY := height - w. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2231 |
] ifFalse:[ |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2232 |
snapX := (width - w) // 2. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2233 |
snapY := (height - w) // 2. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2234 |
]. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2235 |
]. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2236 |
|
2179 | 2237 |
orientation == #vertical ifTrue:[ |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2238 |
left := snapX. "/ v1 width - w // 2. |
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2239 |
top := v1 bottom + 1. |
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2240 |
right := left + w. |
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2241 |
bot := v2 top. |
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2242 |
] ifFalse:[ |
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2243 |
top := snapY. "/ v1 height - w // 2. |
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2244 |
left := v1 right + 1. |
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2245 |
right := v2 left. |
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2246 |
bot := top + w. |
2179 | 2247 |
]. |
2598
6817bf076dc9
beautified CAs UGLY indent style
Claus Gittinger <cg@exept.de>
parents:
2590
diff
changeset
|
2248 |
^ Rectangle left:left top:top right:right bottom:bot |
2179 | 2249 |
! ! |
2250 |
||
2743 | 2251 |
!VariablePanel methodsFor:'private-tableView protocol'! |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2252 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2253 |
setupSubviewOrigins |
826 | 2254 |
"setup subviews origins |
2255 |
if we only have relative extents |
|
2256 |
(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
|
2257 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2258 |
|x y e eX eY subViews n "{ Class: SmallInteger }"| |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2259 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2260 |
x := y := 0.0. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2261 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2262 |
subViews := self subViews. |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2263 |
n := subViews size. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2264 |
1 to:n do:[:index | |
826 | 2265 |
|view| |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2266 |
|
826 | 2267 |
view := subViews at:index. |
2268 |
e := view relativeExtent. |
|
2269 |
e notNil ifTrue:[ |
|
2270 |
view relativeExtent:nil. |
|
2271 |
eX := e x. |
|
2272 |
eY := e y. |
|
2273 |
index == n ifTrue:[ |
|
2274 |
view origin:(x @ y) corner:(1.0 @ 1.0) |
|
2275 |
] ifFalse:[ |
|
2276 |
orientation == #vertical ifTrue:[ |
|
2277 |
view origin:(x @ y) corner:(1.0 @ (y+eY)) |
|
2278 |
] ifFalse:[ |
|
2279 |
view origin:(x @ y) corner:((x+eX) @ 1.0) |
|
2280 |
]. |
|
2281 |
]. |
|
2282 |
orientation == #vertical ifTrue:[ |
|
2283 |
y := y + eY. |
|
2284 |
] ifFalse:[ |
|
2285 |
x := x + eX. |
|
2286 |
] |
|
2287 |
] ifFalse: [ |
|
2288 |
view origin:(x @ y). |
|
2289 |
orientation == #vertical ifTrue:[ |
|
2290 |
y := view relativeCorner y. |
|
2291 |
] ifFalse:[ |
|
2292 |
x := view relativeCorner x. |
|
2293 |
] |
|
2294 |
]. |
|
2295 |
] |
|
2296 |
||
2297 |
"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
|
2298 |
"Modified: 28.1.1997 / 17:55:21 / cg" |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2299 |
! ! |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2300 |
|
2288 | 2301 |
!VariablePanel methodsFor:'realization'! |
2302 |
||
2303 |
fixSize |
|
2304 |
super fixSize. |
|
2305
f2850e54b0ab
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
2288
diff
changeset
|
2305 |
self extentChangedFlag ifTrue:[ |
2288 | 2306 |
self resizeSubviews |
2307 |
]. |
|
2308 |
||
2309 |
"Modified: 22.3.1997 / 01:19:55 / stefan" |
|
2531
6fc09f6a83dd
fix relative sizes when realized
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
2310 |
! |
6fc09f6a83dd
fix relative sizes when realized
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
2311 |
|
6fc09f6a83dd
fix relative sizes when realized
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
2312 |
realize |
6fc09f6a83dd
fix relative sizes when realized
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
2313 |
super realize. |
6fc09f6a83dd
fix relative sizes when realized
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
2314 |
self anyNonRelativeSubviews ifTrue:[ |
2533 | 2315 |
self setupSubviews. |
2316 |
self sizeChanged:nil. "/ force recomputation of subviews |
|
2531
6fc09f6a83dd
fix relative sizes when realized
Claus Gittinger <cg@exept.de>
parents:
2483
diff
changeset
|
2317 |
]. |
2288 | 2318 |
! ! |
2319 |
||
2320 |
!VariablePanel methodsFor:'redrawing'! |
|
2321 |
||
2322 |
redraw |
|
2323 |
"redraw all of the handles" |
|
2324 |
||
2325 |
redrawLocked ~~ true ifTrue:[ |
|
2326 |
"/ self clear. |
|
2327 |
self redrawHandlesFrom:1 to:(self subViews size) |
|
2328 |
] |
|
2329 |
||
2330 |
"Modified: 28.1.1997 / 17:54:15 / cg" |
|
2331 |
! ! |
|
2332 |
||
871 | 2333 |
!VariablePanel class methodsFor:'documentation'! |
295 | 2334 |
|
2335 |
version |
|
3278 | 2336 |
^ '$Header: /cvs/stx/stx/libwidg/VariablePanel.st,v 1.85 2006-03-06 09:00:45 cg Exp $' |
295 | 2337 |
! ! |