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
|
|
17 |
instanceVariableNames:'editValue editView selectedColIndex selectedRowIndex rowHeight
|
|
18 |
columnDescriptors viewOrigin registererImages list fgColor canFit
|
|
19 |
listSizeChanged beDependentOfRows has3Dsepartors bgColor
|
|
20 |
hgLgFgColor hgLgBgColor actionBlock doubleClickActionBlock
|
563
|
21 |
separatorLightColor separatorDarkColor verticalSpacing
|
|
22 |
horizontalSpacing'
|
542
|
23 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor
|
|
24 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor
|
|
25 |
DefaultSeparatorDarkColor DefaultSeparatorLightColor'
|
|
26 |
poolDictionaries:''
|
|
27 |
category:'Views-DataSet'
|
|
28 |
!
|
|
29 |
|
|
30 |
!DSVColumnView class methodsFor:'documentation'!
|
|
31 |
|
|
32 |
copyright
|
|
33 |
"
|
|
34 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
|
|
35 |
All Rights Reserved
|
|
36 |
|
|
37 |
This software is furnished under a license and may be used
|
|
38 |
only in accordance with the terms of that license and with the
|
|
39 |
inclusion of the above copyright notice. This software may not
|
|
40 |
be provided or otherwise made available to, or used by, any
|
|
41 |
other person. No title to or ownership of the software is
|
|
42 |
hereby transferred.
|
|
43 |
"
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
!
|
|
48 |
|
|
49 |
documentation
|
|
50 |
"
|
|
51 |
implements a scrollable selection view based on rows and columns
|
|
52 |
|
|
53 |
[Instance variables:]
|
|
54 |
|
|
55 |
editValue <Model> current editing model
|
|
56 |
editView <View> current editing component
|
|
57 |
selectedColIndex <Integer> selected column index or 0
|
|
58 |
selectedRowIndex <Integer> selected row index or 0
|
|
59 |
rowHeight <Integer> maximum height of any row
|
|
60 |
columnDescriptors <SequancableCollection> list of column descriptors
|
|
61 |
list <SequancableCollection> list of rows
|
|
62 |
fgColor <Color> foreground color
|
|
63 |
registererImages <IdentityDictionary> list of images registered on the device
|
567
|
64 |
beDependentOfRows <Coolean> keep rows dependent; on default is disabled.
|
|
65 |
in case of enabled a row can raise a change
|
|
66 |
notification whithout a parameter which
|
|
67 |
will force a redraw of the row or the
|
|
68 |
readSelector of the column which will
|
|
69 |
redraw the cell in the row only.
|
542
|
70 |
|
|
71 |
[author:]
|
|
72 |
Claus Atzkern
|
|
73 |
|
|
74 |
[see also:]
|
|
75 |
DataSetColumnSpec
|
|
76 |
DataSetColumn
|
|
77 |
DataSetView
|
|
78 |
"
|
|
79 |
|
|
80 |
! !
|
|
81 |
|
|
82 |
!DSVColumnView class methodsFor:'defaults'!
|
|
83 |
|
563
|
84 |
horizontalSpacing
|
|
85 |
^ 4
|
|
86 |
|
|
87 |
!
|
|
88 |
|
542
|
89 |
updateStyleCache
|
|
90 |
"extract values from the styleSheet and cache them in class variables
|
|
91 |
"
|
582
|
92 |
<resource: #style (#textForegroundColor #'scrollableView.backgroundColor'
|
|
93 |
#'selection.hilightForegroundColor'
|
|
94 |
#'selection.hilightBackgroundColor' )>
|
542
|
95 |
|
|
96 |
DefaultForegroundColor := StyleSheet colorAt:'textForegroundColor' default:(Color black).
|
582
|
97 |
DefaultBackgroundColor := StyleSheet at:'scrollableView.backgroundColor' default:DefaultViewBackgroundColor.
|
542
|
98 |
|
582
|
99 |
DefaultHilightForegroundColor := StyleSheet colorAt:'selection.hilightForegroundColor' default:DefaultForegroundColor.
|
|
100 |
DefaultHilightBackgroundColor := StyleSheet colorAt:'selection.hilightBackgroundColor' default:(Color veryLightGrey).
|
542
|
101 |
DefaultSeparatorDarkColor := DefaultShadowColor ? (Color grayPercent:40).
|
|
102 |
DefaultSeparatorLightColor := DefaultLightColor ? (Color grayPercent:75).
|
|
103 |
"
|
|
104 |
self updateStyleCache.
|
|
105 |
"
|
|
106 |
|
582
|
107 |
"Modified: / 26.10.1997 / 17:09:07 / cg"
|
563
|
108 |
!
|
|
109 |
|
|
110 |
verticalSpacing
|
|
111 |
^ 2
|
|
112 |
|
542
|
113 |
! !
|
|
114 |
|
|
115 |
!DSVColumnView methodsFor:'accessing'!
|
|
116 |
|
|
117 |
action:aOneArgAction
|
|
118 |
actionBlock := aOneArgAction
|
|
119 |
|
|
120 |
|
|
121 |
!
|
|
122 |
|
|
123 |
doubleClickAction:aOneArgAction
|
|
124 |
doubleClickActionBlock := aOneArgAction
|
|
125 |
|
|
126 |
|
|
127 |
! !
|
|
128 |
|
|
129 |
!DSVColumnView methodsFor:'accessing behavior'!
|
|
130 |
|
|
131 |
beDependentOfRows
|
|
132 |
"make myself dependent of any row; in this case any change notification
|
|
133 |
raised by a row is catched and the cell identified by the 'readSelector'
|
|
134 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn.
|
|
135 |
-> row changed:'what'
|
|
136 |
On default the attribute is set to true (enabled).
|
|
137 |
"
|
|
138 |
^ beDependentOfRows
|
|
139 |
!
|
|
140 |
|
|
141 |
beDependentOfRows:aBool
|
|
142 |
"make myself dependent of any row; in this case any change notification
|
|
143 |
raised by a row is catched and the cell identified by the 'readSelector'
|
|
144 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn.
|
|
145 |
-> row changed:'what'
|
|
146 |
On default the attribute is set to true (enabled).
|
|
147 |
"
|
|
148 |
aBool ~~ beDependentOfRows ifTrue:[
|
|
149 |
(beDependentOfRows := aBool) ifTrue:[
|
|
150 |
self do:[:aRow| aRow addDependent:self]
|
|
151 |
] ifFalse:[
|
|
152 |
self do:[:aRow| aRow removeDependent:self]
|
|
153 |
]
|
|
154 |
].
|
|
155 |
! !
|
|
156 |
|
|
157 |
!DSVColumnView methodsFor:'accessing columns'!
|
|
158 |
|
|
159 |
columnAt:anIndex
|
|
160 |
"get the column at an index
|
|
161 |
"
|
|
162 |
^ columnDescriptors at:anIndex
|
|
163 |
!
|
|
164 |
|
|
165 |
columnDescriptors:colDesc
|
|
166 |
"set the columnDescriptors
|
|
167 |
"
|
|
168 |
self setSelectColIndex:0 rowIndex:0.
|
|
169 |
|
|
170 |
colDesc size ~~ 0 ifTrue:[
|
|
171 |
columnDescriptors := colDesc collect:[:aCol|
|
|
172 |
DataSetColumn on:self description:aCol
|
|
173 |
]
|
|
174 |
] ifFalse:[
|
|
175 |
columnDescriptors := #()
|
|
176 |
].
|
|
177 |
canFit := (columnDescriptors findFirst:[:aCol|aCol canResize]) ~~ 0.
|
|
178 |
preferredExtent := nil.
|
563
|
179 |
|
|
180 |
listSizeChanged := true.
|
542
|
181 |
self preferredExtentChanged.
|
|
182 |
|
|
183 |
realized ifTrue:[
|
556
|
184 |
self fitColumns ifFalse:[
|
|
185 |
self invalidate.
|
|
186 |
self contentsChanged.
|
|
187 |
]
|
563
|
188 |
].
|
|
189 |
self changed:#sizeOfColumns.
|
|
190 |
listSizeChanged := false.
|
542
|
191 |
|
|
192 |
|
|
193 |
!
|
|
194 |
|
|
195 |
firstColumn
|
|
196 |
"get the first column
|
|
197 |
"
|
|
198 |
^ columnDescriptors at:1
|
|
199 |
|
|
200 |
!
|
|
201 |
|
|
202 |
lastColumn
|
|
203 |
"get the last column
|
|
204 |
"
|
|
205 |
^ columnDescriptors last
|
|
206 |
|
|
207 |
! !
|
|
208 |
|
|
209 |
!DSVColumnView methodsFor:'accessing rows'!
|
|
210 |
|
|
211 |
at:aRowNr
|
|
212 |
"return the row at an index, aRowNr
|
|
213 |
"
|
|
214 |
^ list at:aRowNr
|
|
215 |
!
|
|
216 |
|
|
217 |
at:aRowNr ifAbsent:exceptionBlock
|
|
218 |
"return the element at a aRowNr. If the index is invalid, return the
|
|
219 |
result of evaluating the exceptionblock
|
|
220 |
"
|
|
221 |
^ list at:aRowNr ifAbsent:exceptionBlock
|
|
222 |
!
|
|
223 |
|
|
224 |
at:aRowNr put:aRow
|
|
225 |
"change the row at an index. The added row is returned
|
|
226 |
"
|
|
227 |
beDependentOfRows ifTrue:[
|
563
|
228 |
(list at:aRowNr) removeDependent:self.
|
542
|
229 |
aRow addDependent:self
|
|
230 |
|
|
231 |
] ifFalse:[
|
|
232 |
list at:aRowNr put:aRow
|
|
233 |
].
|
|
234 |
self redrawRowAt:aRowNr.
|
|
235 |
^ aRow.
|
|
236 |
!
|
|
237 |
|
|
238 |
first
|
|
239 |
"return the first row
|
|
240 |
"
|
|
241 |
^ list at:1
|
|
242 |
!
|
|
243 |
|
|
244 |
last
|
|
245 |
"return the last row
|
|
246 |
"
|
|
247 |
^ list last
|
|
248 |
!
|
|
249 |
|
|
250 |
list
|
|
251 |
"get the list of rows
|
|
252 |
"
|
|
253 |
^ list
|
|
254 |
|
|
255 |
|
|
256 |
|
|
257 |
!
|
|
258 |
|
|
259 |
list:aList
|
|
260 |
"set the list of rows
|
|
261 |
"
|
|
262 |
|oldSize|
|
|
263 |
|
|
264 |
self setSelectColIndex:0 rowIndex:0.
|
|
265 |
|
|
266 |
aList size ~~ 0 ifTrue:[ "/ otherwise keep old values
|
|
267 |
self columnsDo:[:aCol| aCol invalidate ].
|
567
|
268 |
preferredExtent := nil.
|
542
|
269 |
].
|
|
270 |
oldSize := list size.
|
|
271 |
|
|
272 |
beDependentOfRows ifTrue:[
|
|
273 |
self do:[:aRow| aRow removeDependent:self].
|
|
274 |
list := aList.
|
|
275 |
self do:[:aRow| aRow addDependent:self]
|
|
276 |
] ifFalse:[
|
|
277 |
list := aList
|
|
278 |
].
|
|
279 |
list size == 0 ifTrue:[
|
|
280 |
list := nil
|
|
281 |
].
|
567
|
282 |
self preferredExtent.
|
|
283 |
self recomputeHeightOfContents.
|
542
|
284 |
|
|
285 |
realized ifTrue:[
|
|
286 |
list size ~~ 0 ifTrue:[
|
|
287 |
self fitColumns ifTrue:[^ self ].
|
|
288 |
] ifFalse:[
|
|
289 |
oldSize == 0 ifTrue:[
|
|
290 |
^ self
|
|
291 |
]
|
|
292 |
].
|
567
|
293 |
self redraw.
|
542
|
294 |
]
|
|
295 |
|
|
296 |
|
|
297 |
|
|
298 |
! !
|
|
299 |
|
|
300 |
!DSVColumnView methodsFor:'accessing visibility'!
|
|
301 |
|
|
302 |
backgroundColor
|
|
303 |
"get the background color of the rows
|
|
304 |
"
|
|
305 |
^ bgColor
|
|
306 |
|
|
307 |
|
|
308 |
!
|
|
309 |
|
|
310 |
backgroundColor:aColor
|
|
311 |
"set the background color of the rows
|
|
312 |
"
|
|
313 |
bgColor ~~ aColor ifTrue:[
|
|
314 |
super viewBackground:bgColor.
|
|
315 |
|
|
316 |
self realized ifTrue:[
|
|
317 |
bgColor := aColor on:device.
|
|
318 |
self invalidate
|
|
319 |
] ifFalse:[
|
|
320 |
bgColor := aColor
|
|
321 |
].
|
|
322 |
self changed:#style.
|
|
323 |
]
|
|
324 |
!
|
|
325 |
|
|
326 |
font:aFont
|
|
327 |
"set the font for all shown rows.
|
|
328 |
"
|
|
329 |
(aFont notNil and:[aFont ~~ font]) ifTrue:[
|
|
330 |
super font:(aFont on:device).
|
|
331 |
self columnsDo:[:aCol| aCol invalidate ].
|
|
332 |
self preferredExtentChanged.
|
|
333 |
|
|
334 |
realized ifTrue:[
|
|
335 |
self invalidate.
|
|
336 |
self contentsChanged
|
|
337 |
].
|
|
338 |
self changed:#style.
|
|
339 |
]
|
|
340 |
|
|
341 |
!
|
|
342 |
|
|
343 |
foregroundColor
|
|
344 |
"return the foreground color of the rows
|
|
345 |
"
|
|
346 |
^ fgColor
|
|
347 |
|
|
348 |
!
|
|
349 |
|
|
350 |
foregroundColor:aColor
|
|
351 |
"set the foreground color of the rows
|
|
352 |
"
|
|
353 |
fgColor ~~ aColor ifTrue:[
|
|
354 |
self realized ifTrue:[
|
|
355 |
fgColor := aColor on:device.
|
|
356 |
self invalidate
|
|
357 |
] ifFalse:[
|
|
358 |
fgColor := aColor
|
|
359 |
].
|
|
360 |
self changed:#style.
|
|
361 |
]
|
|
362 |
|
|
363 |
!
|
|
364 |
|
|
365 |
has3Dsepartors
|
|
366 |
^ has3Dsepartors
|
|
367 |
!
|
|
368 |
|
|
369 |
has3Dsepartors:aBool
|
|
370 |
|
|
371 |
aBool ~~ has3Dsepartors ifTrue:[
|
|
372 |
has3Dsepartors := aBool.
|
|
373 |
self columnsDo:[:aCol| aCol invalidate ].
|
|
374 |
self preferredExtentChanged.
|
|
375 |
|
|
376 |
realized ifTrue:[
|
|
377 |
self invalidate.
|
|
378 |
self contentsChanged
|
|
379 |
].
|
|
380 |
self changed:#style.
|
|
381 |
]
|
|
382 |
|
|
383 |
|
|
384 |
!
|
|
385 |
|
|
386 |
hgLgBgColor
|
|
387 |
^ hgLgBgColor
|
|
388 |
!
|
|
389 |
|
|
390 |
hgLgFgColor
|
|
391 |
^ hgLgFgColor
|
|
392 |
!
|
|
393 |
|
|
394 |
horizontalSpacing
|
|
395 |
"horizontal spacing used by columns
|
|
396 |
"
|
563
|
397 |
^ horizontalSpacing
|
|
398 |
!
|
|
399 |
|
|
400 |
horizontalSpacing:aNumber
|
|
401 |
"horizontal spacing used by columns
|
|
402 |
"
|
|
403 |
horizontalSpacing ~~ aNumber ifTrue:[
|
|
404 |
horizontalSpacing := aNumber.
|
|
405 |
self preferredExtentChanged.
|
|
406 |
].
|
542
|
407 |
!
|
|
408 |
|
|
409 |
separatorDarkColor
|
|
410 |
^ separatorDarkColor
|
|
411 |
|
|
412 |
|
|
413 |
!
|
|
414 |
|
|
415 |
separatorLightColor
|
|
416 |
^ separatorLightColor
|
|
417 |
|
|
418 |
|
|
419 |
!
|
|
420 |
|
|
421 |
verticalSpacing
|
|
422 |
"vertical spacing used by columns
|
|
423 |
"
|
563
|
424 |
^ verticalSpacing
|
|
425 |
!
|
|
426 |
|
|
427 |
verticalSpacing:aNumber
|
|
428 |
"vertical spacing used by columns
|
|
429 |
"
|
|
430 |
verticalSpacing ~~ aNumber ifTrue:[
|
|
431 |
verticalSpacing := aNumber.
|
|
432 |
self preferredExtentChanged.
|
|
433 |
].
|
542
|
434 |
! !
|
|
435 |
|
|
436 |
!DSVColumnView methodsFor:'adding & removing rows'!
|
|
437 |
|
|
438 |
add:aRow
|
|
439 |
"insert row at the end of the list of rows
|
|
440 |
"
|
|
441 |
^ self add:aRow beforeIndex:(1 + list size)
|
|
442 |
!
|
|
443 |
|
|
444 |
add:aRow afterIndex:aRowNr
|
|
445 |
"add a new row after slot aRowNr and redisplay; returns nil in case
|
|
446 |
of an invalid index index or the row added to the list
|
|
447 |
"
|
|
448 |
^ self add:aRow beforeIndex:(aRowNr + 1)
|
|
449 |
!
|
|
450 |
|
|
451 |
add:aRow beforeIndex:aRowNr
|
|
452 |
"add a new row before slot aRowNr and redisplay; returns nil in case
|
|
453 |
of an invalid index index or the row added to the list
|
|
454 |
"
|
545
|
455 |
|y0 y1 h dH|
|
542
|
456 |
|
|
457 |
list isNil ifTrue:[
|
|
458 |
list := OrderedCollection new.
|
|
459 |
preferredExtent := nil. "/ force a recomputation
|
|
460 |
] ifFalse:[
|
|
461 |
list isArray ifTrue:[list := list asOrderedCollection]
|
|
462 |
].
|
|
463 |
list add:aRow beforeIndex:aRowNr.
|
|
464 |
self recomputeHeightOfContents.
|
|
465 |
|
|
466 |
beDependentOfRows ifTrue:[
|
|
467 |
aRow addDependent:self.
|
|
468 |
].
|
|
469 |
(aRowNr <= selectedRowIndex) ifTrue:[
|
|
470 |
selectedRowIndex := selectedRowIndex + 1.
|
|
471 |
].
|
|
472 |
y0 := (aRowNr - 1) * rowHeight.
|
|
473 |
|
|
474 |
y0 < viewOrigin y ifTrue:[
|
|
475 |
self originWillChange.
|
|
476 |
viewOrigin y:(rowHeight + viewOrigin y).
|
|
477 |
self originChanged:(0 @ rowHeight).
|
|
478 |
].
|
|
479 |
shown ifTrue:[
|
|
480 |
y0 := self yVisibleOfRowNr:aRowNr.
|
|
481 |
y1 := y0 + rowHeight.
|
|
482 |
|
|
483 |
(y1 > margin and:[y0 < (height - margin)]) ifTrue:[
|
|
484 |
h := height - margin - y1.
|
|
485 |
y0 := y0 max:margin.
|
|
486 |
dH := y1 - y0.
|
|
487 |
self catchExpose.
|
561
|
488 |
|
542
|
489 |
self copyFrom:self x:0 y:y0
|
|
490 |
toX:0 y:y1
|
|
491 |
width:width height:h async:true.
|
|
492 |
self waitForExpose.
|
|
493 |
self redrawX:margin y:y0 width:width height:dH.
|
|
494 |
]
|
|
495 |
].
|
|
496 |
listSizeChanged := true.
|
|
497 |
self contentsChanged.
|
|
498 |
listSizeChanged := false.
|
|
499 |
^ aRow
|
|
500 |
!
|
|
501 |
|
567
|
502 |
addAll:aCollection beforeIndex:aRowNr
|
|
503 |
"add a collection of rows before slot aRowNr and redisplay
|
|
504 |
"
|
|
505 |
aCollection size ~~ 0 ifTrue:[
|
|
506 |
list size == 0 ifTrue:[
|
|
507 |
^ self list:aCollection
|
|
508 |
].
|
|
509 |
aCollection reverseDo:[:aRow|
|
|
510 |
self add:aRow beforeIndex:aRowNr
|
|
511 |
]
|
|
512 |
].
|
|
513 |
!
|
|
514 |
|
542
|
515 |
addFirst:aRow
|
|
516 |
"insert row at the start of the list of rows
|
|
517 |
"
|
|
518 |
^ self add:aRow beforeIndex:1
|
|
519 |
!
|
|
520 |
|
|
521 |
removeFirst
|
|
522 |
"remove first row; returns the removed row
|
|
523 |
"
|
|
524 |
self removeIndex:1
|
|
525 |
!
|
|
526 |
|
|
527 |
removeIndex:aRowNr
|
|
528 |
"remove row at an index; returns the removed row
|
|
529 |
"
|
545
|
530 |
|y0 y1 h dY oY yB noRedraw row|
|
542
|
531 |
|
|
532 |
row := list at:aRowNr ifAbsent:[^ self subscriptBoundsError:aRowNr].
|
|
533 |
|
|
534 |
list isArray ifTrue:[
|
|
535 |
list := list asOrderedCollection.
|
|
536 |
].
|
|
537 |
selectedRowIndex == aRowNr ifTrue:[
|
|
538 |
self selectColIndex:0 rowIndex:0
|
|
539 |
] ifFalse:[
|
|
540 |
selectedRowIndex > aRowNr ifTrue:[
|
|
541 |
selectedRowIndex := selectedRowIndex - 1
|
|
542 |
]
|
|
543 |
].
|
|
544 |
y1 := aRowNr * rowHeight.
|
|
545 |
y0 := y1 - rowHeight.
|
|
546 |
yB := y1 + margin - viewOrigin y.
|
|
547 |
|
|
548 |
list removeIndex:aRowNr.
|
|
549 |
self recomputeHeightOfContents.
|
|
550 |
|
|
551 |
y0 < (oY := viewOrigin y) ifTrue:[
|
|
552 |
(noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY]
|
|
553 |
ifTrue:[dY := rowHeight negated].
|
|
554 |
self originWillChange.
|
|
555 |
viewOrigin y:(dY + oY).
|
|
556 |
self originChanged:(0 @ dY).
|
|
557 |
] ifFalse:[
|
|
558 |
noRedraw := y0 > (height + viewOrigin y)
|
|
559 |
].
|
|
560 |
|
|
561 |
(noRedraw or:[shown not]) ifFalse:[
|
|
562 |
y1 := yB.
|
|
563 |
y0 := self yVisibleOfRowNr:aRowNr.
|
|
564 |
h := height - margin - yB.
|
|
565 |
y0 := y0 max:margin.
|
|
566 |
|
561
|
567 |
h > 0 ifTrue:[
|
|
568 |
self catchExpose.
|
|
569 |
self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:true.
|
|
570 |
self waitForExpose.
|
|
571 |
].
|
542
|
572 |
y0 := y0 + h.
|
|
573 |
self redrawX:margin y:y0 width:width height:(height - y0).
|
|
574 |
].
|
|
575 |
listSizeChanged := true.
|
|
576 |
self contentsChanged.
|
|
577 |
listSizeChanged := false.
|
|
578 |
|
|
579 |
beDependentOfRows ifTrue:[
|
|
580 |
row removeDependent:self
|
|
581 |
].
|
|
582 |
|
|
583 |
^ row.
|
|
584 |
!
|
|
585 |
|
|
586 |
removeLast
|
|
587 |
"remove last row; the row is returned
|
|
588 |
"
|
|
589 |
^ self removeIndex:list size
|
|
590 |
! !
|
|
591 |
|
|
592 |
!DSVColumnView methodsFor:'change & update'!
|
|
593 |
|
|
594 |
update:something with:aParameter from:changedObject
|
|
595 |
"one of my rows/cells changed its value
|
|
596 |
"
|
563
|
597 |
|start colNr rowNr|
|
542
|
598 |
|
563
|
599 |
(start := self indexOfFirstRowShown) ~~ 0 ifTrue:[
|
|
600 |
rowNr := list identityIndexOf:something
|
|
601 |
startingAt:start
|
|
602 |
endingAt:(start + (height // rowHeight)).
|
542
|
603 |
|
563
|
604 |
rowNr ~~ 0 ifTrue:[
|
|
605 |
something notNil ifTrue:[
|
|
606 |
colNr := columnDescriptors findFirst:[:aCol|
|
|
607 |
aCol readSelector == something
|
|
608 |
]
|
|
609 |
] ifFalse:[
|
|
610 |
colNr := 0
|
|
611 |
].
|
|
612 |
self redrawRowAt:rowNr colAt:colNr
|
|
613 |
]
|
|
614 |
]
|
542
|
615 |
! !
|
|
616 |
|
|
617 |
!DSVColumnView methodsFor:'enumerating columns'!
|
|
618 |
|
|
619 |
columnsDo:aOneArgBlock
|
|
620 |
"evaluate the argument, aOneArgBlock for every column
|
|
621 |
"
|
|
622 |
columnDescriptors do:aOneArgBlock
|
|
623 |
|
|
624 |
|
|
625 |
!
|
|
626 |
|
|
627 |
columnsFrom:start to:stop do:aOneArgBlock
|
|
628 |
"evaluate the argument, aOneArgBlock for the columns with index start to
|
|
629 |
stop in the collection of column descriptors
|
|
630 |
"
|
|
631 |
columnDescriptors from:start to:stop do:aOneArgBlock
|
|
632 |
|
|
633 |
|
|
634 |
! !
|
|
635 |
|
|
636 |
!DSVColumnView methodsFor:'enumerating rows'!
|
|
637 |
|
|
638 |
do:aOneArgBlock
|
|
639 |
"evaluate the argument, aOneArgBlock for every row
|
|
640 |
"
|
|
641 |
list size ~~ 0 ifTrue:[list do:aOneArgBlock]
|
|
642 |
|
|
643 |
!
|
|
644 |
|
|
645 |
findFirst:aOneArgBlock
|
|
646 |
"find the first row, for which evaluation of the argument, aOneArgBlock
|
|
647 |
returns true; return its index or 0 if none detected.
|
|
648 |
"
|
|
649 |
list size ~~ 0 ifTrue:[
|
|
650 |
^ list findFirst:aOneArgBlock
|
|
651 |
].
|
|
652 |
^ 0
|
|
653 |
|
|
654 |
!
|
|
655 |
|
|
656 |
from:start to:stop do:aOneArgBlock
|
|
657 |
"evaluate the argument, aOneArgBlock for the rows with index start to
|
|
658 |
stop in the collection of rows
|
|
659 |
"
|
|
660 |
list size >= start ifTrue:[
|
|
661 |
list from:start to:stop do:aOneArgBlock
|
|
662 |
]
|
|
663 |
! !
|
|
664 |
|
|
665 |
!DSVColumnView methodsFor:'event handling'!
|
|
666 |
|
|
667 |
buttonMultiPress:button x:x y:y
|
|
668 |
"a button was pressed twice - handle doubleclick here
|
|
669 |
"
|
|
670 |
((button == 1) or:[button == #select]) ifFalse:[
|
|
671 |
^ super buttonMultiPress:button x:x y:y
|
|
672 |
].
|
|
673 |
selectedRowIndex == (self yVisibleToRowNr:y) ifTrue:[
|
|
674 |
( selectedColIndex == 0
|
|
675 |
or:[selectedColIndex == (self xVisibleToColNr:x)]
|
|
676 |
) ifTrue:[
|
|
677 |
self doubleClicked
|
|
678 |
]
|
|
679 |
]
|
|
680 |
|
|
681 |
|
|
682 |
|
|
683 |
|
|
684 |
!
|
|
685 |
|
|
686 |
buttonPress:button x:x y:y
|
|
687 |
"a button was pressed - handle selection here
|
|
688 |
"
|
|
689 |
|rowNr colNr menu col|
|
|
690 |
|
|
691 |
( (rowNr := self yVisibleToRowNr:y) notNil
|
|
692 |
and:[(colNr := self xVisibleToColNr:x) notNil]
|
|
693 |
) ifTrue:[
|
|
694 |
((button == 2) or:[button == #menu]) ifTrue:[ "/ menu for cell
|
|
695 |
selectedRowIndex == rowNr ifTrue:[
|
|
696 |
(selectedColIndex == 0) ifTrue:[ "/ row selected
|
|
697 |
col := columnDescriptors detect:[:aCol|
|
|
698 |
aCol rendererType == #rowSelector
|
|
699 |
].
|
|
700 |
col notNil ifTrue:[
|
|
701 |
menu := col menuForRow:(self selectedRow).
|
|
702 |
menu notNil ifTrue:[
|
|
703 |
^ menu startUp
|
|
704 |
]
|
|
705 |
].
|
|
706 |
^ self
|
|
707 |
].
|
|
708 |
selectedColIndex == colNr ifTrue:[
|
|
709 |
menu := self selectedColumn menuForRow:(self selectedRow).
|
|
710 |
menu notNil ifTrue:[
|
|
711 |
^ menu startUp
|
|
712 |
].
|
|
713 |
].
|
|
714 |
].
|
|
715 |
] ifFalse:[
|
|
716 |
((button == 1) or:[button == #select]) ifTrue:[ "/ selection change
|
|
717 |
^ self selectColIndex:colNr rowIndex:rowNr
|
|
718 |
]
|
|
719 |
]
|
|
720 |
].
|
|
721 |
^ super buttonPress:button x:x y:y
|
|
722 |
|
|
723 |
|
|
724 |
!
|
|
725 |
|
|
726 |
contentsChanged
|
|
727 |
"contents changed - move origin up if possible
|
|
728 |
"
|
|
729 |
|y|
|
|
730 |
|
|
731 |
shown ifTrue:[
|
|
732 |
self recomputeHeightOfContents.
|
|
733 |
y := self maxViewOriginY.
|
|
734 |
|
|
735 |
viewOrigin y > y ifTrue:[
|
|
736 |
self scrollTo:(viewOrigin x @ y)
|
|
737 |
] ifFalse:[
|
|
738 |
self updateEditViewOrigin.
|
|
739 |
]
|
|
740 |
].
|
|
741 |
super contentsChanged
|
|
742 |
|
|
743 |
|
|
744 |
!
|
|
745 |
|
|
746 |
doubleClicked
|
|
747 |
"handle a double click
|
|
748 |
"
|
|
749 |
(doubleClickActionBlock notNil and:[self hasSelection]) ifTrue:[
|
|
750 |
doubleClickActionBlock value:selectedRowIndex
|
|
751 |
].
|
|
752 |
!
|
|
753 |
|
|
754 |
keyPress:key x:x y:y
|
|
755 |
"a key was pressed - handle page-keys here
|
|
756 |
"
|
|
757 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
|
|
758 |
#BeginOfText #EndOfText
|
|
759 |
#ScrollUp #ScrollDown
|
|
760 |
#CursorUp #CursorDown #CursorRight #CursorLeft)>
|
|
761 |
|
|
762 |
|sensor n max idx col|
|
|
763 |
|
|
764 |
(key == #PreviousPage) ifTrue: [^ self pageUp].
|
|
765 |
(key == #NextPage) ifTrue: [^ self pageDown].
|
|
766 |
(key == #HalfPageUp) ifTrue: [^ self halfPageUp].
|
|
767 |
(key == #HalfPageDown) ifTrue: [^ self halfPageDown].
|
|
768 |
|
|
769 |
(key == #BeginOfText) ifTrue:[^ self scrollToTop].
|
|
770 |
(key == #EndOfText) ifTrue:[^ self scrollToBottom].
|
|
771 |
|
|
772 |
sensor := self sensor.
|
|
773 |
|
|
774 |
(key == #ScrollUp) ifTrue:[
|
|
775 |
sensor isNil ifTrue:[
|
|
776 |
n := 1
|
|
777 |
] ifFalse:[
|
|
778 |
n := 1 + (sensor compressKeyPressEventsWithKey:#ScrollUp).
|
|
779 |
].
|
|
780 |
^ self scrollUp:(n * self verticalScrollStep)
|
|
781 |
].
|
|
782 |
(key == #ScrollDown) ifTrue:[
|
|
783 |
sensor isNil ifTrue:[
|
|
784 |
n := 1
|
|
785 |
] ifFalse:[
|
|
786 |
n := 1 + (sensor compressKeyPressEventsWithKey:#ScrollDown).
|
|
787 |
].
|
|
788 |
^ self scrollDown:(n * self verticalScrollStep)
|
|
789 |
].
|
|
790 |
self hasSelection ifFalse:[^ self].
|
|
791 |
|
|
792 |
key == #Return ifTrue:[
|
|
793 |
^ self doubleClicked
|
|
794 |
].
|
|
795 |
|
|
796 |
(key == #CursorUp or:[key == #CursorDown]) ifTrue:[
|
|
797 |
sensor isNil ifTrue:[
|
|
798 |
n := 1
|
|
799 |
] ifFalse:[
|
|
800 |
n := 1 + (sensor compressKeyPressEventsWithKey:key).
|
|
801 |
].
|
|
802 |
max := self numberOfRows.
|
|
803 |
(n := n \\ max) == 0 ifTrue:[^ self ].
|
|
804 |
|
|
805 |
key == #CursorUp ifTrue:[
|
|
806 |
(n := selectedRowIndex - n) <= 0 ifTrue:[n := max + n]
|
|
807 |
] ifFalse:[
|
|
808 |
(n := selectedRowIndex + n) > max ifTrue:[n := n - max]
|
|
809 |
].
|
|
810 |
^ self selectColIndex:selectedColIndex rowIndex:n.
|
|
811 |
].
|
|
812 |
|
|
813 |
(key == #CursorRight or:[key == #CursorLeft]) ifTrue:[
|
|
814 |
selectedColIndex == 0 ifTrue:[ "/ line selected
|
|
815 |
^ self
|
|
816 |
].
|
|
817 |
sensor isNil ifTrue:[
|
|
818 |
n := 1
|
|
819 |
] ifFalse:[
|
|
820 |
n := 1 + (sensor compressKeyPressEventsWithKey:key).
|
|
821 |
].
|
|
822 |
(n := n \\ (self numberOfSelectableColumns)) == 0 ifTrue:[^ self ].
|
|
823 |
|
|
824 |
idx := selectedColIndex.
|
|
825 |
max := self numberOfColumns.
|
|
826 |
|
|
827 |
key == #CursorLeft ifTrue:[
|
|
828 |
[n ~~ 0] whileTrue:[
|
|
829 |
(idx := idx - 1) == 0 ifTrue:[idx := max].
|
|
830 |
(self columnAt:idx) canSelect ifTrue:[n := n - 1]
|
|
831 |
]
|
|
832 |
] ifFalse:[
|
|
833 |
[n ~~ 0] whileTrue:[
|
|
834 |
idx == max ifTrue:[idx := 1]
|
|
835 |
ifFalse:[idx := idx + 1].
|
|
836 |
(self columnAt:idx) canSelect ifTrue:[n := n - 1]
|
|
837 |
]
|
|
838 |
].
|
|
839 |
|
|
840 |
^ self selectColIndex:idx rowIndex:selectedRowIndex.
|
|
841 |
].
|
563
|
842 |
key isCharacter ifFalse:[
|
|
843 |
^ self
|
|
844 |
].
|
542
|
845 |
|
|
846 |
col := self columnAt:selectedColIndex.
|
|
847 |
|
|
848 |
"/ search forward
|
|
849 |
idx := col findRowNrStartingWithChar:key
|
|
850 |
start:(selectedRowIndex + 1)
|
|
851 |
stop:(self numberOfRows).
|
|
852 |
|
|
853 |
idx == 0 ifTrue:[
|
|
854 |
"/ search from begin
|
|
855 |
idx := col findRowNrStartingWithChar:key
|
|
856 |
start:1
|
|
857 |
stop:(selectedRowIndex - 1).
|
|
858 |
].
|
|
859 |
idx ~~ 0 ifTrue:[
|
|
860 |
self selectColIndex:selectedColIndex rowIndex:idx.
|
|
861 |
].
|
|
862 |
|
|
863 |
|
|
864 |
|
|
865 |
|
|
866 |
|
|
867 |
!
|
|
868 |
|
|
869 |
originChanged:delta
|
|
870 |
"this one is sent, after the origin of my contents has changed -
|
|
871 |
tell dependents (i.e. scrollers) about this
|
|
872 |
"
|
|
873 |
super originChanged:delta.
|
|
874 |
self updateEditViewOrigin.
|
|
875 |
!
|
|
876 |
|
|
877 |
sizeChanged:how
|
|
878 |
"size changed - move origin up if possible
|
|
879 |
"
|
|
880 |
super sizeChanged:how.
|
|
881 |
|
|
882 |
(shown and:[self numberOfColumns ~~ 0 and:[self fitColumns not]]) ifTrue:[
|
|
883 |
self scrollTo:viewOrigin. "/ validates viewOrigin
|
|
884 |
self invalidate.
|
|
885 |
self scrollToSelection
|
|
886 |
]
|
|
887 |
|
|
888 |
! !
|
|
889 |
|
|
890 |
!DSVColumnView methodsFor:'gc operations'!
|
|
891 |
|
|
892 |
registerImage:anImage key:aKey
|
|
893 |
"any row can register an image with a unique identifier a key symbol
|
|
894 |
"
|
|
895 |
|img|
|
|
896 |
|
|
897 |
(img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[
|
|
898 |
^ img
|
|
899 |
].
|
567
|
900 |
img := anImage onDevice:device.
|
|
901 |
img clearMaskedPixels.
|
|
902 |
registererImages at:aKey put:img.
|
|
903 |
^ img
|
542
|
904 |
!
|
|
905 |
|
|
906 |
registeredImageAt:aKey
|
|
907 |
"any row can register an image with a unique identifier
|
|
908 |
"
|
|
909 |
^ registererImages at:aKey ifAbsent:nil
|
|
910 |
!
|
|
911 |
|
|
912 |
releaseAllRegisteredImages
|
|
913 |
"release all registered images
|
|
914 |
"
|
|
915 |
registererImages := IdentityDictionary new.
|
|
916 |
! !
|
|
917 |
|
|
918 |
!DSVColumnView methodsFor:'initialization'!
|
|
919 |
|
|
920 |
create
|
|
921 |
"set foreground color
|
|
922 |
"
|
|
923 |
super create.
|
|
924 |
fgColor := fgColor on:device.
|
|
925 |
bgColor := bgColor on:device.
|
|
926 |
hgLgFgColor := hgLgFgColor on:device.
|
|
927 |
hgLgBgColor := hgLgBgColor on:device.
|
|
928 |
separatorLightColor := separatorLightColor on:device.
|
|
929 |
separatorDarkColor := separatorDarkColor on:device.
|
|
930 |
|
|
931 |
!
|
|
932 |
|
|
933 |
destroy
|
|
934 |
"remove dependencies
|
|
935 |
"
|
|
936 |
beDependentOfRows ifTrue:[
|
|
937 |
self do:[:aRow| aRow removeDependent:self].
|
|
938 |
].
|
|
939 |
super destroy
|
|
940 |
!
|
|
941 |
|
|
942 |
initStyle
|
|
943 |
"setup viewStyle specifics"
|
|
944 |
|
|
945 |
super initStyle.
|
|
946 |
|
|
947 |
DefaultForegroundColor isNil ifTrue:[
|
|
948 |
self class updateStyleCache
|
|
949 |
].
|
|
950 |
fgColor := DefaultForegroundColor.
|
|
951 |
bgColor := DefaultBackgroundColor.
|
|
952 |
hgLgFgColor := DefaultHilightForegroundColor.
|
|
953 |
hgLgBgColor := DefaultHilightBackgroundColor.
|
|
954 |
separatorDarkColor := DefaultSeparatorDarkColor.
|
|
955 |
separatorLightColor := DefaultSeparatorLightColor.
|
|
956 |
!
|
|
957 |
|
|
958 |
initialize
|
|
959 |
"set default attributes
|
|
960 |
"
|
|
961 |
super initialize.
|
|
962 |
|
|
963 |
viewOrigin := 0@0.
|
|
964 |
font := font on:device.
|
|
965 |
"/ self bitGravity:#NorthWest.
|
|
966 |
rowHeight := font height.
|
|
967 |
selectedRowIndex := 0.
|
|
968 |
selectedColIndex := 0.
|
|
969 |
registererImages := IdentityDictionary new.
|
|
970 |
has3Dsepartors := false.
|
|
971 |
columnDescriptors := #().
|
567
|
972 |
beDependentOfRows := false.
|
542
|
973 |
listSizeChanged := false.
|
563
|
974 |
verticalSpacing := self class verticalSpacing.
|
|
975 |
horizontalSpacing := self class horizontalSpacing.
|
542
|
976 |
!
|
|
977 |
|
|
978 |
realize
|
|
979 |
"recompute contents; set selection
|
|
980 |
"
|
|
981 |
|rowNr colNr|
|
|
982 |
|
|
983 |
self recomputeHeightOfContents.
|
|
984 |
super realize.
|
|
985 |
|
|
986 |
rowNr := selectedRowIndex.
|
|
987 |
colNr := selectedColIndex.
|
|
988 |
selectedColIndex := 0.
|
|
989 |
selectedRowIndex := 0.
|
|
990 |
self fitColumns.
|
|
991 |
self setSelectColIndex:colNr rowIndex:rowNr.
|
|
992 |
self bitGravity:#NorthWest.
|
|
993 |
|
|
994 |
! !
|
|
995 |
|
|
996 |
!DSVColumnView methodsFor:'private'!
|
|
997 |
|
|
998 |
fitColumns
|
|
999 |
"fit columns to view
|
|
1000 |
"
|
|
1001 |
|lastColumn dX sz expand resizables deltaWidth|
|
|
1002 |
|
|
1003 |
self canFit ifFalse:[^ false ].
|
|
1004 |
resizables := 0.
|
|
1005 |
self preferredExtent.
|
|
1006 |
|
|
1007 |
self columnsDo:[:aCol|
|
|
1008 |
aCol canResize ifTrue:[
|
|
1009 |
resizables := resizables + 1.
|
|
1010 |
deltaWidth := aCol setMinWidth.
|
|
1011 |
lastColumn := aCol.
|
|
1012 |
]
|
|
1013 |
].
|
|
1014 |
resizables == 0 ifTrue:[ ^ false ].
|
|
1015 |
|
|
1016 |
sz := self widthOfContents.
|
|
1017 |
|
|
1018 |
(expand := sz < width) ifTrue:[
|
|
1019 |
deltaWidth := width - sz + margin + margin.
|
|
1020 |
] ifFalse:[
|
|
1021 |
deltaWidth == 0 ifTrue:[ ^ false ].
|
|
1022 |
].
|
|
1023 |
|
|
1024 |
expand ifTrue:[
|
|
1025 |
(dX := deltaWidth // resizables) ~~ 0 ifTrue:[
|
|
1026 |
self columnsDo:[:aCol|aCol canResize ifTrue:[aCol growWidth:dX]]
|
|
1027 |
].
|
|
1028 |
lastColumn growWidth:(deltaWidth - (dX * resizables)).
|
|
1029 |
].
|
|
1030 |
self preferredExtentChanged.
|
|
1031 |
self invalidate.
|
|
1032 |
|
|
1033 |
self hasSelection ifTrue:[
|
|
1034 |
editView notNil ifTrue:[
|
|
1035 |
editView width:(self selectedColumn width - 1 - self separatorSize)
|
|
1036 |
].
|
|
1037 |
self scrollToSelection.
|
|
1038 |
].
|
|
1039 |
self contentsChanged.
|
|
1040 |
^ true
|
|
1041 |
|
|
1042 |
|
|
1043 |
!
|
|
1044 |
|
|
1045 |
maxViewOriginY
|
|
1046 |
"returns the maximum possible y of the view origin
|
|
1047 |
"
|
|
1048 |
|y|
|
|
1049 |
|
|
1050 |
y := self heightOfContents - self innerHeight.
|
|
1051 |
^ y max:0
|
|
1052 |
|
|
1053 |
!
|
|
1054 |
|
|
1055 |
updateEditViewOrigin
|
|
1056 |
"update origin of the editView
|
|
1057 |
"
|
|
1058 |
|x y|
|
|
1059 |
|
|
1060 |
editView notNil ifTrue:[
|
|
1061 |
y := 1 + (self yVisibleOfRowNr:selectedRowIndex).
|
|
1062 |
x := 1 + (self xVisibleOfColNr:selectedColIndex).
|
|
1063 |
|
|
1064 |
editView origin:(x @ y).
|
|
1065 |
].
|
|
1066 |
|
|
1067 |
!
|
|
1068 |
|
|
1069 |
xVisibleOfColNr:aColNr
|
|
1070 |
"returns visible x assigned to a column number
|
|
1071 |
"
|
|
1072 |
|x|
|
|
1073 |
|
|
1074 |
x := margin - viewOrigin x.
|
|
1075 |
self columnsFrom:1 to:(aColNr - 1) do:[:aCol| x := x + aCol width ].
|
|
1076 |
^ x
|
|
1077 |
|
|
1078 |
!
|
|
1079 |
|
|
1080 |
xVisibleToColNr:x
|
|
1081 |
|x0 nr|
|
|
1082 |
|
|
1083 |
x0 := x + viewOrigin x - margin.
|
|
1084 |
nr := 1.
|
|
1085 |
|
|
1086 |
self columnsDo:[:aCol|
|
|
1087 |
(x0 := x0 - aCol width) <= 0 ifTrue:[^ nr].
|
|
1088 |
nr := nr + 1.
|
|
1089 |
].
|
|
1090 |
^ nil.
|
|
1091 |
|
|
1092 |
!
|
|
1093 |
|
|
1094 |
yVisibleOfRowNr:aRowNr
|
|
1095 |
"returns visible y assigned to the row number
|
|
1096 |
"
|
|
1097 |
^ (aRowNr - 1) * rowHeight + margin - viewOrigin y
|
|
1098 |
|
|
1099 |
!
|
|
1100 |
|
|
1101 |
yVisibleToRowNr:y
|
|
1102 |
"returns row number or nil
|
|
1103 |
"
|
|
1104 |
|y0|
|
|
1105 |
|
|
1106 |
y0 := (y + viewOrigin y - margin) // rowHeight + 1.
|
|
1107 |
^ (y0 <= self numberOfRows) ifTrue:[y0] ifFalse:[nil]
|
|
1108 |
|
|
1109 |
! !
|
|
1110 |
|
|
1111 |
!DSVColumnView methodsFor:'queries'!
|
|
1112 |
|
|
1113 |
canFit
|
|
1114 |
"returns true if columns can be fit to view
|
|
1115 |
"
|
|
1116 |
^ canFit
|
|
1117 |
!
|
|
1118 |
|
563
|
1119 |
indexOfFirstRowShown
|
|
1120 |
"returns index of first row shown
|
|
1121 |
"
|
|
1122 |
|idx|
|
|
1123 |
|
|
1124 |
idx := (self yOriginOfContents // rowHeight) + 1.
|
|
1125 |
^ (idx <= list size) ifTrue:[idx] ifFalse:[0]
|
|
1126 |
|
|
1127 |
!
|
|
1128 |
|
542
|
1129 |
listSizeChanged
|
|
1130 |
^ listSizeChanged
|
|
1131 |
!
|
|
1132 |
|
|
1133 |
numberOfColumns
|
|
1134 |
"returns number of columns
|
|
1135 |
"
|
|
1136 |
^ columnDescriptors size
|
|
1137 |
|
|
1138 |
!
|
|
1139 |
|
|
1140 |
numberOfRows
|
|
1141 |
"returns number of raws
|
|
1142 |
"
|
|
1143 |
^ list size
|
|
1144 |
|
|
1145 |
!
|
|
1146 |
|
|
1147 |
numberOfSelectableColumns
|
|
1148 |
"returns number of selectable columns
|
|
1149 |
"
|
|
1150 |
|num|
|
|
1151 |
|
|
1152 |
num := 0.
|
|
1153 |
self columnsDo:[:aCol| aCol canSelect ifTrue:[num := num + 1] ].
|
|
1154 |
^ num
|
|
1155 |
!
|
|
1156 |
|
|
1157 |
rowHeight
|
|
1158 |
"get the height of the highest row in pixels
|
|
1159 |
"
|
|
1160 |
^ rowHeight
|
|
1161 |
|
|
1162 |
!
|
|
1163 |
|
|
1164 |
separatorSize
|
|
1165 |
"returns vertical/horizontal size of a separator dependent on the
|
|
1166 |
3D effect.
|
|
1167 |
"
|
|
1168 |
^ has3Dsepartors ifTrue:[4] ifFalse:[1]
|
|
1169 |
|
|
1170 |
!
|
|
1171 |
|
|
1172 |
size
|
|
1173 |
"returns number of raws
|
|
1174 |
"
|
|
1175 |
^ list size
|
|
1176 |
|
|
1177 |
! !
|
|
1178 |
|
|
1179 |
!DSVColumnView methodsFor:'recomputation'!
|
|
1180 |
|
|
1181 |
preferredExtent
|
|
1182 |
"recompute preferred extent
|
|
1183 |
"
|
|
1184 |
|x|
|
|
1185 |
|
|
1186 |
preferredExtent notNil ifTrue:[
|
|
1187 |
^ preferredExtent
|
|
1188 |
].
|
|
1189 |
x := 3.
|
|
1190 |
rowHeight := 0.
|
|
1191 |
|
|
1192 |
self columnsDo:[:aCol|
|
|
1193 |
rowHeight := (aCol heightOfHighestRow) max:rowHeight.
|
|
1194 |
x := x + (aCol minWidth).
|
|
1195 |
].
|
563
|
1196 |
rowHeight := rowHeight + (2 * verticalSpacing) + (self separatorSize).
|
542
|
1197 |
preferredExtent := (x + margin + margin) @ (self numberOfRows * rowHeight).
|
|
1198 |
|
|
1199 |
x := (rowHeight - font height) // 2 + font ascent.
|
|
1200 |
self columnsDo:[:aCol|aCol textInsetChanged:x].
|
|
1201 |
^ preferredExtent
|
|
1202 |
|
|
1203 |
|
|
1204 |
!
|
|
1205 |
|
|
1206 |
preferredExtentChanged
|
|
1207 |
|y x|
|
|
1208 |
|
|
1209 |
y := viewOrigin y.
|
|
1210 |
x := viewOrigin x.
|
|
1211 |
|
|
1212 |
(y ~~ 0 or:[x ~~ 0]) ifTrue:[
|
|
1213 |
self originWillChange.
|
|
1214 |
viewOrigin := 0 @ 0.
|
|
1215 |
preferredExtent := nil.
|
|
1216 |
self originChanged:(x negated @ y negated).
|
|
1217 |
]
|
|
1218 |
!
|
|
1219 |
|
|
1220 |
recomputeHeightOfContents
|
|
1221 |
|
|
1222 |
preferredExtent notNil ifTrue:[
|
|
1223 |
preferredExtent y:(rowHeight * self numberOfRows)
|
|
1224 |
] ifFalse:[
|
|
1225 |
self preferredExtent
|
|
1226 |
].
|
|
1227 |
! !
|
|
1228 |
|
|
1229 |
!DSVColumnView methodsFor:'redrawing'!
|
|
1230 |
|
567
|
1231 |
forceRedraw
|
|
1232 |
"a redraw forced by any other component
|
|
1233 |
"
|
|
1234 |
self redraw
|
|
1235 |
!
|
|
1236 |
|
542
|
1237 |
invalidate
|
|
1238 |
"recompute extent before repair range
|
|
1239 |
"
|
|
1240 |
self recomputeHeightOfContents.
|
|
1241 |
super invalidate.
|
|
1242 |
|
|
1243 |
|
|
1244 |
!
|
|
1245 |
|
|
1246 |
redraw
|
|
1247 |
"redraw complete view
|
|
1248 |
"
|
|
1249 |
self redrawX:0 y:0 width:width height:height.
|
|
1250 |
|
|
1251 |
!
|
|
1252 |
|
|
1253 |
redrawRowAt:aRowNr
|
|
1254 |
"redraw total row at an index
|
|
1255 |
"
|
|
1256 |
self redrawRowAt:aRowNr colAt:0
|
|
1257 |
!
|
|
1258 |
|
|
1259 |
redrawRowAt:aRowNr colAt:aColNr
|
|
1260 |
"redraw visible row in case of aColNr == 0 or the column in a row;
|
|
1261 |
in case that the row/column is hidden no redraw is done
|
|
1262 |
"
|
|
1263 |
|x y h w|
|
|
1264 |
|
|
1265 |
(shown and:[aRowNr between:1 and:self numberOfRows]) ifTrue:[
|
|
1266 |
h := rowHeight - 1.
|
|
1267 |
|
|
1268 |
(y := self yVisibleOfRowNr:aRowNr) < margin ifTrue:[
|
|
1269 |
(h := h + y) <= margin ifTrue:[
|
|
1270 |
^ self
|
|
1271 |
]. "/ row not visible
|
|
1272 |
h := h - margin.
|
|
1273 |
y := margin.
|
|
1274 |
] ifFalse:[
|
|
1275 |
y >= height ifTrue:[^ self].
|
|
1276 |
].
|
|
1277 |
aColNr ~~ 0 ifTrue:[ "/ redraw column in row
|
|
1278 |
w := (self columnAt:aColNr) width - 1.
|
|
1279 |
|
|
1280 |
(x := self xVisibleOfColNr:aColNr) < margin ifTrue:[
|
|
1281 |
(w := w + x) <= margin ifTrue:[
|
|
1282 |
^ self
|
|
1283 |
]. "/ column not visible
|
|
1284 |
w := w - margin.
|
|
1285 |
x := margin.
|
|
1286 |
] ifFalse:[
|
|
1287 |
x >= width ifTrue:[^ self].
|
|
1288 |
]
|
|
1289 |
] ifFalse:[ "/ redraw whole row
|
|
1290 |
x := margin.
|
|
1291 |
w := width.
|
|
1292 |
].
|
|
1293 |
self redrawX:x y:y width:w height:h
|
|
1294 |
]
|
|
1295 |
!
|
|
1296 |
|
|
1297 |
redrawX:x y:y width:w height:h
|
|
1298 |
"redraw part of myself immediately, given logical coordinates
|
|
1299 |
"
|
567
|
1300 |
|x0 x1 c0 c1 yT xM yTop yBot start stop prevTrans transPoint prevClipArea clipHeight|
|
542
|
1301 |
|
|
1302 |
shown ifFalse:[^ self].
|
|
1303 |
|
|
1304 |
self paint:bgColor.
|
|
1305 |
self fillRectangleX:x y:y width:w height:h.
|
|
1306 |
|
|
1307 |
yT := margin - viewOrigin y.
|
|
1308 |
c0 := y - yT.
|
|
1309 |
|
|
1310 |
start := (c0 // rowHeight) + 1.
|
|
1311 |
stop := (c0 + h - 1 // rowHeight + 1) min:(self numberOfRows).
|
|
1312 |
|
|
1313 |
stop < start ifTrue:[
|
|
1314 |
^ self
|
|
1315 |
].
|
|
1316 |
xM := (x + w) min:(width - margin).
|
|
1317 |
prevTrans := transformation.
|
|
1318 |
prevClipArea := clipRect.
|
|
1319 |
clipRect := nil.
|
|
1320 |
transformation := WindowingTransformation new.
|
|
1321 |
clipHeight := height - margin - margin.
|
567
|
1322 |
transPoint := Point x:0 y:yT.
|
542
|
1323 |
|
|
1324 |
x0 := margin - (viewOrigin x).
|
|
1325 |
yTop := (start - 1) * rowHeight.
|
|
1326 |
yBot := stop * rowHeight.
|
|
1327 |
|
|
1328 |
self columnsDo:[:aCol|
|
|
1329 |
((x1 := x0 + aCol width) >= x and:[x0 < xM]) ifTrue:[
|
|
1330 |
c0 := x0 max:margin.
|
|
1331 |
c1 := (x1 + 1) min:xM.
|
|
1332 |
|
|
1333 |
device setClipX:c0 y:margin width:(c1 - c0) height:clipHeight
|
|
1334 |
in:drawableId gc:gcId.
|
|
1335 |
|
567
|
1336 |
transPoint x:x0.
|
|
1337 |
transformation translation:transPoint.
|
542
|
1338 |
aCol drawFrom:start to:stop yTop:yTop yBot:yBot with:fgColor and:bgColor.
|
|
1339 |
].
|
|
1340 |
x0 := x1
|
|
1341 |
].
|
|
1342 |
transformation := prevTrans.
|
|
1343 |
clipRect := nil.
|
|
1344 |
|
|
1345 |
prevClipArea isNil ifTrue:[device noClipIn:drawableId gc:gcId]
|
|
1346 |
ifFalse:[self clippingRectangle:prevClipArea].
|
|
1347 |
|
|
1348 |
(w >= (width - margin - margin) and:[h >= (height - margin - margin)]) ifTrue:[
|
|
1349 |
self sensor flushExposeEventsFor:self.
|
|
1350 |
].
|
|
1351 |
! !
|
|
1352 |
|
|
1353 |
!DSVColumnView methodsFor:'scroller interface'!
|
|
1354 |
|
|
1355 |
heightOfContents
|
|
1356 |
"return the height of the contents in pixels
|
|
1357 |
"
|
|
1358 |
^ self preferredExtent y
|
|
1359 |
|
|
1360 |
|
|
1361 |
!
|
|
1362 |
|
|
1363 |
innerHeight
|
|
1364 |
"returns the inner height of the contents shown
|
|
1365 |
"
|
|
1366 |
^ height - margin - margin
|
|
1367 |
|
|
1368 |
!
|
|
1369 |
|
|
1370 |
innerWidth
|
|
1371 |
"returns the inner width of the contents shown
|
|
1372 |
"
|
|
1373 |
^ width - margin - margin
|
|
1374 |
|
|
1375 |
!
|
|
1376 |
|
|
1377 |
verticalScrollStep
|
|
1378 |
"return the amount to scroll when stepping up/down.
|
|
1379 |
"
|
|
1380 |
^ rowHeight
|
|
1381 |
|
|
1382 |
|
|
1383 |
|
|
1384 |
!
|
|
1385 |
|
|
1386 |
viewOrigin
|
|
1387 |
"return the viewOrigin; thats the coordinate of the contents
|
|
1388 |
which is shown topLeft in the view.
|
|
1389 |
"
|
|
1390 |
^ viewOrigin
|
|
1391 |
|
|
1392 |
!
|
|
1393 |
|
|
1394 |
widthOfContents
|
|
1395 |
"return the width of the contents in pixels
|
|
1396 |
"
|
|
1397 |
^ self preferredExtent x
|
|
1398 |
|
|
1399 |
!
|
|
1400 |
|
|
1401 |
xOriginOfContents
|
|
1402 |
"return the horizontal origin of the contents in pixels
|
|
1403 |
"
|
|
1404 |
^ viewOrigin x
|
|
1405 |
|
|
1406 |
!
|
|
1407 |
|
|
1408 |
yOriginOfContents
|
|
1409 |
"return the vertical origin of the contents in pixels
|
|
1410 |
"
|
|
1411 |
^ viewOrigin y
|
|
1412 |
|
|
1413 |
! !
|
|
1414 |
|
|
1415 |
!DSVColumnView methodsFor:'scrolling'!
|
|
1416 |
|
|
1417 |
halfPageDown
|
|
1418 |
"scroll down half a page
|
|
1419 |
"
|
|
1420 |
self scrollDown:(self innerHeight // 2)
|
|
1421 |
|
|
1422 |
|
|
1423 |
!
|
|
1424 |
|
|
1425 |
halfPageUp
|
|
1426 |
"scroll up half a page
|
|
1427 |
"
|
|
1428 |
self scrollUp:(self innerHeight // 2)
|
|
1429 |
|
|
1430 |
!
|
|
1431 |
|
|
1432 |
scrollTo:anOrigin redraw:doRedraw
|
|
1433 |
"change origin to have newOrigin be visible at the top-left.
|
|
1434 |
"
|
|
1435 |
|x y dX dY newOrg dltOrg h innerWT innerHG|
|
|
1436 |
|
|
1437 |
shown ifFalse:[
|
|
1438 |
^ self
|
|
1439 |
].
|
|
1440 |
[self sensor hasExposeEventFor:nil] whileTrue:[
|
|
1441 |
self windowGroup processExposeEvents
|
|
1442 |
].
|
|
1443 |
innerWT := self innerWidth.
|
|
1444 |
innerHG := self innerHeight.
|
|
1445 |
|
|
1446 |
h := viewOrigin y.
|
|
1447 |
|
|
1448 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents
|
|
1449 |
y > (dY := self maxViewOriginY) ifTrue:[
|
|
1450 |
y := dY max:h
|
|
1451 |
]
|
|
1452 |
] ifFalse:[
|
|
1453 |
y := y max:0.
|
|
1454 |
].
|
|
1455 |
|
|
1456 |
(x := anOrigin x) > 0 ifTrue:[
|
|
1457 |
x := x min:(self widthOfContents - innerWT).
|
|
1458 |
].
|
|
1459 |
x := x max:0.
|
|
1460 |
newOrg := (x @ y).
|
|
1461 |
dltOrg := newOrg - viewOrigin.
|
|
1462 |
dX := dltOrg x.
|
|
1463 |
dY := dltOrg y.
|
|
1464 |
|
|
1465 |
(dX == 0 and:[dY == 0]) ifTrue:[
|
|
1466 |
^ self
|
|
1467 |
].
|
|
1468 |
self originWillChange.
|
|
1469 |
viewOrigin := newOrg.
|
|
1470 |
|
|
1471 |
doRedraw ifFalse:[
|
|
1472 |
^ self originChanged:dltOrg
|
|
1473 |
].
|
|
1474 |
|
|
1475 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL
|
|
1476 |
dY := dY abs.
|
|
1477 |
|
|
1478 |
(dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[
|
|
1479 |
self redraw.
|
|
1480 |
] ifFalse:[ "/ COPY VERTICAL
|
|
1481 |
|y0 y1|
|
|
1482 |
|
|
1483 |
y0 := y1 := margin + dY.
|
|
1484 |
h := innerHG - dY.
|
|
1485 |
|
|
1486 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0]
|
|
1487 |
ifFalse:[y1 := margin. y := y1 + h].
|
|
1488 |
|
|
1489 |
self catchExpose.
|
|
1490 |
self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:h async:true.
|
|
1491 |
self waitForExpose.
|
|
1492 |
self redrawX:0 y:y width:width height:(innerHG - h).
|
|
1493 |
]
|
|
1494 |
] ifFalse:[ "/ SCROLL HORIZONTAL
|
|
1495 |
dX := dX abs.
|
|
1496 |
|
|
1497 |
innerWT - dX < 20 ifTrue:[
|
|
1498 |
self redraw.
|
|
1499 |
] ifFalse:[ "/ COPY HORIZONTAL
|
|
1500 |
|x0 x1 w|
|
|
1501 |
|
|
1502 |
x0 := x1 := dX.
|
|
1503 |
w := width - dX - margin.
|
|
1504 |
|
|
1505 |
dltOrg x < 0 ifTrue:[x0 := 0. x := x0]
|
|
1506 |
ifFalse:[x1 := 0. x := w].
|
|
1507 |
|
|
1508 |
self catchExpose.
|
|
1509 |
self copyFrom:self x:x0 y:0 toX:x1 y:0 width:w height:height async:true.
|
|
1510 |
self waitForExpose.
|
|
1511 |
self redrawX:x y:0 width:(width - w) height:height.
|
|
1512 |
]
|
|
1513 |
].
|
|
1514 |
self originChanged:dltOrg.
|
|
1515 |
!
|
|
1516 |
|
|
1517 |
scrollToRowAt:aRowNr colAt:aColNr
|
|
1518 |
"make row at a row number in column at a column number visible
|
|
1519 |
"
|
|
1520 |
|x y l dY dX|
|
|
1521 |
|
|
1522 |
( (aRowNr between:1 and:(self numberOfRows))
|
|
1523 |
and:[aColNr between:0 and:(self numberOfColumns)]
|
|
1524 |
) ifFalse:[
|
|
1525 |
^ self
|
|
1526 |
].
|
|
1527 |
|
|
1528 |
dY := dX := 0.
|
|
1529 |
y := self yVisibleOfRowNr:aRowNr.
|
|
1530 |
|
|
1531 |
y < margin ifTrue:[
|
|
1532 |
dY := margin - y.
|
|
1533 |
] ifFalse:[
|
|
1534 |
y := y + rowHeight.
|
|
1535 |
l := height - margin.
|
|
1536 |
y > l ifTrue:[dY := l - y]
|
|
1537 |
].
|
|
1538 |
|
|
1539 |
aColNr == 0 ifTrue:[
|
|
1540 |
dY == 0 ifTrue:[^ self].
|
|
1541 |
dX := 0.
|
|
1542 |
] ifFalse:[
|
|
1543 |
x := self xVisibleOfColNr:aColNr.
|
|
1544 |
|
|
1545 |
x < margin ifTrue:[
|
|
1546 |
dX := margin - x
|
|
1547 |
] ifFalse:[
|
|
1548 |
x := x + (self columnAt:aColNr) width.
|
|
1549 |
l := width - margin.
|
|
1550 |
x > l ifTrue:[dX := l - x]
|
|
1551 |
]
|
|
1552 |
].
|
|
1553 |
|
|
1554 |
(dX == 0 and:[dY == 0]) ifFalse:[
|
|
1555 |
self scrollTo:(viewOrigin - (dX @ dY)).
|
|
1556 |
]
|
|
1557 |
|
|
1558 |
|
|
1559 |
!
|
|
1560 |
|
|
1561 |
scrollToSelection
|
|
1562 |
"make selection visible
|
|
1563 |
"
|
|
1564 |
self hasSelection ifTrue:[
|
|
1565 |
self scrollToRowAt:selectedRowIndex colAt:selectedColIndex
|
|
1566 |
]
|
|
1567 |
|
|
1568 |
! !
|
|
1569 |
|
|
1570 |
!DSVColumnView methodsFor:'selection'!
|
|
1571 |
|
|
1572 |
hasSelection
|
|
1573 |
"returns true if a selection (raw and column) exists
|
|
1574 |
"
|
|
1575 |
^ selectedRowIndex ~~ 0
|
|
1576 |
|
|
1577 |
|
|
1578 |
!
|
|
1579 |
|
|
1580 |
selectColIndex:aColNr
|
|
1581 |
"select new column; keep row index
|
|
1582 |
"
|
|
1583 |
self selectColIndex:aColNr rowIndex:selectedRowIndex
|
|
1584 |
!
|
|
1585 |
|
|
1586 |
selectColIndex:aColNr rowIndex:aRowNr
|
|
1587 |
"change selection with notification
|
|
1588 |
"
|
|
1589 |
|oC oR|
|
|
1590 |
|
|
1591 |
oC := selectedColIndex.
|
|
1592 |
oR := selectedRowIndex.
|
|
1593 |
|
|
1594 |
self setSelectColIndex:aColNr rowIndex:aRowNr.
|
|
1595 |
|
|
1596 |
(oC ~~ selectedColIndex or:[oR ~~ selectedRowIndex]) ifTrue:[
|
|
1597 |
self selectionChanged
|
|
1598 |
].
|
|
1599 |
!
|
|
1600 |
|
|
1601 |
selectRow:aRow
|
|
1602 |
"select a row
|
|
1603 |
"
|
|
1604 |
|rowNr|
|
|
1605 |
|
563
|
1606 |
(aRow notNil and:[list size ~~ 0]) ifTrue:[
|
|
1607 |
rowNr := list identityIndexOf:aRow
|
|
1608 |
] ifFalse:[
|
|
1609 |
rowNr := 0
|
|
1610 |
].
|
542
|
1611 |
self selectRowIndex:rowNr.
|
|
1612 |
!
|
|
1613 |
|
|
1614 |
selectRowIndex:aRowNr
|
|
1615 |
"select new row; keep column index
|
|
1616 |
"
|
|
1617 |
self selectColIndex:selectedColIndex rowIndex:aRowNr
|
|
1618 |
!
|
|
1619 |
|
|
1620 |
selectedColIndex
|
|
1621 |
"returns selected column number or 0
|
|
1622 |
"
|
|
1623 |
^ selectedColIndex
|
|
1624 |
!
|
|
1625 |
|
|
1626 |
selectedColumn
|
|
1627 |
"returns selected column or nil
|
|
1628 |
"
|
|
1629 |
^ columnDescriptors at:selectedColIndex ifAbsent:nil.
|
|
1630 |
!
|
|
1631 |
|
|
1632 |
selectedRow
|
|
1633 |
"returns selected row or nil
|
|
1634 |
"
|
|
1635 |
^ self at:selectedRowIndex ifAbsent:nil
|
|
1636 |
!
|
|
1637 |
|
|
1638 |
selectedRowIndex
|
|
1639 |
"returns selected row number or 0
|
|
1640 |
"
|
|
1641 |
^ selectedRowIndex
|
|
1642 |
!
|
|
1643 |
|
|
1644 |
selectedRowIndexInColumn:aCol
|
|
1645 |
selectedRowIndex ~~ 0 ifTrue:[
|
|
1646 |
(selectedColIndex == 0 or:[self selectedColumn == aCol]) ifTrue:[
|
|
1647 |
^ selectedRowIndex
|
|
1648 |
]
|
|
1649 |
].
|
|
1650 |
^ 0
|
|
1651 |
!
|
|
1652 |
|
|
1653 |
selectionChanged
|
|
1654 |
"selection has changed
|
|
1655 |
"
|
|
1656 |
self changed:#selection.
|
|
1657 |
|
|
1658 |
actionBlock notNil ifTrue:[
|
|
1659 |
actionBlock value:selectedRowIndex
|
|
1660 |
]
|
|
1661 |
!
|
|
1662 |
|
|
1663 |
setSelectColIndex:aColNr rowIndex:aRowNr
|
|
1664 |
"change selection without notification
|
|
1665 |
"
|
545
|
1666 |
|rowNr colNr newCol oldCol oldRow level sensor|
|
542
|
1667 |
|
|
1668 |
(aRowNr between:0 and:(self numberOfRows)) ifTrue:[rowNr := aRowNr]
|
|
1669 |
ifFalse:[rowNr := 0].
|
|
1670 |
|
|
1671 |
colNr := 0.
|
|
1672 |
|
|
1673 |
( rowNr ~~ 0
|
|
1674 |
and:[(aColNr between:1 and:(self numberOfColumns))
|
|
1675 |
and:[(self columnAt:aColNr) rendererType ~~ #rowSelector]]
|
|
1676 |
) ifTrue:[
|
|
1677 |
colNr := aColNr
|
|
1678 |
].
|
|
1679 |
|
|
1680 |
(rowNr == selectedRowIndex and:[colNr == selectedColIndex]) ifTrue:[
|
|
1681 |
^ self "/ nothing changed
|
|
1682 |
].
|
|
1683 |
|
|
1684 |
rowNr ~~ 0 ifTrue:[
|
|
1685 |
colNr ~~ 0 ifTrue:[
|
|
1686 |
newCol := self columnAt:colNr.
|
|
1687 |
newCol canSelect ifFalse:[^ self]. "/ not selectable
|
|
1688 |
]
|
|
1689 |
].
|
|
1690 |
|
|
1691 |
"/ release old selection
|
|
1692 |
|
|
1693 |
oldCol := selectedColIndex.
|
|
1694 |
oldRow := selectedRowIndex.
|
|
1695 |
selectedRowIndex := rowNr.
|
|
1696 |
selectedColIndex := colNr.
|
|
1697 |
|
|
1698 |
oldRow ~~ 0 ifTrue:[
|
|
1699 |
editValue notNil ifTrue:[
|
|
1700 |
(self columnAt:oldCol) at:oldRow put:editValue value.
|
|
1701 |
editValue := nil
|
|
1702 |
].
|
|
1703 |
|
|
1704 |
editView notNil ifTrue:[
|
|
1705 |
editView destroy.
|
|
1706 |
editView := nil.
|
|
1707 |
].
|
|
1708 |
"/ redraw old selection unselected
|
|
1709 |
self realized ifTrue:[
|
|
1710 |
self redrawRowAt:oldRow colAt:oldCol.
|
|
1711 |
]
|
|
1712 |
].
|
|
1713 |
|
|
1714 |
"/ show new selection
|
|
1715 |
|
|
1716 |
self realized ifFalse:[^ self ].
|
|
1717 |
|
|
1718 |
newCol notNil ifTrue:[
|
|
1719 |
self scrollToRowAt:rowNr colAt:colNr.
|
|
1720 |
|
|
1721 |
newCol editorType ~~ #None ifTrue:[
|
|
1722 |
|
|
1723 |
level := 1 + self separatorSize.
|
|
1724 |
editView := SimpleView extent:((newCol width - level) @ (rowHeight - level)) in:self.
|
|
1725 |
self updateEditViewOrigin.
|
|
1726 |
editView viewBackground:hgLgBgColor.
|
|
1727 |
|
|
1728 |
editValue := newCol editorForRow:(self at:rowNr)
|
|
1729 |
in:editView
|
|
1730 |
with:hgLgFgColor
|
|
1731 |
bg:hgLgBgColor.
|
|
1732 |
editView realize.
|
|
1733 |
] ifFalse:[
|
|
1734 |
self redrawRowAt:rowNr colAt:colNr
|
|
1735 |
]
|
|
1736 |
] ifFalse:[
|
|
1737 |
selectedRowIndex ~~ 0 ifTrue:[
|
|
1738 |
self redrawRowAt:rowNr colAt:0.
|
|
1739 |
self scrollToRowAt:rowNr colAt:0.
|
|
1740 |
]
|
|
1741 |
].
|
|
1742 |
|
|
1743 |
(sensor := self sensor) notNil ifTrue:[
|
|
1744 |
[sensor hasExposeEventFor:nil] whileTrue:[
|
|
1745 |
self windowGroup processExposeEvents
|
|
1746 |
]
|
|
1747 |
]
|
|
1748 |
|
|
1749 |
|
|
1750 |
! !
|
|
1751 |
|
|
1752 |
!DSVColumnView class methodsFor:'documentation'!
|
|
1753 |
|
|
1754 |
version
|
582
|
1755 |
^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.7 1997-10-28 20:03:47 cg Exp $'
|
542
|
1756 |
! !
|