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