author | ca |
Thu, 29 Jan 1998 15:53:57 +0100 | |
changeset 707 | 7b5f06cf261e |
parent 705 | d9ebfd72d506 |
child 713 | b16e28767967 |
permissions | -rw-r--r-- |
542 | 1 |
" |
2 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
13 |
||
14 |
||
15 |
||
16 |
View subclass:#DSVColumnView |
|
607 | 17 |
instanceVariableNames:'editValue editView multipleSelectOk selectedColIndex |
637 | 18 |
selectedRowIndex rowHeight columnDescriptors viewOrigin colorMap |
618 | 19 |
lockRowIndex rowIfAbsentBlock columnHolder registererImages list |
647 | 20 |
fgColor canFit separatorSize catchChangeEvents beDependentOfRows |
21 |
bgColor hgLgFgColor hgLgBgColor actionBlock |
|
618 | 22 |
doubleClickActionBlock separatorLightColor separatorDarkColor |
647 | 23 |
verticalSpacing horizontalSpacing rowSelectorForm checkToggleForm |
24 |
comboButtonForm buttonExtent clickPosition' |
|
542 | 25 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor |
26 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor |
|
647 | 27 |
DefaultSeparatorDarkColor DefaultSeparatorLightColor RowSelector |
28 |
ButtonExtent' |
|
542 | 29 |
poolDictionaries:'' |
30 |
category:'Views-DataSet' |
|
31 |
! |
|
32 |
||
33 |
!DSVColumnView class methodsFor:'documentation'! |
|
34 |
||
35 |
copyright |
|
36 |
" |
|
37 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
38 |
All Rights Reserved |
|
39 |
||
40 |
This software is furnished under a license and may be used |
|
41 |
only in accordance with the terms of that license and with the |
|
42 |
inclusion of the above copyright notice. This software may not |
|
43 |
be provided or otherwise made available to, or used by, any |
|
44 |
other person. No title to or ownership of the software is |
|
45 |
hereby transferred. |
|
46 |
" |
|
47 |
||
48 |
||
49 |
||
50 |
! |
|
51 |
||
52 |
documentation |
|
53 |
" |
|
54 |
implements a scrollable selection view based on rows and columns |
|
55 |
||
56 |
[Instance variables:] |
|
57 |
||
58 |
editValue <Model> current editing model |
|
59 |
editView <View> current editing component |
|
60 |
selectedColIndex <Integer> selected column index or 0 |
|
61 |
selectedRowIndex <Integer> selected row index or 0 |
|
62 |
rowHeight <Integer> maximum height of any row |
|
63 |
columnDescriptors <SequancableCollection> list of column descriptors |
|
64 |
list <SequancableCollection> list of rows |
|
65 |
fgColor <Color> foreground color |
|
66 |
registererImages <IdentityDictionary> list of images registered on the device |
|
567 | 67 |
beDependentOfRows <Coolean> keep rows dependent; on default is disabled. |
68 |
in case of enabled a row can raise a change |
|
69 |
notification whithout a parameter which |
|
70 |
will force a redraw of the row or the |
|
71 |
readSelector of the column which will |
|
72 |
redraw the cell in the row only. |
|
542 | 73 |
|
74 |
[author:] |
|
75 |
Claus Atzkern |
|
76 |
||
77 |
[see also:] |
|
78 |
DataSetColumnSpec |
|
79 |
DataSetColumn |
|
80 |
DataSetView |
|
81 |
" |
|
82 |
||
83 |
! ! |
|
84 |
||
647 | 85 |
!DSVColumnView class methodsFor:'accessing forms'! |
86 |
||
87 |
buttonExtent |
|
88 |
" |
|
89 |
ButtonExtent := nil |
|
90 |
" |
|
91 |
ButtonExtent isNil ifTrue:[ |
|
92 |
ButtonExtent := (CheckToggle new extent) max:(ComboBoxButton new extent). |
|
93 |
ButtonExtent := ((ButtonExtent + (1 @ 1)) // 2) * 2 |
|
94 |
]. |
|
95 |
^ ButtonExtent |
|
96 |
! |
|
97 |
||
98 |
rowSelector |
|
99 |
||
100 |
RowSelector isNil ifTrue:[ |
|
101 |
RowSelector := Form |
|
607 | 102 |
width:8 |
103 |
height:11 |
|
104 |
fromArray:#[2r01000000 |
|
105 |
2r01100000 |
|
106 |
2r01110000 |
|
107 |
2r01111000 |
|
108 |
2r01111100 |
|
109 |
2r01111110 |
|
110 |
2r01111100 |
|
111 |
2r01111000 |
|
112 |
2r01110000 |
|
113 |
2r01100000 |
|
114 |
2r01000000] |
|
115 |
on:Display. |
|
116 |
||
647 | 117 |
RowSelector := RowSelector asImage. |
607 | 118 |
]. |
647 | 119 |
^ RowSelector |
120 |
||
121 |
! ! |
|
122 |
||
123 |
!DSVColumnView class methodsFor:'defaults'! |
|
607 | 124 |
|
563 | 125 |
horizontalSpacing |
126 |
^ 4 |
|
127 |
||
128 |
! |
|
129 |
||
542 | 130 |
updateStyleCache |
131 |
"extract values from the styleSheet and cache them in class variables |
|
132 |
" |
|
582 | 133 |
<resource: #style (#textForegroundColor #'scrollableView.backgroundColor' |
134 |
#'selection.hilightForegroundColor' |
|
135 |
#'selection.hilightBackgroundColor' )> |
|
542 | 136 |
|
137 |
DefaultForegroundColor := StyleSheet colorAt:'textForegroundColor' default:(Color black). |
|
582 | 138 |
DefaultBackgroundColor := StyleSheet at:'scrollableView.backgroundColor' default:DefaultViewBackgroundColor. |
542 | 139 |
|
582 | 140 |
DefaultHilightForegroundColor := StyleSheet colorAt:'selection.hilightForegroundColor' default:DefaultForegroundColor. |
141 |
DefaultHilightBackgroundColor := StyleSheet colorAt:'selection.hilightBackgroundColor' default:(Color veryLightGrey). |
|
542 | 142 |
DefaultSeparatorDarkColor := DefaultShadowColor ? (Color grayPercent:40). |
143 |
DefaultSeparatorLightColor := DefaultLightColor ? (Color grayPercent:75). |
|
607 | 144 |
|
647 | 145 |
DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[ |
146 |
DefaultHilightBackgroundColor := Color veryLightGrey |
|
147 |
]. |
|
148 |
||
149 |
ButtonExtent := nil. |
|
150 |
||
542 | 151 |
" |
152 |
self updateStyleCache. |
|
153 |
" |
|
154 |
||
582 | 155 |
"Modified: / 26.10.1997 / 17:09:07 / cg" |
563 | 156 |
! |
157 |
||
158 |
verticalSpacing |
|
159 |
^ 2 |
|
160 |
||
542 | 161 |
! ! |
162 |
||
163 |
!DSVColumnView methodsFor:'accessing'! |
|
164 |
||
165 |
action:aOneArgAction |
|
607 | 166 |
"set the action block to be performed on select |
167 |
" |
|
542 | 168 |
actionBlock := aOneArgAction |
169 |
||
170 |
||
171 |
! |
|
172 |
||
173 |
beDependentOfRows |
|
174 |
"make myself dependent of any row; in this case any change notification |
|
175 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
176 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
177 |
-> row changed:'what' |
|
178 |
On default the attribute is set to true (enabled). |
|
179 |
" |
|
180 |
^ beDependentOfRows |
|
181 |
! |
|
182 |
||
183 |
beDependentOfRows:aBool |
|
184 |
"make myself dependent of any row; in this case any change notification |
|
185 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
186 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
187 |
-> row changed:'what' |
|
188 |
On default the attribute is set to true (enabled). |
|
189 |
" |
|
190 |
aBool ~~ beDependentOfRows ifTrue:[ |
|
618 | 191 |
beDependentOfRows := aBool. |
192 |
||
193 |
self size ~~ 0 ifTrue:[ |
|
194 |
list do:[:aRow| aRow notNil ifTrue:[ |
|
195 |
beDependentOfRows ifTrue:[aRow addDependent:self] |
|
196 |
ifFalse:[aRow removeDependent:self] |
|
197 |
] |
|
198 |
] |
|
542 | 199 |
] |
618 | 200 |
] |
607 | 201 |
! |
202 |
||
203 |
doubleClickAction:aOneArgAction |
|
204 |
"set the action block to be performed on doubleclick |
|
205 |
" |
|
206 |
doubleClickActionBlock := aOneArgAction |
|
207 |
||
208 |
||
209 |
! |
|
210 |
||
211 |
multipleSelectOk |
|
212 |
"allow/disallow multiple row selections; the default is false |
|
213 |
" |
|
214 |
^ multipleSelectOk |
|
215 |
! |
|
216 |
||
217 |
multipleSelectOk:aState |
|
218 |
"allow/disallow multiple row selections; the default is false |
|
219 |
" |
|
220 |
aState == multipleSelectOk ifFalse:[ |
|
221 |
multipleSelectOk := aState. |
|
222 |
self deselect |
|
223 |
] |
|
618 | 224 |
! |
225 |
||
226 |
rowIfAbsent:aOneArgAction |
|
227 |
"set the action block to be performed on each 'nil' entry into the |
|
228 |
list. The argument to the block is the index into the list. The |
|
229 |
block returns the row which is put to the list |
|
230 |
" |
|
231 |
rowIfAbsentBlock := aOneArgAction |
|
232 |
||
233 |
||
607 | 234 |
! ! |
235 |
||
236 |
!DSVColumnView methodsFor:'accessing buttons'! |
|
237 |
||
647 | 238 |
buttonExtent |
239 |
||
240 |
buttonExtent isNil ifTrue:[ |
|
241 |
buttonExtent := self class buttonExtent. |
|
242 |
]. |
|
243 |
^ buttonExtent |
|
244 |
! |
|
245 |
||
246 |
checkToggleForm |
|
247 |
"returns the bitmap of an enabled toggle |
|
248 |
" |
|
249 |
checkToggleForm isNil ifTrue:[ |
|
250 |
(checkToggleForm := CheckToggle checkFormOn:device) isImage ifTrue:[ |
|
251 |
checkToggleForm clearMaskedPixels. |
|
252 |
] |
|
253 |
]. |
|
254 |
^ checkToggleForm |
|
255 |
! |
|
256 |
||
257 |
comboButtonForm |
|
607 | 258 |
"returns the bitmap of a comboView button |
259 |
" |
|
647 | 260 |
comboButtonForm isNil ifTrue:[ |
649
70d121ee3f4d
Use #onDevice: instead of obsolete Form>>on:
Stefan Vogel <sv@exept.de>
parents:
648
diff
changeset
|
261 |
(comboButtonForm := (ComboView buttonForm) onDevice:device) isImage ifTrue:[ |
647 | 262 |
comboButtonForm clearMaskedPixels |
263 |
] |
|
607 | 264 |
]. |
265 |
||
647 | 266 |
^ comboButtonForm |
649
70d121ee3f4d
Use #onDevice: instead of obsolete Form>>on:
Stefan Vogel <sv@exept.de>
parents:
648
diff
changeset
|
267 |
|
70d121ee3f4d
Use #onDevice: instead of obsolete Form>>on:
Stefan Vogel <sv@exept.de>
parents:
648
diff
changeset
|
268 |
"Modified: / 7.1.1998 / 14:02:35 / stefan" |
607 | 269 |
! |
270 |
||
647 | 271 |
rowSelectorForm |
607 | 272 |
"returns the bitmap of a selected row |
273 |
" |
|
647 | 274 |
rowSelectorForm isNil ifTrue:[ |
275 |
rowSelectorForm := (self class rowSelector) on:device |
|
607 | 276 |
]. |
647 | 277 |
^ rowSelectorForm |
542 | 278 |
! ! |
279 |
||
280 |
!DSVColumnView methodsFor:'accessing columns'! |
|
281 |
||
282 |
columnAt:anIndex |
|
607 | 283 |
"returns the column at an index |
542 | 284 |
" |
285 |
^ columnDescriptors at:anIndex |
|
286 |
! |
|
287 |
||
288 |
columnDescriptors:colDesc |
|
289 |
"set the columnDescriptors |
|
290 |
" |
|
612 | 291 |
|id sz| |
292 |
||
293 |
sz := colDesc size. |
|
607 | 294 |
|
612 | 295 |
(sz == 0 or:[selectedColIndex ~~ 0]) ifTrue:[ "/ cell selected |
296 |
self deselect "/ remove selection |
|
297 |
]. |
|
542 | 298 |
|
612 | 299 |
sz ~~ 0 ifTrue:[ |
607 | 300 |
id := 0. |
301 |
||
542 | 302 |
columnDescriptors := colDesc collect:[:aCol| |
607 | 303 |
id := id + 1. |
304 |
DataSetColumn new on:self description:aCol columnNumber:id. |
|
542 | 305 |
] |
306 |
] ifFalse:[ |
|
307 |
columnDescriptors := #() |
|
308 |
]. |
|
647 | 309 |
catchChangeEvents := true. |
310 |
||
542 | 311 |
canFit := (columnDescriptors findFirst:[:aCol|aCol canResize]) ~~ 0. |
312 |
preferredExtent := nil. |
|
313 |
self preferredExtentChanged. |
|
314 |
||
612 | 315 |
shown ifTrue:[ |
556 | 316 |
self fitColumns ifFalse:[ |
317 |
self invalidate. |
|
318 |
self contentsChanged. |
|
319 |
] |
|
563 | 320 |
]. |
647 | 321 |
catchChangeEvents := false. |
322 |
||
563 | 323 |
self changed:#sizeOfColumns. |
542 | 324 |
|
325 |
||
326 |
! |
|
327 |
||
328 |
firstColumn |
|
607 | 329 |
"returns the first column |
542 | 330 |
" |
331 |
^ columnDescriptors at:1 |
|
332 |
||
333 |
! |
|
334 |
||
335 |
lastColumn |
|
607 | 336 |
"returns the last column |
542 | 337 |
" |
338 |
^ columnDescriptors last |
|
339 |
||
340 |
! ! |
|
341 |
||
612 | 342 |
!DSVColumnView methodsFor:'accessing mvc'! |
343 |
||
344 |
columnHolder |
|
345 |
^ columnHolder |
|
346 |
||
347 |
! |
|
348 |
||
349 |
columnHolder:aValueHolder |
|
350 |
|columns| |
|
351 |
||
352 |
columnHolder notNil ifTrue:[ |
|
353 |
columnHolder removeDependent:self |
|
354 |
]. |
|
355 |
||
356 |
(columnHolder := aValueHolder) notNil ifTrue:[ |
|
357 |
columnHolder addDependent:self. |
|
358 |
columns := columnHolder value. |
|
359 |
||
360 |
columns notNil ifTrue:[ |
|
361 |
self columnDescriptors:columns |
|
362 |
] |
|
363 |
]. |
|
364 |
||
365 |
! ! |
|
366 |
||
542 | 367 |
!DSVColumnView methodsFor:'accessing rows'! |
368 |
||
369 |
at:aRowNr |
|
370 |
"return the row at an index, aRowNr |
|
371 |
" |
|
618 | 372 |
|row| |
373 |
||
374 |
(row := list at:aRowNr) isNil ifTrue:[ |
|
375 |
lockRowIndex := aRowNr. |
|
376 |
||
377 |
(row := rowIfAbsentBlock value:aRowNr) notNil ifTrue:[ |
|
378 |
list at:aRowNr put:row. |
|
379 |
beDependentOfRows ifTrue:[row addDependent:self]. |
|
380 |
]. |
|
381 |
||
382 |
lockRowIndex := 0 |
|
383 |
]. |
|
384 |
^ row |
|
542 | 385 |
! |
386 |
||
387 |
at:aRowNr ifAbsent:exceptionBlock |
|
607 | 388 |
"return the row at a aRowNr. If the index is invalid, return the |
542 | 389 |
result of evaluating the exceptionblock |
390 |
" |
|
618 | 391 |
(aRowNr between:1 and:self size) ifTrue:[ |
392 |
^ self at:aRowNr |
|
393 |
]. |
|
394 |
^ exceptionBlock value |
|
542 | 395 |
! |
396 |
||
397 |
at:aRowNr put:aRow |
|
398 |
"change the row at an index. The added row is returned |
|
399 |
" |
|
618 | 400 |
|row| |
401 |
||
402 |
lockRowIndex == aRowNr ifTrue:[ |
|
403 |
^ self |
|
404 |
]. |
|
405 |
row := list at:aRowNr. |
|
406 |
row == aRow ifTrue:[ |
|
407 |
^ self |
|
408 |
]. |
|
409 |
||
542 | 410 |
beDependentOfRows ifTrue:[ |
618 | 411 |
(row := list at:aRowNr) notNil ifTrue:[ |
412 |
row removeDependent:self |
|
413 |
] |
|
542 | 414 |
]. |
618 | 415 |
|
607 | 416 |
list at:aRowNr put:aRow. |
618 | 417 |
|
418 |
aRow notNil ifTrue:[ "/ free list |
|
419 |
beDependentOfRows ifTrue:[ |
|
420 |
aRow addDependent:self |
|
421 |
]. |
|
422 |
self redrawRowAt:aRowNr |
|
423 |
]. |
|
542 | 424 |
^ aRow. |
425 |
! |
|
426 |
||
427 |
first |
|
428 |
"return the first row |
|
429 |
" |
|
618 | 430 |
^ self at:1 |
431 |
! |
|
432 |
||
433 |
identityIndexOfRow:aRow |
|
434 |
"returns index of a row or 0 |
|
435 |
" |
|
436 |
(list size ~~ 0 and:[aRow notNil]) ifTrue:[ |
|
437 |
^ list identityIndexOf:aRow |
|
438 |
]. |
|
439 |
^ 0 |
|
542 | 440 |
! |
441 |
||
442 |
last |
|
443 |
"return the last row |
|
444 |
" |
|
618 | 445 |
^ self at:(self size) |
542 | 446 |
! |
447 |
||
448 |
list |
|
449 |
"get the list of rows |
|
450 |
" |
|
451 |
^ list |
|
452 |
||
453 |
||
454 |
||
455 |
! |
|
456 |
||
457 |
list:aList |
|
458 |
"set the list of rows |
|
459 |
" |
|
656 | 460 |
|makeDependent| |
461 |
||
618 | 462 |
"/ remove selection without redraw |
622 | 463 |
|
464 |
editValue notNil ifTrue:[ |
|
465 |
editValue removeDependent:self. |
|
466 |
editValue := nil |
|
467 |
]. |
|
468 |
||
618 | 469 |
editView notNil ifTrue:[ |
470 |
editView destroy. |
|
471 |
editView := nil. |
|
472 |
]. |
|
622 | 473 |
|
618 | 474 |
selectedColIndex := 0. |
475 |
selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0]. |
|
542 | 476 |
|
612 | 477 |
shown ifFalse:[ |
478 |
preferredExtent := nil |
|
479 |
] ifTrue:[ |
|
480 |
aList size ~~ 0 ifTrue:[ "/ otherwise keep old values |
|
481 |
self columnsDo:[:aCol| aCol invalidate ]. |
|
482 |
preferredExtent := nil. |
|
618 | 483 |
] |
542 | 484 |
]. |
485 |
||
656 | 486 |
(makeDependent := beDependentOfRows) ifTrue:[ |
487 |
self beDependentOfRows:false. |
|
488 |
]. |
|
643 | 489 |
|
490 |
aList size ~~ 0 ifTrue:[ |
|
491 |
list := OrderedCollection new:(aList size). |
|
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
492 |
aList do:[:el| list add:el ]. |
542 | 493 |
] ifFalse:[ |
643 | 494 |
list := nil |
542 | 495 |
]. |
656 | 496 |
self beDependentOfRows:makeDependent. |
542 | 497 |
|
612 | 498 |
shown ifTrue:[ |
499 |
self recomputeHeightOfContents. |
|
500 |
||
542 | 501 |
list size ~~ 0 ifTrue:[ |
502 |
self fitColumns ifTrue:[^ self ]. |
|
503 |
]. |
|
637 | 504 |
self invalidate. |
505 |
self contentsChanged. |
|
506 |
]. |
|
507 |
||
542 | 508 |
|
509 |
||
510 |
||
511 |
! ! |
|
512 |
||
513 |
!DSVColumnView methodsFor:'accessing visibility'! |
|
514 |
||
515 |
backgroundColor |
|
516 |
"get the background color of the rows |
|
517 |
" |
|
518 |
^ bgColor |
|
519 |
||
520 |
||
521 |
! |
|
522 |
||
523 |
backgroundColor:aColor |
|
524 |
"set the background color of the rows |
|
525 |
" |
|
526 |
bgColor ~~ aColor ifTrue:[ |
|
527 |
super viewBackground:bgColor. |
|
528 |
||
529 |
self realized ifTrue:[ |
|
530 |
bgColor := aColor on:device. |
|
531 |
self invalidate |
|
532 |
] ifFalse:[ |
|
533 |
bgColor := aColor |
|
643 | 534 |
] |
542 | 535 |
] |
536 |
! |
|
537 |
||
538 |
font:aFont |
|
539 |
"set the font for all shown rows. |
|
540 |
" |
|
541 |
(aFont notNil and:[aFont ~~ font]) ifTrue:[ |
|
542 |
super font:(aFont on:device). |
|
543 |
self columnsDo:[:aCol| aCol invalidate ]. |
|
544 |
self preferredExtentChanged. |
|
545 |
||
546 |
realized ifTrue:[ |
|
547 |
self invalidate. |
|
548 |
self contentsChanged |
|
643 | 549 |
] |
542 | 550 |
] |
551 |
||
552 |
! |
|
553 |
||
554 |
foregroundColor |
|
555 |
"return the foreground color of the rows |
|
556 |
" |
|
557 |
^ fgColor |
|
558 |
||
559 |
! |
|
560 |
||
561 |
foregroundColor:aColor |
|
562 |
"set the foreground color of the rows |
|
563 |
" |
|
564 |
fgColor ~~ aColor ifTrue:[ |
|
565 |
self realized ifTrue:[ |
|
566 |
fgColor := aColor on:device. |
|
567 |
self invalidate |
|
568 |
] ifFalse:[ |
|
569 |
fgColor := aColor |
|
643 | 570 |
] |
542 | 571 |
] |
572 |
||
573 |
! |
|
574 |
||
607 | 575 |
has3Dseparators |
576 |
"returns true if shown in 3D mode |
|
577 |
" |
|
578 |
^ separatorSize ~~ 1 |
|
542 | 579 |
! |
580 |
||
607 | 581 |
has3Dseparators:aBool |
582 |
"enable or disable 3D mode |
|
583 |
" |
|
584 |
|newSepSize| |
|
542 | 585 |
|
637 | 586 |
newSepSize := aBool ifTrue:[2] ifFalse:[1]. |
607 | 587 |
|
588 |
newSepSize ~~ separatorSize ifTrue:[ |
|
589 |
separatorSize := newSepSize. |
|
590 |
||
542 | 591 |
self columnsDo:[:aCol| aCol invalidate ]. |
592 |
self preferredExtentChanged. |
|
593 |
||
594 |
realized ifTrue:[ |
|
595 |
self invalidate. |
|
596 |
self contentsChanged |
|
647 | 597 |
] |
542 | 598 |
] |
599 |
||
600 |
||
601 |
! |
|
602 |
||
603 |
hgLgBgColor |
|
607 | 604 |
"returns the background color of a selected row |
605 |
" |
|
542 | 606 |
^ hgLgBgColor |
607 |
! |
|
608 |
||
609 |
hgLgFgColor |
|
607 | 610 |
"returns the foreground color of a selected row |
611 |
" |
|
542 | 612 |
^ hgLgFgColor |
613 |
! |
|
614 |
||
615 |
horizontalSpacing |
|
616 |
"horizontal spacing used by columns |
|
617 |
" |
|
563 | 618 |
^ horizontalSpacing |
619 |
! |
|
620 |
||
621 |
horizontalSpacing:aNumber |
|
622 |
"horizontal spacing used by columns |
|
623 |
" |
|
624 |
horizontalSpacing ~~ aNumber ifTrue:[ |
|
625 |
horizontalSpacing := aNumber. |
|
626 |
self preferredExtentChanged. |
|
627 |
]. |
|
542 | 628 |
! |
629 |
||
630 |
separatorDarkColor |
|
607 | 631 |
"returns the dark color used for drawing a shadowed separator (3D) |
632 |
" |
|
542 | 633 |
^ separatorDarkColor |
634 |
||
635 |
||
636 |
! |
|
637 |
||
638 |
separatorLightColor |
|
607 | 639 |
"returns the light color used for drawing a shadowed separator (3D) |
640 |
" |
|
542 | 641 |
^ separatorLightColor |
642 |
||
643 |
||
644 |
! |
|
645 |
||
646 |
verticalSpacing |
|
647 |
"vertical spacing used by columns |
|
648 |
" |
|
563 | 649 |
^ verticalSpacing |
650 |
! |
|
651 |
||
652 |
verticalSpacing:aNumber |
|
653 |
"vertical spacing used by columns |
|
654 |
" |
|
655 |
verticalSpacing ~~ aNumber ifTrue:[ |
|
656 |
verticalSpacing := aNumber. |
|
657 |
self preferredExtentChanged. |
|
658 |
]. |
|
542 | 659 |
! ! |
660 |
||
661 |
!DSVColumnView methodsFor:'adding & removing rows'! |
|
662 |
||
663 |
add:aRow |
|
618 | 664 |
"insert row at end |
542 | 665 |
" |
618 | 666 |
^ self add:aRow beforeIndex:(1 + self size) |
542 | 667 |
! |
668 |
||
669 |
add:aRow afterIndex:aRowNr |
|
670 |
"add a new row after slot aRowNr and redisplay; returns nil in case |
|
618 | 671 |
of an invalid index or the row |
542 | 672 |
" |
673 |
^ self add:aRow beforeIndex:(aRowNr + 1) |
|
674 |
! |
|
675 |
||
676 |
add:aRow beforeIndex:aRowNr |
|
677 |
"add a new row before slot aRowNr and redisplay; returns nil in case |
|
618 | 678 |
of an invalid index or the row |
542 | 679 |
" |
545 | 680 |
|y0 y1 h dH| |
542 | 681 |
|
682 |
list isNil ifTrue:[ |
|
683 |
list := OrderedCollection new. |
|
684 |
preferredExtent := nil. "/ force a recomputation |
|
618 | 685 |
]. |
643 | 686 |
|
618 | 687 |
beDependentOfRows ifTrue:[ |
688 |
aRow notNil ifTrue:[aRow addDependent:self]. |
|
542 | 689 |
]. |
637 | 690 |
|
542 | 691 |
list add:aRow beforeIndex:aRowNr. |
707 | 692 |
|
542 | 693 |
self recomputeHeightOfContents. |
694 |
||
607 | 695 |
(y0 := self numberOfSelections) ~~ 0 ifTrue:[ |
696 |
y0 == 1 ifTrue:[ |
|
697 |
(y0 := self firstIndexSelected) >= aRowNr ifTrue:[ |
|
698 |
y0 := y0 + 1. |
|
699 |
multipleSelectOk ifFalse:[ |
|
700 |
selectedRowIndex := y0 |
|
701 |
] ifTrue:[ |
|
702 |
selectedRowIndex at:1 put:y0 |
|
703 |
] |
|
704 |
] |
|
705 |
] ifFalse:[ |
|
706 |
self deselect |
|
707 |
] |
|
542 | 708 |
]. |
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
709 |
|
542 | 710 |
y0 := (aRowNr - 1) * rowHeight. |
711 |
||
712 |
y0 < viewOrigin y ifTrue:[ |
|
713 |
self originWillChange. |
|
714 |
viewOrigin y:(rowHeight + viewOrigin y). |
|
715 |
self originChanged:(0 @ rowHeight). |
|
716 |
]. |
|
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
717 |
|
707 | 718 |
(shown not or:[self sensor hasDamageFor:self]) ifFalse:[ |
542 | 719 |
y0 := self yVisibleOfRowNr:aRowNr. |
720 |
y1 := y0 + rowHeight. |
|
721 |
||
643 | 722 |
(y1 > margin and:[y0 < (h := height - margin)]) ifTrue:[ |
723 |
h := h - y1. |
|
542 | 724 |
y0 := y0 max:margin. |
725 |
dH := y1 - y0. |
|
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
726 |
aRowNr == list size ifFalse:[ |
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
727 |
self catchExpose. |
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
728 |
|
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
729 |
self copyFrom:self x:0 y:y0 |
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
730 |
toX:0 y:y1 |
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
731 |
width:width height:h async:true. |
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
732 |
|
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
733 |
self waitForExpose |
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
734 |
]. |
643 | 735 |
self redrawX:margin y:y0 width:width - margin - margin height:dH. |
542 | 736 |
] |
737 |
]. |
|
738 |
self contentsChanged. |
|
647 | 739 |
^ aRow |
542 | 740 |
! |
741 |
||
567 | 742 |
addAll:aCollection beforeIndex:aRowNr |
743 |
"add a collection of rows before slot aRowNr and redisplay |
|
744 |
" |
|
745 |
aCollection size ~~ 0 ifTrue:[ |
|
618 | 746 |
self size == 0 ifTrue:[ |
567 | 747 |
^ self list:aCollection |
748 |
]. |
|
749 |
aCollection reverseDo:[:aRow| |
|
750 |
self add:aRow beforeIndex:aRowNr |
|
751 |
] |
|
752 |
]. |
|
753 |
! |
|
754 |
||
542 | 755 |
addFirst:aRow |
618 | 756 |
"insert a row at start |
542 | 757 |
" |
758 |
^ self add:aRow beforeIndex:1 |
|
759 |
! |
|
760 |
||
761 |
removeFirst |
|
762 |
"remove first row; returns the removed row |
|
763 |
" |
|
764 |
self removeIndex:1 |
|
765 |
! |
|
766 |
||
767 |
removeIndex:aRowNr |
|
768 |
"remove row at an index; returns the removed row |
|
769 |
" |
|
545 | 770 |
|y0 y1 h dY oY yB noRedraw row| |
542 | 771 |
|
772 |
row := list at:aRowNr ifAbsent:[^ self subscriptBoundsError:aRowNr]. |
|
618 | 773 |
|
774 |
(beDependentOfRows and:[row notNil]) ifTrue:[ |
|
775 |
row removeDependent:self |
|
776 |
]. |
|
777 |
||
607 | 778 |
(y0 := self numberOfSelections) ~~ 0 ifTrue:[ |
779 |
y0 == 1 ifTrue:[ |
|
780 |
(y0 := self firstIndexSelected) > aRowNr ifTrue:[ |
|
781 |
y0 := y0 - 1. |
|
782 |
multipleSelectOk ifFalse:[ |
|
783 |
selectedRowIndex := y0 |
|
784 |
] ifTrue:[ |
|
785 |
selectedRowIndex at:1 put:y0 |
|
786 |
] |
|
637 | 787 |
] ifFalse:[ |
788 |
y0 == aRowNr ifTrue:[ |
|
789 |
editValue notNil ifTrue:[ |
|
790 |
editValue removeDependent:self. |
|
791 |
editValue := nil. |
|
792 |
]. |
|
793 |
self deselect |
|
794 |
] |
|
607 | 795 |
] |
796 |
] ifFalse:[ |
|
797 |
self deselect |
|
542 | 798 |
] |
799 |
]. |
|
800 |
y1 := aRowNr * rowHeight. |
|
801 |
y0 := y1 - rowHeight. |
|
802 |
yB := y1 + margin - viewOrigin y. |
|
803 |
||
804 |
list removeIndex:aRowNr. |
|
805 |
self recomputeHeightOfContents. |
|
806 |
||
807 |
y0 < (oY := viewOrigin y) ifTrue:[ |
|
808 |
(noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY] |
|
809 |
ifTrue:[dY := rowHeight negated]. |
|
810 |
self originWillChange. |
|
811 |
viewOrigin y:(dY + oY). |
|
812 |
self originChanged:(0 @ dY). |
|
813 |
] ifFalse:[ |
|
814 |
noRedraw := y0 > (height + viewOrigin y) |
|
815 |
]. |
|
816 |
||
817 |
(noRedraw or:[shown not]) ifFalse:[ |
|
818 |
y1 := yB. |
|
819 |
y0 := self yVisibleOfRowNr:aRowNr. |
|
820 |
h := height - margin - yB. |
|
821 |
y0 := y0 max:margin. |
|
822 |
||
561 | 823 |
h > 0 ifTrue:[ |
824 |
self catchExpose. |
|
825 |
self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:true. |
|
826 |
self waitForExpose. |
|
827 |
]. |
|
542 | 828 |
y0 := y0 + h. |
643 | 829 |
self redrawX:margin y:y0 width:width - margin - margin height:(height - y0). |
542 | 830 |
]. |
831 |
self contentsChanged. |
|
647 | 832 |
^ row. |
542 | 833 |
! |
834 |
||
835 |
removeLast |
|
836 |
"remove last row; the row is returned |
|
837 |
" |
|
618 | 838 |
^ self removeIndex:self size |
542 | 839 |
! ! |
840 |
||
841 |
!DSVColumnView methodsFor:'change & update'! |
|
842 |
||
707 | 843 |
changed:what |
647 | 844 |
catchChangeEvents ifTrue:[ |
707 | 845 |
|
647 | 846 |
(what == #columnsLayout or:[what == #originOfContents]) ifTrue:[ |
847 |
^ self |
|
848 |
] |
|
849 |
]. |
|
707 | 850 |
^ super changed:what |
647 | 851 |
! |
852 |
||
542 | 853 |
update:something with:aParameter from:changedObject |
854 |
"one of my rows/cells changed its value |
|
855 |
" |
|
618 | 856 |
|row| |
542 | 857 |
|
612 | 858 |
changedObject == columnHolder ifTrue:[ |
859 |
^ self columnDescriptors:(columnHolder value) |
|
622 | 860 |
]. |
861 |
||
862 |
changedObject == editValue ifTrue:[ |
|
863 |
^ self selectedColumn at:(self firstIndexSelected) put:(editValue value) |
|
864 |
]. |
|
865 |
||
866 |
row := (something isNumber) ifTrue:[something] ifFalse:[changedObject]. |
|
867 |
self redrawVisibleRow:row. |
|
542 | 868 |
! ! |
869 |
||
637 | 870 |
!DSVColumnView methodsFor:'drawing'! |
871 |
||
872 |
colorOnDevice:aColor |
|
873 |
"returns color on device |
|
874 |
" |
|
875 |
|col| |
|
876 |
||
641 | 877 |
aColor = Color noColor ifFalse:[ |
878 |
col := colorMap at:aColor ifAbsent:nil. |
|
637 | 879 |
|
641 | 880 |
col isNil ifTrue:[ |
881 |
colorMap at:aColor put:(col := aColor on:device) |
|
882 |
]. |
|
883 |
^ col |
|
637 | 884 |
]. |
641 | 885 |
^ bgColor |
637 | 886 |
! |
887 |
||
888 |
forceRedraw |
|
889 |
"a redraw forced by any other component |
|
890 |
" |
|
891 |
self redraw |
|
892 |
! |
|
893 |
||
894 |
invalidate |
|
895 |
"recompute extent before repair range |
|
896 |
" |
|
897 |
self recomputeHeightOfContents. |
|
898 |
super invalidate. |
|
899 |
||
900 |
||
901 |
! |
|
902 |
||
903 |
redraw |
|
904 |
"redraw complete view |
|
905 |
" |
|
906 |
self redrawX:0 y:0 width:width height:height. |
|
907 |
||
908 |
! |
|
909 |
||
910 |
redrawRowAt:aRowNr |
|
911 |
"redraw total row at an index |
|
912 |
" |
|
913 |
self redrawRowAt:aRowNr colAt:0 |
|
914 |
! |
|
915 |
||
916 |
redrawRowAt:aRowNr colAt:aColNr |
|
917 |
"redraw visible row in case of aColNr == 0 or the column in a row; |
|
918 |
in case that the row/column is hidden no redraw is done |
|
919 |
" |
|
920 |
|x y h w| |
|
921 |
||
922 |
(shown and:[aRowNr between:1 and:self size]) ifTrue:[ |
|
923 |
h := rowHeight - 1. |
|
924 |
||
925 |
(y := self yVisibleOfRowNr:aRowNr) < margin ifTrue:[ |
|
926 |
(h := h + y) <= margin ifTrue:[ |
|
927 |
^ self |
|
928 |
]. "/ row not visible |
|
929 |
h := h - margin. |
|
930 |
y := margin. |
|
931 |
] ifFalse:[ |
|
932 |
y >= height ifTrue:[^ self]. |
|
933 |
]. |
|
934 |
aColNr ~~ 0 ifTrue:[ "/ redraw column in row |
|
935 |
w := (self columnAt:aColNr) width. |
|
936 |
||
937 |
(x := self xVisibleOfColNr:aColNr) < margin ifTrue:[ |
|
938 |
(w := w + x) <= margin ifTrue:[ |
|
939 |
^ self |
|
940 |
]. "/ column not visible |
|
941 |
w := w - margin. |
|
942 |
x := margin. |
|
943 |
] ifFalse:[ |
|
944 |
x >= width ifTrue:[^ self]. |
|
945 |
] |
|
946 |
] ifFalse:[ "/ redraw whole row |
|
947 |
x := margin. |
|
948 |
w := width. |
|
949 |
]. |
|
950 |
self redrawX:x y:y width:w height:h |
|
951 |
] |
|
952 |
! |
|
953 |
||
954 |
redrawVisibleRow:aRow |
|
955 |
"redraw row if visible |
|
956 |
" |
|
957 |
|start "{ Class:SmallInteger }" |
|
958 |
stop "{ Class:SmallInteger }" |
|
959 |
| |
|
960 |
||
961 |
(start := self indexOfFirstRowShown) ~~ 0 ifTrue:[ |
|
962 |
stop := (start + (height // rowHeight)) min:(self size). |
|
963 |
||
964 |
aRow isNumber ifTrue:[ |
|
965 |
(aRow between:start and:stop) ifTrue:[ |
|
966 |
self redrawRowAt:aRow colAt:0 |
|
967 |
] |
|
968 |
] ifFalse:[ |
|
969 |
start to:stop do:[:i| |
|
970 |
(self at:i) == aRow ifTrue:[ |
|
971 |
^ self redrawRowAt:i colAt:0 |
|
972 |
] |
|
973 |
] |
|
974 |
] |
|
975 |
] |
|
976 |
! |
|
977 |
||
978 |
redrawX:x y:y width:w height:h |
|
979 |
"redraw part of myself immediately, given logical coordinates |
|
980 |
" |
|
643 | 981 |
|c0 prevClipArea |
637 | 982 |
start "{ Class:SmallInteger }" |
983 |
stop "{ Class:SmallInteger }" |
|
984 |
x0 "{ Class:SmallInteger }" |
|
985 |
x1 "{ Class:SmallInteger }" |
|
986 |
maxX "{ Class:SmallInteger }" |
|
643 | 987 |
minX "{ Class:SmallInteger }" |
637 | 988 |
yTop "{ Class:SmallInteger }" |
989 |
yBot "{ Class:SmallInteger }" |
|
990 |
times "{ Class:SmallInteger }" |
|
641 | 991 |
yMax "{ Class:SmallInteger }" |
637 | 992 |
| |
993 |
||
994 |
shown ifFalse:[^ self]. |
|
995 |
self paint:bgColor. |
|
996 |
self fillRectangleX:x y:y width:w height:h. |
|
997 |
||
643 | 998 |
columnDescriptors size ~~ 0 ifTrue:[ |
637 | 999 |
yTop := margin - viewOrigin y. |
1000 |
c0 := y - yTop. |
|
1001 |
start := (c0 // rowHeight) + 1. |
|
643 | 1002 |
stop := (c0 + h - 1 // rowHeight + 1) min:(list size). |
637 | 1003 |
|
1004 |
(times := stop - start + 1) > 0 ifTrue:[ |
|
643 | 1005 |
prevClipArea := clipRect. |
1006 |
clipRect := nil. |
|
1007 |
||
1008 |
maxX := (x + w) min:(width - margin). |
|
637 | 1009 |
x0 := margin - viewOrigin x. |
1010 |
yTop := yTop + ((start - 1) * rowHeight). |
|
1011 |
yBot := yTop + (times * rowHeight). |
|
642 | 1012 |
yMax := height - margin - margin. |
643 | 1013 |
minX := x max:margin. |
1014 |
||
1015 |
columnDescriptors do:[:aCol| |
|
1016 |
x1 := x0 + aCol width. |
|
637 | 1017 |
|
1018 |
(x1 > x and:[x0 < maxX]) ifTrue:[ |
|
643 | 1019 |
c0 := (x1 min:maxX) - minX. |
1020 |
device setClipX:minX y:margin width:c0 height:yMax in:drawableId gc:gcId. |
|
637 | 1021 |
aCol drawFrom:start times:times x0:x0 yTop:yTop yBot:yBot with:fgColor and:bgColor. |
1022 |
]. |
|
1023 |
x0 := x1 |
|
1024 |
]. |
|
1025 |
clipRect := nil. |
|
1026 |
prevClipArea isNil ifTrue:[device noClipIn:drawableId gc:gcId] |
|
1027 |
ifFalse:[self clippingRectangle:prevClipArea]. |
|
1028 |
] |
|
1029 |
] |
|
1030 |
||
1031 |
! ! |
|
1032 |
||
542 | 1033 |
!DSVColumnView methodsFor:'enumerating columns'! |
1034 |
||
1035 |
columnsDo:aOneArgBlock |
|
1036 |
"evaluate the argument, aOneArgBlock for every column |
|
1037 |
" |
|
1038 |
columnDescriptors do:aOneArgBlock |
|
1039 |
||
1040 |
||
1041 |
! |
|
1042 |
||
1043 |
columnsFrom:start to:stop do:aOneArgBlock |
|
1044 |
"evaluate the argument, aOneArgBlock for the columns with index start to |
|
1045 |
stop in the collection of column descriptors |
|
1046 |
" |
|
1047 |
columnDescriptors from:start to:stop do:aOneArgBlock |
|
1048 |
||
1049 |
||
1050 |
! ! |
|
1051 |
||
1052 |
!DSVColumnView methodsFor:'event handling'! |
|
1053 |
||
607 | 1054 |
buttonMotion:buttonMask x:x y:y |
1055 |
"mouse-move while button was pressed - handle multiple selection changes |
|
1056 |
" |
|
1057 |
|idx size scr| |
|
1058 |
||
1059 |
self sensor ctrlDown ifTrue:[^ self ]. |
|
1060 |
||
1061 |
(multipleSelectOk and:[selectedColIndex == 0 and:[selectedRowIndex notNil]]) ifFalse:[ |
|
1062 |
^ self |
|
1063 |
]. |
|
1064 |
"is it the select or 1-button ?" |
|
1065 |
||
1066 |
(device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[ |
|
1067 |
(device buttonMotionMask:buttonMask includesButton:1) ifFalse:[ |
|
1068 |
^ self |
|
1069 |
]. |
|
1070 |
]. |
|
1071 |
scr := 0. |
|
1072 |
||
1073 |
y > height ifTrue:[ |
|
1074 |
scr := rowHeight. |
|
1075 |
idx := self yVisibleToRowNr:(height + rowHeight). |
|
1076 |
] ifFalse:[ |
|
1077 |
y < 0 ifTrue:[ |
|
1078 |
scr := rowHeight negated. |
|
1079 |
idx := self yVisibleToRowNr:scr. |
|
1080 |
] ifFalse:[ |
|
1081 |
idx := self yVisibleToRowNr:y. |
|
1082 |
] |
|
1083 |
]. |
|
643 | 1084 |
(idx isNil or:[idx < 1 or:[self isInSelection:idx]]) ifTrue:[ |
607 | 1085 |
^ self |
1086 |
]. |
|
1087 |
selectedRowIndex := selectedRowIndex asOrderedCollection. |
|
643 | 1088 |
|
1089 |
clickPosition notNil ifTrue:[ |
|
1090 |
(clickPosition - idx) abs > 1 ifTrue:[|s e| |
|
1091 |
clickPosition < idx ifTrue:[ |
|
1092 |
s := clickPosition + 1. |
|
1093 |
e := idx - 1. |
|
1094 |
] ifFalse:[ |
|
1095 |
s := idx + 1. |
|
1096 |
e := clickPosition - 1. |
|
1097 |
]. |
|
1098 |
s to:e do:[:i| |
|
1099 |
(self isInSelection:i) ifFalse:[ |
|
1100 |
selectedRowIndex add:i. |
|
1101 |
self redrawRowAt:i colAt:0. |
|
1102 |
] |
|
1103 |
] |
|
1104 |
] |
|
1105 |
]. |
|
1106 |
selectedRowIndex add:(clickPosition := idx). |
|
607 | 1107 |
|
1108 |
scr == 0 ifTrue:[ |
|
643 | 1109 |
self redrawX:margin y:y width:width - margin - margin height:1 |
607 | 1110 |
] ifFalse:[ |
1111 |
self scrollTo:(viewOrigin + (0 @ scr)) redraw:true |
|
1112 |
]. |
|
1113 |
! |
|
1114 |
||
542 | 1115 |
buttonMultiPress:button x:x y:y |
1116 |
"a button was pressed twice - handle doubleclick here |
|
1117 |
" |
|
1118 |
((button == 1) or:[button == #select]) ifFalse:[ |
|
1119 |
^ super buttonMultiPress:button x:x y:y |
|
1120 |
]. |
|
607 | 1121 |
self numberOfSelections == 1 ifTrue:[ |
1122 |
self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[ |
|
1123 |
( selectedColIndex == 0 |
|
1124 |
or:[selectedColIndex == (self xVisibleToColNr:x)] |
|
1125 |
) ifTrue:[ |
|
1126 |
self doubleClicked |
|
1127 |
] |
|
542 | 1128 |
] |
1129 |
] |
|
1130 |
||
1131 |
||
1132 |
||
1133 |
||
1134 |
! |
|
1135 |
||
1136 |
buttonPress:button x:x y:y |
|
1137 |
"a button was pressed - handle selection here |
|
1138 |
" |
|
637 | 1139 |
|rowNr colNr menu col sz view point| |
542 | 1140 |
|
667 | 1141 |
((button == 2) or:[button == #menu]) ifTrue:[ |
1142 |
(menu := self findMenuForSelection) notNil ifTrue:[ |
|
1143 |
^ menu startUp |
|
1144 |
] |
|
1145 |
] ifFalse:[ |
|
1146 |
( (button == 1 or:[button == #select]) |
|
1147 |
and:[(rowNr := self yVisibleToRowNr:y) notNil |
|
1148 |
and:[(colNr := self xVisibleToColNr:x) notNil]] |
|
1149 |
) ifTrue:[ |
|
1150 |
(multipleSelectOk not or:[self sensor ctrlDown not]) ifFalse:[ |
|
1151 |
selectedColIndex ~~ 0 ifTrue:[ |
|
1152 |
colNr := 0 |
|
1153 |
] ifFalse:[ |
|
1154 |
(sz := self numberOfSelections == 0) ifFalse:[ |
|
1155 |
(self isInSelection:rowNr) ifTrue:[ |
|
1156 |
sz == 1 ifTrue:[ |
|
1157 |
self selectColIndex:0 rowIndex:nil. |
|
1158 |
^ self sensor flushMotionEventsFor:self. |
|
1159 |
]. |
|
1160 |
selectedRowIndex remove:rowNr. |
|
1161 |
] ifFalse:[ |
|
1162 |
selectedRowIndex add:rowNr |
|
1163 |
]. |
|
1164 |
self redrawRowAt:rowNr. |
|
1165 |
self selectionChanged. |
|
1166 |
^ self sensor flushMotionEventsFor:self. |
|
607 | 1167 |
] |
667 | 1168 |
] |
1169 |
]. |
|
1170 |
self selectColIndex:colNr rowIndex:rowNr. |
|
1171 |
point := x@y. |
|
1172 |
view := self detectViewAt:point in:editView. |
|
1173 |
||
1174 |
view notNil ifTrue:[ |
|
1175 |
point := device translatePoint:(x@y) from:(self id) to:(view id). |
|
1176 |
||
1177 |
self sensor pushEvent:(WindowEvent buttonEvent |
|
1178 |
for:view |
|
1179 |
type:#buttonPress:x:y: |
|
1180 |
arguments:(Array with:button with:point x with:point y) |
|
1181 |
) |
|
1182 |
]. |
|
1183 |
^ self |
|
542 | 1184 |
] |
1185 |
]. |
|
667 | 1186 |
super buttonPress:button x:x y:y |
1187 |
||
542 | 1188 |
|
1189 |
||
1190 |
! |
|
1191 |
||
643 | 1192 |
buttonRelease:button x:x y:y |
1193 |
||
1194 |
clickPosition notNil ifTrue:[ |
|
1195 |
clickPosition := nil. |
|
1196 |
self selectionChanged. |
|
1197 |
]. |
|
1198 |
super buttonRelease:button x:x y:y |
|
1199 |
||
1200 |
||
1201 |
! |
|
1202 |
||
542 | 1203 |
contentsChanged |
1204 |
"contents changed - move origin up if possible |
|
1205 |
" |
|
1206 |
|y| |
|
1207 |
||
1208 |
shown ifTrue:[ |
|
1209 |
self recomputeHeightOfContents. |
|
1210 |
y := self maxViewOriginY. |
|
1211 |
||
1212 |
viewOrigin y > y ifTrue:[ |
|
1213 |
self scrollTo:(viewOrigin x @ y) |
|
1214 |
] ifFalse:[ |
|
1215 |
self updateEditViewOrigin. |
|
1216 |
] |
|
1217 |
]. |
|
1218 |
super contentsChanged |
|
1219 |
||
1220 |
||
1221 |
! |
|
1222 |
||
1223 |
doubleClicked |
|
1224 |
"handle a double click |
|
1225 |
" |
|
637 | 1226 |
|col sel idx| |
1227 |
||
1228 |
self hasSelection ifTrue:[ |
|
1229 |
idx := self firstIndexSelected. |
|
1230 |
col := self selectedColumn. |
|
1231 |
(col notNil and:[(sel := col doubleClickedSelector) notNil]) ifTrue:[ |
|
1232 |
(self at:idx) perform:sel |
|
1233 |
] ifFalse:[ |
|
1234 |
doubleClickActionBlock notNil ifTrue:[ |
|
1235 |
doubleClickActionBlock value:idx |
|
1236 |
] |
|
1237 |
] |
|
1238 |
] |
|
542 | 1239 |
! |
1240 |
||
667 | 1241 |
findMenuForSelection |
1242 |
"find the middle button menu for the current selection; returns the menu or nil |
|
1243 |
" |
|
1244 |
|col row menu| |
|
1245 |
||
1246 |
self numberOfSelections == 1 ifTrue:[ |
|
1247 |
row := self at:(self firstIndexSelected). |
|
1248 |
col := self selectedColumn. |
|
1249 |
||
1250 |
(col notNil and:[(menu := col menuForRow:row) notNil]) ifTrue:[ |
|
1251 |
^ menu |
|
1252 |
]. |
|
1253 |
col := columnDescriptors detect:[:c| c rendererType == #rowSelector] |
|
1254 |
ifNone:[nil]. |
|
1255 |
||
1256 |
col notNil ifTrue:[ |
|
1257 |
^ col menuForRow:row |
|
1258 |
] |
|
1259 |
]. |
|
1260 |
^ nil |
|
1261 |
! |
|
1262 |
||
542 | 1263 |
keyPress:key x:x y:y |
1264 |
"a key was pressed - handle page-keys here |
|
1265 |
" |
|
1266 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
|
1267 |
#BeginOfText #EndOfText |
|
1268 |
#ScrollUp #ScrollDown |
|
1269 |
#CursorUp #CursorDown #CursorRight #CursorLeft)> |
|
1270 |
||
607 | 1271 |
|sensor n max idx col selRowNr| |
542 | 1272 |
|
1273 |
(key == #PreviousPage) ifTrue: [^ self pageUp]. |
|
1274 |
(key == #NextPage) ifTrue: [^ self pageDown]. |
|
1275 |
(key == #HalfPageUp) ifTrue: [^ self halfPageUp]. |
|
1276 |
(key == #HalfPageDown) ifTrue: [^ self halfPageDown]. |
|
1277 |
||
1278 |
(key == #BeginOfText) ifTrue:[^ self scrollToTop]. |
|
1279 |
(key == #EndOfText) ifTrue:[^ self scrollToBottom]. |
|
1280 |
||
1281 |
sensor := self sensor. |
|
1282 |
||
1283 |
(key == #ScrollUp) ifTrue:[ |
|
1284 |
sensor isNil ifTrue:[ |
|
1285 |
n := 1 |
|
1286 |
] ifFalse:[ |
|
1287 |
n := 1 + (sensor compressKeyPressEventsWithKey:#ScrollUp). |
|
1288 |
]. |
|
1289 |
^ self scrollUp:(n * self verticalScrollStep) |
|
1290 |
]. |
|
1291 |
(key == #ScrollDown) ifTrue:[ |
|
1292 |
sensor isNil ifTrue:[ |
|
1293 |
n := 1 |
|
1294 |
] ifFalse:[ |
|
1295 |
n := 1 + (sensor compressKeyPressEventsWithKey:#ScrollDown). |
|
1296 |
]. |
|
1297 |
^ self scrollDown:(n * self verticalScrollStep) |
|
1298 |
]. |
|
607 | 1299 |
self numberOfSelections == 1 ifFalse:[^ self]. |
1300 |
selRowNr := self firstIndexSelected. |
|
542 | 1301 |
|
1302 |
key == #Return ifTrue:[ |
|
1303 |
^ self doubleClicked |
|
1304 |
]. |
|
618 | 1305 |
max := self size. |
542 | 1306 |
|
1307 |
(key == #CursorUp or:[key == #CursorDown]) ifTrue:[ |
|
1308 |
sensor isNil ifTrue:[ |
|
1309 |
n := 1 |
|
1310 |
] ifFalse:[ |
|
1311 |
n := 1 + (sensor compressKeyPressEventsWithKey:key). |
|
1312 |
]. |
|
1313 |
(n := n \\ max) == 0 ifTrue:[^ self ]. |
|
1314 |
||
1315 |
key == #CursorUp ifTrue:[ |
|
607 | 1316 |
(n := selRowNr - n) <= 0 ifTrue:[n := max + n] |
542 | 1317 |
] ifFalse:[ |
607 | 1318 |
(n := selRowNr + n) > max ifTrue:[n := n - max] |
542 | 1319 |
]. |
1320 |
^ self selectColIndex:selectedColIndex rowIndex:n. |
|
1321 |
]. |
|
1322 |
||
612 | 1323 |
selectedColIndex == 0 ifTrue:[ "/ line selected |
1324 |
^ self |
|
1325 |
]. |
|
1326 |
||
542 | 1327 |
(key == #CursorRight or:[key == #CursorLeft]) ifTrue:[ |
1328 |
sensor isNil ifTrue:[ |
|
1329 |
n := 1 |
|
1330 |
] ifFalse:[ |
|
1331 |
n := 1 + (sensor compressKeyPressEventsWithKey:key). |
|
1332 |
]. |
|
1333 |
idx := selectedColIndex. |
|
1334 |
max := self numberOfColumns. |
|
1335 |
||
1336 |
key == #CursorLeft ifTrue:[ |
|
1337 |
[n ~~ 0] whileTrue:[ |
|
1338 |
(idx := idx - 1) == 0 ifTrue:[idx := max]. |
|
607 | 1339 |
((self columnAt:idx) canSelect:selRowNr) ifTrue:[n := n - 1] |
542 | 1340 |
] |
1341 |
] ifFalse:[ |
|
1342 |
[n ~~ 0] whileTrue:[ |
|
1343 |
idx == max ifTrue:[idx := 1] |
|
1344 |
ifFalse:[idx := idx + 1]. |
|
607 | 1345 |
((self columnAt:idx) canSelect:selRowNr) ifTrue:[n := n - 1] |
542 | 1346 |
] |
1347 |
]. |
|
1348 |
||
607 | 1349 |
^ self selectColIndex:idx rowIndex:selRowNr. |
542 | 1350 |
]. |
618 | 1351 |
(rowIfAbsentBlock isNil and:[key isCharacter]) ifFalse:[ |
563 | 1352 |
^ self |
1353 |
]. |
|
542 | 1354 |
|
1355 |
col := self columnAt:selectedColIndex. |
|
1356 |
||
1357 |
"/ search forward |
|
618 | 1358 |
|
1359 |
max > selRowNr ifTrue:[ |
|
1360 |
idx := col findRowNrStartingWithChar:key start:(selRowNr + 1) stop:max. |
|
1361 |
] ifFalse:[ |
|
1362 |
idx := 0 |
|
1363 |
]. |
|
542 | 1364 |
|
1365 |
idx == 0 ifTrue:[ |
|
618 | 1366 |
selRowNr ~~ 1 ifTrue:[ |
1367 |
"/ search from begin |
|
1368 |
idx := col findRowNrStartingWithChar:key start:1 stop:(selRowNr - 1). |
|
1369 |
] |
|
542 | 1370 |
]. |
1371 |
idx ~~ 0 ifTrue:[ |
|
1372 |
self selectColIndex:selectedColIndex rowIndex:idx. |
|
1373 |
]. |
|
1374 |
||
1375 |
||
1376 |
||
1377 |
||
1378 |
||
1379 |
! |
|
1380 |
||
1381 |
originChanged:delta |
|
1382 |
"this one is sent, after the origin of my contents has changed - |
|
1383 |
tell dependents (i.e. scrollers) about this |
|
1384 |
" |
|
1385 |
super originChanged:delta. |
|
1386 |
self updateEditViewOrigin. |
|
1387 |
! |
|
1388 |
||
1389 |
sizeChanged:how |
|
1390 |
"size changed - move origin up if possible |
|
1391 |
" |
|
1392 |
super sizeChanged:how. |
|
1393 |
||
1394 |
(shown and:[self numberOfColumns ~~ 0 and:[self fitColumns not]]) ifTrue:[ |
|
1395 |
self scrollTo:viewOrigin. "/ validates viewOrigin |
|
1396 |
self invalidate. |
|
1397 |
self scrollToSelection |
|
1398 |
] |
|
1399 |
||
1400 |
! ! |
|
1401 |
||
1402 |
!DSVColumnView methodsFor:'gc operations'! |
|
1403 |
||
1404 |
registerImage:anImage key:aKey |
|
1405 |
"any row can register an image with a unique identifier a key symbol |
|
1406 |
" |
|
1407 |
|img| |
|
1408 |
||
1409 |
(img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
|
1410 |
^ img |
|
1411 |
]. |
|
567 | 1412 |
img := anImage onDevice:device. |
1413 |
img clearMaskedPixels. |
|
1414 |
registererImages at:aKey put:img. |
|
1415 |
^ img |
|
542 | 1416 |
! |
1417 |
||
1418 |
registeredImageAt:aKey |
|
1419 |
"any row can register an image with a unique identifier |
|
1420 |
" |
|
1421 |
^ registererImages at:aKey ifAbsent:nil |
|
1422 |
! |
|
1423 |
||
1424 |
releaseAllRegisteredImages |
|
1425 |
"release all registered images |
|
1426 |
" |
|
1427 |
registererImages := IdentityDictionary new. |
|
1428 |
! ! |
|
1429 |
||
1430 |
!DSVColumnView methodsFor:'initialization'! |
|
1431 |
||
1432 |
create |
|
607 | 1433 |
"set color on device |
542 | 1434 |
" |
1435 |
super create. |
|
1436 |
fgColor := fgColor on:device. |
|
1437 |
bgColor := bgColor on:device. |
|
1438 |
hgLgFgColor := hgLgFgColor on:device. |
|
1439 |
hgLgBgColor := hgLgBgColor on:device. |
|
1440 |
separatorLightColor := separatorLightColor on:device. |
|
1441 |
separatorDarkColor := separatorDarkColor on:device. |
|
1442 |
||
1443 |
! |
|
1444 |
||
1445 |
destroy |
|
1446 |
"remove dependencies |
|
1447 |
" |
|
618 | 1448 |
self columnHolder:nil. |
1449 |
self beDependentOfRows:false. |
|
542 | 1450 |
super destroy |
1451 |
! |
|
1452 |
||
1453 |
initStyle |
|
607 | 1454 |
"setup colors |
1455 |
" |
|
542 | 1456 |
super initStyle. |
1457 |
||
1458 |
DefaultForegroundColor isNil ifTrue:[ |
|
1459 |
self class updateStyleCache |
|
1460 |
]. |
|
1461 |
fgColor := DefaultForegroundColor. |
|
1462 |
bgColor := DefaultBackgroundColor. |
|
1463 |
hgLgFgColor := DefaultHilightForegroundColor. |
|
1464 |
hgLgBgColor := DefaultHilightBackgroundColor. |
|
1465 |
separatorDarkColor := DefaultSeparatorDarkColor. |
|
1466 |
separatorLightColor := DefaultSeparatorLightColor. |
|
1467 |
! |
|
1468 |
||
1469 |
initialize |
|
1470 |
"set default attributes |
|
1471 |
" |
|
1472 |
super initialize. |
|
1473 |
||
607 | 1474 |
viewOrigin := 0@0. |
1475 |
font := font on:device. |
|
1476 |
rowHeight := font height. |
|
1477 |
multipleSelectOk := false. |
|
1478 |
selectedRowIndex := selectedColIndex := 0. |
|
1479 |
registererImages := IdentityDictionary new. |
|
1480 |
separatorSize := 1. |
|
542 | 1481 |
columnDescriptors := #(). |
567 | 1482 |
beDependentOfRows := false. |
563 | 1483 |
verticalSpacing := self class verticalSpacing. |
1484 |
horizontalSpacing := self class horizontalSpacing. |
|
637 | 1485 |
colorMap := Dictionary new. |
647 | 1486 |
catchChangeEvents := false. |
637 | 1487 |
|
610 | 1488 |
self lineWidth:0. |
542 | 1489 |
! |
1490 |
||
705 | 1491 |
mapped |
1492 |
"set selection if exists after mapping |
|
1493 |
" |
|
1494 |
|idx| |
|
1495 |
||
1496 |
super mapped. |
|
1497 |
||
1498 |
idx := self firstIndexSelected. |
|
1499 |
||
1500 |
idx ~~ 0 ifTrue:[ |
|
1501 |
self scrollToRowAt:idx colAt:0. |
|
1502 |
]. |
|
1503 |
! |
|
1504 |
||
542 | 1505 |
realize |
607 | 1506 |
"recompute contents and fit columns to view |
542 | 1507 |
" |
607 | 1508 |
self bitGravity:#NorthWest. |
542 | 1509 |
self recomputeHeightOfContents. |
1510 |
super realize. |
|
607 | 1511 |
self fitColumns. |
1512 |
! ! |
|
1513 |
||
1514 |
!DSVColumnView methodsFor:'obsolete'! |
|
1515 |
||
1516 |
has3Dsepartors |
|
1517 |
"shouldn't be used any more |
|
1518 |
" |
|
1519 |
^ self has3Dseparators |
|
1520 |
! |
|
1521 |
||
1522 |
has3Dsepartors:aBool |
|
1523 |
"shouldn't be used any more |
|
1524 |
" |
|
1525 |
self has3Dseparators:aBool |
|
542 | 1526 |
|
1527 |
! ! |
|
1528 |
||
1529 |
!DSVColumnView methodsFor:'private'! |
|
1530 |
||
637 | 1531 |
detectViewAt:aPoint in:aView |
1532 |
|p| |
|
1533 |
||
1534 |
(aView notNil and:[aView subViews notNil]) ifTrue:[ |
|
1535 |
aView subViews do:[:sv| |
|
1536 |
p := device translatePoint:aPoint from:(self id) to:(sv id). |
|
1537 |
||
1538 |
(p x >= 0 and:[p y >= 0 and:[p x <= sv width and:[p y <= sv height]]]) ifTrue:[ |
|
1539 |
^ self detectViewAt:aPoint in:sv |
|
1540 |
] |
|
1541 |
] |
|
1542 |
]. |
|
1543 |
^ aView |
|
1544 |
! |
|
1545 |
||
542 | 1546 |
fitColumns |
1547 |
"fit columns to view |
|
1548 |
" |
|
647 | 1549 |
|lastColumn dX sz expand resizables deltaWidth saveEvent noExtent| |
542 | 1550 |
|
1551 |
self canFit ifFalse:[^ false ]. |
|
647 | 1552 |
|
1553 |
saveEvent := catchChangeEvents. |
|
1554 |
catchChangeEvents := true. |
|
1555 |
resizables := 0. |
|
1556 |
deltaWidth := 0. |
|
1557 |
||
1558 |
(noExtent := self preferredExtent isNil) ifTrue:[ |
|
1559 |
self preferredExtent. |
|
1560 |
]. |
|
542 | 1561 |
|
1562 |
self columnsDo:[:aCol| |
|
1563 |
aCol canResize ifTrue:[ |
|
1564 |
resizables := resizables + 1. |
|
1565 |
deltaWidth := aCol setMinWidth. |
|
1566 |
lastColumn := aCol. |
|
1567 |
] |
|
1568 |
]. |
|
647 | 1569 |
|
1570 |
resizables == 0 ifFalse:[ |
|
1571 |
sz := self widthOfContents. |
|
1572 |
||
1573 |
(expand := sz < width) ifTrue:[ |
|
1574 |
deltaWidth := width - sz + margin + margin |
|
1575 |
] |
|
1576 |
]. |
|
1577 |
||
1578 |
deltaWidth == 0 ifTrue:[ |
|
1579 |
(catchChangeEvents := saveEvent) ifFalse:[ |
|
1580 |
noExtent ifTrue:[self changed:#columnsLayout] |
|
1581 |
]. |
|
1582 |
^ false |
|
542 | 1583 |
]. |
1584 |
||
1585 |
expand ifTrue:[ |
|
1586 |
(dX := deltaWidth // resizables) ~~ 0 ifTrue:[ |
|
1587 |
self columnsDo:[:aCol|aCol canResize ifTrue:[aCol growWidth:dX]] |
|
1588 |
]. |
|
1589 |
lastColumn growWidth:(deltaWidth - (dX * resizables)). |
|
1590 |
]. |
|
1591 |
self preferredExtentChanged. |
|
612 | 1592 |
|
1593 |
shown ifTrue:[ |
|
1594 |
self invalidate. |
|
542 | 1595 |
|
612 | 1596 |
self hasSelection ifTrue:[ |
1597 |
editView notNil ifTrue:[ |
|
1598 |
editView width:(self selectedColumn width - separatorSize) |
|
1599 |
]. |
|
1600 |
self scrollToSelection. |
|
542 | 1601 |
]. |
612 | 1602 |
self contentsChanged |
542 | 1603 |
]. |
647 | 1604 |
|
1605 |
catchChangeEvents := saveEvent. |
|
1606 |
self changed:#columnsLayout. |
|
542 | 1607 |
^ true |
1608 |
||
1609 |
||
1610 |
! |
|
1611 |
||
1612 |
maxViewOriginY |
|
1613 |
"returns the maximum possible y of the view origin |
|
1614 |
" |
|
1615 |
|y| |
|
1616 |
||
1617 |
y := self heightOfContents - self innerHeight. |
|
1618 |
^ y max:0 |
|
1619 |
||
1620 |
! |
|
1621 |
||
1622 |
updateEditViewOrigin |
|
1623 |
"update origin of the editView |
|
1624 |
" |
|
1625 |
|x y| |
|
1626 |
||
1627 |
editView notNil ifTrue:[ |
|
607 | 1628 |
y := self yVisibleOfRowNr:(self firstIndexSelected). |
1629 |
x := self xVisibleOfColNr:(self selectedColIndex). |
|
542 | 1630 |
|
1631 |
editView origin:(x @ y). |
|
1632 |
]. |
|
1633 |
||
1634 |
! |
|
1635 |
||
1636 |
xVisibleOfColNr:aColNr |
|
1637 |
"returns visible x assigned to a column number |
|
1638 |
" |
|
1639 |
|x| |
|
1640 |
||
1641 |
x := margin - viewOrigin x. |
|
1642 |
self columnsFrom:1 to:(aColNr - 1) do:[:aCol| x := x + aCol width ]. |
|
1643 |
^ x |
|
1644 |
||
1645 |
! |
|
1646 |
||
1647 |
xVisibleToColNr:x |
|
607 | 1648 |
"returns the column number assigned to a physical x or nil |
1649 |
" |
|
542 | 1650 |
|x0 nr| |
1651 |
||
1652 |
x0 := x + viewOrigin x - margin. |
|
1653 |
nr := 1. |
|
1654 |
||
1655 |
self columnsDo:[:aCol| |
|
1656 |
(x0 := x0 - aCol width) <= 0 ifTrue:[^ nr]. |
|
1657 |
nr := nr + 1. |
|
1658 |
]. |
|
1659 |
^ nil. |
|
1660 |
||
1661 |
! |
|
1662 |
||
1663 |
yVisibleOfRowNr:aRowNr |
|
1664 |
"returns visible y assigned to the row number |
|
1665 |
" |
|
1666 |
^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
|
1667 |
||
1668 |
! |
|
1669 |
||
1670 |
yVisibleToRowNr:y |
|
607 | 1671 |
"returns the row number assigned to a physical y or nil |
542 | 1672 |
" |
1673 |
|y0| |
|
1674 |
||
1675 |
y0 := (y + viewOrigin y - margin) // rowHeight + 1. |
|
618 | 1676 |
^ (y0 <= self size) ifTrue:[y0] ifFalse:[nil] |
542 | 1677 |
|
1678 |
! ! |
|
1679 |
||
1680 |
!DSVColumnView methodsFor:'queries'! |
|
1681 |
||
1682 |
canFit |
|
1683 |
"returns true if columns can be fit to view |
|
1684 |
" |
|
1685 |
^ canFit |
|
1686 |
! |
|
1687 |
||
563 | 1688 |
indexOfFirstRowShown |
1689 |
"returns index of first row shown |
|
1690 |
" |
|
1691 |
|idx| |
|
1692 |
||
1693 |
idx := (self yOriginOfContents // rowHeight) + 1. |
|
618 | 1694 |
^ (idx <= self size) ifTrue:[idx] ifFalse:[0] |
563 | 1695 |
|
1696 |
! |
|
1697 |
||
542 | 1698 |
numberOfColumns |
1699 |
"returns number of columns |
|
1700 |
" |
|
1701 |
^ columnDescriptors size |
|
1702 |
||
1703 |
! |
|
1704 |
||
1705 |
numberOfRows |
|
1706 |
"returns number of raws |
|
1707 |
" |
|
618 | 1708 |
^ self size |
542 | 1709 |
|
1710 |
! |
|
1711 |
||
1712 |
rowHeight |
|
1713 |
"get the height of the highest row in pixels |
|
1714 |
" |
|
1715 |
^ rowHeight |
|
1716 |
||
1717 |
! |
|
1718 |
||
1719 |
separatorSize |
|
1720 |
"returns vertical/horizontal size of a separator dependent on the |
|
1721 |
3D effect. |
|
1722 |
" |
|
607 | 1723 |
^ separatorSize |
542 | 1724 |
|
1725 |
! |
|
1726 |
||
1727 |
size |
|
1728 |
"returns number of raws |
|
1729 |
" |
|
1730 |
^ list size |
|
1731 |
||
1732 |
! ! |
|
1733 |
||
1734 |
!DSVColumnView methodsFor:'recomputation'! |
|
1735 |
||
647 | 1736 |
hasPreferredExtent |
1737 |
"returns true if preferred extent is accumulated |
|
1738 |
" |
|
1739 |
^ preferredExtent notNil |
|
1740 |
! |
|
1741 |
||
542 | 1742 |
preferredExtent |
647 | 1743 |
"recompute preferred extent; raise notification |
542 | 1744 |
" |
1745 |
|x| |
|
1746 |
||
1747 |
preferredExtent notNil ifTrue:[ |
|
1748 |
^ preferredExtent |
|
1749 |
]. |
|
1750 |
x := 3. |
|
1751 |
rowHeight := 0. |
|
1752 |
||
1753 |
self columnsDo:[:aCol| |
|
1754 |
rowHeight := (aCol heightOfHighestRow) max:rowHeight. |
|
1755 |
x := x + (aCol minWidth). |
|
1756 |
]. |
|
647 | 1757 |
rowHeight := (rowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
618 | 1758 |
preferredExtent := (x + margin + margin) @ (self size * rowHeight). |
542 | 1759 |
|
607 | 1760 |
x := (rowHeight - separatorSize - font height) // 2 + font ascent. |
542 | 1761 |
self columnsDo:[:aCol|aCol textInsetChanged:x]. |
707 | 1762 |
self changed:#columnsLayout. |
542 | 1763 |
^ preferredExtent |
1764 |
||
1765 |
||
1766 |
! |
|
1767 |
||
1768 |
preferredExtentChanged |
|
1769 |
|y x| |
|
1770 |
||
1771 |
y := viewOrigin y. |
|
1772 |
x := viewOrigin x. |
|
1773 |
||
1774 |
(y ~~ 0 or:[x ~~ 0]) ifTrue:[ |
|
1775 |
self originWillChange. |
|
1776 |
viewOrigin := 0 @ 0. |
|
1777 |
preferredExtent := nil. |
|
1778 |
self originChanged:(x negated @ y negated). |
|
1779 |
] |
|
1780 |
! |
|
1781 |
||
1782 |
recomputeHeightOfContents |
|
1783 |
||
1784 |
preferredExtent notNil ifTrue:[ |
|
618 | 1785 |
preferredExtent y:(rowHeight * self size) |
542 | 1786 |
] ifFalse:[ |
1787 |
self preferredExtent |
|
1788 |
]. |
|
1789 |
! ! |
|
1790 |
||
1791 |
!DSVColumnView methodsFor:'scroller interface'! |
|
1792 |
||
1793 |
heightOfContents |
|
1794 |
"return the height of the contents in pixels |
|
1795 |
" |
|
1796 |
^ self preferredExtent y |
|
1797 |
||
1798 |
||
1799 |
! |
|
1800 |
||
1801 |
innerHeight |
|
1802 |
"returns the inner height of the contents shown |
|
1803 |
" |
|
1804 |
^ height - margin - margin |
|
1805 |
||
1806 |
! |
|
1807 |
||
1808 |
innerWidth |
|
1809 |
"returns the inner width of the contents shown |
|
1810 |
" |
|
1811 |
^ width - margin - margin |
|
1812 |
||
1813 |
! |
|
1814 |
||
1815 |
verticalScrollStep |
|
1816 |
"return the amount to scroll when stepping up/down. |
|
1817 |
" |
|
1818 |
^ rowHeight |
|
1819 |
||
1820 |
||
1821 |
||
1822 |
! |
|
1823 |
||
1824 |
viewOrigin |
|
1825 |
"return the viewOrigin; thats the coordinate of the contents |
|
1826 |
which is shown topLeft in the view. |
|
1827 |
" |
|
1828 |
^ viewOrigin |
|
1829 |
||
1830 |
! |
|
1831 |
||
1832 |
widthOfContents |
|
1833 |
"return the width of the contents in pixels |
|
1834 |
" |
|
647 | 1835 |
preferredExtent isNil ifTrue:[ |
1836 |
self preferredExtent |
|
1837 |
]. |
|
1838 |
^ preferredExtent x |
|
542 | 1839 |
|
1840 |
! |
|
1841 |
||
1842 |
xOriginOfContents |
|
1843 |
"return the horizontal origin of the contents in pixels |
|
1844 |
" |
|
1845 |
^ viewOrigin x |
|
1846 |
||
1847 |
! |
|
1848 |
||
1849 |
yOriginOfContents |
|
1850 |
"return the vertical origin of the contents in pixels |
|
1851 |
" |
|
1852 |
^ viewOrigin y |
|
1853 |
||
1854 |
! ! |
|
1855 |
||
1856 |
!DSVColumnView methodsFor:'scrolling'! |
|
1857 |
||
1858 |
halfPageDown |
|
1859 |
"scroll down half a page |
|
1860 |
" |
|
1861 |
self scrollDown:(self innerHeight // 2) |
|
1862 |
||
1863 |
||
1864 |
! |
|
1865 |
||
1866 |
halfPageUp |
|
1867 |
"scroll up half a page |
|
1868 |
" |
|
1869 |
self scrollUp:(self innerHeight // 2) |
|
1870 |
||
1871 |
! |
|
1872 |
||
1873 |
scrollTo:anOrigin redraw:doRedraw |
|
1874 |
"change origin to have newOrigin be visible at the top-left. |
|
1875 |
" |
|
1876 |
|x y dX dY newOrg dltOrg h innerWT innerHG| |
|
1877 |
||
1878 |
shown ifFalse:[ |
|
1879 |
^ self |
|
1880 |
]. |
|
612 | 1881 |
|
542 | 1882 |
[self sensor hasExposeEventFor:nil] whileTrue:[ |
1883 |
self windowGroup processExposeEvents |
|
1884 |
]. |
|
612 | 1885 |
|
542 | 1886 |
innerWT := self innerWidth. |
1887 |
innerHG := self innerHeight. |
|
1888 |
||
1889 |
h := viewOrigin y. |
|
1890 |
||
1891 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents |
|
1892 |
y > (dY := self maxViewOriginY) ifTrue:[ |
|
1893 |
y := dY max:h |
|
1894 |
] |
|
1895 |
] ifFalse:[ |
|
1896 |
y := y max:0. |
|
1897 |
]. |
|
1898 |
||
1899 |
(x := anOrigin x) > 0 ifTrue:[ |
|
1900 |
x := x min:(self widthOfContents - innerWT). |
|
1901 |
]. |
|
1902 |
x := x max:0. |
|
1903 |
newOrg := (x @ y). |
|
1904 |
dltOrg := newOrg - viewOrigin. |
|
1905 |
dX := dltOrg x. |
|
1906 |
dY := dltOrg y. |
|
1907 |
||
1908 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
|
1909 |
^ self |
|
1910 |
]. |
|
1911 |
self originWillChange. |
|
1912 |
viewOrigin := newOrg. |
|
1913 |
||
1914 |
doRedraw ifFalse:[ |
|
1915 |
^ self originChanged:dltOrg |
|
1916 |
]. |
|
1917 |
||
1918 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL |
|
1919 |
dY := dY abs. |
|
1920 |
||
1921 |
(dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[ |
|
1922 |
self redraw. |
|
1923 |
] ifFalse:[ "/ COPY VERTICAL |
|
1924 |
|y0 y1| |
|
1925 |
||
1926 |
y0 := y1 := margin + dY. |
|
1927 |
h := innerHG - dY. |
|
1928 |
||
1929 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0] |
|
1930 |
ifFalse:[y1 := margin. y := y1 + h]. |
|
1931 |
||
1932 |
self catchExpose. |
|
643 | 1933 |
self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:true. |
542 | 1934 |
self waitForExpose. |
643 | 1935 |
self redrawX:margin y:y width:innerWT height:(innerHG - h). |
542 | 1936 |
] |
1937 |
] ifFalse:[ "/ SCROLL HORIZONTAL |
|
1938 |
dX := dX abs. |
|
1939 |
||
1940 |
innerWT - dX < 20 ifTrue:[ |
|
1941 |
self redraw. |
|
1942 |
] ifFalse:[ "/ COPY HORIZONTAL |
|
1943 |
|x0 x1 w| |
|
1944 |
||
643 | 1945 |
x0 := x1 := dX + margin. |
542 | 1946 |
w := width - dX - margin. |
1947 |
||
643 | 1948 |
dltOrg x < 0 ifTrue:[x0 := x := margin ] |
1949 |
ifFalse:[x1 := margin. x := w]. |
|
542 | 1950 |
|
1951 |
self catchExpose. |
|
643 | 1952 |
self copyFrom:self x:x0 y:margin toX:x1 y:margin width:w height:innerHG async:true. |
542 | 1953 |
self waitForExpose. |
643 | 1954 |
self redrawX:x y:margin width:(width - w) height:innerHG. |
542 | 1955 |
] |
1956 |
]. |
|
1957 |
self originChanged:dltOrg. |
|
1958 |
! |
|
1959 |
||
1960 |
scrollToRowAt:aRowNr colAt:aColNr |
|
1961 |
"make row at a row number in column at a column number visible |
|
1962 |
" |
|
1963 |
|x y l dY dX| |
|
1964 |
||
618 | 1965 |
( (aRowNr between:1 and:(self size)) |
542 | 1966 |
and:[aColNr between:0 and:(self numberOfColumns)] |
1967 |
) ifFalse:[ |
|
1968 |
^ self |
|
1969 |
]. |
|
1970 |
||
1971 |
dY := dX := 0. |
|
1972 |
y := self yVisibleOfRowNr:aRowNr. |
|
1973 |
||
1974 |
y < margin ifTrue:[ |
|
1975 |
dY := margin - y. |
|
1976 |
] ifFalse:[ |
|
1977 |
y := y + rowHeight. |
|
1978 |
l := height - margin. |
|
1979 |
y > l ifTrue:[dY := l - y] |
|
1980 |
]. |
|
1981 |
||
1982 |
aColNr == 0 ifTrue:[ |
|
1983 |
dY == 0 ifTrue:[^ self]. |
|
1984 |
dX := 0. |
|
1985 |
] ifFalse:[ |
|
1986 |
x := self xVisibleOfColNr:aColNr. |
|
1987 |
||
1988 |
x < margin ifTrue:[ |
|
1989 |
dX := margin - x |
|
1990 |
] ifFalse:[ |
|
1991 |
x := x + (self columnAt:aColNr) width. |
|
1992 |
l := width - margin. |
|
1993 |
x > l ifTrue:[dX := l - x] |
|
1994 |
] |
|
1995 |
]. |
|
1996 |
||
1997 |
(dX == 0 and:[dY == 0]) ifFalse:[ |
|
1998 |
self scrollTo:(viewOrigin - (dX @ dY)). |
|
1999 |
] |
|
2000 |
||
2001 |
||
2002 |
! |
|
2003 |
||
2004 |
scrollToSelection |
|
2005 |
"make selection visible |
|
2006 |
" |
|
607 | 2007 |
|rowNr| |
2008 |
||
2009 |
(rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
2010 |
self scrollToRowAt:rowNr colAt:(self selectedColIndex) |
|
542 | 2011 |
] |
2012 |
||
2013 |
! ! |
|
2014 |
||
2015 |
!DSVColumnView methodsFor:'selection'! |
|
2016 |
||
607 | 2017 |
deselect |
2018 |
"deselect |
|
2019 |
" |
|
2020 |
self selectColIndex:0 rowIndex:0 |
|
2021 |
! |
|
2022 |
||
2023 |
firstIndexSelected |
|
2024 |
"returns index of first element selected or 0 |
|
2025 |
" |
|
2026 |
multipleSelectOk ifFalse:[ |
|
2027 |
^ selectedRowIndex |
|
2028 |
]. |
|
2029 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2030 |
^ selectedRowIndex at:1 |
|
2031 |
]. |
|
2032 |
^ 0 |
|
2033 |
! |
|
2034 |
||
542 | 2035 |
hasSelection |
607 | 2036 |
"returns true if a selection exists |
542 | 2037 |
" |
607 | 2038 |
^ self numberOfSelections ~~ 0 |
542 | 2039 |
|
2040 |
||
2041 |
! |
|
2042 |
||
607 | 2043 |
isInSelection:aRowNr |
2044 |
"return true, if row, aRowNr is in the selection |
|
542 | 2045 |
" |
607 | 2046 |
aRowNr ~~ 0 ifTrue:[ |
2047 |
multipleSelectOk ifFalse:[ |
|
2048 |
^ aRowNr == selectedRowIndex |
|
2049 |
]. |
|
2050 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2051 |
^ selectedRowIndex includes:aRowNr |
|
2052 |
] |
|
2053 |
]. |
|
2054 |
^ false |
|
2055 |
! |
|
2056 |
||
647 | 2057 |
isRowSelected:aRowNr |
2058 |
"return true, if row is in the selection |
|
2059 |
" |
|
2060 |
selectedColIndex == 0 ifTrue:[ |
|
2061 |
^ self isInSelection:aRowNr |
|
2062 |
]. |
|
2063 |
^ false |
|
2064 |
! |
|
2065 |
||
607 | 2066 |
isSelected:aRowNr inColumn:aColNr |
612 | 2067 |
"returns true if cell in a row; a row number, in a column, a column |
2068 |
number is selected. |
|
2069 |
" |
|
607 | 2070 |
(self isInSelection:aRowNr) ifTrue:[ |
2071 |
^ (selectedColIndex == 0 or:[selectedColIndex == aColNr]) |
|
2072 |
]. |
|
2073 |
^ false |
|
2074 |
! |
|
2075 |
||
2076 |
numberOfSelections |
|
2077 |
"return the number of selected rows |
|
2078 |
" |
|
2079 |
multipleSelectOk ifFalse:[ |
|
2080 |
^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
|
2081 |
]. |
|
2082 |
^ selectedRowIndex size |
|
542 | 2083 |
! |
2084 |
||
2085 |
selectColIndex:aColNr rowIndex:aRowNr |
|
2086 |
"change selection with notification |
|
2087 |
" |
|
2088 |
|oC oR| |
|
2089 |
||
607 | 2090 |
oC := self selectedColIndex. |
2091 |
oR := self selectedRowIndex. |
|
542 | 2092 |
|
2093 |
self setSelectColIndex:aColNr rowIndex:aRowNr. |
|
2094 |
||
607 | 2095 |
(oC ~~ self selectedColIndex or:[oR ~= self selectedRowIndex]) ifTrue:[ |
542 | 2096 |
self selectionChanged |
2097 |
]. |
|
2098 |
! |
|
2099 |
||
607 | 2100 |
selectRow:something |
542 | 2101 |
"select a row |
2102 |
" |
|
607 | 2103 |
^ self selectedRowIndex:something |
542 | 2104 |
! |
2105 |
||
607 | 2106 |
selectRowIndex:something |
2107 |
"set selection of rows |
|
542 | 2108 |
" |
607 | 2109 |
self selectColIndex:selectedColIndex rowIndex:something |
2110 |
||
2111 |
||
542 | 2112 |
! |
2113 |
||
2114 |
selectedColIndex |
|
2115 |
"returns selected column number or 0 |
|
2116 |
" |
|
2117 |
^ selectedColIndex |
|
2118 |
! |
|
2119 |
||
2120 |
selectedColumn |
|
2121 |
"returns selected column or nil |
|
2122 |
" |
|
2123 |
^ columnDescriptors at:selectedColIndex ifAbsent:nil. |
|
2124 |
! |
|
2125 |
||
2126 |
selectedRow |
|
607 | 2127 |
"returns selected row (or collection if multiple selection) or nil |
542 | 2128 |
" |
607 | 2129 |
multipleSelectOk ifFalse:[ |
2130 |
^ self at:selectedRowIndex ifAbsent:nil |
|
2131 |
]. |
|
2132 |
||
2133 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2134 |
^ selectedRowIndex collect:[:i| self at:i] |
|
2135 |
]. |
|
2136 |
^ nil |
|
2137 |
! |
|
2138 |
||
2139 |
selectedRow:something |
|
2140 |
"select something |
|
2141 |
" |
|
2142 |
self selectedRowIndex:something |
|
542 | 2143 |
! |
2144 |
||
2145 |
selectedRowIndex |
|
2146 |
"returns selected row number or 0 |
|
2147 |
" |
|
2148 |
^ selectedRowIndex |
|
2149 |
! |
|
2150 |
||
607 | 2151 |
selectedRowIndex:something |
2152 |
"set selection of rows |
|
2153 |
" |
|
2154 |
self selectColIndex:selectedColIndex rowIndex:something |
|
2155 |
||
2156 |
||
542 | 2157 |
! |
2158 |
||
2159 |
selectionChanged |
|
2160 |
"selection has changed |
|
2161 |
" |
|
2162 |
self changed:#selection. |
|
2163 |
||
2164 |
actionBlock notNil ifTrue:[ |
|
607 | 2165 |
actionBlock value:(self selectedRowIndex) |
2166 |
] |
|
2167 |
! |
|
2168 |
||
2169 |
selectionIndicesDo:aOneArgBlock |
|
2170 |
"evaluate block on each row selected; the argument to the row |
|
2171 |
is the index of the selected row |
|
2172 |
" |
|
2173 |
multipleSelectOk ifFalse:[ |
|
2174 |
selectedRowIndex ~~ 0 ifTrue:[ |
|
2175 |
aOneArgBlock value:selectedRowIndex |
|
2176 |
] |
|
2177 |
] ifTrue:[ |
|
2178 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2179 |
selectedRowIndex do:[:i| aOneArgBlock value:i ] |
|
2180 |
] |
|
542 | 2181 |
] |
2182 |
! |
|
2183 |
||
2184 |
setSelectColIndex:aColNr rowIndex:aRowNr |
|
2185 |
"change selection without notification |
|
2186 |
" |
|
612 | 2187 |
|rowNr colNr newCol oldCol oldRow sensor sglSelRow index oldSz| |
542 | 2188 |
|
607 | 2189 |
rowNr := self validateSelection:aRowNr. |
542 | 2190 |
|
607 | 2191 |
multipleSelectOk ifTrue:[ |
2192 |
colNr := (rowNr size == 1) ifTrue:[aColNr] ifFalse:[0] |
|
2193 |
] ifFalse:[ |
|
2194 |
colNr := rowNr ~~ 0 ifTrue:[aColNr] ifFalse:[0] |
|
542 | 2195 |
]. |
2196 |
||
607 | 2197 |
(colNr := colNr ? 0) ~~ 0 ifTrue:[ |
2198 |
newCol := self columnAt:colNr. |
|
2199 |
newCol rendererType == #rowSelector ifTrue:[ |
|
2200 |
colNr := 0. |
|
2201 |
newCol := nil |
|
2202 |
] ifFalse:[ |
|
2203 |
multipleSelectOk ifTrue:[sglSelRow := rowNr at:1] |
|
2204 |
ifFalse:[sglSelRow := rowNr]. |
|
2205 |
||
2206 |
(newCol canSelect:sglSelRow) ifFalse:[ |
|
2207 |
newCol := nil. |
|
2208 |
colNr := 0 |
|
2209 |
] |
|
2210 |
] |
|
2211 |
]. |
|
2212 |
||
2213 |
(rowNr = selectedRowIndex and:[colNr == selectedColIndex]) ifTrue:[ |
|
643 | 2214 |
^ self |
542 | 2215 |
]. |
2216 |
||
2217 |
"/ release old selection |
|
2218 |
||
612 | 2219 |
oldSz := self numberOfSelections. |
542 | 2220 |
oldCol := selectedColIndex. |
2221 |
oldRow := selectedRowIndex. |
|
612 | 2222 |
|
542 | 2223 |
selectedRowIndex := rowNr. |
2224 |
selectedColIndex := colNr. |
|
2225 |
||
612 | 2226 |
oldSz == 1 ifTrue:[ |
2227 |
multipleSelectOk ifTrue:[oldRow := oldRow at:1]. |
|
542 | 2228 |
|
612 | 2229 |
editValue notNil ifTrue:[ |
622 | 2230 |
editValue removeDependent:self. |
612 | 2231 |
(self columnAt:oldCol) at:oldRow put:editValue value. |
2232 |
editValue := nil |
|
2233 |
]. |
|
2234 |
editView notNil ifTrue:[ |
|
2235 |
editView destroy. |
|
2236 |
editView := nil. |
|
607 | 2237 |
] |
612 | 2238 |
]. |
2239 |
shown ifFalse:[^ self ]. |
|
542 | 2240 |
|
618 | 2241 |
oldSz > 1 ifTrue:[ "/ redraw old selection |
2242 |
oldRow do:[:aRowNr| "/ unselected if visible |
|
2243 |
self redrawRowAt:aRowNr colAt:0 |
|
2244 |
] |
|
2245 |
] ifFalse:[ |
|
2246 |
oldSz == 1 ifTrue:[ |
|
2247 |
self redrawRowAt:oldRow colAt:oldCol |
|
2248 |
] |
|
2249 |
]. |
|
2250 |
||
542 | 2251 |
"/ show new selection |
2252 |
||
2253 |
newCol notNil ifTrue:[ |
|
607 | 2254 |
self scrollToRowAt:sglSelRow colAt:colNr. |
542 | 2255 |
|
2256 |
newCol editorType ~~ #None ifTrue:[ |
|
607 | 2257 |
editView := SimpleView extent:( (newCol width - separatorSize) |
2258 |
@ (rowHeight - separatorSize) |
|
2259 |
) |
|
2260 |
in:self. |
|
542 | 2261 |
self updateEditViewOrigin. |
2262 |
editView viewBackground:hgLgBgColor. |
|
612 | 2263 |
editValue := newCol editorAt:sglSelRow in:editView with:hgLgFgColor bg:hgLgBgColor. |
648 | 2264 |
editValue notNil ifTrue:[ |
2265 |
editValue addDependent:self |
|
2266 |
]. |
|
542 | 2267 |
editView realize. |
2268 |
] ifFalse:[ |
|
607 | 2269 |
self redrawRowAt:sglSelRow colAt:colNr |
612 | 2270 |
]. |
2271 |
] ifFalse:[ |
|
2272 |
self selectionIndicesDo:[:i| self redrawRowAt:i colAt:0 ]. |
|
2273 |
self scrollToRowAt:(self firstIndexSelected) colAt:0 |
|
2274 |
]. |
|
2275 |
||
2276 |
sensor := self sensor. "/ catch expose events |
|
2277 |
||
2278 |
[sensor hasExposeEventFor:nil] whileTrue:[ |
|
2279 |
self windowGroup processExposeEvents |
|
2280 |
]. |
|
2281 |
||
542 | 2282 |
|
607 | 2283 |
! |
2284 |
||
2285 |
validateSelection:aSelection |
|
2286 |
|newSel| |
|
2287 |
||
2288 |
newSel := aSelection. |
|
2289 |
||
618 | 2290 |
(self size == 0 or:[newSel isNil or:[newSel == 0]]) ifTrue:[ |
607 | 2291 |
^ multipleSelectOk ifFalse:[0] ifTrue:[nil] |
2292 |
]. |
|
2293 |
||
2294 |
newSel isNumber ifTrue:[ |
|
2295 |
^ multipleSelectOk ifFalse:[newSel] ifTrue:[OrderedCollection with:newSel] |
|
2296 |
]. |
|
2297 |
multipleSelectOk ifFalse:[ |
|
618 | 2298 |
newSel := self identityIndexOfRow:aSelection |
607 | 2299 |
] ifTrue:[ |
2300 |
newSel := nil. |
|
2301 |
||
2302 |
aSelection size ~~ 0 ifTrue:[ |
|
2303 |
aSelection first isNumber ifTrue:[ |
|
2304 |
newSel := aSelection |
|
2305 |
] ifFalse:[ |
|
2306 |
aSelection do:[:el||n| |
|
618 | 2307 |
(n := self identityIndexOfRow:el) ~~ 0 ifTrue:[ |
607 | 2308 |
newSel isNil ifTrue:[newSel := OrderedCollection new]. |
2309 |
newSel add:n |
|
2310 |
] |
|
2311 |
] |
|
2312 |
] |
|
2313 |
] |
|
2314 |
]. |
|
2315 |
^ newSel |
|
542 | 2316 |
! ! |
2317 |
||
2318 |
!DSVColumnView class methodsFor:'documentation'! |
|
2319 |
||
2320 |
version |
|
707 | 2321 |
^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.26 1998-01-29 14:53:57 ca Exp $' |
542 | 2322 |
! ! |