author | martin |
Mon, 19 Nov 2001 18:06:33 +0100 | |
changeset 2482 | b499b4a10907 |
parent 2305 | f2850e54b0ab |
child 2483 | 94560abb05ce |
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 |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
16 |
instanceVariableNames:'barHeight barWidth separatingLine shadowForm lightForm showHandle |
295 | 17 |
handlePosition handleColor handleStyle handleLevel noColor |
1655 | 18 |
trackLine redrawLocked orientation handleLabels knobHeight |
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
19 |
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 |
|
744 |
constantNamed:#'VariablePanel snapIconDown' |
|
745 |
ifAbsentPut:[(Depth4Image new) width: 62; height: 5; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2270 | 746 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@L3@CL0@3LAL3@SL0D3LAL3@SL0D3L@@@@@@@@@@@@C@P@0D@LA@S@PD0DALA@S@PD0DALA@@ |
2482 | 747 |
@@@@@@@@@@@QD@DQ@ADP@QD@DQ@ADP@QD@DQ@ADP@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 68 68 68 141 141 141 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] |
748 |
! |
|
2269 | 749 |
|
750 |
snapIconLeft |
|
751 |
"This resource specification was automatically generated |
|
752 |
by the ImageEditor of ST/X." |
|
753 |
||
754 |
"Do not manually edit this!! If it is corrupted, |
|
755 |
the ImageEditor may not be able to read the specification." |
|
756 |
||
757 |
" |
|
758 |
self snapIconLeft inspect |
|
759 |
ImageEditor openOnClass:self andSelector:#snapIconLeft |
|
760 |
" |
|
761 |
||
762 |
<resource: #image> |
|
763 |
||
764 |
^Icon |
|
765 |
constantNamed:#'VariablePanel snapIconLeft' |
|
766 |
ifAbsentPut:[(Depth4Image new) width: 5; height: 62; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2270 | 767 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@3D@@0D@@1D@@@@@@@@@@3D@@0D@@1D@@@@@@@@@@3D@@0D@@1D@@@@@@AD@@3D@@0D@@1D@@@@@@AD@ |
768 |
@3D@@0D@@1D@@@@@@AD@@3D@@0D@@1D@@@@@@AD@@3D@@0D@@1D@@@@@@AD@@3D@@0D@@1D@@@@@@AD@@3@@@0D@@AD@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2482 | 769 |
@@@@@@@@') ; colorMapFromArray:#[0 0 0 68 68 68 141 141 141 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] |
770 |
! |
|
2269 | 771 |
|
772 |
snapIconLeftRight |
|
773 |
"This resource specification was automatically generated |
|
774 |
by the ImageEditor of ST/X." |
|
775 |
||
776 |
"Do not manually edit this!! If it is corrupted, |
|
777 |
the ImageEditor may not be able to read the specification." |
|
778 |
||
779 |
" |
|
780 |
self snapIconLeftRight inspect |
|
781 |
ImageEditor openOnClass:self andSelector:#snapIconLeftRight |
|
782 |
" |
|
783 |
||
784 |
<resource: #image> |
|
785 |
||
786 |
^Icon |
|
787 |
constantNamed:#'VariablePanel snapIconLeftRight' |
|
788 |
ifAbsentPut:[(Depth4Image new) width: 5; height: 62; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2274 | 789 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@3@@@0D@@AD@@@@@@@@@@3L@@0D@@QD@@@@@@@@@L3L3@@@@@@@@@@@@@@@@@3L@@0D@@QD@@@@@@@@@ |
790 |
@3L@@0D@@QD@@@@@@@@@@3L@@0D@@QD@@@@@@@@@L3L0@@@C@@@@@@@@@@@@@3L@@0D@@QD@@@@@@@@@@3L@@0D@@QD@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2482 | 791 |
@@@@@@@@') ; colorMapFromArray:#[0 0 0 68 68 68 141 141 141 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] |
792 |
! |
|
2269 | 793 |
|
794 |
snapIconRight |
|
795 |
"This resource specification was automatically generated |
|
796 |
by the ImageEditor of ST/X." |
|
797 |
||
798 |
"Do not manually edit this!! If it is corrupted, |
|
799 |
the ImageEditor may not be able to read the specification." |
|
800 |
||
801 |
" |
|
802 |
self snapIconRight inspect |
|
803 |
ImageEditor openOnClass:self andSelector:#snapIconRight |
|
804 |
" |
|
805 |
||
806 |
<resource: #image> |
|
807 |
||
808 |
^Icon |
|
809 |
constantNamed:#'VariablePanel snapIconRight' |
|
810 |
ifAbsentPut:[(Depth4Image new) width: 5; height: 62; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2270 | 811 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@3@@@0D@@AD@@Q@@@@@@@3L@@0D@@QD@@Q@@@@@@@3L@@0D@@QD@@Q@@@@@@@3L@@0D@@QD@@Q@@@@@@@3L@ |
812 |
@0D@@QD@@Q@@@@@@@3L@@0D@@QD@@Q@@@@@@@3L@@0D@@QD@@@@@@@@@@3L@@0D@@QD@@@@@@@@@@3L@@0D@@QD@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
2482 | 813 |
@@@@@@@@') ; colorMapFromArray:#[0 0 0 68 68 68 141 141 141 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] |
814 |
! |
|
2269 | 815 |
|
816 |
snapIconUp |
|
817 |
"This resource specification was automatically generated |
|
818 |
by the ImageEditor of ST/X." |
|
819 |
||
820 |
"Do not manually edit this!! If it is corrupted, |
|
821 |
the ImageEditor may not be able to read the specification." |
|
822 |
||
823 |
" |
|
824 |
self snapIconUp inspect |
|
825 |
ImageEditor openOnClass:self andSelector:#snapIconUp |
|
826 |
" |
|
827 |
||
828 |
<resource: #image> |
|
829 |
||
830 |
^Icon |
|
831 |
constantNamed:#'VariablePanel snapIconUp' |
|
832 |
ifAbsentPut:[(Depth4Image new) width: 62; height: 5; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2270 | 833 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@CL0@3L@L3@CL0@3L@L3@CL0@3@@L0@@@@@@@@@@@@@0DPLADC@Q@0DPLADC@Q@0D@LA@C@P@@ |
2482 | 834 |
@@@@@@@@@@@QD@DQ@ADP@QD@DQ@ADP@Q@@DP@AD@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 68 68 68 141 141 141 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] |
835 |
! |
|
2269 | 836 |
|
837 |
snapIconUpDown |
|
838 |
"This resource specification was automatically generated |
|
839 |
by the ImageEditor of ST/X." |
|
840 |
||
841 |
"Do not manually edit this!! If it is corrupted, |
|
842 |
the ImageEditor may not be able to read the specification." |
|
843 |
||
844 |
" |
|
845 |
self snapIconUpDown inspect |
|
846 |
ImageEditor openOnClass:self andSelector:#snapIconUpDown |
|
847 |
" |
|
848 |
||
849 |
<resource: #image> |
|
850 |
||
851 |
^Icon |
|
852 |
constantNamed:#'VariablePanel snapIconUpDown' |
|
853 |
ifAbsentPut:[(Depth4Image new) width: 62; height: 5; photometric:(#palette); bitsPerSample:(#(4 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:' |
|
2274 | 854 |
@@@@@@@@@@@@@@@0@@@@@@@@@@@@L@@@@@@@@@@@@@@@@@@@L0@CL@@@L@L0@CL@@3@@@C@CL@@3@@@@@@@@@@@@@C@P@0D@DC@C@P@0D@LA@@@0@0D@LA@@ |
2482 | 855 |
@@@@@@@@@@@AD@@Q@@@0@AD@@Q@@DP@@L@@Q@@DP@@@@@@@@@@@@@@@@@@@@L@@@@@@@@@@@@C@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 68 68 68 141 141 141 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] |
856 |
! ! |
|
2269 | 857 |
|
295 | 858 |
!VariablePanel methodsFor:'accessing'! |
859 |
||
860 |
orientation |
|
485 | 861 |
"return my orientation; either #horizontal or #vertical" |
862 |
||
295 | 863 |
^ orientation |
485 | 864 |
|
865 |
"Modified: 6.3.1996 / 18:08:45 / cg" |
|
295 | 866 |
! |
867 |
||
868 |
orientation:aSymbol |
|
485 | 869 |
"change my orientation; aSymbol must be one of #horizontal or #vertical. |
870 |
Changing implies a resize of my subViews." |
|
871 |
||
872 |
aSymbol ~~ orientation ifTrue:[ |
|
873 |
orientation := aSymbol. |
|
874 |
self initCursor. |
|
875 |
self anyNonRelativeSubviews ifTrue:[ |
|
876 |
self setupSubviews |
|
877 |
]. |
|
878 |
shown ifTrue:[ |
|
879 |
self cursor:cursor. |
|
880 |
self sizeChanged:nil. |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
881 |
self invalidate. |
485 | 882 |
] |
295 | 883 |
] |
485 | 884 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
885 |
"Modified: 29.5.1996 / 16:22:35 / cg" |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
886 |
! ! |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
887 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
888 |
!VariablePanel methodsFor:'accessing-look'! |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
889 |
|
295 | 890 |
barHeight |
891 |
"return the height of the separating bar" |
|
892 |
||
893 |
^ barHeight |
|
894 |
! |
|
895 |
||
896 |
barHeight:nPixel |
|
897 |
"set the height of the separating bar" |
|
898 |
||
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
899 |
|bH| |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
900 |
|
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
901 |
bH := nPixel. |
295 | 902 |
|
1207 | 903 |
"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
|
904 |
(bH < 4) ifTrue:[ |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
905 |
bH := 4 |
295 | 906 |
]. |
907 |
||
876 | 908 |
"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
|
909 |
bH odd ifTrue:[ |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
910 |
bH := bH + 1 |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
911 |
]. |
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
912 |
self setBarHeight:bH |
876 | 913 |
|
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
914 |
"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
|
915 |
"Modified: / 30.1.2000 / 22:31:32 / cg" |
876 | 916 |
! |
917 |
||
918 |
handleImage:aBitmapOrImage |
|
919 |
"define the handles image" |
|
920 |
||
921 |
shadowForm := aBitmapOrImage. |
|
922 |
lightForm := nil. |
|
923 |
self computeBarHeight. |
|
924 |
||
925 |
"Created: 7.11.1996 / 20:21:10 / cg" |
|
926 |
"Modified: 7.11.1996 / 20:27:22 / cg" |
|
295 | 927 |
! |
928 |
||
871 | 929 |
handleLabels:aCollectionOfLabels |
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
930 |
"define special handle labels - typically a collection of |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
931 |
bitmap images. Notice, that the first handle is not |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
932 |
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
|
933 |
|
871 | 934 |
orientation == #horizontal ifTrue:[ |
935 |
self error:'not allowed for horizontal panels' |
|
936 |
]. |
|
937 |
||
938 |
handleLabels := aCollectionOfLabels. |
|
939 |
self computeBarHeight. |
|
940 |
self resizeSubviews. |
|
941 |
||
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
942 |
" |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
943 |
|top panel v1 v2| |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
944 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
945 |
top := StandardSystemView new. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
946 |
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
|
947 |
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
|
948 |
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
|
949 |
panel handleStyle:nil. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
950 |
panel handleLabels:#('foo' 'bar'). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
951 |
top open |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
952 |
" |
871 | 953 |
! |
954 |
||
295 | 955 |
handleLevel:aNumber |
956 |
"define the 3D level of the handle (only with some styles). |
|
957 |
Normally, this is defined via styleSheet files, but this entry allows |
|
958 |
individual views to be manipulated." |
|
959 |
||
2244 | 960 |
handleLevel ~~ aNumber ifTrue:[ |
961 |
handleLevel := aNumber. |
|
962 |
shown ifTrue:[ |
|
963 |
self clear. |
|
964 |
self invalidate |
|
965 |
] |
|
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
966 |
] |
295 | 967 |
! |
968 |
||
969 |
handlePosition |
|
970 |
"return the position of the handle" |
|
971 |
||
972 |
^ handlePosition |
|
973 |
! |
|
974 |
||
975 |
handlePosition:aSymbol |
|
976 |
"define the position of the handle; the argument aSymbol |
|
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
977 |
may be one of #left, #right or #center. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
978 |
If never set by the program, the position is controlled by the styleSheet." |
295 | 979 |
|
2244 | 980 |
handlePosition ~~ aSymbol ifTrue:[ |
981 |
handlePosition := aSymbol ? DefaultHandlePosition. |
|
982 |
shown ifTrue:[ |
|
983 |
self clear. |
|
984 |
self invalidate |
|
985 |
] |
|
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
986 |
] |
295 | 987 |
! |
988 |
||
876 | 989 |
handleShadowImage:shadowImage lightImage:lightImage |
990 |
"define the handles image; both shadow and light parts" |
|
991 |
||
992 |
shadowForm := shadowImage. |
|
993 |
lightForm := lightImage. |
|
994 |
self computeBarHeight. |
|
995 |
||
996 |
"Created: 7.11.1996 / 20:21:51 / cg" |
|
997 |
"Modified: 7.11.1996 / 20:27:26 / cg" |
|
998 |
! |
|
999 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1000 |
handleStyle:styleSymbol |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1001 |
"define the style of the handle; |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1002 |
styleSymbol may be #motif to draw a little knob or |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1003 |
anything else to draw scrollBars handleForm. |
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1004 |
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
|
1005 |
individual views to be manipulated." |
295 | 1006 |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1007 |
(styleSymbol ~~ handleStyle) ifTrue:[ |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1008 |
handleStyle := styleSymbol. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1009 |
handleStyle == #next ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1010 |
shadowForm := self class shadowFormOn:device. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1011 |
lightForm := self class lightFormOn:device. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1012 |
] ifFalse:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1013 |
shadowForm := lightForm := nil |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1014 |
]. |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1015 |
|
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1016 |
shadowForm notNil ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1017 |
(self is3D and:[handleStyle ~~ #motif]) ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1018 |
self barHeight:(shadowForm height + 2). |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1019 |
barWidth := shadowForm width |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1020 |
] |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1021 |
]. |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1022 |
shown ifTrue:[ |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1023 |
self resizeSubviews. |
2244 | 1024 |
self clear. |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1025 |
self invalidate |
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1026 |
] |
295 | 1027 |
] |
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1028 |
|
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1029 |
"Created: 24.2.1996 / 19:04:07 / cg" |
722
3f297a438fec
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
1030 |
"Modified: 29.5.1996 / 16:22:24 / cg" |
295 | 1031 |
! |
1032 |
||
1948 | 1033 |
setBarHeight:nPixel |
2179 | 1034 |
"check whether snap matches to extent of bar otherwise disable snap |
1035 |
" |
|
1036 |
snapAdornment notNil ifTrue:[ |
|
1037 |
barHeight := nPixel max:(snapAdornment at:#height ifAbsent:0) |
|
1038 |
] ifFalse:[ |
|
1039 |
barHeight := nPixel max:0 |
|
1040 |
]. |
|
1948 | 1041 |
|
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
1042 |
realized ifTrue:[ |
2179 | 1043 |
self resizeSubviews |
2108
b9322a905330
resize when the barWidth is changed while already visible.
Claus Gittinger <cg@exept.de>
parents:
2084
diff
changeset
|
1044 |
] |
1948 | 1045 |
|
1046 |
! |
|
1047 |
||
2114 | 1048 |
showHandle |
1049 |
"return the the handle-drawing flag; aBoolean" |
|
1050 |
||
1051 |
^ showHandle |
|
1052 |
! |
|
1053 |
||
1054 |
showHandle:aBoolean |
|
1055 |
"enabled/disable the handle-drawing" |
|
1056 |
||
2244 | 1057 |
showHandle ~~ aBoolean ifTrue:[ |
1058 |
showHandle := aBoolean ? DefaultShowHandle. |
|
1059 |
realized ifTrue:[ |
|
1060 |
self clear. |
|
1061 |
self invalidate |
|
1062 |
] |
|
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1063 |
] |
2114 | 1064 |
! |
1065 |
||
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1066 |
snapHandlePosition |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1067 |
"return the position of the snap-handle" |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1068 |
|
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1069 |
^ self handlePosition. "/ ^ snapHandlePosition |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1070 |
! |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1071 |
|
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1072 |
snapHandlePosition:aSymbol |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1073 |
"define the position of the snap-handle; the argument aSymbol |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1074 |
may be one of #left, #right or #center. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1075 |
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
|
1076 |
|
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1077 |
self handlePosition:aSymbol. |
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1078 |
|
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1079 |
"/ snapHandlePosition := aSymbol. |
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1080 |
"/ realized ifTrue:[ |
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1081 |
"/ self invalidate |
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1082 |
"/ ] |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1083 |
! |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1084 |
|
2179 | 1085 |
snapMode |
1086 |
"allowed modes are: |
|
1087 |
nil no snap |
|
1088 |
||
1089 |
#max on press the view is increased to bottom(vertical) or right(horizontal) |
|
1090 |
#min on press the view is decreased to top (vertical) or left (horizontal) |
|
1091 |
#maxMin on press the view is increased or decreased dependent on its current extent |
|
1092 |
#minMax on press the view is increased or decreased dependent on its current extent |
|
1093 |
" |
|
1094 |
snapAdornment notNil ifTrue:[ |
|
1095 |
^ snapAdornment at:#mode ifAbsent:nil |
|
1096 |
]. |
|
1097 |
^ nil |
|
1098 |
||
1099 |
! |
|
1100 |
||
1101 |
snapMode:aMode |
|
1102 |
"allowed modes are: |
|
1103 |
nil no snap |
|
1104 |
||
1105 |
#max on press the view is increased to bottom(vertical) or right(horizontal) |
|
1106 |
#min on press the view is decreased to top (vertical) or left (horizontal) |
|
1107 |
#maxMin on press the view is increased or decreased dependent on its current extent |
|
1108 |
#minMax on press the view is increased or decreased dependent on its current extent |
|
1109 |
" |
|
1110 |
|oldHeight oldMode| |
|
1111 |
||
1112 |
aMode notNil ifTrue:[ |
|
2236 | 1113 |
( #( max min maxMin minMax both) includes:aMode) ifFalse:[ |
2179 | 1114 |
^ self error:('unknown snapMode: ', aMode printString). |
1115 |
] |
|
1116 |
]. |
|
1117 |
(oldMode := self snapMode) == aMode ifTrue:[^ self]. |
|
1118 |
||
1119 |
(snapAdornment notNil and:[aMode notNil]) ifTrue:[ |
|
1120 |
"must only redraw" |
|
1121 |
snapAdornment at:#mode put:aMode |
|
1122 |
] ifFalse:[ |
|
1123 |
"must recompute barHeight and redraw" |
|
1124 |
||
1125 |
aMode isNil ifTrue:[ |
|
1126 |
snapAdornment := nil |
|
1127 |
] ifFalse:[ |
|
1128 |
self initSnapAdornment. |
|
1129 |
snapAdornment at:#mode put:aMode. |
|
1130 |
]. |
|
1131 |
oldHeight := barHeight. |
|
1132 |
||
1133 |
self computeBarHeight. |
|
1134 |
||
1135 |
oldHeight ~~ barHeight ifTrue:[ |
|
1136 |
"must recompute subViews" |
|
1137 |
self setupSubviews. |
|
1138 |
self resizeSubviews. |
|
1139 |
] |
|
1140 |
]. |
|
1141 |
shown ifTrue:[ |
|
2244 | 1142 |
self clear. |
2179 | 1143 |
self invalidate |
1144 |
]. |
|
1145 |
! |
|
1146 |
||
295 | 1147 |
style:styleSymbol |
1148 |
"define the style of the handle; |
|
1149 |
styleSymbol may be #motif to draw a little knob or |
|
1150 |
anything else to draw scrollBars handleForm. |
|
1151 |
Normally, this is defined via styleSheet files, but this entry allows |
|
1152 |
individual views to be manipulated." |
|
1153 |
||
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1154 |
self handleStyle:styleSymbol |
295 | 1155 |
|
395
db172e0f3d56
renamed #style: to #handleStyle:
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
1156 |
"Modified: 24.2.1996 / 19:04:19 / cg" |
295 | 1157 |
! ! |
1158 |
||
2288 | 1159 |
!VariablePanel methodsFor:'adding & removing components'! |
1160 |
||
1161 |
addSubView:aView |
|
1162 |
"a view is added; adjust other subviews sizes" |
|
1163 |
||
1164 |
super addSubView:aView. |
|
1165 |
||
1166 |
"/ (aView relativeOrigin isNil |
|
1167 |
"/ or:[aView relativeExtent isNil and:[aView relativeCorner isNil]]) ifTrue:[ |
|
1168 |
"/ aView geometryLayout:nil. |
|
1169 |
"/ aView origin:0.0@0.0. |
|
1170 |
"/ aView extent:1.0@0.5. |
|
1171 |
"/ self setupSubviews |
|
1172 |
"/ ]. |
|
1173 |
||
1174 |
realized ifTrue:[ |
|
2482 | 1175 |
self setupSubviews. |
2288 | 1176 |
self resizeSubviews. |
1177 |
] |
|
1178 |
||
1179 |
"Created: 17.1.1996 / 22:41:00 / cg" |
|
1180 |
"Modified: 24.2.1996 / 19:05:05 / cg" |
|
1181 |
! |
|
1182 |
||
1183 |
removeSubView:aView |
|
1184 |
"a view is removed; adjust other subviews sizes" |
|
1185 |
||
1186 |
super removeSubView:aView. |
|
1187 |
shown ifTrue:[ |
|
1188 |
(superView isNil or:[superView shown]) ifTrue:[ |
|
1189 |
self setupSubviews. |
|
1190 |
self resizeSubviews. |
|
1191 |
] |
|
1192 |
] |
|
1193 |
! ! |
|
1194 |
||
295 | 1195 |
!VariablePanel methodsFor:'drawing'! |
1196 |
||
871 | 1197 |
drawHandle:hIndex atX:hx y:hy |
295 | 1198 |
"draw a single handle at hx/hy" |
1199 |
||
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1200 |
|h w x y m xm ym lbl maxKnob |
1096 | 1201 |
mar "{ Class: SmallInteger }" |
1202 |
barWidthInt "{ Class: SmallInteger }" |
|
1203 |
barHeightInt "{ Class: SmallInteger }" | |
|
295 | 1204 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1205 |
((handleStyle isNil or:[handleStyle == #none]) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1206 |
and:[handleLabels isNil]) ifTrue:[^ self]. |
396
973d4a9fa32c
setting handleStyle to nil disables handleDrawing
Claus Gittinger <cg@exept.de>
parents:
395
diff
changeset
|
1207 |
|
1096 | 1208 |
mar := margin. |
1209 |
barHeightInt := barHeight. |
|
1210 |
barWidthInt := barWidth. |
|
871 | 1211 |
|
295 | 1212 |
shadowForm notNil ifTrue:[ |
871 | 1213 |
h := shadowForm height. |
1214 |
w := shadowForm width . |
|
1096 | 1215 |
maxKnob := h min:barHeightInt. |
295 | 1216 |
] ifFalse:[ |
1096 | 1217 |
maxKnob := knobHeight min: barHeightInt. |
876 | 1218 |
maxKnob := maxKnob max:4. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1219 |
handleStyle == #full ifTrue:[ |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1220 |
w := h := maxKnob |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1221 |
] ifFalse:[ |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1222 |
w := h := maxKnob - 4. |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1223 |
] |
295 | 1224 |
]. |
1225 |
||
1226 |
self paint:viewBackground. |
|
1131 | 1227 |
self lineStyle:#solid. |
1228 |
||
295 | 1229 |
orientation == #vertical ifTrue:[ |
1096 | 1230 |
self fillRectangleX:mar y:hy |
1231 |
width:(width - mar - mar) |
|
1232 |
height:barHeightInt. |
|
871 | 1233 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1234 |
(handleStyle isNil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1235 |
or:[handleStyle == #none]) ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1236 |
(handleStyle ~~ #normal |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1237 |
and:[handleStyle ~~ #mswindows]) ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1238 |
m := (maxKnob - h) // 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1239 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1240 |
shadowForm isNil ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1241 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1242 |
y := hy + (barHeightInt // 2). "/ center of the bar |
871 | 1243 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1244 |
separatingLine ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1245 |
self paint:shadowColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1246 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1247 |
y := y + 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1248 |
self paint:lightColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1249 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1250 |
self paint:viewBackground. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1251 |
]. |
876 | 1252 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1253 |
self fillRectangleX:(hx - barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1254 |
y:hy |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1255 |
width:(barWidthInt + barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1256 |
height:h. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1257 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1258 |
handleStyle == #line ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1259 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1260 |
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
|
1261 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1262 |
y := hy. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1263 |
handleStyle == #st80 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1264 |
y := y - 1 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1265 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1266 |
ym := y + m. |
295 | 1267 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1268 |
handleStyle == #full ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1269 |
handleLevel ~~ 0 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1270 |
self |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1271 |
drawEdgesForX:0 "/ -(handleLevel abs) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1272 |
y:ym "/-1 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1273 |
width:width "/+(handleLevel+handleLevel)abs |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1274 |
height:h-2 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1275 |
level:handleLevel |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1276 |
shadow:shadowColor |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1277 |
light:lightColor |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1278 |
halfShadow:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1279 |
halfLight:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1280 |
style:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1281 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1282 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1283 |
handleLevel ~~ 0 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1284 |
self drawEdgesForX:(hx - barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1285 |
y:ym |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1286 |
width:(barWidthInt + barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1287 |
height:h |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1288 |
level:handleLevel. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1289 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1290 |
|
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1291 |
handleStyle == #iris ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1292 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1293 |
self fillDeviceRectangleX:(hx - barWidthInt + 2) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1294 |
y:(ym + 2) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1295 |
width:(barWidthInt + barWidthInt - 4) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1296 |
height:h - 4 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1297 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1298 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1299 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1300 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1301 |
y := hy. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1302 |
(shadowForm notNil or:[lightForm notNil]) ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1303 |
self drawHandleFormAtX:hx y:(y + m) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1304 |
] |
871 | 1305 |
]. |
1096 | 1306 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1307 |
handleStyle == #st80 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1308 |
y := hy - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1309 |
self paint:lightColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1310 |
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
|
1311 |
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
|
1312 |
y := hy + knobHeight - 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1313 |
self paint:shadowColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1314 |
self displayLineFromX:mar y:y toX:(width - mar) y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1315 |
"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
|
1316 |
" VVV" |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1317 |
self displayLineFromX:width-1 y:hy" "-1" " toX:width-1 y:(hy + knobHeight - 1 - 1). |
871 | 1318 |
]. |
1319 |
] ifFalse:[ |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1320 |
y := hy + barHeightInt - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1321 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1322 |
separatingLine ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1323 |
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
|
1324 |
self displayLineFromX:0 y:y toX:width y:y. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1325 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1326 |
self fillRectangleX:hx y:hy width:barWidthInt height:barHeightInt |
871 | 1327 |
]. |
1328 |
]. |
|
1329 |
lbl := self handleLabelAt:hIndex. |
|
1330 |
lbl notNil ifTrue:[ |
|
1331 |
hIndex ~~ 1 ifTrue:[ |
|
1332 |
self paint:Color black. |
|
874 | 1333 |
lbl isImageOrForm ifTrue:[ |
1096 | 1334 |
lbl displayOn:self x:mar y:hy |
874 | 1335 |
] ifFalse:[ |
1096 | 1336 |
lbl displayOn:self x:mar y:hy + font ascent + 1 |
874 | 1337 |
] |
871 | 1338 |
] |
1339 |
]. |
|
1340 |
||
295 | 1341 |
] ifFalse:[ |
1096 | 1342 |
self fillRectangleX:hx y:mar |
1343 |
width:barHeightInt |
|
1344 |
height:(height - mar - mar). |
|
876 | 1345 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1346 |
(handleStyle isNil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1347 |
or:[handleStyle == #none]) ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1348 |
(handleStyle ~~ #normal |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1349 |
and:[handleStyle ~~ #mswindows]) ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1350 |
m := (barHeightInt - w) // 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1351 |
m := (maxKnob - w) // 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1352 |
shadowForm isNil ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1353 |
x := hx + (barHeightInt // 2). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1354 |
separatingLine ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1355 |
self paint:shadowColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1356 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1357 |
x := x + 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1358 |
self paint:lightColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1359 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1360 |
self paint:viewBackground. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1361 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1362 |
self fillRectangleX:hx y:(hy - barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1363 |
width:w |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1364 |
height:(barWidthInt + barWidthInt). |
295 | 1365 |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1366 |
handleStyle == #line ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1367 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1368 |
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
|
1369 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1370 |
x := hx. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1371 |
handleStyle == #st80 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1372 |
x := x - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1373 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1374 |
xm := x + m. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1375 |
handleStyle == #full ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1376 |
handleLevel ~~ 0 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1377 |
self |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1378 |
drawEdgesForX:xm "/-1 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1379 |
y:0 "/ -handleLevel |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1380 |
width:w-2 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1381 |
height:height "/ +handleLevel+handleLevel |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1382 |
level:handleLevel |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1383 |
shadow:shadowColor |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1384 |
light:lightColor |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1385 |
halfShadow:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1386 |
halfLight:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1387 |
style:nil |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1388 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1389 |
] ifFalse:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1390 |
handleLevel ~~ 0 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1391 |
self drawEdgesForX:xm |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1392 |
y:(hy - barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1393 |
width:w |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1394 |
height:(barWidthInt + barWidthInt) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1395 |
level:handleLevel. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1396 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1397 |
handleStyle == #iris ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1398 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1399 |
self fillDeviceRectangleX:(xm + 2) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1400 |
y:(hy - barWidthInt + 2) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1401 |
width:w - 4 |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1402 |
height:(barWidthInt + barWidthInt - 4) |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1403 |
]. |
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 |
] |
871 | 1406 |
] ifFalse:[ |
1407 |
x := hx. |
|
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1408 |
(shadowForm notNil or:[lightForm notNil]) ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1409 |
self drawHandleFormAtX:(x + m) y:hy |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1410 |
] |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1411 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1412 |
handleStyle == #st80 ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1413 |
x := hx - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1414 |
self paint:lightColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1415 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1416 |
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
|
1417 |
x := hx + barHeightInt - 2. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1418 |
self paint:shadowColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1419 |
self displayLineFromX:x y:mar toX:x y:(height - mar). |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1420 |
"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
|
1421 |
" VVV" |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1422 |
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
|
1423 |
]. |
871 | 1424 |
] ifFalse:[ |
1981
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1425 |
x := hx + barHeightInt - 1. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1426 |
self paint:handleColor. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1427 |
separatingLine ifTrue:[ |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1428 |
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
|
1429 |
self displayLineFromX:x y:0 toX:x y:height. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1430 |
]. |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1431 |
self fillRectangleX:hx y:hy width:barHeightInt height:barWidthInt |
15a646f9e4fb
error: vs. error:mayProceed:
Claus Gittinger <cg@exept.de>
parents:
1948
diff
changeset
|
1432 |
] |
871 | 1433 |
] |
295 | 1434 |
]. |
1435 |
||
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1436 |
"Modified: / 29.7.1998 / 22:48:33 / cg" |
295 | 1437 |
! |
1438 |
||
1439 |
drawHandleFormAtX:hx y:hy |
|
1440 |
"draw a handles bitmap at hx/hy" |
|
1441 |
||
876 | 1442 |
shadowForm notNil ifTrue:[ |
1443 |
self paint:shadowColor. |
|
1444 |
self displayForm:shadowForm x:hx y:hy. |
|
1445 |
]. |
|
1446 |
lightForm notNil ifTrue:[ |
|
1447 |
self paint:lightColor. |
|
1448 |
self displayForm:lightForm x:hx y:hy. |
|
1449 |
]. |
|
295 | 1450 |
self paint:viewBackground |
876 | 1451 |
|
1452 |
"Modified: 7.11.1996 / 20:25:33 / cg" |
|
295 | 1453 |
! |
1454 |
||
2179 | 1455 |
drawSnapAt:anIndex |
1456 |
"draw the snap for a handle at an index |
|
1457 |
" |
|
2238 | 1458 |
|layout icon level offLevel paint canChangeExtent |
2179 | 1459 |
left "{ Class:SmallInteger }" |
1460 |
top "{ Class:SmallInteger }" |
|
1461 |
width "{ Class:SmallInteger }" |
|
1462 |
height "{ Class:SmallInteger }" |
|
2238 | 1463 |
snapMode leftEdge wEdge topEdge hEdge part wPart hPart |
2179 | 1464 |
| |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1465 |
|
2179 | 1466 |
(layout := self snapLayoutAt:anIndex) isNil ifTrue:[ |
1467 |
"snap disabled" |
|
1468 |
^ self |
|
1469 |
]. |
|
1470 |
||
1471 |
left := layout left. |
|
1472 |
top := layout top. |
|
1473 |
width := layout width. |
|
1474 |
height := layout height. |
|
2236 | 1475 |
snapMode := self snapMode. |
2179 | 1476 |
|
2238 | 1477 |
offLevel := level := snapAdornment at:#level ifAbsent:0. |
1478 |
||
2179 | 1479 |
canChangeExtent := self canChangeExtentOfViewAt:anIndex. |
1480 |
canChangeExtent ifTrue:[ |
|
1481 |
(controller isSnapEntered:anIndex) ifTrue:[ |
|
1482 |
controller isSnapPressed ifTrue:[ |
|
1483 |
level := #selectedLevel. |
|
1484 |
paint := #selectedBgColor. |
|
1485 |
] ifFalse:[ |
|
1486 |
level := #enterLevel. |
|
1487 |
paint := #enterBgColor. |
|
2238 | 1488 |
]. |
1489 |
level := snapAdornment at:level ifAbsent:0. |
|
2179 | 1490 |
] |
1491 |
]. |
|
1492 |
paint notNil ifTrue:[ |
|
1493 |
paint := snapAdornment at:paint ifAbsent:viewBackground |
|
1494 |
] ifFalse:[ |
|
1495 |
paint := viewBackground |
|
1496 |
]. |
|
1497 |
self paint:paint. |
|
1498 |
||
2238 | 1499 |
level == 0 ifTrue:[ |
1500 |
]. |
|
1501 |
||
1502 |
self fillRectangleX:left+1 y:top+1 width:width-2 height:height-2. |
|
2179 | 1503 |
|
1504 |
level ~~ 0 ifTrue:[ |
|
2236 | 1505 |
leftEdge := left + 1. |
2240 | 1506 |
wEdge := wPart := width - 2. |
2236 | 1507 |
topEdge := top + 1. |
2240 | 1508 |
hEdge := hPart := height - 2. |
2236 | 1509 |
|
2238 | 1510 |
orientation == #vertical ifTrue:[ |
1511 |
wPart := width // 3. |
|
1512 |
] ifFalse:[ |
|
1513 |
hPart := height // 3. |
|
1514 |
]. |
|
1515 |
||
2236 | 1516 |
level < 0 ifTrue:[ |
1517 |
part := (self subViews at:anIndex) objectAttributeAt:#snapPart. |
|
1518 |
part == #left ifTrue:[ |
|
2238 | 1519 |
self drawEdgesForX:leftEdge y:topEdge width:wEdge height:hEdge level:offLevel. |
2243 | 1520 |
wPart := wPart + 1. |
2236 | 1521 |
] ifFalse:[ |
1522 |
part == #middle ifTrue:[ |
|
2238 | 1523 |
self drawEdgesForX:leftEdge y:topEdge width:wEdge height:hEdge level:offLevel. |
2240 | 1524 |
orientation == #vertical ifTrue:[ |
1525 |
leftEdge := leftEdge + wPart. |
|
1526 |
] ifFalse:[ |
|
1527 |
topEdge := topEdge + hPart. |
|
1528 |
] |
|
2236 | 1529 |
] ifFalse:[ |
1530 |
part == #right ifTrue:[ |
|
2238 | 1531 |
self drawEdgesForX:leftEdge y:topEdge width:wEdge height:hEdge level:offLevel. |
2240 | 1532 |
orientation == #vertical ifTrue:[ |
2243 | 1533 |
leftEdge := leftEdge + (width - wPart - 1). |
2240 | 1534 |
] ifFalse:[ |
2243 | 1535 |
topEdge := topEdge + (height - hPart - 1). |
1536 |
]. |
|
1537 |
wPart := wPart - 1. |
|
2236 | 1538 |
] |
1539 |
] |
|
1540 |
]. |
|
2240 | 1541 |
wEdge := wPart. |
1542 |
hEdge := hPart. |
|
2236 | 1543 |
]. |
1544 |
self drawEdgesForX:leftEdge y:topEdge width:wEdge height:hEdge level:level. |
|
2179 | 1545 |
]. |
1546 |
||
1547 |
canChangeExtent ifFalse:[^ self]. |
|
1548 |
||
2236 | 1549 |
snapMode == #both ifTrue:[ |
1550 |
icon := orientation == #vertical ifTrue:[#iconUpDown] ifFalse:[#iconLeftRight] |
|
2179 | 1551 |
] ifFalse:[ |
2236 | 1552 |
(self snapAtIndexWillGrow:anIndex) ifTrue:[ |
1553 |
icon := orientation == #vertical ifTrue:[#iconDown] ifFalse:[#iconRight] |
|
1554 |
] ifFalse:[ |
|
1555 |
icon := orientation == #vertical ifTrue:[#iconUp] ifFalse:[#iconLeft] |
|
1556 |
]. |
|
2179 | 1557 |
]. |
1558 |
icon := snapAdornment at:icon ifAbsent:nil. |
|
1559 |
||
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
1560 |
icon displayOn:self x:(left + (width - icon width // 2)) |
2179 | 1561 |
y:(top + (height - icon height // 2)). |
1562 |
! |
|
1563 |
||
295 | 1564 |
invertHandleBarAtX:hx y:hy |
1894 | 1565 |
|doLine oldStyle| |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1566 |
|
1894 | 1567 |
doLine := (trackLine == #solidLine |
1568 |
or:[trackLine == #dashedLine |
|
1569 |
or:[trackLine == #dottedLine]]). |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1570 |
|
1131 | 1571 |
trackLine == #dashedLine ifTrue:[ |
1894 | 1572 |
oldStyle := lineStyle. |
1131 | 1573 |
self lineStyle:#dashed. |
1894 | 1574 |
] ifFalse:[ |
1575 |
trackLine == #dottedLine ifTrue:[ |
|
1576 |
oldStyle := lineStyle. |
|
1577 |
self lineStyle:#dotted. |
|
1578 |
] |
|
1131 | 1579 |
]. |
1580 |
||
1220 | 1581 |
self clippedByChildren:false. |
1131 | 1582 |
|
295 | 1583 |
self xoring:[ |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1584 |
|yL xL halfHeight| |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1585 |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1586 |
halfHeight := (barHeight // 2) - 1. |
295 | 1587 |
|
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1588 |
orientation == #vertical ifTrue:[ |
1894 | 1589 |
yL := hy + halfHeight. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1590 |
doLine ifTrue:[ |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1591 |
self displayLineFromX:0 y:yL toX:width y:yL. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1592 |
] ifFalse:[ |
1130 | 1593 |
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
|
1594 |
] |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1595 |
] ifFalse:[ |
1894 | 1596 |
xL := hx + halfHeight. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1597 |
doLine ifTrue:[ |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1598 |
self displayLineFromX:xL y:0 toX:xL y:height. |
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1599 |
] ifFalse:[ |
1130 | 1600 |
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
|
1601 |
] |
1130 | 1602 |
]. |
295 | 1603 |
]. |
1220 | 1604 |
self clippedByChildren:true. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1605 |
|
1894 | 1606 |
oldStyle notNil ifTrue:[ |
1607 |
self lineStyle:oldStyle. |
|
1131 | 1608 |
]. |
1129
17a77892f180
added support for dashed-LineTrack
Claus Gittinger <cg@exept.de>
parents:
1119
diff
changeset
|
1609 |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1610 |
"Modified: / 28.4.1997 / 14:56:26 / dq" |
1894 | 1611 |
"Modified: / 3.5.1999 / 18:49:04 / cg" |
295 | 1612 |
! |
1613 |
||
1614 |
lockRedraw |
|
1615 |
redrawLocked := true |
|
1616 |
! |
|
1617 |
||
1618 |
redrawHandlesFrom:start to:stop |
|
2179 | 1619 |
"redraw some handles and snaps |
1620 |
" |
|
1621 |
subViews size ~~ 0 ifTrue:[ |
|
2236 | 1622 |
"/ do not draw handle, if there is a snapper ... |
1623 |
(showHandle and:[snapAdornment isNil]) ifTrue:[ |
|
871 | 1624 |
self handleOriginsWithIndexFrom:start to:stop do:[:hPoint :hIndex | |
2179 | 1625 |
self drawHandle:hIndex atX:(hPoint x) y:(hPoint y). |
1626 |
] |
|
1627 |
]. |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1628 |
|
2179 | 1629 |
snapAdornment notNil ifTrue:[ |
1630 |
start to:stop do:[:i| self drawSnapAt:i ]. |
|
1631 |
]. |
|
1632 |
]. |
|
295 | 1633 |
! |
1634 |
||
1635 |
unlockRedraw |
|
1636 |
redrawLocked := false |
|
1637 |
! ! |
|
1638 |
||
1159 | 1639 |
!VariablePanel methodsFor:'enumerating subviews'! |
1640 |
||
1641 |
changeSequenceOrderFor:aSubView to:anIndex |
|
1416 | 1642 |
"change a subview's position in the subviews collection. |
1159 | 1643 |
" |
1644 |
|success| |
|
1645 |
||
1646 |
success := super changeSequenceOrderFor:aSubView to:anIndex. |
|
1647 |
success ifTrue:[ |
|
1648 |
self setupSubviews. |
|
1649 |
self resizeSubviews. |
|
1650 |
]. |
|
1651 |
^ success |
|
1652 |
! ! |
|
1653 |
||
295 | 1654 |
!VariablePanel methodsFor:'event handling'! |
1655 |
||
1656 |
sizeChanged:how |
|
1657 |
"my size has changed; resize my subviews" |
|
1658 |
||
2123
33fda8594eee
must resize children if realized;
Claus Gittinger <cg@exept.de>
parents:
2114
diff
changeset
|
1659 |
realized ifTrue:[ |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1660 |
(how == #smaller) ifTrue:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1661 |
self resizeSubviews |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1662 |
] ifFalse:[ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1663 |
"/ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1664 |
"/ 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
|
1665 |
"/ |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1666 |
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
|
1667 |
] |
295 | 1668 |
]. |
1669 |
self changed:#sizeOfView with:how. |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1670 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1671 |
"Modified: 28.1.1997 / 17:56:30 / cg" |
295 | 1672 |
! ! |
1673 |
||
1821
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1674 |
!VariablePanel methodsFor:'focus handling'! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1675 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1676 |
wantsFocusWithButtonPress |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1677 |
"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
|
1678 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1679 |
^ false |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1680 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1681 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1682 |
! ! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1698
diff
changeset
|
1683 |
|
2288 | 1684 |
!VariablePanel methodsFor:'initialization & release'! |
295 | 1685 |
|
871 | 1686 |
computeBarHeight |
958 | 1687 |
"compute the height if the separating bar from either the |
1688 |
form or an explicit height given in the styleSheet" |
|
1689 |
||
1550 | 1690 |
<resource: #style (#'variablePanel.barHeight' |
1691 |
#'variablePanel.barHeightMM')> |
|
924
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1692 |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1693 |
|bH h lvl| |
871 | 1694 |
|
876 | 1695 |
shadowForm notNil ifTrue:[ |
871 | 1696 |
bH := shadowForm height + 2. |
1697 |
] ifFalse:[ |
|
1869 | 1698 |
bH := styleSheet at:#'variablePanel.barHeight'. |
924
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1699 |
bH isNil ifTrue:[ |
1869 | 1700 |
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
|
1701 |
bH := (h * device verticalPixelPerMillimeter) rounded. |
81f3ca4512bd
allow barHeight to be set in the styleSheet
Claus Gittinger <cg@exept.de>
parents:
900
diff
changeset
|
1702 |
]. |
871 | 1703 |
]. |
1869 | 1704 |
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
|
1705 |
lvl ~~ 0 ifTrue:[ |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1706 |
bH := bH + (lvl abs * 2). |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1707 |
]. |
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1708 |
|
876 | 1709 |
self barHeight:bH. |
871 | 1710 |
knobHeight := bH. |
1711 |
||
1712 |
handleLabels notNil ifTrue:[ |
|
1987 | 1713 |
font := font onDevice:device. |
871 | 1714 |
bH := handleLabels inject:bH into:[:maxSoFar :thisLabel | |
874 | 1715 |
thisLabel isNil ifTrue:[ |
1716 |
maxSoFar |
|
1717 |
] ifFalse:[ |
|
1718 |
maxSoFar max:(thisLabel heightOn:self) |
|
1719 |
] |
|
1720 |
]. |
|
871 | 1721 |
bH := bH + font descent - 1 |
1722 |
]. |
|
1723 |
||
1724 |
self barHeight:bH. |
|
1725 |
||
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1726 |
"Modified: / 29.7.1998 / 14:47:21 / cg" |
871 | 1727 |
! |
1728 |
||
295 | 1729 |
defaultControllerClass |
1730 |
^ VariablePanelController |
|
1731 |
! |
|
1732 |
||
1733 |
initCursor |
|
1734 |
"set the cursor - a double arrow" |
|
1735 |
||
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
1736 |
cursor := self class |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
1737 |
cursorForOrientation:orientation |
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
1738 |
onDevice:device |
900 | 1739 |
|
1698
cab69c6081a8
use windows-like cursors if running on windows
Claus Gittinger <cg@exept.de>
parents:
1655
diff
changeset
|
1740 |
"Modified: / 30.9.1998 / 18:20:35 / cg" |
295 | 1741 |
! |
1742 |
||
1743 |
initStyle |
|
966 | 1744 |
"setup viewStyle specifics" |
1745 |
||
871 | 1746 |
|mm| |
295 | 1747 |
|
1748 |
super initStyle. |
|
1749 |
||
1987 | 1750 |
handleColor := DefaultHandleColor onDevice:device. |
295 | 1751 |
|
1752 |
DefaultHandleStyle isNil ifTrue:[ |
|
496 | 1753 |
handleStyle := styleSheet name |
295 | 1754 |
] ifFalse:[ |
496 | 1755 |
handleStyle := DefaultHandleStyle |
295 | 1756 |
]. |
1757 |
||
496 | 1758 |
handleLevel := DefaultHandleLevel. |
1759 |
showHandle := DefaultShowHandle. |
|
295 | 1760 |
handlePosition := DefaultHandlePosition. |
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
1761 |
"/ snapHandlePosition := DefaultSnapHandlePosition. |
295 | 1762 |
trackLine := DefaultTrackingLine. |
1763 |
separatingLine := DefaultSeparatingLine. |
|
1764 |
||
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1765 |
DefaultHandleImage notNil ifTrue:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1766 |
shadowForm := DefaultHandleImage onDevice:device. |
496 | 1767 |
barWidth := shadowForm width. |
295 | 1768 |
] ifFalse:[ |
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1769 |
handleStyle == #next ifTrue:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1770 |
DefaultHandleImage notNil ifTrue:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1771 |
shadowForm := DefaultHandleImage onDevice:device. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1772 |
] ifFalse:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1773 |
shadowForm := self class shadowFormOn:device. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1774 |
lightForm := self class lightFormOn:device. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1775 |
]. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1776 |
barWidth := shadowForm width. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1777 |
] ifFalse:[ |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1778 |
shadowForm := lightForm := nil. |
496 | 1779 |
|
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1780 |
mm := device verticalPixelPerMillimeter. |
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1781 |
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
|
1782 |
]. |
295 | 1783 |
]. |
871 | 1784 |
self computeBarHeight. |
496 | 1785 |
|
295 | 1786 |
handleStyle == #mswindows ifTrue:[ |
496 | 1787 |
barWidth := (ArrowButton new direction:#up) width + 1 |
295 | 1788 |
]. |
496 | 1789 |
|
1529
509edab0a08b
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1416
diff
changeset
|
1790 |
"Modified: / 19.5.1998 / 16:21:02 / cg" |
295 | 1791 |
! |
1792 |
||
1793 |
initialize |
|
496 | 1794 |
orientation isNil ifTrue:[orientation := #vertical]. |
295 | 1795 |
super initialize. |
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1796 |
self bitGravity:nil. |
496 | 1797 |
|
1628
d5065006e796
fixed / beautified #full handleStyle (used with win95 style)
Claus Gittinger <cg@exept.de>
parents:
1551
diff
changeset
|
1798 |
"Modified: / 29.7.1998 / 16:07:23 / cg" |
295 | 1799 |
! ! |
1800 |
||
1801 |
!VariablePanel methodsFor:'private'! |
|
1802 |
||
1803 |
anyNonRelativeSubviews |
|
1804 |
"return true, if any of my subviews has no relative origin/extent" |
|
1805 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1806 |
self subViews do:[:aComponent | |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1807 |
aComponent relativeCorner isNil ifTrue:[^ true]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1808 |
aComponent relativeOrigin isNil ifTrue:[^ true] |
295 | 1809 |
]. |
1810 |
^ false |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1811 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1812 |
"Modified: 28.1.1997 / 17:57:26 / cg" |
295 | 1813 |
! |
1814 |
||
1655 | 1815 |
expandSubView:expandedView |
1816 |
"expand one of my subviews to full size" |
|
1817 |
||
1818 |
|pos subViews| |
|
1819 |
||
1820 |
realRelativeSizes notNil ifTrue:[ |
|
1821 |
"/ already expanded .. |
|
1822 |
^ self |
|
1823 |
]. |
|
1824 |
||
1825 |
pos := 0.0. |
|
1826 |
subViews := self subViews. |
|
1827 |
||
1828 |
orientation == #vertical ifTrue:[ |
|
1829 |
realRelativeSizes := subViews collect:[:v | v relativeCorner y - v relativeOrigin y]. |
|
1830 |
] ifFalse:[ |
|
1831 |
realRelativeSizes := subViews collect:[:v | v relativeCorner x - v relativeOrigin x]. |
|
1832 |
]. |
|
1833 |
||
1834 |
subViews do:[:aSubView | |
|
1835 |
aSubView == expandedView ifTrue:[ |
|
1836 |
aSubView origin:(0.0 @ 0.0) corner:(1.0 @ 1.0). |
|
1837 |
pos := 1.0 |
|
1838 |
] ifFalse:[ |
|
1839 |
orientation == #vertical ifTrue:[ |
|
1840 |
aSubView origin:(0.0 @ pos) corner:(1.0 @ pos) |
|
1841 |
] ifFalse:[ |
|
1842 |
aSubView origin:(pos @ 0.0) corner:(pos @ 1.0) |
|
1843 |
] |
|
1844 |
] |
|
1845 |
]. |
|
1846 |
self resizeSubviews. |
|
1847 |
||
1848 |
"Modified: 28.1.1997 / 17:56:20 / cg" |
|
1849 |
! |
|
1850 |
||
871 | 1851 |
handleLabelAt:hIndex |
1852 |
handleLabels notNil ifTrue:[ |
|
1853 |
^ handleLabels at:hIndex ifAbsent:nil |
|
1854 |
]. |
|
1855 |
^ nil |
|
1856 |
! |
|
1857 |
||
1858 |
handleOriginsWithIndexDo:aBlock |
|
295 | 1859 |
"evaluate the argument block for every handle-origin" |
1860 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1861 |
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
|
1862 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1863 |
"Modified: 28.1.1997 / 17:53:44 / cg" |
295 | 1864 |
! |
1865 |
||
871 | 1866 |
handleOriginsWithIndexFrom:start to:stop do:aBlock |
295 | 1867 |
"evaluate the argument block for some handle-origins" |
1868 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1869 |
|x y hw hh hDelta vDelta subViews |
295 | 1870 |
first "{ Class: SmallInteger }" |
1871 |
last "{ Class: SmallInteger }"| |
|
1872 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1873 |
(subViews := self subViews) notNil ifTrue:[ |
871 | 1874 |
shadowForm notNil ifTrue:[ |
1875 |
hw := shadowForm width. |
|
1876 |
hh := shadowForm height. |
|
1877 |
] ifFalse:[ |
|
1878 |
hw := hh := barWidth |
|
1879 |
]. |
|
295 | 1880 |
|
871 | 1881 |
(handleStyle ~~ #normal and:[handleStyle ~~ #mswindows]) ifTrue:[ |
1882 |
hDelta := barWidth // 2. |
|
1883 |
vDelta := barWidth // 2. |
|
1884 |
] ifFalse:[ |
|
1885 |
hDelta := vDelta := 0 |
|
1886 |
]. |
|
295 | 1887 |
|
871 | 1888 |
(handlePosition == #left) ifTrue:[ |
1889 |
x := hDelta. |
|
1381 | 1890 |
y := vDelta. |
1891 |
||
1892 |
orientation == #vertical ifTrue:[ |
|
1893 |
x := x + barWidth |
|
1894 |
] ifFalse:[ |
|
1895 |
y := y + barWidth |
|
1896 |
]. |
|
1897 |
margin ~~ 0 ifTrue:[ |
|
1898 |
x := x + 2 |
|
1899 |
]. |
|
871 | 1900 |
] ifFalse:[ |
1901 |
(handlePosition == #right) ifTrue:[ |
|
1902 |
x := width - hw - margin - hDelta. |
|
1903 |
y := height - hh - margin - vDelta. |
|
1904 |
] ifFalse:[ |
|
1905 |
x := width - barWidth // 2. |
|
1906 |
y := height - barWidth // 2 |
|
1907 |
] |
|
1908 |
]. |
|
1909 |
first := start + 1. |
|
1910 |
last := stop. |
|
1381 | 1911 |
|
871 | 1912 |
first to:last do:[:index | |
1913 |
|view| |
|
295 | 1914 |
|
871 | 1915 |
view := subViews at:index. |
1916 |
orientation == #vertical ifTrue:[ |
|
1917 |
y := view top "origin y" - barHeight + 1. |
|
1918 |
] ifFalse:[ |
|
1919 |
x := view left "origin x" - barHeight + 1. |
|
1920 |
]. |
|
1921 |
aBlock value:(x @ y) value:index |
|
1922 |
] |
|
295 | 1923 |
] |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1924 |
|
1381 | 1925 |
"Modified: / 1.11.1997 / 11:53:40 / cg" |
295 | 1926 |
! |
1927 |
||
2026
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1928 |
resizeSubViewsTo:relativeSizeList |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1929 |
"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
|
1930 |
(a collection of relative sizes)" |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1931 |
|
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1932 |
|pos subViews| |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1933 |
|
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1934 |
subViews := self subViews. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1935 |
|
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1936 |
pos := 0.0. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1937 |
subViews with:relativeSizeList do:[:aSubView :relSize | |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1938 |
orientation == #vertical ifTrue:[ |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1939 |
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
|
1940 |
] ifFalse:[ |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1941 |
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
|
1942 |
]. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1943 |
pos := pos + relSize. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1944 |
]. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1945 |
self resizeSubviews. |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1946 |
|
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1947 |
! |
9876789dfba7
added interface to change the subViews sizes programmatically.
Claus Gittinger <cg@exept.de>
parents:
1987
diff
changeset
|
1948 |
|
295 | 1949 |
resizeSubviews |
1151
94aff1c7b0aa
Fix comments, eliminate common message sends.
Stefan Vogel <sv@exept.de>
parents:
1131
diff
changeset
|
1950 |
"readjust size of all subviews" |
295 | 1951 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1952 |
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
|
1953 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1954 |
"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
|
1955 |
"Modified: 22.3.1997 / 01:01:31 / stefan" |
295 | 1956 |
! |
1957 |
||
1958 |
resizeSubviewsFrom:start to:stop |
|
1959 |
"readjust size of some subviews" |
|
1960 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1961 |
|step nSubviews subViews| |
295 | 1962 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
1963 |
(subViews := self subViews) size > 0 ifTrue:[ |
871 | 1964 |
(start <= stop) ifTrue:[ |
1965 |
step := 1 |
|
1966 |
] ifFalse:[ |
|
1967 |
step := -1 |
|
1968 |
]. |
|
1969 |
nSubviews := subViews size. |
|
1970 |
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
|
1971 |
|bw view o1 o2 newOrg newCorner newExt| |
295 | 1972 |
|
871 | 1973 |
view := subViews at:index. |
1974 |
bw := view borderWidth. |
|
295 | 1975 |
|
871 | 1976 |
index == 1 ifTrue:[ |
1977 |
o1 := 0. |
|
1978 |
] ifFalse:[ |
|
1979 |
o1 := barHeight // 2 - bw |
|
1980 |
]. |
|
1981 |
index == nSubviews ifTrue:[ |
|
1982 |
o2 := 0. |
|
1983 |
] ifFalse:[ |
|
1984 |
o2 := barHeight // 2 - bw |
|
1985 |
]. |
|
295 | 1986 |
|
871 | 1987 |
newOrg := view computeOrigin. |
1988 |
newOrg notNil ifTrue:[ |
|
1989 |
(index ~~ 1) ifTrue:[ |
|
1990 |
orientation == #vertical ifTrue:[ |
|
1991 |
newOrg y:(newOrg y + o1) |
|
1992 |
] ifFalse:[ |
|
1993 |
newOrg x:(newOrg x + o1) |
|
1994 |
] |
|
1995 |
]. |
|
1996 |
]. |
|
1997 |
newExt := view computeExtent. |
|
1998 |
newExt notNil ifTrue:[ |
|
1999 |
orientation == #vertical ifTrue:[ |
|
2000 |
newExt y:(newExt y - o2 - o1) |
|
2001 |
] ifFalse:[ |
|
2002 |
newExt x:(newExt x - o2 - o1) |
|
2003 |
] |
|
2004 |
]. |
|
2005 |
view pixelOrigin:newOrg extent:newExt. |
|
1550 | 2006 |
]. |
1551 | 2007 |
shown ifTrue:[ |
2008 |
"/ must clear, since handles are copied automatically (by bitGravity) |
|
2009 |
self clear. |
|
2010 |
self invalidate. |
|
2011 |
] |
|
295 | 2012 |
] |
873 | 2013 |
|
2160 | 2014 |
"Modified: / 22.3.1997 / 01:02:21 / stefan" |
2015 |
"Modified: / 23.2.2000 / 18:32:37 / cg" |
|
295 | 2016 |
! |
2017 |
||
1655 | 2018 |
restoreSubViewRatios |
2019 |
"restore my subviews sizes to the state before the full-expand" |
|
2020 |
||
2021 |
|pos subViews | |
|
2022 |
||
2023 |
realRelativeSizes == nil ifTrue:[ |
|
2024 |
"/ not expanded - ignore |
|
2025 |
^ self |
|
2026 |
]. |
|
2027 |
||
2028 |
pos := 0.0. |
|
2029 |
self subViews with:realRelativeSizes do:[:aSubView :aRelativeSize | |
|
2030 |
orientation == #vertical ifTrue:[ |
|
2031 |
aSubView origin:(0.0 @ pos) corner:(1.0 @ (pos+aRelativeSize)) |
|
2032 |
] ifFalse:[ |
|
2033 |
aSubView origin:(pos @ 0.0) corner:((pos+aRelativeSize) @ 1.0) |
|
2034 |
]. |
|
2035 |
pos := pos + aRelativeSize |
|
2036 |
]. |
|
2037 |
realRelativeSizes := nil. |
|
2038 |
self resizeSubviews. |
|
2039 |
||
2040 |
"Modified: 28.1.1997 / 17:56:20 / cg" |
|
2041 |
! |
|
2042 |
||
295 | 2043 |
setupSubviews |
2044 |
"setup subviews sizes (in case of non-relative sizes)" |
|
2045 |
||
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2046 |
|pos delta subViews nSubViews "{ Class: SmallInteger }"| |
295 | 2047 |
|
300 | 2048 |
"/ setup all subviews to spread evenly ... |
295 | 2049 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2050 |
subViews := self subViews. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2051 |
nSubViews := subViews size. |
1043 | 2052 |
nSubViews == 0 ifTrue:[^ self]. |
295 | 2053 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2054 |
pos := 0.0. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2055 |
delta := 1.0 / nSubViews. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2056 |
|
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2057 |
1 to:nSubViews do:[:index | |
2160 | 2058 |
|view org corn| |
295 | 2059 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2060 |
view := subViews at:index. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2061 |
orientation == #vertical ifTrue:[ |
2160 | 2062 |
org := (0.0 @ pos). |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2063 |
index == subViews size ifTrue:[ |
2160 | 2064 |
corn := (1.0 @ 1.0) |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2065 |
] ifFalse:[ |
2160 | 2066 |
corn := (1.0 @ (pos + delta)) |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2067 |
]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2068 |
] ifFalse:[ |
2160 | 2069 |
org := (pos @ 0.0). |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2070 |
index == subViews size ifTrue:[ |
2160 | 2071 |
corn := (1.0 @ 1.0) |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2072 |
] ifFalse:[ |
2160 | 2073 |
corn := ((pos + delta) @ 1.0) |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2074 |
]. |
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2075 |
]. |
2160 | 2076 |
view origin:org corner:corn. |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2077 |
pos := pos + delta |
295 | 2078 |
] |
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2079 |
|
2160 | 2080 |
"Modified: / 23.2.2000 / 18:14:01 / cg" |
295 | 2081 |
! ! |
2082 |
||
2179 | 2083 |
!VariablePanel methodsFor:'private snap queries'! |
2084 |
||
2085 |
canChangeExtentOfViewAt:anIndex |
|
2086 |
"returns true if extent at an index is changable |
|
2087 |
" |
|
2088 |
|view| |
|
2089 |
||
2090 |
view := subViews at:anIndex ifAbsent:[^ false]. |
|
2091 |
||
2092 |
orientation == #vertical ifTrue:[ |
|
2093 |
view height > 2 ifFalse:[ |
|
2094 |
view := subViews at:(anIndex + 1) ifAbsent:[^ false]. |
|
2095 |
^ view height > 2 |
|
2096 |
]. |
|
2097 |
^ true |
|
2098 |
]. |
|
2099 |
||
2100 |
view width > 2 ifFalse:[ |
|
2101 |
view := subViews at:(anIndex + 1) ifAbsent:[^ false]. |
|
2102 |
^ view width > 2 |
|
2103 |
]. |
|
2104 |
^ true |
|
2105 |
||
2106 |
||
2107 |
! |
|
2108 |
||
2109 |
initSnapAdornment |
|
2110 |
|num icon level enterLevel selectedLevel color| |
|
2111 |
||
2112 |
snapAdornment notNil ifTrue:[^ snapAdornment ]. |
|
2113 |
||
2114 |
snapAdornment := IdentityDictionary new. |
|
2115 |
||
2116 |
level := styleSheet at:#'variablePanel.snapLevel' default:1. |
|
2117 |
enterLevel := styleSheet at:#'variablePanel.snapEnterLevel' default:level. |
|
2118 |
selectedLevel := styleSheet at:#'variablePanel.selectedLevel' default:(level negated). |
|
2119 |
||
2120 |
snapAdornment at:#level put:level. |
|
2121 |
snapAdornment at:#enterLevel put:enterLevel. |
|
2122 |
snapAdornment at:#selectedLevel put:selectedLevel. |
|
2123 |
snapAdornment at:#mode put:#min. |
|
2124 |
||
2125 |
color := styleSheet colorAt:#'variablePanel.snapSelectedBgColor' |
|
2126 |
default:(StyleSheet colorAt:#'button.activeBackgroundColor'). |
|
2127 |
color notNil ifTrue:[ |
|
2128 |
snapAdornment at:#selectedBgColor put:(color onDevice:device) |
|
2129 |
]. |
|
2130 |
||
2131 |
color := StyleSheet colorAt:#'variablePanel.snapEnterBgColor' |
|
2132 |
default:(StyleSheet colorAt:#'button.enteredBackgroundColor'). |
|
2133 |
color notNil ifTrue:[ |
|
2134 |
snapAdornment at:#enterBgColor put:(color onDevice:device) |
|
2135 |
]. |
|
2136 |
||
2137 |
self class snapIcons keysAndValuesDo:[:aKey :anIcon| |
|
2279 | 2138 |
anIcon device == device ifTrue:[ |
2139 |
icon := anIcon |
|
2140 |
] ifFalse:[ |
|
2141 |
icon := anIcon copy onDevice:device. |
|
2142 |
icon clearMaskedPixels. |
|
2143 |
device == Display ifTrue:[ |
|
2144 |
self class snapIcons at:aKey put:icon. |
|
2145 |
] |
|
2146 |
]. |
|
2179 | 2147 |
snapAdornment at:aKey put:icon |
2148 |
]. |
|
2149 |
"compute required snap extent including level and margins ..." |
|
2150 |
||
2151 |
num := level abs max:(enterLevel abs). |
|
2152 |
num := num max:(selectedLevel abs). |
|
2153 |
num := num + 2 "margin into handle := 1" * 2. |
|
2154 |
icon := snapAdornment at:#iconUp. |
|
2155 |
||
2156 |
snapAdornment at:#height put:(icon height + num). |
|
2157 |
snapAdornment at:#width put:(icon width + num). |
|
2158 |
||
2159 |
^ snapAdornment |
|
2160 |
||
2161 |
! |
|
2162 |
||
2163 |
snapAtIndexWillGrow:anIndex |
|
2164 |
"returns true if the view assigned to the snap at an index will grow |
|
2165 |
if pressing the snap |
|
2166 |
" |
|
2167 |
|view mode| |
|
2168 |
||
2169 |
(mode := self snapMode) notNil ifTrue:[ |
|
2170 |
(mode == #max or:[mode == #maxMin]) ifTrue:[ |
|
2171 |
"on press the view is increased to bottom(vertical) or right(horizontal)" |
|
2172 |
view := subViews at:(anIndex + 1) ifAbsent:[^ false]. |
|
2173 |
^ orientation == #vertical ifTrue:[view height > 2] ifFalse:[view width > 2] |
|
2174 |
]. |
|
2175 |
||
2176 |
(mode == #min or:[mode == #minMax]) ifTrue:[ |
|
2177 |
"on press the view is decreased to top(vertical) or left (horizontal)" |
|
2178 |
view := subViews at:anIndex ifAbsent:[^ false]. |
|
2179 |
^ orientation == #vertical ifTrue:[view height <= 2] ifFalse:[view width <= 2] |
|
2236 | 2180 |
]. |
2181 |
||
2269 | 2182 |
self error:'unexepected snapMode state'. |
2179 | 2183 |
]. |
2184 |
^ false "snap is diasbled" |
|
2185 |
! |
|
2186 |
||
2187 |
snapLayoutAt:anIndex |
|
2188 |
"returns the layout of the snap at an index |
|
2189 |
or nil if snaps are disabled |
|
2190 |
" |
|
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2191 |
|v1 v2 left top w snapX snapY| |
2179 | 2192 |
|
2193 |
snapAdornment isNil ifTrue:[^ nil]. "snap disabled" |
|
2194 |
||
2195 |
v1 := subViews at:anIndex ifAbsent:[^ nil]. |
|
2196 |
v2 := subViews at:anIndex + 1 ifAbsent:[^ nil]. |
|
2197 |
w := snapAdornment at:#width ifAbsent:0. |
|
2198 |
||
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
2199 |
handlePosition "snapHandlePosition" == #left ifTrue:[ |
2241
d9c7f1486b7a
draw snap at very left of panel
Claus Gittinger <cg@exept.de>
parents:
2240
diff
changeset
|
2200 |
snapX := snapY := margin. "/ ViewSpacing. |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2201 |
] ifFalse:[ |
2242
1aea02d32c96
snapHandlePosition is same as handlePosition
Claus Gittinger <cg@exept.de>
parents:
2241
diff
changeset
|
2202 |
handlePosition "snapHandlePosition" == #right ifTrue:[ |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2203 |
snapX := width - w. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2204 |
snapY := height - w. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2205 |
] ifFalse:[ |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2206 |
snapX := (width - w) // 2. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2207 |
snapY := (height - w) // 2. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2208 |
]. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2209 |
]. |
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2210 |
|
2179 | 2211 |
orientation == #vertical ifTrue:[ |
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2212 |
left := snapX. "/ v1 width - w // 2. |
2179 | 2213 |
^ Rectangle left:left top:(v1 bottom + 1) right:(left + w) bottom:(v2 top) |
2214 |
]. |
|
2215 |
||
2228
d74b093fe48d
snapHandlePosition adjustable
Claus Gittinger <cg@exept.de>
parents:
2179
diff
changeset
|
2216 |
top := snapY. "/ v1 height - w // 2. |
2179 | 2217 |
^ Rectangle left:(v1 right + 1) top:top right:(v2 left) bottom:(top + w) |
2218 |
! ! |
|
2219 |
||
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2220 |
!VariablePanel methodsFor:'private tableView protocol'! |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2221 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2222 |
setupSubviewOrigins |
826 | 2223 |
"setup subviews origins |
2224 |
if we only have relative extents |
|
2225 |
(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
|
2226 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2227 |
|x y e eX eY subViews n "{ Class: SmallInteger }"| |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2228 |
|
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2229 |
x := y := 0.0. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2230 |
|
980
6079922a5519
eliminated references to subViews instance variable (will vanish)
Claus Gittinger <cg@exept.de>
parents:
966
diff
changeset
|
2231 |
subViews := self subViews. |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2232 |
n := subViews size. |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2233 |
1 to:n do:[:index | |
826 | 2234 |
|view| |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2235 |
|
826 | 2236 |
view := subViews at:index. |
2237 |
e := view relativeExtent. |
|
2238 |
e notNil ifTrue:[ |
|
2239 |
view relativeExtent:nil. |
|
2240 |
eX := e x. |
|
2241 |
eY := e y. |
|
2242 |
index == n ifTrue:[ |
|
2243 |
view origin:(x @ y) corner:(1.0 @ 1.0) |
|
2244 |
] ifFalse:[ |
|
2245 |
orientation == #vertical ifTrue:[ |
|
2246 |
view origin:(x @ y) corner:(1.0 @ (y+eY)) |
|
2247 |
] ifFalse:[ |
|
2248 |
view origin:(x @ y) corner:((x+eX) @ 1.0) |
|
2249 |
]. |
|
2250 |
]. |
|
2251 |
orientation == #vertical ifTrue:[ |
|
2252 |
y := y + eY. |
|
2253 |
] ifFalse:[ |
|
2254 |
x := x + eX. |
|
2255 |
] |
|
2256 |
] ifFalse: [ |
|
2257 |
view origin:(x @ y). |
|
2258 |
orientation == #vertical ifTrue:[ |
|
2259 |
y := view relativeCorner y. |
|
2260 |
] ifFalse:[ |
|
2261 |
x := view relativeCorner x. |
|
2262 |
] |
|
2263 |
]. |
|
2264 |
] |
|
2265 |
||
2266 |
"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
|
2267 |
"Modified: 28.1.1997 / 17:55:21 / cg" |
299
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2268 |
! ! |
d2f955840ad5
oops - tableViews private interface was lost - reintroduced
ah
parents:
295
diff
changeset
|
2269 |
|
2288 | 2270 |
!VariablePanel methodsFor:'realization'! |
2271 |
||
2272 |
fixSize |
|
2273 |
super fixSize. |
|
2305
f2850e54b0ab
only access originChanged, extentChanged and cornerChanged
Claus Gittinger <cg@exept.de>
parents:
2288
diff
changeset
|
2274 |
self extentChangedFlag ifTrue:[ |
2288 | 2275 |
self resizeSubviews |
2276 |
]. |
|
2277 |
||
2278 |
"Modified: 22.3.1997 / 01:19:55 / stefan" |
|
2279 |
! ! |
|
2280 |
||
2281 |
!VariablePanel methodsFor:'redrawing'! |
|
2282 |
||
2283 |
redraw |
|
2284 |
"redraw all of the handles" |
|
2285 |
||
2286 |
redrawLocked ~~ true ifTrue:[ |
|
2287 |
"/ self clear. |
|
2288 |
self redrawHandlesFrom:1 to:(self subViews size) |
|
2289 |
] |
|
2290 |
||
2291 |
"Modified: 28.1.1997 / 17:54:15 / cg" |
|
2292 |
! ! |
|
2293 |
||
871 | 2294 |
!VariablePanel class methodsFor:'documentation'! |
295 | 2295 |
|
2296 |
version |
|
2482 | 2297 |
^ '$Header: /cvs/stx/stx/libwidg/VariablePanel.st,v 1.75 2001-11-19 17:06:33 martin Exp $' |
295 | 2298 |
! ! |