author | ca |
Mon, 17 Jul 2000 15:23:30 +0200 | |
changeset 1778 | 51bbd960baf9 |
parent 1776 | e28ffcdd52a7 |
child 1805 | 66792febb315 |
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 |
||
1754 | 16 |
"{ Package: 'stx:libwidg2' }" |
17 |
||
542 | 18 |
View subclass:#DSVColumnView |
1487 | 19 |
instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex |
20 |
selectedColIndex selectedRowIndex selectRowOnDefault rowHeight |
|
21 |
columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex |
|
22 |
rowIfAbsentBlock columnHolder registererImages list fgColor |
|
23 |
separatorSize catchChangeEvents beDependentOfRows bgColor |
|
1668 | 24 |
hgLgFgColor hgLgBgColor actionBlock builder tabIntern |
1487 | 25 |
doubleClickActionBlock verticalSpacing horizontalSpacing |
26 |
rowSelectorForm buttonLightColor buttonShadowColor |
|
27 |
buttonHalfLightColor buttonHalfShadowColor checkToggleExtent |
|
28 |
checkToggleForm checkToggleActiveImage checkTogglePassiveImage |
|
29 |
checkToggleLevel comboButtonExtent comboButtonForm |
|
30 |
comboButtonLevel clickPosition dragAccessPoint dragIsActive |
|
31 |
dropTarget dropSource columnAdaptor tabAtEndAction |
|
1749 | 32 |
tabAtStartAction modifiedChannel autoScroll autoScrollBlock' |
542 | 33 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor |
34 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor |
|
1498 | 35 |
ButtonLightColor ButtonShadowColor CheckToggleActiveImage |
36 |
CheckTogglePassiveImage ButtonHalfLightColor |
|
37 |
ButtonHalfShadowColor ButtonEdgeStyle CheckToggleForm |
|
38 |
CheckToggleLevel CheckToggleExtent ComboButtonForm |
|
39 |
ComboButtonLevel ComboButtonExtent' |
|
542 | 40 |
poolDictionaries:'' |
41 |
category:'Views-DataSet' |
|
42 |
! |
|
43 |
||
44 |
!DSVColumnView class methodsFor:'documentation'! |
|
45 |
||
46 |
copyright |
|
47 |
" |
|
48 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
49 |
All Rights Reserved |
|
50 |
||
51 |
This software is furnished under a license and may be used |
|
52 |
only in accordance with the terms of that license and with the |
|
53 |
inclusion of the above copyright notice. This software may not |
|
54 |
be provided or otherwise made available to, or used by, any |
|
55 |
other person. No title to or ownership of the software is |
|
56 |
hereby transferred. |
|
57 |
" |
|
58 |
||
59 |
||
60 |
||
61 |
! |
|
62 |
||
63 |
documentation |
|
64 |
" |
|
65 |
implements a scrollable selection view based on rows and columns |
|
66 |
||
67 |
[Instance variables:] |
|
68 |
||
69 |
editValue <Model> current editing model |
|
70 |
editView <View> current editing component |
|
1087 | 71 |
|
72 |
multipleSelectOk <Boolean> multiple selection enabled/disabled |
|
73 |
||
542 | 74 |
selectedColIndex <Integer> selected column index or 0 |
1087 | 75 |
selectedRowIndex <Integer> selected row index or 0 |
76 |
||
542 | 77 |
rowHeight <Integer> maximum height of any row |
1087 | 78 |
|
542 | 79 |
columnDescriptors <SequancableCollection> list of column descriptors |
1087 | 80 |
|
81 |
viewOrigin <Point> current view origin |
|
82 |
||
83 |
colorMap <Dictionary> store and register used colors on device |
|
84 |
||
85 |
rowFontAscent <SmallInteger> inset of a printable text in a row |
|
86 |
including separator and font ascent. |
|
87 |
||
88 |
lockRowIndex <SmallInteger> internal used to indicate a row which has |
|
89 |
changed its contents but no redraw should be |
|
90 |
done( at:put: ). |
|
91 |
||
92 |
columnHolder <ValueHolder> holder which keeps the list of column descriptors. |
|
93 |
||
94 |
registererImages <IdentityDictionary> list of images registered on the device |
|
95 |
||
542 | 96 |
list <SequancableCollection> list of rows |
1087 | 97 |
|
98 |
||
99 |
catchChangeEvents <Boolean> internal used to discard change notifications |
|
100 |
||
101 |
beDependentOfRows <Boolean> keep rows dependent; on default is disabled. |
|
567 | 102 |
in case of enabled a row can raise a change |
103 |
notification whithout a parameter which |
|
104 |
will force a redraw of the row or the |
|
105 |
readSelector of the column which will |
|
106 |
redraw the cell in the row only. |
|
542 | 107 |
|
1087 | 108 |
fgColor <Color> foreground color |
109 |
bgColor <Color> background color |
|
110 |
hgLgFgColor <Color> highlight foreground color (selected) |
|
111 |
hgLgBgColor <Color> highlight background color (selected) |
|
112 |
||
113 |
buttonLightColor <Color> LightColor ( drawing the edge of a button ) |
|
114 |
buttonShadowColor <Color> ShadowColor ( drawing the edge of a button ) |
|
115 |
buttonHalfLightColor <Color> HalfLightColor ( drawing the edge of a button ) |
|
116 |
buttonHalfShadowColor <Color> HalfShadowColor ( drawing the edge of a button ) |
|
117 |
||
118 |
actionBlock <a OneArgBlock> action block performed on select |
|
119 |
doubleClickActionBlock <a OneArgBlock> action block performed on double click |
|
120 |
rowIfAbsentBlock <a OneArgBlock> this block is performed on an emty list entry |
|
121 |
to retrive the item from the application. The |
|
122 |
argument to the block is the index into the list. |
|
123 |
The block should return the row instance which |
|
124 |
is put to the list under the index. |
|
125 |
||
126 |
builder <UIBuilder> builder set by application |
|
127 |
||
128 |
verticalSpacing <SmallInteger> vertical row spacing( top & bottom ) |
|
129 |
horizontalSpacing <SmallInteger> horizontal row spacing( left & right ) |
|
130 |
separatorSize <SmallInteger> line width of a vertical or horizontal separator |
|
131 |
||
132 |
rowSelectorForm <Form> form used by a row selector |
|
133 |
||
134 |
checkToggleForm <Form> form used by a checkToggle |
|
135 |
checkToggleExtent <Point> extent of a checkToggle |
|
136 |
checkToggleLevel <SmallInteger> level used to draw a check toggle |
|
137 |
||
138 |
comboButtonForm <Form> form used by a comboList or -Box |
|
139 |
comboButtonExtent <Point> extent of a comboList or -Box |
|
140 |
comboButtonLevel <SmallInteger> level used to draw a comboList or -Box |
|
141 |
||
142 |
clickPosition <Point> click position of the mouse |
|
143 |
||
144 |
dragAccessPoint <Point> point where the drag operation starts |
|
145 |
dragIsActive <Boolean> true if a drag operation is active |
|
146 |
dropTarget <DropTarget> drag & drop target |
|
147 |
dropSource <DropSource> drag & drop source |
|
148 |
||
542 | 149 |
[author:] |
150 |
Claus Atzkern |
|
151 |
||
152 |
[see also:] |
|
153 |
DataSetColumnSpec |
|
154 |
DataSetColumn |
|
155 |
DataSetView |
|
156 |
" |
|
157 |
||
158 |
! ! |
|
159 |
||
647 | 160 |
!DSVColumnView class methodsFor:'accessing forms'! |
161 |
||
162 |
rowSelector |
|
989 | 163 |
"This resource specification was automatically generated |
164 |
by the ImageEditor of ST/X." |
|
165 |
||
166 |
"Do not manually edit this!! If it is corrupted, |
|
167 |
the ImageEditor may not be able to read the specification." |
|
168 |
||
169 |
" |
|
170 |
self rowSelector inspect |
|
171 |
ImageEditor openOnClass:self andSelector:#rowSelector |
|
172 |
" |
|
173 |
||
174 |
<resource: #image> |
|
175 |
||
176 |
^Icon |
|
177 |
constantNamed:#'DSVColumnView rowSelector' |
|
1129 | 178 |
ifAbsentPut:[(Depth2Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@A@@@AP@@A4@EW=@G?? O?:@@C(@@B @@B@@@@@@') ; colorMapFromArray:#[0 0 0 255 255 255 127 127 127 170 170 170]; mask:((Depth1Image new) width: 11; height: 11; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'C@@N@@<@?8C?0O? ?<C? @<@C @L@@@a') ; yourself); yourself] |
179 |
||
180 |
||
181 |
! ! |
|
647 | 182 |
|
183 |
!DSVColumnView class methodsFor:'defaults'! |
|
607 | 184 |
|
563 | 185 |
horizontalSpacing |
1087 | 186 |
"returns the default horizontal space between rows |
187 |
" |
|
563 | 188 |
^ 4 |
189 |
||
190 |
! |
|
191 |
||
542 | 192 |
updateStyleCache |
193 |
"extract values from the styleSheet and cache them in class variables |
|
194 |
" |
|
582 | 195 |
<resource: #style (#textForegroundColor #'scrollableView.backgroundColor' |
196 |
#'selection.hilightForegroundColor' |
|
197 |
#'selection.hilightBackgroundColor' )> |
|
542 | 198 |
|
1333 | 199 |
DefaultForegroundColor := StyleSheet colorAt:#'textForegroundColor' default:(Color black). |
200 |
DefaultBackgroundColor := StyleSheet colorAt:#'scrollableView.backgroundColor' default:DefaultViewBackgroundColor. |
|
201 |
||
202 |
DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor. |
|
203 |
DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor. |
|
607 | 204 |
|
647 | 205 |
DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[ |
988 | 206 |
DefaultHilightBackgroundColor := Color black |
647 | 207 |
]. |
1333 | 208 |
ButtonLightColor := StyleSheet colorAt:#'button.lightColor'. |
209 |
ButtonShadowColor := StyleSheet colorAt:#'button.shadowColor'. |
|
210 |
ButtonHalfLightColor := StyleSheet colorAt:#'button.halfLightColor'. |
|
211 |
ButtonHalfShadowColor := StyleSheet colorAt:#'button.halfShadowColor'. |
|
212 |
ButtonEdgeStyle := StyleSheet at:#'button.edgeStyle'. |
|
213 |
CheckToggleActiveImage := StyleSheet at:#'checkToggle.activeImage'. |
|
1100 | 214 |
|
215 |
CheckToggleActiveImage isNil ifTrue:[ |
|
216 |
CheckTogglePassiveImage := nil |
|
217 |
] ifFalse:[ |
|
1333 | 218 |
CheckTogglePassiveImage := StyleSheet at:#'checkToggle.passiveImage'. |
1100 | 219 |
|
220 |
CheckTogglePassiveImage isNil ifTrue:[ |
|
221 |
CheckToggleActiveImage := nil |
|
222 |
] |
|
223 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
224 |
ComboButtonForm := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
225 |
ComboButtonLevel := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
226 |
ComboButtonExtent := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
227 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
228 |
CheckToggleForm := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
229 |
CheckToggleLevel := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
230 |
CheckToggleExtent := nil. |
647 | 231 |
|
542 | 232 |
" |
233 |
self updateStyleCache. |
|
234 |
" |
|
235 |
||
582 | 236 |
"Modified: / 26.10.1997 / 17:09:07 / cg" |
563 | 237 |
! |
238 |
||
239 |
verticalSpacing |
|
1087 | 240 |
"returns the default vertical space between rows |
241 |
" |
|
563 | 242 |
^ 2 |
243 |
||
542 | 244 |
! ! |
245 |
||
809 | 246 |
!DSVColumnView class methodsFor:'resources'! |
247 |
||
248 |
dragIconMulti |
|
988 | 249 |
"This resource specification was automatically generated |
250 |
by the ImageEditor of ST/X." |
|
251 |
||
252 |
"Do not manually edit this!! If it is corrupted, |
|
253 |
the ImageEditor may not be able to read the specification." |
|
254 |
||
809 | 255 |
" |
988 | 256 |
self dragIconMulti inspect |
257 |
ImageEditor openOnClass:self andSelector:#dragIconMulti |
|
809 | 258 |
" |
259 |
||
260 |
<resource: #image> |
|
261 |
||
262 |
^Icon |
|
263 |
constantNamed:#'DSVColumnView dragIconMulti' |
|
988 | 264 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@<@@@@O@@@@C3??L@<??3@OO?<<C3??O@<??0@OO?<@C3???0<???<OO???C3???0<???<OO???@C???0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C????@????0O????C????0?????O????3?????????????????????????????????????????????????????@????0O???<C????@????0@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself]! |
809 | 265 |
|
266 |
dragIconSingle |
|
988 | 267 |
"This resource specification was automatically generated |
268 |
by the ImageEditor of ST/X." |
|
269 |
||
270 |
"Do not manually edit this!! If it is corrupted, |
|
271 |
the ImageEditor may not be able to read the specification." |
|
272 |
||
809 | 273 |
" |
988 | 274 |
self dragIconSingle inspect |
275 |
ImageEditor openOnClass:self andSelector:#dragIconSingle |
|
809 | 276 |
" |
277 |
||
278 |
<resource: #image> |
|
279 |
||
280 |
^Icon |
|
281 |
constantNamed:#'DSVColumnView dragIconSingle' |
|
988 | 282 |
ifAbsentPut:[(Depth1Image new) width: 32; height: 32; photometric:(#palette); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255]; mask:((ImageMask new) width: 32; height: 32; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') ; yourself); yourself]! ! |
809 | 283 |
|
886 | 284 |
!DSVColumnView methodsFor:'accessing'! |
285 |
||
1042 | 286 |
builder |
1087 | 287 |
"get the builder (UIBuilder or nil) |
288 |
" |
|
1042 | 289 |
^ builder |
290 |
! |
|
291 |
||
292 |
builder:aBuilder |
|
1087 | 293 |
"set the builder (UIBuilder or nil) |
294 |
" |
|
1042 | 295 |
builder := aBuilder |
296 |
! |
|
297 |
||
886 | 298 |
columnView |
1087 | 299 |
"returns self |
300 |
" |
|
886 | 301 |
^ self |
1067
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
302 |
! |
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
303 |
|
1487 | 304 |
labelView:aView |
305 |
labelView := aView for:self. |
|
306 |
||
1067
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
307 |
! |
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
308 |
|
1487 | 309 |
layout:aLayout |
310 |
"layout changed; change the layout of the labelView dependent on my layout |
|
311 |
" |
|
312 |
|newLyt lblLyt bOffset tOffset| |
|
313 |
||
314 |
(newLyt := aLayout ? layout) isNil ifTrue:[ |
|
315 |
^ self |
|
316 |
]. |
|
317 |
lblLyt := newLyt copy. |
|
318 |
||
319 |
labelView isVisible ifTrue:[ |
|
320 |
bOffset := labelView preferredHeight. |
|
321 |
tOffset := margin. |
|
322 |
newLyt topOffset:1 + bOffset. |
|
323 |
] ifFalse:[ |
|
324 |
bOffset := -1. |
|
325 |
tOffset := -2. |
|
326 |
newLyt topOffset:margin. |
|
327 |
]. |
|
328 |
lblLyt bottomFraction:0 offset:bOffset. |
|
329 |
lblLyt topFraction:0 offset:tOffset. |
|
330 |
labelView layout:lblLyt. |
|
331 |
super layout:newLyt. |
|
332 |
||
333 |
! |
|
334 |
||
335 |
level:aLevel |
|
336 |
"change the level and thus the level of the labelView |
|
337 |
" |
|
338 |
aLevel ~~ level ifTrue:[ |
|
339 |
super level:aLevel. |
|
340 |
labelView level:aLevel. |
|
341 |
] |
|
1087 | 342 |
! |
343 |
||
1661 | 344 |
modifiedChannel |
345 |
"return the value of the instance variable 'modifiedChannel' (automatically generated)" |
|
346 |
||
347 |
^ modifiedChannel |
|
348 |
||
349 |
"Created: / 30.1.2000 / 12:10:57 / cg" |
|
350 |
! |
|
351 |
||
352 |
modifiedChannel:something |
|
353 |
"set the value of the instance variable 'modifiedChannel' (automatically generated)" |
|
354 |
||
355 |
modifiedChannel := something. |
|
356 |
||
357 |
"Created: / 30.1.2000 / 12:10:57 / cg" |
|
358 |
! |
|
359 |
||
1087 | 360 |
rowFontAscent |
361 |
"returns the inset of a printable text in a row |
|
362 |
" |
|
363 |
^ rowFontAscent |
|
886 | 364 |
! ! |
365 |
||
809 | 366 |
!DSVColumnView methodsFor:'accessing actions'! |
542 | 367 |
|
368 |
action:aOneArgAction |
|
607 | 369 |
"set the action block to be performed on select |
370 |
" |
|
542 | 371 |
actionBlock := aOneArgAction |
372 |
||
373 |
||
374 |
! |
|
375 |
||
809 | 376 |
doubleClickAction:aOneArgAction |
377 |
"set the action block to be performed on doubleclick |
|
378 |
" |
|
379 |
doubleClickActionBlock := aOneArgAction |
|
380 |
||
381 |
||
382 |
! |
|
383 |
||
384 |
rowIfAbsent:aOneArgAction |
|
385 |
"set the action block to be performed on each 'nil' entry into the |
|
386 |
list. The argument to the block is the index into the list. The |
|
387 |
block returns the row which is put to the list |
|
388 |
" |
|
389 |
rowIfAbsentBlock := aOneArgAction |
|
390 |
||
391 |
||
1416 | 392 |
! |
393 |
||
394 |
tabAtEndAction:aNoneArgAction |
|
395 |
"set the action, called without any argument at end of the list entering |
|
396 |
tab next. |
|
397 |
The default is to give the focus to the view after self in the focusSequence |
|
398 |
" |
|
399 |
tabAtEndAction := aNoneArgAction |
|
400 |
||
401 |
||
402 |
! |
|
403 |
||
404 |
tabAtStartAction:aNoneArgAction |
|
405 |
"set the action, called without any argument at start of the list entering |
|
406 |
tab previous. |
|
407 |
The default is to give the focus to the view before self in the focusSequence |
|
408 |
" |
|
409 |
tabAtStartAction := aNoneArgAction |
|
410 |
||
411 |
||
809 | 412 |
! ! |
413 |
||
414 |
!DSVColumnView methodsFor:'accessing behavior'! |
|
415 |
||
542 | 416 |
beDependentOfRows |
417 |
"make myself dependent of any row; in this case any change notification |
|
418 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
419 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
420 |
-> row changed:'what' |
|
421 |
On default the attribute is set to true (enabled). |
|
422 |
" |
|
423 |
^ beDependentOfRows |
|
424 |
! |
|
425 |
||
426 |
beDependentOfRows:aBool |
|
427 |
"make myself dependent of any row; in this case any change notification |
|
428 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
429 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
430 |
-> row changed:'what' |
|
431 |
On default the attribute is set to true (enabled). |
|
432 |
" |
|
433 |
aBool ~~ beDependentOfRows ifTrue:[ |
|
618 | 434 |
beDependentOfRows := aBool. |
435 |
||
1497 | 436 |
list size ~~ 0 ifTrue:[ |
618 | 437 |
list do:[:aRow| aRow notNil ifTrue:[ |
438 |
beDependentOfRows ifTrue:[aRow addDependent:self] |
|
439 |
ifFalse:[aRow removeDependent:self] |
|
440 |
] |
|
441 |
] |
|
542 | 442 |
] |
618 | 443 |
] |
607 | 444 |
! |
445 |
||
446 |
multipleSelectOk |
|
447 |
"allow/disallow multiple row selections; the default is false |
|
448 |
" |
|
449 |
^ multipleSelectOk |
|
450 |
! |
|
451 |
||
452 |
multipleSelectOk:aState |
|
453 |
"allow/disallow multiple row selections; the default is false |
|
454 |
" |
|
455 |
aState == multipleSelectOk ifFalse:[ |
|
456 |
multipleSelectOk := aState. |
|
457 |
self deselect |
|
458 |
] |
|
1112 | 459 |
! |
460 |
||
461 |
selectRowOnDefault |
|
462 |
"in case of selecting a none selectable cell, the row is selected |
|
463 |
" |
|
464 |
^ selectRowOnDefault |
|
465 |
! |
|
466 |
||
467 |
selectRowOnDefault:aBool |
|
468 |
"in case of selecting a none selectable cell, the row is selected |
|
469 |
" |
|
470 |
selectRowOnDefault := aBool |
|
1487 | 471 |
! |
472 |
||
1668 | 473 |
tabIntern |
474 |
"returns true if tabing is supported in the widget |
|
475 |
" |
|
476 |
^ tabIntern |
|
477 |
! |
|
478 |
||
479 |
tabIntern:aBool |
|
480 |
"returns true if tabing is supported in the widget |
|
481 |
" |
|
482 |
tabIntern := aBool ? true |
|
483 |
! |
|
484 |
||
1487 | 485 |
useIndex |
486 |
"specify, if the selected components value or its index in the |
|
487 |
list should be sent to the model. The default is its index. |
|
488 |
" |
|
489 |
^ useIndex |
|
490 |
||
491 |
||
492 |
! |
|
493 |
||
494 |
useIndex:aBool |
|
495 |
"specify, if the selected components value or its index in the |
|
496 |
list should be sent to the model. The default is its index. |
|
497 |
" |
|
498 |
useIndex := aBool |
|
499 |
||
542 | 500 |
! ! |
501 |
||
824 | 502 |
!DSVColumnView methodsFor:'accessing colors'! |
503 |
||
504 |
backgroundColor |
|
505 |
"get the background color of the rows |
|
506 |
" |
|
507 |
^ bgColor |
|
508 |
||
509 |
||
510 |
! |
|
511 |
||
512 |
backgroundColor:aColor |
|
513 |
"set the background color of the rows |
|
514 |
" |
|
515 |
bgColor ~~ aColor ifTrue:[ |
|
516 |
super viewBackground:bgColor. |
|
517 |
||
518 |
self realized ifTrue:[ |
|
1480 | 519 |
bgColor := aColor onDevice:device. |
824 | 520 |
self invalidate |
521 |
] ifFalse:[ |
|
522 |
bgColor := aColor |
|
523 |
] |
|
524 |
] |
|
525 |
! |
|
526 |
||
527 |
foregroundColor |
|
528 |
"return the foreground color of the rows |
|
529 |
" |
|
530 |
^ fgColor |
|
531 |
||
532 |
! |
|
533 |
||
534 |
foregroundColor:aColor |
|
535 |
"set the foreground color of the rows |
|
536 |
" |
|
537 |
fgColor ~~ aColor ifTrue:[ |
|
538 |
self realized ifTrue:[ |
|
1480 | 539 |
fgColor := aColor onDevice:device. |
824 | 540 |
self invalidate |
541 |
] ifFalse:[ |
|
542 |
fgColor := aColor |
|
543 |
] |
|
544 |
] |
|
545 |
||
546 |
! |
|
547 |
||
548 |
hgLgBgColor |
|
549 |
"returns the background color of a selected row |
|
550 |
" |
|
551 |
^ hgLgBgColor |
|
552 |
! |
|
553 |
||
554 |
hgLgFgColor |
|
555 |
"returns the foreground color of a selected row |
|
556 |
" |
|
557 |
^ hgLgFgColor |
|
558 |
! |
|
559 |
||
560 |
separatorDarkColor |
|
561 |
"returns the dark color used for drawing a shadowed separator (3D) |
|
562 |
" |
|
563 |
^ shadowColor |
|
564 |
||
565 |
||
566 |
! |
|
567 |
||
568 |
separatorLightColor |
|
569 |
"returns the light color used for drawing a shadowed separator (3D) |
|
570 |
" |
|
571 |
^ lightColor |
|
572 |
||
573 |
||
574 |
! ! |
|
575 |
||
542 | 576 |
!DSVColumnView methodsFor:'accessing columns'! |
577 |
||
578 |
columnAt:anIndex |
|
607 | 579 |
"returns the column at an index |
542 | 580 |
" |
1112 | 581 |
^ columnDescriptors at:anIndex ifAbsent:nil |
542 | 582 |
! |
583 |
||
886 | 584 |
columnDescriptors |
585 |
"returns list of column descriptors |
|
586 |
" |
|
587 |
^ columnDescriptors collect:[:aCol| aCol description ] |
|
588 |
! |
|
589 |
||
590 |
columnDescriptors:aColumnDescriptionList |
|
542 | 591 |
"set the columnDescriptors |
592 |
" |
|
1487 | 593 |
|cid delta| |
612 | 594 |
|
886 | 595 |
self deselect. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
596 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
597 |
(viewOrigin x ~~ 0 or:[viewOrigin y ~~ 0]) ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
598 |
delta := viewOrigin negated. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
599 |
viewOrigin := 0@0. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
600 |
super originChanged:delta |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
601 |
]. |
1487 | 602 |
cid := 0. |
603 |
columnDescriptors := aColumnDescriptionList ? #(). |
|
604 |
||
605 |
columnDescriptors := columnDescriptors collect:[:el||dsc lbl| |
|
606 |
dsc := el isSequenceable ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:el] |
|
607 |
ifFalse:[el]. |
|
608 |
cid := cid + 1. |
|
609 |
lbl := DataSetLabel new description:dsc builder:builder on:labelView. |
|
610 |
DataSetColumn new on:self description:dsc columnNumber:cid label:lbl |
|
542 | 611 |
]. |
1487 | 612 |
|
613 |
preferredExtent := nil. |
|
614 |
labelView columns:columnDescriptors. |
|
542 | 615 |
|
612 | 616 |
shown ifTrue:[ |
1487 | 617 |
self fitColumns. |
563 | 618 |
]. |
542 | 619 |
|
620 |
||
621 |
! |
|
622 |
||
623 |
firstColumn |
|
607 | 624 |
"returns the first column |
542 | 625 |
" |
626 |
^ columnDescriptors at:1 |
|
627 |
||
628 |
! |
|
629 |
||
630 |
lastColumn |
|
607 | 631 |
"returns the last column |
542 | 632 |
" |
633 |
^ columnDescriptors last |
|
634 |
||
635 |
! ! |
|
636 |
||
809 | 637 |
!DSVColumnView methodsFor:'accessing interactors'! |
638 |
||
1100 | 639 |
checkToggleActiveImage |
640 |
^ checkToggleActiveImage |
|
641 |
! |
|
642 |
||
809 | 643 |
checkToggleExtent |
1087 | 644 |
"returns the extent of a checkToggle |
645 |
" |
|
809 | 646 |
^ checkToggleExtent |
647 |
! |
|
648 |
||
649 |
checkToggleForm |
|
1087 | 650 |
"returns the form of a checkToggle |
651 |
" |
|
809 | 652 |
^ checkToggleForm |
653 |
! |
|
654 |
||
655 |
checkToggleLevel |
|
1087 | 656 |
"returns the level of a checkToggle button |
657 |
" |
|
809 | 658 |
^ checkToggleLevel |
659 |
! |
|
660 |
||
1100 | 661 |
checkTogglePassiveImage |
662 |
^ checkTogglePassiveImage |
|
663 |
! |
|
664 |
||
809 | 665 |
comboButtonExtent |
1087 | 666 |
"returns the extent of a comboList or -Box |
667 |
" |
|
809 | 668 |
^ comboButtonExtent |
669 |
! |
|
670 |
||
671 |
comboButtonForm |
|
1087 | 672 |
"returns the form of a comboList or -Box |
673 |
" |
|
809 | 674 |
^ comboButtonForm |
675 |
! |
|
676 |
||
677 |
comboButtonLevel |
|
1087 | 678 |
"returns the level of a comboList or -Box button |
679 |
" |
|
809 | 680 |
^ comboButtonLevel |
681 |
! |
|
682 |
||
683 |
rowSelectorExtent |
|
684 |
"returns the bitmap of a selected row |
|
685 |
" |
|
686 |
^ rowSelectorForm extent |
|
687 |
! |
|
688 |
||
689 |
rowSelectorForm |
|
690 |
"returns the bitmap of a selected row |
|
691 |
" |
|
692 |
^ rowSelectorForm |
|
693 |
! ! |
|
694 |
||
612 | 695 |
!DSVColumnView methodsFor:'accessing mvc'! |
696 |
||
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
697 |
columnAdaptor |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
698 |
"return the value of the instance variable 'columnAdaptor' (automatically generated)" |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
699 |
|
1711 | 700 |
columnAdaptor isValueModel ifTrue:[^ columnAdaptor value]. |
701 |
^ columnAdaptor |
|
702 |
! |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
703 |
|
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
704 |
columnAdaptor:something |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
705 |
"set the value of the instance variable 'columnAdaptor' (automatically generated)" |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
706 |
|
1711 | 707 |
columnAdaptor isValueModel ifTrue:[ |
708 |
columnAdaptor removeDependent:self |
|
709 |
]. |
|
710 |
(columnAdaptor := something) isValueModel ifTrue:[ |
|
711 |
columnAdaptor addDependent:self |
|
712 |
]. |
|
713 |
! |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
714 |
|
612 | 715 |
columnHolder |
1087 | 716 |
"get the valueHolder, which keeps the list of column descriptions |
717 |
" |
|
612 | 718 |
^ columnHolder |
719 |
||
720 |
! |
|
721 |
||
722 |
columnHolder:aValueHolder |
|
1087 | 723 |
"set the valueHolder, which keeps the list of column descriptions |
724 |
" |
|
612 | 725 |
|columns| |
726 |
||
727 |
columnHolder notNil ifTrue:[ |
|
728 |
columnHolder removeDependent:self |
|
729 |
]. |
|
730 |
||
731 |
(columnHolder := aValueHolder) notNil ifTrue:[ |
|
732 |
columnHolder addDependent:self. |
|
733 |
columns := columnHolder value. |
|
734 |
||
735 |
columns notNil ifTrue:[ |
|
736 |
self columnDescriptors:columns |
|
737 |
] |
|
738 |
]. |
|
739 |
||
1487 | 740 |
! |
741 |
||
742 |
listAt:index put:newElement |
|
743 |
"kludge callback, when an element hs to be replaced |
|
744 |
due to a col-adaptor returning a new row element |
|
745 |
" |
|
746 |
|list| |
|
747 |
||
748 |
(list := listHolder value) notNil ifTrue:[ |
|
749 |
list at:index put:newElement |
|
750 |
] |
|
751 |
! |
|
752 |
||
753 |
listHolder:aListHolder |
|
754 |
"set the valueHolder which holds the list of rows |
|
755 |
" |
|
756 |
listHolder ~~ aListHolder ifTrue:[ |
|
757 |
listHolder notNil ifTrue:[ |
|
758 |
listHolder removeDependent:self |
|
759 |
]. |
|
760 |
||
761 |
(listHolder := aListHolder) notNil ifTrue:[ |
|
762 |
listHolder addDependent:self |
|
763 |
] |
|
764 |
]. |
|
765 |
self pushEvent:#list: with:(listHolder value). |
|
766 |
||
767 |
! |
|
768 |
||
1721
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
769 |
menuPerformer |
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
770 |
"redefined to avoid sending the menuMessage to my valueHolder" |
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
771 |
|
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
772 |
menuPerformer notNil ifTrue:[^ menuPerformer]. |
1722 | 773 |
useIndex ifTrue:[ |
774 |
^ self |
|
775 |
]. |
|
776 |
^ model ? self |
|
1721
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
777 |
|
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
778 |
|
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
779 |
! |
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
780 |
|
1487 | 781 |
model:aModel |
782 |
"set the valueHolder which holds the selection and maybe the list of rows |
|
783 |
" |
|
784 |
model notNil ifTrue:[ |
|
785 |
model removeDependent:self. |
|
786 |
(model respondsTo:#list) ifTrue:[ |
|
787 |
(model list == listHolder) ifTrue:[ |
|
788 |
self listHolder:nil |
|
789 |
] |
|
790 |
] |
|
791 |
]. |
|
792 |
||
793 |
(model := aModel) notNil ifTrue:[ |
|
794 |
model addDependent:self. |
|
795 |
||
796 |
(aModel respondsTo:#list) ifTrue:[ |
|
797 |
self listHolder:model list |
|
798 |
] |
|
799 |
] |
|
800 |
||
612 | 801 |
! ! |
802 |
||
542 | 803 |
!DSVColumnView methodsFor:'accessing rows'! |
804 |
||
805 |
at:aRowNr |
|
806 |
"return the row at an index, aRowNr |
|
807 |
" |
|
618 | 808 |
|row| |
809 |
||
810 |
(row := list at:aRowNr) isNil ifTrue:[ |
|
811 |
lockRowIndex := aRowNr. |
|
812 |
||
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
813 |
(rowIfAbsentBlock notNil |
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
814 |
and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[ |
618 | 815 |
list at:aRowNr put:row. |
816 |
beDependentOfRows ifTrue:[row addDependent:self]. |
|
817 |
]. |
|
818 |
||
819 |
lockRowIndex := 0 |
|
820 |
]. |
|
821 |
^ row |
|
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
822 |
|
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
823 |
"Modified: / 31.7.1998 / 01:07:46 / cg" |
542 | 824 |
! |
825 |
||
826 |
at:aRowNr ifAbsent:exceptionBlock |
|
607 | 827 |
"return the row at a aRowNr. If the index is invalid, return the |
542 | 828 |
result of evaluating the exceptionblock |
829 |
" |
|
1497 | 830 |
(aRowNr between:1 and:list size) ifTrue:[ |
618 | 831 |
^ self at:aRowNr |
832 |
]. |
|
833 |
^ exceptionBlock value |
|
542 | 834 |
! |
835 |
||
836 |
at:aRowNr put:aRow |
|
837 |
"change the row at an index. The added row is returned |
|
838 |
" |
|
618 | 839 |
|row| |
840 |
||
841 |
lockRowIndex == aRowNr ifTrue:[ |
|
842 |
^ self |
|
843 |
]. |
|
844 |
row := list at:aRowNr. |
|
845 |
row == aRow ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
846 |
^ self invalidateRowAt:aRowNr |
618 | 847 |
]. |
848 |
||
542 | 849 |
beDependentOfRows ifTrue:[ |
618 | 850 |
(row := list at:aRowNr) notNil ifTrue:[ |
851 |
row removeDependent:self |
|
852 |
] |
|
542 | 853 |
]. |
618 | 854 |
|
607 | 855 |
list at:aRowNr put:aRow. |
618 | 856 |
|
857 |
aRow notNil ifTrue:[ "/ free list |
|
858 |
beDependentOfRows ifTrue:[ |
|
859 |
aRow addDependent:self |
|
860 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
861 |
self invalidateRowAt:aRowNr |
618 | 862 |
]. |
542 | 863 |
^ aRow. |
864 |
! |
|
865 |
||
866 |
first |
|
867 |
"return the first row |
|
868 |
" |
|
618 | 869 |
^ self at:1 |
870 |
! |
|
871 |
||
872 |
identityIndexOfRow:aRow |
|
873 |
"returns index of a row or 0 |
|
874 |
" |
|
875 |
(list size ~~ 0 and:[aRow notNil]) ifTrue:[ |
|
876 |
^ list identityIndexOf:aRow |
|
877 |
]. |
|
878 |
^ 0 |
|
542 | 879 |
! |
880 |
||
881 |
last |
|
882 |
"return the last row |
|
883 |
" |
|
1497 | 884 |
^ self at:(list size) |
542 | 885 |
! |
886 |
||
887 |
list |
|
888 |
"get the list of rows |
|
889 |
" |
|
890 |
^ list |
|
891 |
||
892 |
||
893 |
||
894 |
! |
|
895 |
||
896 |
list:aList |
|
897 |
"set the list of rows |
|
898 |
" |
|
1259 | 899 |
|makeDependent selectionHasChanged| |
656 | 900 |
|
618 | 901 |
"/ remove selection without redraw |
622 | 902 |
|
1259 | 903 |
selectionHasChanged := self hasSelection. |
904 |
||
622 | 905 |
editValue notNil ifTrue:[ |
906 |
editValue removeDependent:self. |
|
907 |
editValue := nil |
|
908 |
]. |
|
1111 | 909 |
self destroyEditView. |
622 | 910 |
|
618 | 911 |
selectedColIndex := 0. |
912 |
selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0]. |
|
542 | 913 |
|
612 | 914 |
shown ifFalse:[ |
915 |
preferredExtent := nil |
|
916 |
] ifTrue:[ |
|
917 |
aList size ~~ 0 ifTrue:[ "/ otherwise keep old values |
|
1497 | 918 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
612 | 919 |
preferredExtent := nil. |
618 | 920 |
] |
542 | 921 |
]. |
922 |
||
656 | 923 |
(makeDependent := beDependentOfRows) ifTrue:[ |
924 |
self beDependentOfRows:false. |
|
925 |
]. |
|
643 | 926 |
|
927 |
aList size ~~ 0 ifTrue:[ |
|
928 |
list := OrderedCollection new:(aList size). |
|
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
929 |
aList do:[:el| list add:el ]. |
542 | 930 |
] ifFalse:[ |
643 | 931 |
list := nil |
542 | 932 |
]. |
656 | 933 |
self beDependentOfRows:makeDependent. |
542 | 934 |
|
612 | 935 |
shown ifTrue:[ |
1484 | 936 |
self fitColumns |
637 | 937 |
]. |
1259 | 938 |
selectionHasChanged ifTrue:[ |
939 |
self selectionChanged. |
|
940 |
]. |
|
542 | 941 |
|
942 |
||
943 |
! ! |
|
944 |
||
945 |
!DSVColumnView methodsFor:'accessing visibility'! |
|
946 |
||
947 |
font:aFont |
|
948 |
"set the font for all shown rows. |
|
949 |
" |
|
950 |
(aFont notNil and:[aFont ~~ font]) ifTrue:[ |
|
1480 | 951 |
super font:(aFont onDevice:device). |
542 | 952 |
realized ifTrue:[ |
1497 | 953 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
954 |
self preferredExtentChanged. |
542 | 955 |
self invalidate. |
956 |
self contentsChanged |
|
643 | 957 |
] |
542 | 958 |
] |
959 |
||
960 |
! |
|
961 |
||
607 | 962 |
has3Dseparators |
963 |
"returns true if shown in 3D mode |
|
964 |
" |
|
965 |
^ separatorSize ~~ 1 |
|
542 | 966 |
! |
967 |
||
607 | 968 |
has3Dseparators:aBool |
969 |
"enable or disable 3D mode |
|
970 |
" |
|
971 |
|newSepSize| |
|
542 | 972 |
|
637 | 973 |
newSepSize := aBool ifTrue:[2] ifFalse:[1]. |
607 | 974 |
|
975 |
newSepSize ~~ separatorSize ifTrue:[ |
|
976 |
separatorSize := newSepSize. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
977 |
|
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
978 |
realized ifTrue:[ |
1497 | 979 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
1136 | 980 |
self preferredExtentChanged. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
981 |
self invalidate. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
982 |
self contentsChanged |
647 | 983 |
] |
542 | 984 |
] |
985 |
||
986 |
||
987 |
! |
|
988 |
||
989 |
horizontalSpacing |
|
990 |
"horizontal spacing used by columns |
|
991 |
" |
|
563 | 992 |
^ horizontalSpacing |
993 |
! |
|
994 |
||
995 |
horizontalSpacing:aNumber |
|
996 |
"horizontal spacing used by columns |
|
997 |
" |
|
998 |
horizontalSpacing ~~ aNumber ifTrue:[ |
|
999 |
horizontalSpacing := aNumber. |
|
1000 |
self preferredExtentChanged. |
|
1001 |
]. |
|
542 | 1002 |
! |
1003 |
||
1487 | 1004 |
showLabels |
1005 |
"control the labels view to be visible or unvisible |
|
1006 |
" |
|
1007 |
^ labelView isVisible |
|
1008 |
||
1009 |
! |
|
1010 |
||
1011 |
showLabels:aState |
|
1012 |
"control the labels view to be visible or unvisible |
|
1013 |
" |
|
1014 |
labelView isVisible:aState |
|
1015 |
! |
|
1016 |
||
542 | 1017 |
verticalSpacing |
1018 |
"vertical spacing used by columns |
|
1019 |
" |
|
563 | 1020 |
^ verticalSpacing |
1021 |
! |
|
1022 |
||
1023 |
verticalSpacing:aNumber |
|
1024 |
"vertical spacing used by columns |
|
1025 |
" |
|
1026 |
verticalSpacing ~~ aNumber ifTrue:[ |
|
1027 |
verticalSpacing := aNumber. |
|
1028 |
self preferredExtentChanged. |
|
1029 |
]. |
|
542 | 1030 |
! ! |
1031 |
||
1032 |
!DSVColumnView methodsFor:'adding & removing rows'! |
|
1033 |
||
1034 |
add:aRow |
|
618 | 1035 |
"insert row at end |
542 | 1036 |
" |
1497 | 1037 |
^ self add:aRow beforeIndex:(1 + list size) |
542 | 1038 |
! |
1039 |
||
1040 |
add:aRow afterIndex:aRowNr |
|
1041 |
"add a new row after slot aRowNr and redisplay; returns nil in case |
|
618 | 1042 |
of an invalid index or the row |
542 | 1043 |
" |
1044 |
^ self add:aRow beforeIndex:(aRowNr + 1) |
|
1045 |
! |
|
1046 |
||
1047 |
add:aRow beforeIndex:aRowNr |
|
1048 |
"add a new row before slot aRowNr and redisplay; returns nil in case |
|
618 | 1049 |
of an invalid index or the row |
542 | 1050 |
" |
861 | 1051 |
self addAll:(Array with:aRow) beforeIndex:aRowNr. |
1052 |
^ aRow. |
|
1053 |
! |
|
1054 |
||
1055 |
addAll:aList beforeIndex:start |
|
1056 |
"add a collection of rows before slot start and redisplay |
|
1057 |
" |
|
1058 |
|y0 y1 yD h dH size noSel| |
|
1059 |
||
1060 |
(size := aList size) == 0 ifTrue:[ |
|
1061 |
^ self |
|
1062 |
]. |
|
1063 |
||
1497 | 1064 |
list size == 0 ifTrue:[ |
861 | 1065 |
^ self list:aList |
618 | 1066 |
]. |
643 | 1067 |
|
618 | 1068 |
beDependentOfRows ifTrue:[ |
861 | 1069 |
aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]] |
542 | 1070 |
]. |
637 | 1071 |
|
861 | 1072 |
noSel := self numberOfSelections. |
1073 |
||
1074 |
noSel ~~ 0 ifTrue:[ |
|
1075 |
multipleSelectOk ifFalse:[ |
|
1076 |
selectedRowIndex >= start ifTrue:[ |
|
1077 |
selectedRowIndex := selectedRowIndex + size |
|
1078 |
] |
|
1079 |
] ifTrue:[ |
|
1080 |
1 to:noSel do:[:i||v| |
|
1081 |
(v := selectedRowIndex at:i) >= start ifTrue:[ |
|
1082 |
selectedRowIndex at:i put:(v + size) |
|
607 | 1083 |
] |
1084 |
] |
|
1085 |
] |
|
542 | 1086 |
]. |
861 | 1087 |
list addAll:aList beforeIndex:start. |
1088 |
self recomputeHeightOfContents. |
|
1089 |
||
1090 |
y0 := (start - 1) * rowHeight. |
|
1091 |
yD := size * rowHeight. |
|
1092 |
y1 := y0 + yD. |
|
542 | 1093 |
|
1094 |
y0 < viewOrigin y ifTrue:[ |
|
1095 |
self originWillChange. |
|
861 | 1096 |
viewOrigin y:(yD + viewOrigin y). |
1097 |
self originChanged:(0 @ yD). |
|
1098 |
]. |
|
1099 |
||
1100 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
|
1483 | 1101 |
self invalidate. |
861 | 1102 |
^ self contentsChanged. |
542 | 1103 |
]. |
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
1104 |
|
861 | 1105 |
y0 := self yVisibleOfRowNr:start. |
1258 | 1106 |
h := height - margin. |
1107 |
y1 := y0 + yD min:h. |
|
1108 |
||
1109 |
(y1 > margin and:[y0 < h]) ifTrue:[ |
|
861 | 1110 |
h := h - y1. |
1111 |
y0 := y0 max:margin. |
|
1112 |
dH := y1 - y0. |
|
1113 |
||
1114 |
start == list size ifFalse:[ |
|
1487 | 1115 |
self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:h async:false |
861 | 1116 |
]. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1117 |
self invalidateX:margin y:y0 width:width - margin - margin height:dH. |
542 | 1118 |
]. |
1119 |
self contentsChanged. |
|
861 | 1120 |
|
567 | 1121 |
! |
1122 |
||
542 | 1123 |
addFirst:aRow |
618 | 1124 |
"insert a row at start |
542 | 1125 |
" |
1126 |
^ self add:aRow beforeIndex:1 |
|
1127 |
! |
|
1128 |
||
1487 | 1129 |
remove:aRow |
1130 |
"remove a row |
|
1131 |
" |
|
1132 |
|idx| |
|
1133 |
||
1134 |
idx := list identityIndexOf:aRow. |
|
1135 |
||
1136 |
idx ~~ 0 ifTrue:[ |
|
1137 |
self removeFrom:idx to:idx. |
|
1138 |
]. |
|
1139 |
^ aRow |
|
1140 |
! |
|
1141 |
||
542 | 1142 |
removeFirst |
1143 |
"remove first row; returns the removed row |
|
1144 |
" |
|
1112 | 1145 |
^ self removeIndex:1 |
542 | 1146 |
! |
1147 |
||
861 | 1148 |
removeFrom:startIndex to:stopIndex |
1149 |
"remove rows from start to stop |
|
542 | 1150 |
" |
861 | 1151 |
|coll noRedraw |
1152 |
noSel "{ Class: SmallInteger }" |
|
1153 |
size "{ Class: SmallInteger }" |
|
1154 |
start "{ Class: SmallInteger }" |
|
1155 |
stop "{ Class: SmallInteger }" |
|
1156 |
y0 "{ Class: SmallInteger }" |
|
1157 |
y1 "{ Class: SmallInteger }" |
|
1158 |
oY "{ Class: SmallInteger }" |
|
1159 |
dY "{ Class: SmallInteger }" |
|
1160 |
yB "{ Class: SmallInteger }" |
|
1161 |
h "{ Class: SmallInteger }" |
|
1162 |
| |
|
1163 |
||
1164 |
( (start := startIndex) < 1 |
|
1165 |
or:[(stop := stopIndex) > list size] |
|
1166 |
) ifTrue:[ |
|
1167 |
^ self subscriptBoundsError:start |
|
618 | 1168 |
]. |
861 | 1169 |
size := stop - start + 1. |
1170 |
||
1171 |
beDependentOfRows ifTrue:[ |
|
1172 |
list from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]]. |
|
1173 |
]. |
|
1174 |
noSel := self numberOfSelections. |
|
1175 |
||
1176 |
noSel ~~ 0 ifTrue:[ |
|
1177 |
noSel == 1 ifTrue:[ |
|
1178 |
noSel := self firstIndexSelected. |
|
1179 |
||
1180 |
noSel < start ifFalse:[ |
|
1181 |
noSel > stop ifTrue:[ |
|
1182 |
noSel := noSel - size. |
|
1183 |
||
1184 |
multipleSelectOk ifFalse:[selectedRowIndex := noSel] |
|
1185 |
ifTrue:[selectedRowIndex at:1 put:noSel] |
|
1186 |
] ifFalse:[ |
|
637 | 1187 |
editValue notNil ifTrue:[ |
1188 |
editValue removeDependent:self. |
|
1189 |
editValue := nil. |
|
1190 |
]. |
|
861 | 1191 |
self deselect. |
637 | 1192 |
] |
607 | 1193 |
] |
1194 |
] ifFalse:[ |
|
861 | 1195 |
coll := OrderedCollection new:noSel. |
1196 |
||
1197 |
selectedRowIndex do:[:i| |
|
1198 |
i < start ifTrue:[ |
|
1199 |
coll add:i |
|
1200 |
] ifFalse:[ |
|
1201 |
i > stop ifTrue:[ |
|
1202 |
coll add:(i - size) |
|
1203 |
] |
|
1204 |
] |
|
1205 |
]. |
|
1206 |
coll size == 0 ifTrue:[ |
|
1207 |
self deselect |
|
1208 |
] ifFalse:[ |
|
1209 |
selectedRowIndex := coll |
|
1210 |
] |
|
542 | 1211 |
] |
1212 |
]. |
|
861 | 1213 |
list removeFrom:start to:stop. |
1214 |
||
1215 |
y0 := start - 1 * rowHeight. |
|
1216 |
dY := size * rowHeight. |
|
1217 |
y1 := dY + y0. |
|
542 | 1218 |
yB := y1 + margin - viewOrigin y. |
1219 |
self recomputeHeightOfContents. |
|
1220 |
||
1221 |
y0 < (oY := viewOrigin y) ifTrue:[ |
|
1222 |
(noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY] |
|
861 | 1223 |
ifTrue:[dY := dY negated]. |
542 | 1224 |
self originWillChange. |
1225 |
viewOrigin y:(dY + oY). |
|
1226 |
self originChanged:(0 @ dY). |
|
1227 |
] ifFalse:[ |
|
1228 |
noRedraw := y0 > (height + viewOrigin y) |
|
1229 |
]. |
|
1230 |
||
1483 | 1231 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
1232 |
self invalidate. |
|
1233 |
^ self contentsChanged. |
|
1234 |
]. |
|
1235 |
||
542 | 1236 |
(noRedraw or:[shown not]) ifFalse:[ |
1237 |
y1 := yB. |
|
861 | 1238 |
y0 := self yVisibleOfRowNr:start. |
542 | 1239 |
h := height - margin - yB. |
1240 |
y0 := y0 max:margin. |
|
1241 |
||
561 | 1242 |
h > 0 ifTrue:[ |
1487 | 1243 |
self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:false |
561 | 1244 |
]. |
542 | 1245 |
y0 := y0 + h. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1246 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
542 | 1247 |
]. |
1248 |
self contentsChanged. |
|
861 | 1249 |
|
1250 |
! |
|
1251 |
||
1252 |
removeIndex:aRowNr |
|
1253 |
"remove row at an index; returns the removed row |
|
1254 |
" |
|
1255 |
|row| |
|
1256 |
||
1257 |
row := list at:aRowNr ifAbsent:nil. |
|
1258 |
self removeFrom:aRowNr to:aRowNr. |
|
1259 |
^ row |
|
542 | 1260 |
! |
1261 |
||
1262 |
removeLast |
|
1263 |
"remove last row; the row is returned |
|
1264 |
" |
|
1497 | 1265 |
^ self removeIndex:(list size) |
542 | 1266 |
! ! |
1267 |
||
1268 |
!DSVColumnView methodsFor:'change & update'! |
|
1269 |
||
1492 | 1270 |
changeWidthOfColumn:aColumn deltaX:aDeltaX |
1271 |
||
1272 |
aColumn setDescWidth:(aColumn width + aDeltaX). |
|
1273 |
preferredExtent notNil ifTrue:[self fitColumns] |
|
1274 |
! |
|
1275 |
||
1487 | 1276 |
sizeChanged:how |
1277 |
"size changed - move origin up if possible |
|
1278 |
change the layout of the labelView dependent on my layout |
|
1279 |
" |
|
1280 |
|lyt| |
|
1281 |
||
1282 |
super sizeChanged:how. |
|
1283 |
||
1284 |
shown ifTrue:[ |
|
1285 |
labelView isVisible ifTrue:[ |
|
1286 |
lyt := labelView layout. |
|
1287 |
lyt leftOffset:(layout leftOffset). |
|
1288 |
lyt rightOffset:(layout rightOffset). |
|
1289 |
labelView layout:lyt. |
|
1290 |
]. |
|
1291 |
self fitColumns. |
|
1292 |
] |
|
859 | 1293 |
! |
1294 |
||
1487 | 1295 |
update:what with:aPara from:chgObj |
542 | 1296 |
"one of my rows/cells changed its value |
1297 |
" |
|
1673
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1298 |
|row newValue realValue list arg1 arg2 col idx| |
1487 | 1299 |
|
1300 |
chgObj == columnHolder ifTrue:[ |
|
612 | 1301 |
^ self columnDescriptors:(columnHolder value) |
622 | 1302 |
]. |
1711 | 1303 |
|
1304 |
chgObj == columnAdaptor ifTrue:[ |
|
1305 |
col := columnAdaptor value. |
|
1306 |
columnDescriptors do:[:aCol| aCol columnAdaptor:col]. |
|
1307 |
^ self invalidate |
|
1308 |
]. |
|
1309 |
||
1487 | 1310 |
chgObj == editValue ifTrue:[ |
1227 | 1311 |
newValue := editValue value. |
1673
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1312 |
col := self selectedColumn. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1313 |
idx := self firstIndexSelected. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1314 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1315 |
col at:idx put:newValue. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1316 |
realValue := col at:idx. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1317 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1318 |
"/ !!!! editValue could be changed before set !!!! therefore: chgObj == editValue |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1319 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1320 |
(chgObj == editValue and:[realValue ~= newValue]) ifTrue:[ |
1227 | 1321 |
"/ some validation by the row-object; the stored value |
1322 |
"/ is different from what I think. |
|
1323 |
"/ update my input fields modelValue |
|
1324 |
editValue value:realValue. |
|
1325 |
]. |
|
1673
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1326 |
|
1661 | 1327 |
modifiedChannel notNil ifTrue:[ |
1328 |
modifiedChannel value:true. |
|
1329 |
]. |
|
1227 | 1330 |
^ self |
622 | 1331 |
]. |
1332 |
||
1487 | 1333 |
chgObj == model ifTrue:[ |
1334 |
(what == #selectionIndex or:[what == #selection]) ifTrue:[ |
|
1335 |
^ self selectRowIndex:(model selectionIndex copy) |
|
1336 |
]. |
|
1337 |
what == #list ifTrue:[ |
|
1338 |
^ self listHolder:model list |
|
1339 |
]. |
|
1340 |
what == #value ifTrue:[ |
|
1341 |
model == listHolder ifTrue:[ |
|
1342 |
self list:(listHolder value) |
|
1343 |
] ifFalse:[ |
|
1344 |
self selectRowIndex:model value |
|
1345 |
] |
|
1346 |
]. |
|
1347 |
^ self |
|
1348 |
]. |
|
1349 |
||
1350 |
chgObj == listHolder ifTrue:[ |
|
1351 |
list := listHolder value. |
|
1352 |
||
1353 |
what == #value ifTrue:[ |
|
1354 |
^ self list:list |
|
1355 |
]. |
|
1356 |
aPara isCollection ifTrue:[ |
|
1357 |
arg1 := aPara at:1. |
|
1358 |
arg2 := aPara at:2. |
|
1359 |
] ifFalse:[ |
|
1360 |
arg1 := arg2 := aPara |
|
1361 |
]. |
|
1362 |
||
1363 |
what == #at: ifTrue:[ |
|
1364 |
^ self at:arg1 put:(list at:arg1) |
|
1365 |
]. |
|
1366 |
||
1367 |
what == #insert: ifTrue:[ |
|
1368 |
^ self add:(list at:arg1) beforeIndex:arg1 |
|
1369 |
]. |
|
1370 |
||
1371 |
what == #remove: ifTrue:[ |
|
1372 |
^ self removeFrom:arg1 to:arg1 |
|
1373 |
]. |
|
1374 |
what == #removeFrom: ifTrue:[ |
|
1375 |
list size == 0 ifTrue:[self list:nil] |
|
1376 |
ifFalse:[self removeFrom:arg1 to:arg2]. |
|
1377 |
^ self |
|
1378 |
]. |
|
1379 |
||
1380 |
what == #insertCollection: ifTrue:[ |
|
1381 |
arg2 ~~ 0 ifTrue:[ |
|
1382 |
self addAll:(list copyFrom:arg1 to:(arg1 + arg2 - 1)) beforeIndex:arg1 |
|
1383 |
]. |
|
1384 |
^ self. |
|
1385 |
]. |
|
1386 |
what == #replace: ifTrue:[ |
|
1387 |
arg1 to:arg2 do:[:i| self at:i put:(list at:i) ]. |
|
1388 |
^ self |
|
1389 |
]. |
|
1390 |
^ self |
|
1391 |
]. |
|
1593 | 1392 |
arg1 := aPara ? what. |
1487 | 1393 |
row := (what isNumber) ifTrue:[what] ifFalse:[chgObj]. |
1593 | 1394 |
self redrawVisibleRow:row readSelector:arg1. |
1395 |
||
1661 | 1396 |
"Modified: / 30.1.2000 / 12:16:49 / cg" |
809 | 1397 |
! ! |
1398 |
||
1399 |
!DSVColumnView methodsFor:'drag & drop'! |
|
1400 |
||
824 | 1401 |
canDrag |
1402 |
"returns true if dragging is enabled |
|
1403 |
" |
|
1404 |
^ dropSource notNil |
|
1405 |
||
1406 |
! |
|
1407 |
||
1408 |
dropSource |
|
1409 |
"returns the dropSource or nil |
|
809 | 1410 |
" |
824 | 1411 |
^ dropSource |
1412 |
||
1413 |
||
1414 |
! |
|
1415 |
||
1416 |
dropSource:aDropSourceOrNil |
|
1417 |
"set the dropSource or nil |
|
1418 |
" |
|
1419 |
dropSource := aDropSourceOrNil. |
|
1420 |
||
809 | 1421 |
|
1422 |
! |
|
1423 |
||
824 | 1424 |
dropTarget |
1425 |
"returns the dropTarget or nil |
|
809 | 1426 |
" |
824 | 1427 |
^ dropTarget |
1428 |
||
1429 |
! |
|
1430 |
||
1431 |
dropTarget:aDropTragetOrNil |
|
1432 |
"set the dropTarget or nil |
|
1433 |
" |
|
1434 |
dropTarget := aDropTragetOrNil. |
|
1435 |
||
1436 |
! |
|
1437 |
||
1438 |
startDragAt:aPoint |
|
1439 |
(dragIsActive not and:[dropSource notNil]) ifTrue:[ |
|
809 | 1440 |
dragIsActive := true. |
824 | 1441 |
dropSource startDragIn:self at:aPoint |
809 | 1442 |
] |
824 | 1443 |
|
542 | 1444 |
! ! |
1445 |
||
637 | 1446 |
!DSVColumnView methodsFor:'drawing'! |
1447 |
||
1448 |
colorOnDevice:aColor |
|
1449 |
"returns color on device |
|
1450 |
" |
|
1451 |
|col| |
|
1452 |
||
641 | 1453 |
aColor = Color noColor ifFalse:[ |
1454 |
col := colorMap at:aColor ifAbsent:nil. |
|
637 | 1455 |
|
641 | 1456 |
col isNil ifTrue:[ |
1480 | 1457 |
colorMap at:aColor put:(col := aColor onDevice:device) |
641 | 1458 |
]. |
1459 |
^ col |
|
637 | 1460 |
]. |
641 | 1461 |
^ bgColor |
637 | 1462 |
! |
1463 |
||
1464 |
forceRedraw |
|
1465 |
"a redraw forced by any other component |
|
1466 |
" |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1467 |
shown ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1468 |
self invalidate |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1469 |
] |
637 | 1470 |
! |
1471 |
||
1472 |
invalidate |
|
1473 |
"recompute extent before repair range |
|
1474 |
" |
|
1475 |
self recomputeHeightOfContents. |
|
1476 |
super invalidate. |
|
1477 |
||
1478 |
||
1479 |
! |
|
1480 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1481 |
invalidateRowAt:aRowNr |
637 | 1482 |
"redraw total row at an index |
1483 |
" |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1484 |
self invalidateRowAt:aRowNr colAt:0 |
637 | 1485 |
! |
1486 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1487 |
invalidateRowAt:aRowNr colAt:aColNr |
637 | 1488 |
"redraw visible row in case of aColNr == 0 or the column in a row; |
1489 |
in case that the row/column is hidden no redraw is done |
|
1490 |
" |
|
1497 | 1491 |
|x "{ Class:SmallInteger }" |
1492 |
y "{ Class:SmallInteger }" |
|
1493 |
h "{ Class:SmallInteger }" |
|
1494 |
w "{ Class:SmallInteger }" |
|
1495 |
| |
|
1496 |
||
1497 |
(shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[ |
|
1131 | 1498 |
h := rowHeight. |
1497 | 1499 |
y := self yVisibleOfRowNr:aRowNr. |
1500 |
||
1501 |
y < margin ifTrue:[ |
|
637 | 1502 |
(h := h + y) <= margin ifTrue:[ |
1503 |
^ self |
|
1504 |
]. "/ row not visible |
|
1505 |
h := h - margin. |
|
1506 |
y := margin. |
|
1507 |
] ifFalse:[ |
|
1508 |
y >= height ifTrue:[^ self]. |
|
1509 |
]. |
|
1510 |
aColNr ~~ 0 ifTrue:[ "/ redraw column in row |
|
1511 |
w := (self columnAt:aColNr) width. |
|
1497 | 1512 |
x := self xVisibleOfColNr:aColNr. |
1513 |
||
1514 |
x < margin ifTrue:[ |
|
637 | 1515 |
(w := w + x) <= margin ifTrue:[ |
1516 |
^ self |
|
1517 |
]. "/ column not visible |
|
1518 |
w := w - margin. |
|
1519 |
x := margin. |
|
1520 |
] ifFalse:[ |
|
1521 |
x >= width ifTrue:[^ self]. |
|
1522 |
] |
|
1523 |
] ifFalse:[ "/ redraw whole row |
|
1524 |
x := margin. |
|
1525 |
w := width. |
|
1526 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1527 |
self invalidateX:x y:y width:w height:h |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1528 |
] |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1529 |
! |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1530 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1531 |
invalidateX:x y:y width:w height:h |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1532 |
"invalidate a rectangle |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1533 |
" |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1534 |
shown ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1535 |
self invalidate:(Rectangle left:x top:y width:w height:h) |
637 | 1536 |
] |
1537 |
! |
|
1538 |
||
1539 |
redrawVisibleRow:aRow |
|
1540 |
"redraw row if visible |
|
1541 |
" |
|
809 | 1542 |
self redrawVisibleRow:aRow colAt:0 |
1543 |
||
1544 |
! |
|
1545 |
||
1546 |
redrawVisibleRow:aRow colAt:aColNr |
|
1547 |
"redraw row if visible |
|
1548 |
" |
|
637 | 1549 |
|start "{ Class:SmallInteger }" |
1550 |
stop "{ Class:SmallInteger }" |
|
1551 |
| |
|
1552 |
||
1553 |
(start := self indexOfFirstRowShown) ~~ 0 ifTrue:[ |
|
1497 | 1554 |
stop := (start + (height // rowHeight)) min:(list size). |
637 | 1555 |
|
1556 |
aRow isNumber ifTrue:[ |
|
1557 |
(aRow between:start and:stop) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1558 |
self invalidateRowAt:aRow colAt:aColNr |
637 | 1559 |
] |
1560 |
] ifFalse:[ |
|
1561 |
start to:stop do:[:i| |
|
1562 |
(self at:i) == aRow ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1563 |
^ self invalidateRowAt:i colAt:aColNr |
637 | 1564 |
] |
1565 |
] |
|
1566 |
] |
|
1567 |
] |
|
809 | 1568 |
|
1569 |
||
1570 |
! |
|
1571 |
||
1572 |
redrawVisibleRow:aRow readSelector:aSelector |
|
1573 |
"redraw a column identified by its read selector; if no column with |
|
1574 |
the specified read selector is detected, the whole line is drawn. |
|
1575 |
" |
|
1576 |
|row idx| |
|
1577 |
||
1578 |
aSelector isNil ifTrue:[ |
|
1579 |
idx := 0 |
|
1580 |
] ifFalse:[ |
|
1581 |
(row := aRow) isNumber ifTrue:[ |
|
1582 |
(row := self at:aRow) isNil ifTrue:[ ^ self ] |
|
1583 |
]. |
|
1584 |
idx := columnDescriptors findFirst:[:aCol||desc| |
|
1585 |
aCol description readSelector == aSelector |
|
1586 |
] |
|
1587 |
]. |
|
1588 |
self redrawVisibleRow:aRow colAt:idx |
|
1589 |
||
1590 |
||
1591 |
||
1592 |
||
637 | 1593 |
! |
1594 |
||
1595 |
redrawX:x y:y width:w height:h |
|
1596 |
"redraw part of myself immediately, given logical coordinates |
|
1597 |
" |
|
1112 | 1598 |
|c0 savClip rctg |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1599 |
start "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1600 |
stop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1601 |
x0 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1602 |
x1 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1603 |
maxX "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1604 |
yTop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1605 |
yBot "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1606 |
clHg "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1607 |
size "{ Class:SmallInteger }" |
637 | 1608 |
| |
1609 |
||
1610 |
shown ifFalse:[^ self]. |
|
1611 |
self paint:bgColor. |
|
1115 | 1612 |
|
1613 |
columnDescriptors isEmpty ifTrue:[ |
|
1614 |
^ self fillRectangleX:x y:y width:w height:h |
|
1615 |
]. |
|
1131 | 1616 |
size := list size. |
1115 | 1617 |
yTop := margin - viewOrigin y. |
1618 |
c0 := y - yTop max:0. |
|
1619 |
start := (c0 // rowHeight) + 1. |
|
1131 | 1620 |
stop := (c0 + h - 1 // rowHeight + 1) min:size. |
1115 | 1621 |
|
1622 |
stop < start ifTrue:[ |
|
1623 |
^ self fillRectangleX:x y:y width:w height:h |
|
1624 |
]. |
|
1625 |
savClip := clipRect. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1626 |
|
1115 | 1627 |
maxX := (x + w) min:(width - margin). |
1628 |
x0 := margin - viewOrigin x. |
|
1629 |
yTop := yTop + ((start - 1) * rowHeight). |
|
1630 |
rctg := Rectangle left:x top:y width:w height:h. |
|
1131 | 1631 |
clHg := (stop - start + 1) * rowHeight. |
1632 |
yBot := yTop + clHg. |
|
1633 |
||
1634 |
columnDescriptors do:[:aCol| |
|
1115 | 1635 |
x1 := x0 + aCol width. |
1636 |
||
1637 |
(x1 > x and:[x0 < maxX]) ifTrue:[ |
|
1638 |
rctg width:((x1 min:maxX) - x). |
|
1639 |
clipRect := nil. |
|
1640 |
self clippingRectangle:rctg. |
|
1131 | 1641 |
aCol redrawX:x0 y:yTop h:clHg from:start to:stop. |
1115 | 1642 |
]. |
1643 |
x0 := x1 |
|
1644 |
]. |
|
1131 | 1645 |
|
1646 |
"/ restore old clipping rectangle |
|
1115 | 1647 |
self clippingRectangle:savClip. |
1131 | 1648 |
|
1649 |
stop == size ifTrue:[ |
|
1115 | 1650 |
yTop := y + h. |
1651 |
yBot < (yTop - margin) ifTrue:[ |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1652 |
"/ clear to bottom of screen |
1115 | 1653 |
self paint:bgColor. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1654 |
self fillRectangleX:x y:yBot width:w height:(yTop - yBot). |
1112 | 1655 |
] |
1136 | 1656 |
]. |
1657 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1658 |
(c0 := w + x- x1) > 0 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1659 |
"/ clear to right of screen |
1136 | 1660 |
self paint:bgColor. |
1661 |
self fillRectangleX:x1 y:y width:c0 height:h. |
|
1662 |
]. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1663 |
|
1112 | 1664 |
! ! |
1665 |
||
1666 |
!DSVColumnView methodsFor:'drawing interactors'! |
|
1667 |
||
1131 | 1668 |
drawCheckToggleAtX:xTop y:yTop w:rowWidth state:aState |
1112 | 1669 |
"draw a check toggle button |
1670 |
" |
|
1671 |
|e form |
|
1672 |
y "{ Class:SmallInteger }" |
|
1673 |
x "{ Class:SmallInteger }" |
|
1674 |
h "{ Class:SmallInteger }" |
|
1675 |
w "{ Class:SmallInteger }" |
|
1676 |
| |
|
1677 |
w := checkToggleExtent x. |
|
1678 |
h := checkToggleExtent y. |
|
1679 |
y := yTop + (rowHeight - h // 2). |
|
1680 |
x := xTop + (rowWidth - w // 2). |
|
1529 | 1681 |
h odd ifTrue:[y := y + 1]. |
1112 | 1682 |
|
1683 |
(form := checkToggleActiveImage) isNil ifTrue:[ |
|
1131 | 1684 |
self paint:bgColor. |
1685 |
self fillRectangleX:x y:y width:w height:h. |
|
1686 |
self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self. |
|
1687 |
||
1112 | 1688 |
aState ifFalse:[ |
1689 |
^ self |
|
1690 |
]. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1691 |
self paint:fgColor on:bgColor. |
1112 | 1692 |
form := checkToggleForm |
1693 |
] ifFalse:[ |
|
1694 |
aState ifFalse:[form := checkTogglePassiveImage] |
|
859 | 1695 |
]. |
1112 | 1696 |
e := (checkToggleExtent - form extent) // 2. |
1697 |
self displayForm:form x:(x + e x) y:(y + e y). |
|
1698 |
||
1699 |
||
1700 |
||
1701 |
||
1702 |
||
1703 |
! |
|
1704 |
||
1131 | 1705 |
drawComboButtonAtX:xTop y:yTop w:rowWidth |
1112 | 1706 |
"draw a combo button |
1707 |
" |
|
1708 |
|e |
|
1709 |
x "{ Class:SmallInteger }" |
|
1710 |
y "{ Class:SmallInteger }" |
|
1711 |
h "{ Class:SmallInteger }" |
|
1712 |
w "{ Class:SmallInteger }" |
|
1713 |
| |
|
1714 |
w := comboButtonExtent x. |
|
1715 |
h := comboButtonExtent y. |
|
1716 |
y := yTop + (rowHeight - h // 2). |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1717 |
x := xTop + (rowWidth - w - separatorSize - 1). |
1112 | 1718 |
e := (comboButtonExtent - comboButtonForm extent) // 2. |
1719 |
||
1131 | 1720 |
self paint:bgColor. |
1721 |
self fillRectangleX:x y:y width:w height:h. |
|
1722 |
self drawEdgesAtX:x y:y width:w height:h level:comboButtonLevel on:self. |
|
1136 | 1723 |
self paint:fgColor on:bgColor. |
1112 | 1724 |
self displayForm:comboButtonForm x:(x + e x) y:(y + e y) |
1725 |
||
1726 |
! |
|
1727 |
||
1728 |
drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC |
|
1729 |
"draw edges for a cell or label |
|
1730 |
" |
|
1731 |
aGC drawEdgesForX:x |
|
1732 |
y:y |
|
1733 |
width:w |
|
1734 |
height:h |
|
1735 |
level:aLevel |
|
1736 |
shadow:buttonShadowColor |
|
1737 |
light:buttonLightColor |
|
1738 |
halfShadow:buttonHalfShadowColor |
|
1739 |
halfLight:buttonHalfLightColor |
|
1740 |
style:ButtonEdgeStyle. |
|
1741 |
||
637 | 1742 |
! ! |
1743 |
||
542 | 1744 |
!DSVColumnView methodsFor:'enumerating columns'! |
1745 |
||
1746 |
columnsDo:aOneArgBlock |
|
1747 |
"evaluate the argument, aOneArgBlock for every column |
|
1748 |
" |
|
1749 |
columnDescriptors do:aOneArgBlock |
|
1750 |
||
1751 |
||
1752 |
! |
|
1753 |
||
1754 |
columnsFrom:start to:stop do:aOneArgBlock |
|
1755 |
"evaluate the argument, aOneArgBlock for the columns with index start to |
|
1756 |
stop in the collection of column descriptors |
|
1757 |
" |
|
1758 |
columnDescriptors from:start to:stop do:aOneArgBlock |
|
1759 |
||
1760 |
||
1761 |
! ! |
|
1762 |
||
1763 |
!DSVColumnView methodsFor:'event handling'! |
|
1764 |
||
607 | 1765 |
buttonMotion:buttonMask x:x y:y |
1766 |
"mouse-move while button was pressed - handle multiple selection changes |
|
1767 |
" |
|
1754 | 1768 |
|lnNr p oldSelection step| |
607 | 1769 |
|
809 | 1770 |
dragAccessPoint notNil ifTrue:[ |
1771 |
dragIsActive ifFalse:[ |
|
824 | 1772 |
p := x @ y. |
1773 |
(clickPosition dist:p) > 5.0 ifTrue:[ self startDragAt:p ] |
|
809 | 1774 |
]. |
1775 |
^ self |
|
1776 |
]. |
|
607 | 1777 |
self sensor ctrlDown ifTrue:[^ self ]. |
1778 |
||
1779 |
(multipleSelectOk and:[selectedColIndex == 0 and:[selectedRowIndex notNil]]) ifFalse:[ |
|
1780 |
^ self |
|
1781 |
]. |
|
1782 |
"is it the select or 1-button ?" |
|
1783 |
||
1023
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1784 |
self sensor leftButtonPressed ifFalse:[^ self]. |
1749 | 1785 |
|
1786 |
autoScroll ifTrue:[ |
|
1787 |
"/ if moved outside of view, start autoscroll |
|
1788 |
(y < 0) ifTrue:[ |
|
1789 |
^ self startAutoScroll:[self scrollUp] distance:y. |
|
1790 |
]. |
|
1791 |
(y > height) ifTrue:[ |
|
1792 |
^ self startAutoScroll:[self scrollDown] distance:(y - height). |
|
1793 |
]. |
|
1794 |
]. |
|
1795 |
||
1796 |
"move inside - stop autoscroll if any" |
|
1797 |
self stopAutoScroll. |
|
1798 |
||
607 | 1799 |
y > height ifTrue:[ |
1754 | 1800 |
lnNr := self yVisibleToRowNr:(height + rowHeight). |
607 | 1801 |
] ifFalse:[ |
1802 |
y < 0 ifTrue:[ |
|
1754 | 1803 |
lnNr := self yVisibleToRowNr:(rowHeight negated). |
607 | 1804 |
] ifFalse:[ |
1754 | 1805 |
lnNr := self yVisibleToRowNr:y. |
607 | 1806 |
] |
1807 |
]. |
|
1754 | 1808 |
|
1809 |
(lnNr isNil or:[lnNr < 1]) ifTrue:[ |
|
607 | 1810 |
^ self |
1811 |
]. |
|
1749 | 1812 |
|
1754 | 1813 |
oldSelection := selectedRowIndex asOrderedCollection. |
1814 |
selectedRowIndex := OrderedCollection new. |
|
1815 |
||
1816 |
clickPosition isNil ifTrue:[ |
|
1817 |
clickPosition := oldSelection at:1 ifAbsent:lnNr |
|
643 | 1818 |
]. |
1754 | 1819 |
|
1820 |
step := lnNr < clickPosition ifTrue:[-1] ifFalse:[1]. |
|
1821 |
||
1822 |
clickPosition to:lnNr by:step do:[:i| |
|
1823 |
selectedRowIndex add:i. |
|
1824 |
oldSelection removeIdentical:i ifAbsent:[ self invalidateRowAt:i colAt:0 ]. |
|
607 | 1825 |
]. |
1754 | 1826 |
oldSelection do:[:i| self invalidateRowAt:i colAt:0 ]. |
1827 |
self scrollToRowAt:lnNr colAt:0. |
|
607 | 1828 |
! |
1829 |
||
542 | 1830 |
buttonMultiPress:button x:x y:y |
1831 |
"a button was pressed twice - handle doubleclick here |
|
1832 |
" |
|
1833 |
((button == 1) or:[button == #select]) ifFalse:[ |
|
1834 |
^ super buttonMultiPress:button x:x y:y |
|
1835 |
]. |
|
607 | 1836 |
self numberOfSelections == 1 ifTrue:[ |
1837 |
self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[ |
|
1838 |
( selectedColIndex == 0 |
|
1839 |
or:[selectedColIndex == (self xVisibleToColNr:x)] |
|
1840 |
) ifTrue:[ |
|
1841 |
self doubleClicked |
|
1842 |
] |
|
542 | 1843 |
] |
1844 |
] |
|
1845 |
||
1846 |
||
1847 |
||
1848 |
||
1849 |
! |
|
1850 |
||
1851 |
buttonPress:button x:x y:y |
|
1852 |
"a button was pressed - handle selection here |
|
1853 |
" |
|
1603 | 1854 |
|rowNr colNr menu sz first| |
542 | 1855 |
|
809 | 1856 |
clickPosition := nil. |
1857 |
dragAccessPoint := nil. |
|
1858 |
dragIsActive := false. |
|
1859 |
||
667 | 1860 |
((button == 2) or:[button == #menu]) ifTrue:[ |
1861 |
(menu := self findMenuForSelection) notNil ifTrue:[ |
|
1862 |
^ menu startUp |
|
1863 |
] |
|
1864 |
] ifFalse:[ |
|
1865 |
( (button == 1 or:[button == #select]) |
|
1866 |
and:[(rowNr := self yVisibleToRowNr:y) notNil |
|
1867 |
and:[(colNr := self xVisibleToColNr:x) notNil]] |
|
1868 |
) ifTrue:[ |
|
1603 | 1869 |
multipleSelectOk ifTrue:[ |
1870 |
self sensor ctrlDown ifTrue:[ |
|
1871 |
selectedColIndex ~~ 0 ifTrue:[ |
|
1872 |
colNr := 0 |
|
1873 |
] ifFalse:[ |
|
1874 |
(sz := self numberOfSelections == 0) ifFalse:[ |
|
1875 |
(self isInSelection:rowNr) ifTrue:[ |
|
1876 |
sz == 1 ifTrue:[ |
|
1877 |
self selectColIndex:0 rowIndex:nil. |
|
1878 |
^ self sensor flushMotionEventsFor:self. |
|
1879 |
]. |
|
1880 |
selectedRowIndex remove:rowNr. |
|
1881 |
] ifFalse:[ |
|
1882 |
selectedRowIndex add:rowNr |
|
1883 |
]. |
|
1884 |
self invalidateRowAt:rowNr. |
|
1885 |
self selectionChanged. |
|
1886 |
^ self sensor flushMotionEventsFor:self. |
|
1887 |
] |
|
1888 |
] |
|
667 | 1889 |
] ifFalse:[ |
1603 | 1890 |
( selectedColIndex == 0 |
1891 |
and:[(first := self firstIndexSelected) ~~ 0 |
|
1892 |
and:[self sensor shiftDown]] |
|
1893 |
) ifTrue:[|step list| |
|
1894 |
list := OrderedCollection new. |
|
1895 |
step := first < rowNr ifTrue:[1] ifFalse:[-1]. |
|
1896 |
first to:rowNr by:step do:[:i|list add:i]. |
|
1897 |
self selectedRowIndex:list. |
|
1898 |
^ self. |
|
607 | 1899 |
] |
667 | 1900 |
] |
1901 |
]. |
|
824 | 1902 |
(self canDrag and:[self isSelected:rowNr inColumn:colNr]) ifTrue:[ |
1903 |
clickPosition := x @ y. |
|
809 | 1904 |
dragAccessPoint := (colNr @ rowNr). |
1905 |
] ifFalse:[ |
|
1906 |
self selectRowAt:rowNr colAt:colNr atPoint:(x @ y) |
|
667 | 1907 |
]. |
1908 |
^ self |
|
542 | 1909 |
] |
1910 |
]. |
|
667 | 1911 |
super buttonPress:button x:x y:y |
1912 |
||
542 | 1913 |
|
1914 |
||
1915 |
! |
|
1916 |
||
643 | 1917 |
buttonRelease:button x:x y:y |
1918 |
||
1749 | 1919 |
self stopAutoScroll. |
1920 |
||
643 | 1921 |
clickPosition notNil ifTrue:[ |
809 | 1922 |
dragAccessPoint notNil ifTrue:[ |
1923 |
dragIsActive ifFalse:[ |
|
1924 |
self selectRowAt:(dragAccessPoint y) |
|
1925 |
colAt:(dragAccessPoint x) |
|
1926 |
atPoint:clickPosition |
|
1927 |
]. |
|
1928 |
dragAccessPoint := nil. |
|
824 | 1929 |
dragIsActive := false. |
809 | 1930 |
] ifFalse:[ |
1931 |
self selectionChanged |
|
1932 |
]. |
|
643 | 1933 |
clickPosition := nil. |
1934 |
]. |
|
1935 |
super buttonRelease:button x:x y:y |
|
1936 |
||
1937 |
||
1938 |
! |
|
1939 |
||
809 | 1940 |
characterPress:aChar x:x y:y |
1941 |
"search row in column at x/y starting its printable label with cahracter. |
|
1942 |
" |
|
1943 |
|colNr rowNr lsize found column| |
|
1944 |
||
872
ad92183a6e6b
pass unhandled keys up (for focus control)
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
1945 |
(rowIfAbsentBlock notNil |
896
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1946 |
or:[x isNil |
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1947 |
or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[ |
809 | 1948 |
^ self |
1949 |
]. |
|
1950 |
rowNr := self lastIndexSelected. |
|
1497 | 1951 |
lsize := list size. |
809 | 1952 |
column := self columnAt:colNr. |
1953 |
found := 0. |
|
1954 |
||
1955 |
lsize > rowNr ifTrue:[ |
|
1956 |
"/ search to end |
|
1957 |
found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize. |
|
1958 |
]. |
|
1959 |
||
1960 |
(found == 0 and:[rowNr > 1]) ifTrue:[ |
|
1961 |
"/ search from begin |
|
1962 |
found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1) |
|
1963 |
]. |
|
1964 |
found ~~ 0 ifTrue:[ |
|
1965 |
self selectColIndex:colNr rowIndex:found. |
|
1966 |
]. |
|
1967 |
||
896
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1968 |
"Modified: / 21.5.1998 / 03:30:22 / cg" |
809 | 1969 |
! |
1970 |
||
542 | 1971 |
contentsChanged |
1972 |
"contents changed - move origin up if possible |
|
1973 |
" |
|
1974 |
|y| |
|
1975 |
||
1976 |
shown ifTrue:[ |
|
1977 |
self recomputeHeightOfContents. |
|
1978 |
y := self maxViewOriginY. |
|
1979 |
||
1980 |
viewOrigin y > y ifTrue:[ |
|
1981 |
self scrollTo:(viewOrigin x @ y) |
|
1982 |
] ifFalse:[ |
|
1983 |
self updateEditViewOrigin. |
|
1984 |
] |
|
1985 |
]. |
|
1986 |
super contentsChanged |
|
1987 |
||
1988 |
||
1989 |
! |
|
1990 |
||
1991 |
doubleClicked |
|
1992 |
"handle a double click |
|
1993 |
" |
|
637 | 1994 |
|col sel idx| |
1995 |
||
1996 |
self hasSelection ifTrue:[ |
|
1997 |
idx := self firstIndexSelected. |
|
1998 |
col := self selectedColumn. |
|
1999 |
(col notNil and:[(sel := col doubleClickedSelector) notNil]) ifTrue:[ |
|
2000 |
(self at:idx) perform:sel |
|
2001 |
] ifFalse:[ |
|
2002 |
doubleClickActionBlock notNil ifTrue:[ |
|
2003 |
doubleClickActionBlock value:idx |
|
2004 |
] |
|
2005 |
] |
|
2006 |
] |
|
542 | 2007 |
! |
2008 |
||
667 | 2009 |
findMenuForSelection |
2010 |
"find the middle button menu for the current selection; returns the menu or nil |
|
2011 |
" |
|
2012 |
|col row menu| |
|
2013 |
||
2014 |
self numberOfSelections == 1 ifTrue:[ |
|
2015 |
row := self at:(self firstIndexSelected). |
|
2016 |
col := self selectedColumn. |
|
2017 |
||
2018 |
(col notNil and:[(menu := col menuForRow:row) notNil]) ifTrue:[ |
|
2019 |
^ menu |
|
2020 |
]. |
|
2021 |
col := columnDescriptors detect:[:c| c rendererType == #rowSelector] |
|
2022 |
ifNone:[nil]. |
|
2023 |
||
2024 |
col notNil ifTrue:[ |
|
1223
176702811314
kludge: when asking for an itemMenu, pass application to
tm
parents:
1215
diff
changeset
|
2025 |
^ col menuForRow:row inApplication:(self application) |
667 | 2026 |
] |
2027 |
]. |
|
2028 |
^ nil |
|
2029 |
! |
|
2030 |
||
1111 | 2031 |
keyPress:aKey x:x y:y |
542 | 2032 |
"a key was pressed - handle page-keys here |
2033 |
" |
|
2034 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
|
809 | 2035 |
#BeginOfText #EndOfText #ScrollUp #ScrollDown |
542 | 2036 |
#CursorUp #CursorDown #CursorRight #CursorLeft)> |
2037 |
||
1776 | 2038 |
|sensor maxColNr selRowNr selColNr key column isTab listSize hasSelectables| |
1111 | 2039 |
|
2040 |
(sensor := self sensor) isNil ifTrue:[ |
|
2041 |
^ self |
|
542 | 2042 |
]. |
1416 | 2043 |
(listSize := list size) == 0 ifTrue:[ |
2044 |
^ super keyPress:aKey x:x y:y |
|
2045 |
]. |
|
1776 | 2046 |
aKey isCharacter ifTrue:[ |
2047 |
^ self characterPress:aKey x:x y:y |
|
542 | 2048 |
]. |
1111 | 2049 |
|
1776 | 2050 |
aKey == #PreviousPage ifTrue:[^ self pageUp]. |
2051 |
aKey == #NextPage ifTrue:[^ self pageDown]. |
|
2052 |
aKey == #HalfPageUp ifTrue:[^ self halfPageUp]. |
|
2053 |
aKey == #HalfPageDown ifTrue:[^ self halfPageDown]. |
|
2054 |
aKey == #BeginOfText ifTrue:[^ self scrollToTop]. |
|
2055 |
aKey == #EndOfText ifTrue:[^ self scrollToBottom]. |
|
2056 |
aKey == #ScrollUp ifTrue:[^ self scrollUp]. |
|
2057 |
aKey == #ScrollDown ifTrue:[^ self scrollDown]. |
|
2058 |
||
1111 | 2059 |
aKey == #Return ifTrue:[ |
1416 | 2060 |
self numberOfSelections == 1 ifTrue:[self doubleClicked]. |
2061 |
^ self |
|
542 | 2062 |
]. |
1111 | 2063 |
|
1668 | 2064 |
hasSelectables := false. |
2065 |
||
2066 |
columnDescriptors do:[:aCol| |
|
2067 |
(hasSelectables or:[aCol rendererType == #rowSelector]) ifFalse:[ |
|
2068 |
hasSelectables := aCol description canSelect |
|
2069 |
] |
|
2070 |
]. |
|
1776 | 2071 |
selRowNr := self firstIndexSelected. |
2072 |
||
2073 |
(aKey == #CursorUp or:[aKey == #CursorDown]) ifTrue:[ |
|
2074 |
(hasSelectables or:[selectRowOnDefault]) ifTrue:[ |
|
2075 |
selColNr := hasSelectables ifFalse:[0] |
|
2076 |
ifTrue:[selectedColIndex]. |
|
2077 |
||
2078 |
aKey == #CursorUp ifTrue:[ |
|
2079 |
selRowNr := selRowNr > 1 ifTrue:[selRowNr - 1] ifFalse:[listSize]. |
|
2080 |
] ifFalse:[ |
|
2081 |
selRowNr := selRowNr < listSize ifTrue:[selRowNr + 1] ifFalse:[1]. |
|
2082 |
]. |
|
2083 |
self selectColIndex:selColNr rowIndex:selRowNr |
|
2084 |
]. |
|
2085 |
^ self |
|
2086 |
]. |
|
1668 | 2087 |
|
2088 |
hasSelectables ifFalse:[ |
|
2089 |
^ super keyPress:aKey x:x y:y |
|
2090 |
]. |
|
2091 |
||
1776 | 2092 |
"/ CURSOR LEFT/RIGHT or TABING |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2093 |
(aKey == #CursorLeft or:[aKey == #CursorRight]) ifFalse:[ |
1668 | 2094 |
tabIntern ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2095 |
^ super keyPress:aKey x:x y:y |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2096 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2097 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2098 |
(aKey includesString:'Tab') ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2099 |
key := (sensor shiftDown or:[aKey includesString:'Left']) ifTrue:[#CursorLeft] |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2100 |
ifFalse:[#CursorRight] |
1416 | 2101 |
] ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2102 |
(aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[ |
1416 | 2103 |
^ super keyPress:aKey x:x y:y |
2104 |
]. |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2105 |
key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2106 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2107 |
isTab := true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2108 |
] ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2109 |
isTab := false. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2110 |
key := aKey. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2111 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2112 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2113 |
maxColNr := self numberOfColumns. |
1776 | 2114 |
selColNr := selectedColIndex. |
612 | 2115 |
|
1111 | 2116 |
key == #CursorLeft ifTrue:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2117 |
selRowNr == 0 ifTrue:[selRowNr := listSize]. |
1776 | 2118 |
selColNr == 0 ifTrue:[selColNr := maxColNr + 1]. |
2119 |
||
2120 |
[true] whileTrue:[ |
|
2121 |
(selColNr := selColNr - 1) == 0 ifTrue:[ |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2122 |
(selRowNr := selRowNr - 1) == 0 ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2123 |
isTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2124 |
tabAtStartAction notNil ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2125 |
tabAtStartAction value |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2126 |
] ifFalse:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2127 |
self deselect. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2128 |
self windowGroup focusPreviousFrom:self |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2129 |
] |
1416 | 2130 |
]. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2131 |
^ self |
1111 | 2132 |
]. |
1776 | 2133 |
selColNr := maxColNr |
1111 | 2134 |
]. |
1776 | 2135 |
column := self columnAt:selColNr. |
1416 | 2136 |
|
1111 | 2137 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
1776 | 2138 |
^ self selectColIndex:selColNr rowIndex:selRowNr. |
1111 | 2139 |
] |
2140 |
] |
|
542 | 2141 |
]. |
1776 | 2142 |
|
2143 |
selRowNr == 0 ifTrue:[selRowNr := 1]. |
|
2144 |
||
2145 |
[true] whileTrue:[ |
|
2146 |
(selColNr := selColNr + 1) > maxColNr ifTrue:[ |
|
2147 |
(selRowNr := selRowNr + 1) > listSize ifTrue:[ |
|
2148 |
isTab ifTrue:[ |
|
2149 |
tabAtEndAction notNil ifTrue:[ |
|
2150 |
tabAtEndAction value |
|
2151 |
] ifFalse:[ |
|
2152 |
self deselect. |
|
2153 |
self windowGroup focusNextFrom:self |
|
2154 |
] |
|
2155 |
]. |
|
2156 |
^ self |
|
2157 |
]. |
|
2158 |
selColNr := 1 |
|
2159 |
]. |
|
2160 |
column := self columnAt:selColNr. |
|
2161 |
||
2162 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
|
2163 |
^ self selectColIndex:selColNr rowIndex:selRowNr |
|
2164 |
] |
|
2165 |
]. |
|
1111 | 2166 |
|
2167 |
||
1416 | 2168 |
|
542 | 2169 |
! |
2170 |
||
2171 |
originChanged:delta |
|
2172 |
"this one is sent, after the origin of my contents has changed - |
|
2173 |
tell dependents (i.e. scrollers) about this |
|
2174 |
" |
|
2175 |
super originChanged:delta. |
|
2176 |
self updateEditViewOrigin. |
|
2177 |
! ! |
|
2178 |
||
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2179 |
!DSVColumnView methodsFor:'focus handling'! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2180 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2181 |
canTab |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2182 |
super canTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2183 |
^ editView isNil |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2184 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2185 |
^ false |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2186 |
! ! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2187 |
|
542 | 2188 |
!DSVColumnView methodsFor:'gc operations'! |
2189 |
||
1100 | 2190 |
imageOnDevice:anImage |
2191 |
"associate image to device and clear pixel mask; returns the new image. |
|
2192 |
" |
|
2193 |
|image| |
|
2194 |
||
2195 |
(image := anImage) notNil ifTrue:[ |
|
2196 |
image device ~~ device ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2197 |
image := image copy onDevice:device. |
1100 | 2198 |
]. |
2199 |
image isImage ifTrue:[ |
|
2200 |
image := image clearMaskedPixels |
|
2201 |
] |
|
2202 |
]. |
|
2203 |
^ image |
|
2204 |
||
2205 |
! |
|
2206 |
||
542 | 2207 |
registerImage:anImage key:aKey |
2208 |
"any row can register an image with a unique identifier a key symbol |
|
2209 |
" |
|
2210 |
|img| |
|
2211 |
||
2212 |
(img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
|
2213 |
^ img |
|
2214 |
]. |
|
1112 | 2215 |
img := self imageOnDevice:anImage. |
567 | 2216 |
registererImages at:aKey put:img. |
2217 |
^ img |
|
542 | 2218 |
! |
2219 |
||
2220 |
registeredImageAt:aKey |
|
2221 |
"any row can register an image with a unique identifier |
|
2222 |
" |
|
2223 |
^ registererImages at:aKey ifAbsent:nil |
|
2224 |
! |
|
2225 |
||
2226 |
releaseAllRegisteredImages |
|
2227 |
"release all registered images |
|
2228 |
" |
|
2229 |
registererImages := IdentityDictionary new. |
|
2230 |
! ! |
|
2231 |
||
1326 | 2232 |
!DSVColumnView methodsFor:'initialize / release'! |
542 | 2233 |
|
2234 |
create |
|
607 | 2235 |
"set color on device |
542 | 2236 |
" |
2237 |
super create. |
|
1480 | 2238 |
fgColor := fgColor onDevice:device. |
2239 |
bgColor := bgColor onDevice:device. |
|
2240 |
hgLgFgColor := hgLgFgColor onDevice:device. |
|
2241 |
hgLgBgColor := hgLgBgColor onDevice:device. |
|
2242 |
||
2243 |
buttonShadowColor := buttonShadowColor onDevice:device. |
|
2244 |
buttonLightColor := buttonLightColor onDevice:device. |
|
809 | 2245 |
|
2246 |
buttonHalfShadowColor notNil ifTrue:[ |
|
1480 | 2247 |
buttonHalfShadowColor := buttonHalfShadowColor onDevice:device |
809 | 2248 |
]. |
2249 |
||
2250 |
buttonHalfLightColor notNil ifTrue:[ |
|
1480 | 2251 |
buttonHalfLightColor := buttonHalfLightColor onDevice:device |
809 | 2252 |
]. |
1100 | 2253 |
rowSelectorForm := self imageOnDevice:rowSelectorForm. |
2254 |
checkToggleActiveImage := self imageOnDevice:checkToggleActiveImage. |
|
2255 |
checkTogglePassiveImage := self imageOnDevice:checkTogglePassiveImage. |
|
2256 |
comboButtonForm := self imageOnDevice:comboButtonForm. |
|
2257 |
checkToggleForm := self imageOnDevice:checkToggleForm. |
|
2258 |
||
2259 |
||
542 | 2260 |
! |
2261 |
||
2262 |
destroy |
|
2263 |
"remove dependencies |
|
2264 |
" |
|
618 | 2265 |
self columnHolder:nil. |
1487 | 2266 |
listHolder removeDependent:self. |
2267 |
||
1711 | 2268 |
columnAdaptor isValueModel ifTrue:[ |
2269 |
columnAdaptor removeDependent:self |
|
2270 |
]. |
|
2271 |
||
618 | 2272 |
self beDependentOfRows:false. |
542 | 2273 |
super destroy |
2274 |
! |
|
2275 |
||
2276 |
initStyle |
|
607 | 2277 |
"setup colors |
2278 |
" |
|
1100 | 2279 |
|button widget| |
809 | 2280 |
|
542 | 2281 |
super initStyle. |
2282 |
||
2283 |
DefaultForegroundColor isNil ifTrue:[ |
|
2284 |
self class updateStyleCache |
|
2285 |
]. |
|
2286 |
fgColor := DefaultForegroundColor. |
|
2287 |
bgColor := DefaultBackgroundColor. |
|
2288 |
hgLgFgColor := DefaultHilightForegroundColor. |
|
2289 |
hgLgBgColor := DefaultHilightBackgroundColor. |
|
809 | 2290 |
|
2291 |
shadowColor isNil ifTrue:[ |
|
2292 |
shadowColor := Color grayPercent:40. |
|
2293 |
]. |
|
2294 |
||
2295 |
lightColor isNil ifTrue:[ |
|
2296 |
lightColor := Color grayPercent:75 |
|
2297 |
]. |
|
2298 |
||
2299 |
buttonLightColor := ButtonLightColor ? lightColor. |
|
2300 |
buttonShadowColor := ButtonShadowColor ? shadowColor. |
|
2301 |
||
2302 |
(ButtonEdgeStyle == #soft) ifTrue:[ |
|
2303 |
buttonHalfShadowColor := ButtonHalfShadowColor. |
|
2304 |
buttonHalfLightColor := ButtonHalfLightColor. |
|
2305 |
||
2306 |
buttonHalfShadowColor isNil ifTrue:[ |
|
2307 |
buttonHalfShadowColor := buttonShadowColor lightened |
|
2308 |
] |
|
2309 |
]. |
|
1490 | 2310 |
|
2311 |
buttonHalfShadowColor isNil ifTrue:[ |
|
2312 |
buttonHalfShadowColor := Color gray |
|
2313 |
]. |
|
2314 |
||
1100 | 2315 |
rowSelectorForm := self class rowSelector. |
2316 |
checkToggleActiveImage := CheckToggleActiveImage. |
|
2317 |
checkTogglePassiveImage := CheckTogglePassiveImage. |
|
2318 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2319 |
ComboButtonForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2320 |
widget := ComboListView new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2321 |
button := widget menuButton. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2322 |
ComboButtonForm := button label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2323 |
ComboButtonLevel := button offLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2324 |
ComboButtonExtent := (button preferredExtent x) @ (widget preferredExtent y). |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2325 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2326 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2327 |
CheckToggleForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2328 |
widget := CheckToggle new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2329 |
CheckToggleForm := widget label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2330 |
CheckToggleLevel := widget offLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2331 |
CheckToggleExtent := widget preferredExtent. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2332 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2333 |
comboButtonForm := ComboButtonForm. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2334 |
comboButtonLevel := ComboButtonLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2335 |
comboButtonExtent := ComboButtonExtent. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2336 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2337 |
checkToggleForm := CheckToggleForm. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2338 |
checkToggleLevel := CheckToggleLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2339 |
checkToggleExtent := CheckToggleExtent. |
542 | 2340 |
! |
2341 |
||
2342 |
initialize |
|
2343 |
"set default attributes |
|
2344 |
" |
|
2345 |
super initialize. |
|
1487 | 2346 |
self lineWidth:0. |
2347 |
||
1668 | 2348 |
tabIntern := true. |
1487 | 2349 |
useIndex := true. |
1112 | 2350 |
viewOrigin := 0@0. |
1480 | 2351 |
font := font onDevice:device. |
1112 | 2352 |
rowHeight := font height. |
2353 |
multipleSelectOk := false. "/ multiselect disabled |
|
2354 |
selectedRowIndex := selectedColIndex := 0. "/ no selection |
|
1778
51bbd960baf9
change registeredIcons from IdentityDictionary to Dictionary
ca
parents:
1776
diff
changeset
|
2355 |
registererImages := Dictionary new. |
1112 | 2356 |
columnDescriptors := #(). |
2357 |
beDependentOfRows := false. |
|
2358 |
verticalSpacing := self class verticalSpacing. |
|
2359 |
horizontalSpacing := self class horizontalSpacing. |
|
2360 |
colorMap := Dictionary new. |
|
2361 |
catchChangeEvents := false. |
|
2362 |
dragIsActive := false. |
|
2363 |
rowFontAscent := 1. "/ dummy initialization |
|
2364 |
separatorSize := 1. "/ separators mode 2D |
|
2365 |
selectRowOnDefault := true. |
|
1749 | 2366 |
autoScroll := true. |
542 | 2367 |
! |
2368 |
||
705 | 2369 |
mapped |
2370 |
"set selection if exists after mapping |
|
2371 |
" |
|
2372 |
|idx| |
|
2373 |
||
2374 |
super mapped. |
|
2375 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2376 |
(idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
705 | 2377 |
self scrollToRowAt:idx colAt:0. |
2378 |
]. |
|
2379 |
! |
|
2380 |
||
542 | 2381 |
realize |
607 | 2382 |
"recompute contents and fit columns to view |
542 | 2383 |
" |
1487 | 2384 |
|selection| |
2385 |
||
607 | 2386 |
self bitGravity:#NorthWest. |
542 | 2387 |
self recomputeHeightOfContents. |
1487 | 2388 |
|
2389 |
selection := 0. |
|
2390 |
||
2391 |
model notNil ifTrue:[ |
|
2392 |
(model respondsTo:#selectionIndex) ifTrue:[ |
|
2393 |
selection := model selectionIndex |
|
2394 |
] ifFalse:[ |
|
2395 |
model == listHolder ifFalse:[ |
|
2396 |
selection := model value |
|
2397 |
] |
|
2398 |
] |
|
2399 |
]. |
|
2400 |
self selectRowIndex:selection. |
|
2401 |
||
542 | 2402 |
super realize. |
607 | 2403 |
self fitColumns. |
2404 |
! ! |
|
2405 |
||
2406 |
!DSVColumnView methodsFor:'obsolete'! |
|
2407 |
||
2408 |
has3Dsepartors |
|
2409 |
"shouldn't be used any more |
|
2410 |
" |
|
2411 |
^ self has3Dseparators |
|
2412 |
! |
|
2413 |
||
2414 |
has3Dsepartors:aBool |
|
2415 |
"shouldn't be used any more |
|
2416 |
" |
|
2417 |
self has3Dseparators:aBool |
|
542 | 2418 |
|
2419 |
! ! |
|
2420 |
||
2421 |
!DSVColumnView methodsFor:'private'! |
|
2422 |
||
1111 | 2423 |
destroyEditView |
2424 |
"destroy the edit view; release KeyboardForwarder |
|
2425 |
" |
|
2426 |
editView notNil ifTrue:[ |
|
2427 |
editView withAllSubViewsDo:[:aView| |
|
2428 |
aView delegate:nil |
|
2429 |
]. |
|
2430 |
editView destroy. |
|
2431 |
editView := nil. |
|
2432 |
self windowGroup focusView:nil. |
|
2433 |
]. |
|
2434 |
||
2435 |
||
2436 |
! |
|
2437 |
||
637 | 2438 |
detectViewAt:aPoint in:aView |
1087 | 2439 |
"returns the view at a point |
2440 |
" |
|
637 | 2441 |
|p| |
2442 |
||
2443 |
(aView notNil and:[aView subViews notNil]) ifTrue:[ |
|
2444 |
aView subViews do:[:sv| |
|
2445 |
p := device translatePoint:aPoint from:(self id) to:(sv id). |
|
2446 |
||
2447 |
(p x >= 0 and:[p y >= 0 and:[p x <= sv width and:[p y <= sv height]]]) ifTrue:[ |
|
2448 |
^ self detectViewAt:aPoint in:sv |
|
2449 |
] |
|
2450 |
] |
|
2451 |
]. |
|
2452 |
^ aView |
|
2453 |
! |
|
2454 |
||
542 | 2455 |
fitColumns |
1484 | 2456 |
"fit columns to view; |
542 | 2457 |
" |
1498 | 2458 |
|list width changed dX sz oldOrgX newOrgX| |
1487 | 2459 |
|
2460 |
preferredExtent isNil ifTrue:[ |
|
2461 |
self preferredExtent. |
|
2462 |
]. |
|
1484 | 2463 |
|
2464 |
columnDescriptors isEmpty ifTrue:[ |
|
2465 |
^ self |
|
2466 |
]. |
|
1492 | 2467 |
width := 0. |
2468 |
list := OrderedCollection new. |
|
1484 | 2469 |
|
2470 |
columnDescriptors do:[:aCol| |
|
2471 |
aCol canResize ifTrue:[ |
|
2472 |
changed := true. |
|
2473 |
aCol invalidate. |
|
1492 | 2474 |
aCol hasRelativeWidth ifFalse:[list add:aCol]. |
1484 | 2475 |
]. |
1492 | 2476 |
width := width + aCol minWidth. |
1484 | 2477 |
]. |
1492 | 2478 |
preferredExtent x:width. |
2479 |
width := self innerWidth - width. |
|
2480 |
||
2481 |
(list notEmpty and:[width > 0]) ifTrue:[ |
|
2482 |
sz := list size. |
|
2483 |
width >= sz ifTrue:[ |
|
2484 |
dX := width // sz. |
|
1484 | 2485 |
list do:[:aCol|aCol growWidth:dX]. |
1492 | 2486 |
width := width - (dX * sz). |
1484 | 2487 |
]. |
1492 | 2488 |
width ~~ 0 ifTrue:[list last growWidth:width]. |
1484 | 2489 |
]. |
1492 | 2490 |
|
612 | 2491 |
shown ifTrue:[ |
1492 | 2492 |
self invalidate. |
1487 | 2493 |
labelView invalidate. |
542 | 2494 |
|
1498 | 2495 |
(oldOrgX := viewOrigin x) ~~ 0 ifTrue:[ |
2496 |
"/ UPDATE VIEW-ORIGIN X |
|
2497 |
||
2498 |
width := preferredExtent x. |
|
2499 |
newOrgX := (width - self innerWidth) max:0. |
|
2500 |
||
2501 |
newOrgX < oldOrgX ifTrue:[ |
|
2502 |
self originWillChange. |
|
2503 |
viewOrigin := newOrgX @ (viewOrigin y). |
|
2504 |
self originChanged:((newOrgX - oldOrgX) @ 0). |
|
2505 |
] |
|
2506 |
]. |
|
2507 |
||
612 | 2508 |
self hasSelection ifTrue:[ |
2509 |
editView notNil ifTrue:[ |
|
1490 | 2510 |
editView width:(self selectedColumn width - (2 * separatorSize)). |
612 | 2511 |
]. |
2512 |
self scrollToSelection. |
|
542 | 2513 |
]. |
1498 | 2514 |
self contentsChanged. |
542 | 2515 |
]. |
647 | 2516 |
|
542 | 2517 |
! |
2518 |
||
2519 |
maxViewOriginY |
|
2520 |
"returns the maximum possible y of the view origin |
|
2521 |
" |
|
2522 |
|y| |
|
2523 |
||
2524 |
y := self heightOfContents - self innerHeight. |
|
2525 |
^ y max:0 |
|
2526 |
||
2527 |
! |
|
2528 |
||
2529 |
updateEditViewOrigin |
|
2530 |
"update origin of the editView |
|
2531 |
" |
|
2532 |
|x y| |
|
2533 |
||
2534 |
editView notNil ifTrue:[ |
|
607 | 2535 |
y := self yVisibleOfRowNr:(self firstIndexSelected). |
1498 | 2536 |
x := self xVisibleOfColNr:selectedColIndex. |
542 | 2537 |
|
1112 | 2538 |
editView origin:(x @ y + separatorSize). |
542 | 2539 |
]. |
2540 |
||
2541 |
! |
|
2542 |
||
2543 |
xVisibleOfColNr:aColNr |
|
2544 |
"returns visible x assigned to a column number |
|
2545 |
" |
|
1497 | 2546 |
|x |
2547 |
end "{ Class:SmallInteger }" |
|
2548 |
| |
|
542 | 2549 |
x := margin - viewOrigin x. |
1497 | 2550 |
|
1498 | 2551 |
aColNr > 1 ifTrue:[ |
1497 | 2552 |
end := aColNr - 1. |
2553 |
||
2554 |
columnDescriptors from:1 to:end do:[:aCol| |
|
2555 |
x := x + aCol width |
|
2556 |
] |
|
2557 |
]. |
|
542 | 2558 |
^ x |
2559 |
||
2560 |
! |
|
2561 |
||
2562 |
xVisibleToColNr:x |
|
607 | 2563 |
"returns the column number assigned to a physical x or nil |
2564 |
" |
|
1497 | 2565 |
|x0 |
2566 |
nr "{ Class:SmallInteger }" |
|
2567 |
| |
|
542 | 2568 |
|
2569 |
x0 := x + viewOrigin x - margin. |
|
2570 |
nr := 1. |
|
2571 |
||
1497 | 2572 |
columnDescriptors do:[:aCol| |
542 | 2573 |
(x0 := x0 - aCol width) <= 0 ifTrue:[^ nr]. |
2574 |
nr := nr + 1. |
|
2575 |
]. |
|
2576 |
^ nil. |
|
2577 |
||
2578 |
! |
|
2579 |
||
2580 |
yVisibleOfRowNr:aRowNr |
|
2581 |
"returns visible y assigned to the row number |
|
2582 |
" |
|
2583 |
^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
|
2584 |
||
2585 |
! |
|
2586 |
||
2587 |
yVisibleToRowNr:y |
|
607 | 2588 |
"returns the row number assigned to a physical y or nil |
542 | 2589 |
" |
2590 |
|y0| |
|
2591 |
||
2592 |
y0 := (y + viewOrigin y - margin) // rowHeight + 1. |
|
1497 | 2593 |
^ (y0 <= list size) ifTrue:[y0] ifFalse:[nil] |
542 | 2594 |
|
2595 |
! ! |
|
2596 |
||
2597 |
!DSVColumnView methodsFor:'queries'! |
|
2598 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2599 |
hasOpenEditor |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2600 |
^ editView notNil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2601 |
! |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2602 |
|
563 | 2603 |
indexOfFirstRowShown |
2604 |
"returns index of first row shown |
|
2605 |
" |
|
2606 |
|idx| |
|
2607 |
||
1498 | 2608 |
idx := (viewOrigin y // rowHeight) + 1. |
1497 | 2609 |
^ (idx <= list size) ifTrue:[idx] ifFalse:[0] |
563 | 2610 |
|
2611 |
! |
|
2612 |
||
542 | 2613 |
numberOfColumns |
2614 |
"returns number of columns |
|
2615 |
" |
|
2616 |
^ columnDescriptors size |
|
2617 |
||
2618 |
! |
|
2619 |
||
2620 |
numberOfRows |
|
2621 |
"returns number of raws |
|
2622 |
" |
|
1497 | 2623 |
^ list size |
542 | 2624 |
|
2625 |
! |
|
2626 |
||
2627 |
rowHeight |
|
2628 |
"get the height of the highest row in pixels |
|
2629 |
" |
|
2630 |
^ rowHeight |
|
2631 |
||
2632 |
! |
|
2633 |
||
2634 |
separatorSize |
|
2635 |
"returns vertical/horizontal size of a separator dependent on the |
|
2636 |
3D effect. |
|
2637 |
" |
|
607 | 2638 |
^ separatorSize |
542 | 2639 |
|
2640 |
! |
|
2641 |
||
2642 |
size |
|
2643 |
"returns number of raws |
|
2644 |
" |
|
2645 |
^ list size |
|
2646 |
||
2647 |
! ! |
|
2648 |
||
2649 |
!DSVColumnView methodsFor:'recomputation'! |
|
2650 |
||
647 | 2651 |
hasPreferredExtent |
2652 |
"returns true if preferred extent is accumulated |
|
2653 |
" |
|
2654 |
^ preferredExtent notNil |
|
2655 |
! |
|
2656 |
||
542 | 2657 |
preferredExtent |
647 | 2658 |
"recompute preferred extent; raise notification |
542 | 2659 |
" |
1497 | 2660 |
|x "{ Class:SmallInteger }" |
2661 |
h "{ Class:SmallInteger }" |
|
2662 |
| |
|
542 | 2663 |
|
2664 |
preferredExtent notNil ifTrue:[ |
|
2665 |
^ preferredExtent |
|
2666 |
]. |
|
2667 |
x := 3. |
|
1521 | 2668 |
h := 0. |
1497 | 2669 |
|
2670 |
columnDescriptors do:[:aCol| |
|
2671 |
h := (aCol heightOfHighestRow) max:h. |
|
2672 |
x := x + (aCol minWidth). |
|
542 | 2673 |
]. |
1521 | 2674 |
h == 0 ifTrue:[h := font height]. |
1497 | 2675 |
rowHeight := (h + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
2676 |
preferredExtent := x @ (list size * rowHeight). |
|
1201 | 2677 |
rowFontAscent := font ascent. |
2678 |
||
542 | 2679 |
^ preferredExtent |
2680 |
||
2681 |
||
2682 |
! |
|
2683 |
||
2684 |
preferredExtentChanged |
|
1087 | 2685 |
"called if the preffered extent changed |
2686 |
" |
|
1497 | 2687 |
|x "{ Class:SmallInteger }" |
2688 |
y "{ Class:SmallInteger }" |
|
2689 |
| |
|
542 | 2690 |
y := viewOrigin y. |
2691 |
x := viewOrigin x. |
|
2692 |
||
2693 |
(y ~~ 0 or:[x ~~ 0]) ifTrue:[ |
|
2694 |
self originWillChange. |
|
2695 |
viewOrigin := 0 @ 0. |
|
2696 |
preferredExtent := nil. |
|
2697 |
self originChanged:(x negated @ y negated). |
|
2698 |
] |
|
2699 |
! |
|
2700 |
||
2701 |
recomputeHeightOfContents |
|
1087 | 2702 |
"recompute height of contents( scrolling ) |
2703 |
" |
|
542 | 2704 |
preferredExtent notNil ifTrue:[ |
1497 | 2705 |
preferredExtent y:(rowHeight * list size) |
542 | 2706 |
] ifFalse:[ |
2707 |
self preferredExtent |
|
2708 |
]. |
|
2709 |
! ! |
|
2710 |
||
2711 |
!DSVColumnView methodsFor:'scroller interface'! |
|
2712 |
||
2713 |
heightOfContents |
|
2714 |
"return the height of the contents in pixels |
|
2715 |
" |
|
1498 | 2716 |
preferredExtent isNil ifTrue:[ |
2717 |
self preferredExtent |
|
2718 |
]. |
|
2719 |
^ preferredExtent y |
|
542 | 2720 |
! |
2721 |
||
2722 |
innerHeight |
|
2723 |
"returns the inner height of the contents shown |
|
2724 |
" |
|
2725 |
^ height - margin - margin |
|
2726 |
||
2727 |
! |
|
2728 |
||
2729 |
innerWidth |
|
2730 |
"returns the inner width of the contents shown |
|
2731 |
" |
|
2732 |
^ width - margin - margin |
|
2733 |
||
2734 |
! |
|
2735 |
||
2736 |
verticalScrollStep |
|
2737 |
"return the amount to scroll when stepping up/down. |
|
2738 |
" |
|
2739 |
^ rowHeight |
|
2740 |
||
2741 |
||
2742 |
||
2743 |
! |
|
2744 |
||
2745 |
viewOrigin |
|
2746 |
"return the viewOrigin; thats the coordinate of the contents |
|
2747 |
which is shown topLeft in the view. |
|
2748 |
" |
|
2749 |
^ viewOrigin |
|
2750 |
||
2751 |
! |
|
2752 |
||
2753 |
widthOfContents |
|
2754 |
"return the width of the contents in pixels |
|
2755 |
" |
|
647 | 2756 |
preferredExtent isNil ifTrue:[ |
2757 |
self preferredExtent |
|
2758 |
]. |
|
2759 |
^ preferredExtent x |
|
542 | 2760 |
|
2761 |
! |
|
2762 |
||
2763 |
xOriginOfContents |
|
2764 |
"return the horizontal origin of the contents in pixels |
|
2765 |
" |
|
2766 |
^ viewOrigin x |
|
2767 |
||
2768 |
! |
|
2769 |
||
2770 |
yOriginOfContents |
|
2771 |
"return the vertical origin of the contents in pixels |
|
2772 |
" |
|
2773 |
^ viewOrigin y |
|
2774 |
||
2775 |
! ! |
|
2776 |
||
2777 |
!DSVColumnView methodsFor:'scrolling'! |
|
2778 |
||
2779 |
scrollTo:anOrigin redraw:doRedraw |
|
2780 |
"change origin to have newOrigin be visible at the top-left. |
|
2781 |
" |
|
1497 | 2782 |
|newOrg dltOrg wg |
2783 |
h "{ Class:SmallInteger }" |
|
2784 |
w "{ Class:SmallInteger }" |
|
2785 |
x "{ Class:SmallInteger }" |
|
2786 |
x0 "{ Class:SmallInteger }" |
|
2787 |
x1 "{ Class:SmallInteger }" |
|
2788 |
y "{ Class:SmallInteger }" |
|
2789 |
y0 "{ Class:SmallInteger }" |
|
2790 |
y1 "{ Class:SmallInteger }" |
|
2791 |
dX "{ Class:SmallInteger }" |
|
2792 |
dY "{ Class:SmallInteger }" |
|
2793 |
innerHG "{ Class:SmallInteger }" |
|
2794 |
innerWT "{ Class:SmallInteger }" |
|
2795 |
| |
|
542 | 2796 |
shown ifFalse:[ |
2797 |
^ self |
|
2798 |
]. |
|
612 | 2799 |
|
1448 | 2800 |
(wg := self windowGroup) notNil ifTrue:[ |
2801 |
wg processRealExposeEventsFor:self. |
|
542 | 2802 |
]. |
612 | 2803 |
|
542 | 2804 |
innerWT := self innerWidth. |
2805 |
innerHG := self innerHeight. |
|
2806 |
||
2807 |
h := viewOrigin y. |
|
2808 |
||
2809 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents |
|
2810 |
y > (dY := self maxViewOriginY) ifTrue:[ |
|
2811 |
y := dY max:h |
|
2812 |
] |
|
2813 |
] ifFalse:[ |
|
2814 |
y := y max:0. |
|
2815 |
]. |
|
2816 |
||
2817 |
(x := anOrigin x) > 0 ifTrue:[ |
|
2818 |
x := x min:(self widthOfContents - innerWT). |
|
2819 |
]. |
|
2820 |
x := x max:0. |
|
2821 |
newOrg := (x @ y). |
|
2822 |
dltOrg := newOrg - viewOrigin. |
|
2823 |
dX := dltOrg x. |
|
2824 |
dY := dltOrg y. |
|
2825 |
||
2826 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
|
2827 |
^ self |
|
2828 |
]. |
|
2829 |
self originWillChange. |
|
2830 |
viewOrigin := newOrg. |
|
2831 |
||
2832 |
doRedraw ifFalse:[ |
|
2833 |
^ self originChanged:dltOrg |
|
2834 |
]. |
|
2835 |
||
2836 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL |
|
2837 |
dY := dY abs. |
|
2838 |
||
2839 |
(dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2840 |
self invalidate. |
542 | 2841 |
] ifFalse:[ "/ COPY VERTICAL |
2842 |
y0 := y1 := margin + dY. |
|
2843 |
h := innerHG - dY. |
|
2844 |
||
2845 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0] |
|
2846 |
ifFalse:[y1 := margin. y := y1 + h]. |
|
2847 |
||
1460 | 2848 |
self copyFrom:self x:margin y:y0 toX:margin y:y1 width:innerWT height:h async:false. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2849 |
self invalidateX:margin y:y width:innerWT height:(innerHG - h). |
542 | 2850 |
] |
2851 |
] ifFalse:[ "/ SCROLL HORIZONTAL |
|
2852 |
dX := dX abs. |
|
2853 |
||
2854 |
innerWT - dX < 20 ifTrue:[ |
|
1487 | 2855 |
labelView invalidate. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2856 |
self invalidate. |
542 | 2857 |
] ifFalse:[ "/ COPY HORIZONTAL |
643 | 2858 |
x0 := x1 := dX + margin. |
542 | 2859 |
w := width - dX - margin. |
2860 |
||
643 | 2861 |
dltOrg x < 0 ifTrue:[x0 := x := margin ] |
2862 |
ifFalse:[x1 := margin. x := w]. |
|
542 | 2863 |
|
1460 | 2864 |
self copyFrom:self x:x0 y:margin toX:x1 y:margin width:w height:innerHG async:false. |
1487 | 2865 |
|
2866 |
labelView notNil ifTrue:[ |
|
2867 |
labelView copyFromX:x0 y:margin toX:x1 y:margin width:w invalidateX:x. |
|
2868 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2869 |
self invalidateX:x y:margin width:(width - w) height:innerHG. |
542 | 2870 |
] |
2871 |
]. |
|
2872 |
self originChanged:dltOrg. |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
2873 |
|
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
2874 |
"Modified: / 7.9.1998 / 16:39:49 / cg" |
542 | 2875 |
! |
2876 |
||
2877 |
scrollToRowAt:aRowNr colAt:aColNr |
|
2878 |
"make row at a row number in column at a column number visible |
|
2879 |
" |
|
1497 | 2880 |
|x "{ Class:SmallInteger }" |
2881 |
y "{ Class:SmallInteger }" |
|
2882 |
l "{ Class:SmallInteger }" |
|
2883 |
dY "{ Class:SmallInteger }" |
|
2884 |
dX "{ Class:SmallInteger }" |
|
2885 |
| |
|
2886 |
||
2887 |
( (aRowNr between:1 and:(list size)) |
|
2888 |
and:[aColNr between:0 and:(columnDescriptors size)] |
|
542 | 2889 |
) ifFalse:[ |
2890 |
^ self |
|
2891 |
]. |
|
2892 |
||
2893 |
dY := dX := 0. |
|
2894 |
y := self yVisibleOfRowNr:aRowNr. |
|
2895 |
||
2896 |
y < margin ifTrue:[ |
|
2897 |
dY := margin - y. |
|
2898 |
] ifFalse:[ |
|
2899 |
y := y + rowHeight. |
|
2900 |
l := height - margin. |
|
2901 |
y > l ifTrue:[dY := l - y] |
|
2902 |
]. |
|
2903 |
||
2904 |
aColNr == 0 ifTrue:[ |
|
2905 |
dY == 0 ifTrue:[^ self]. |
|
2906 |
dX := 0. |
|
2907 |
] ifFalse:[ |
|
2908 |
x := self xVisibleOfColNr:aColNr. |
|
2909 |
||
1163 | 2910 |
x <= margin ifTrue:[ |
542 | 2911 |
dX := margin - x |
2912 |
] ifFalse:[ |
|
1497 | 2913 |
x := x + (columnDescriptors at:aColNr) width. |
542 | 2914 |
l := width - margin. |
2915 |
x > l ifTrue:[dX := l - x] |
|
2916 |
] |
|
2917 |
]. |
|
2918 |
||
2919 |
(dX == 0 and:[dY == 0]) ifFalse:[ |
|
2920 |
self scrollTo:(viewOrigin - (dX @ dY)). |
|
2921 |
] |
|
2922 |
||
2923 |
||
2924 |
! |
|
2925 |
||
2926 |
scrollToSelection |
|
2927 |
"make selection visible |
|
2928 |
" |
|
607 | 2929 |
|rowNr| |
2930 |
||
2931 |
(rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
1497 | 2932 |
self scrollToRowAt:rowNr colAt:selectedColIndex |
542 | 2933 |
] |
2934 |
||
1506 | 2935 |
! |
2936 |
||
2937 |
scrollVerticalTo:aPixelOffset |
|
2938 |
"change origin to make aPixelOffset be the top line" |
|
2939 |
||
2940 |
|orgX orgY| |
|
2941 |
||
2942 |
orgX := viewOrigin x. |
|
2943 |
orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight. |
|
2944 |
^ self scrollTo:(orgX @ orgY). |
|
2945 |
||
1749 | 2946 |
! |
2947 |
||
2948 |
startAutoScroll:aBlock distance:aDistance |
|
2949 |
"setup for auto-scroll (when button-press-moving below view); |
|
2950 |
- timeDelta for scroll is computed from distance |
|
2951 |
" |
|
2952 |
|timeDelta| |
|
2953 |
||
2954 |
(autoScroll and:[aBlock notNil]) ifFalse:[ |
|
2955 |
^ self stopAutoScroll |
|
2956 |
]. |
|
2957 |
autoScrollBlock notNil ifTrue:[ |
|
2958 |
Processor removeTimedBlock:autoScrollBlock. |
|
2959 |
] ifFalse:[ |
|
2960 |
self compressMotionEvents:false. |
|
2961 |
]. |
|
2962 |
||
2963 |
timeDelta := 0.5 / (aDistance abs). |
|
2964 |
||
2965 |
autoScrollBlock := [ |
|
2966 |
aBlock value. |
|
2967 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
|
2968 |
]. |
|
2969 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
|
2970 |
||
2971 |
||
2972 |
! |
|
2973 |
||
2974 |
stopAutoScroll |
|
2975 |
"stop any autoScroll |
|
2976 |
" |
|
2977 |
autoScrollBlock notNil ifTrue:[ |
|
2978 |
Processor removeTimedBlock:autoScrollBlock. |
|
2979 |
autoScrollBlock := nil. |
|
2980 |
self compressMotionEvents:true. |
|
2981 |
]. |
|
2982 |
||
2983 |
||
542 | 2984 |
! ! |
2985 |
||
2986 |
!DSVColumnView methodsFor:'selection'! |
|
2987 |
||
607 | 2988 |
deselect |
2989 |
"deselect |
|
2990 |
" |
|
2991 |
self selectColIndex:0 rowIndex:0 |
|
2992 |
! |
|
2993 |
||
2994 |
firstIndexSelected |
|
809 | 2995 |
"returns index of first row selected or 0 |
607 | 2996 |
" |
2997 |
multipleSelectOk ifFalse:[ |
|
2998 |
^ selectedRowIndex |
|
2999 |
]. |
|
3000 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3001 |
^ selectedRowIndex at:1 |
|
3002 |
]. |
|
3003 |
^ 0 |
|
3004 |
! |
|
3005 |
||
542 | 3006 |
hasSelection |
607 | 3007 |
"returns true if a selection exists |
542 | 3008 |
" |
607 | 3009 |
^ self numberOfSelections ~~ 0 |
542 | 3010 |
|
3011 |
||
3012 |
! |
|
3013 |
||
607 | 3014 |
isInSelection:aRowNr |
3015 |
"return true, if row, aRowNr is in the selection |
|
542 | 3016 |
" |
607 | 3017 |
aRowNr ~~ 0 ifTrue:[ |
3018 |
multipleSelectOk ifFalse:[ |
|
3019 |
^ aRowNr == selectedRowIndex |
|
3020 |
]. |
|
3021 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3022 |
^ selectedRowIndex includes:aRowNr |
|
3023 |
] |
|
3024 |
]. |
|
3025 |
^ false |
|
3026 |
! |
|
3027 |
||
647 | 3028 |
isRowSelected:aRowNr |
3029 |
"return true, if row is in the selection |
|
3030 |
" |
|
3031 |
selectedColIndex == 0 ifTrue:[ |
|
3032 |
^ self isInSelection:aRowNr |
|
3033 |
]. |
|
3034 |
^ false |
|
3035 |
! |
|
3036 |
||
607 | 3037 |
isSelected:aRowNr inColumn:aColNr |
612 | 3038 |
"returns true if cell in a row; a row number, in a column, a column |
3039 |
number is selected. |
|
3040 |
" |
|
1042 | 3041 |
multipleSelectOk ifFalse:[ |
3042 |
aRowNr ~~ selectedRowIndex ifTrue:[ |
|
3043 |
^ false |
|
3044 |
] |
|
3045 |
] ifTrue:[ |
|
3046 |
(selectedRowIndex size ~~ 0 and:[selectedRowIndex includes:aRowNr]) ifFalse:[ |
|
3047 |
^ false |
|
3048 |
] |
|
607 | 3049 |
]. |
1042 | 3050 |
^ (selectedColIndex == 0 or:[selectedColIndex == aColNr]) |
3051 |
||
607 | 3052 |
! |
3053 |
||
809 | 3054 |
lastIndexSelected |
3055 |
"returns index of last row selected or 0 |
|
3056 |
" |
|
3057 |
multipleSelectOk ifFalse:[ |
|
3058 |
^ selectedRowIndex |
|
3059 |
]. |
|
3060 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3061 |
^ selectedRowIndex last |
|
3062 |
]. |
|
3063 |
^ 0 |
|
3064 |
! |
|
3065 |
||
607 | 3066 |
numberOfSelections |
3067 |
"return the number of selected rows |
|
3068 |
" |
|
3069 |
multipleSelectOk ifFalse:[ |
|
3070 |
^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
|
3071 |
]. |
|
3072 |
^ selectedRowIndex size |
|
542 | 3073 |
! |
3074 |
||
3075 |
selectColIndex:aColNr rowIndex:aRowNr |
|
3076 |
"change selection with notification |
|
3077 |
" |
|
3078 |
|oC oR| |
|
3079 |
||
607 | 3080 |
oC := self selectedColIndex. |
3081 |
oR := self selectedRowIndex. |
|
542 | 3082 |
|
3083 |
self setSelectColIndex:aColNr rowIndex:aRowNr. |
|
3084 |
||
607 | 3085 |
(oC ~~ self selectedColIndex or:[oR ~= self selectedRowIndex]) ifTrue:[ |
542 | 3086 |
self selectionChanged |
3087 |
]. |
|
3088 |
! |
|
3089 |
||
607 | 3090 |
selectRow:something |
542 | 3091 |
"select a row |
3092 |
" |
|
607 | 3093 |
^ self selectedRowIndex:something |
542 | 3094 |
! |
3095 |
||
809 | 3096 |
selectRowAt:rowNr colAt:colNr atPoint:aPoint |
3097 |
|v p| |
|
3098 |
||
3099 |
self selectColIndex:colNr rowIndex:rowNr. |
|
3100 |
||
3101 |
(v := self detectViewAt:aPoint in:editView) notNil ifTrue:[ |
|
3102 |
p := device translatePoint:aPoint from:(self id) to:(v id). |
|
3103 |
||
3104 |
self sensor pushEvent:(WindowEvent buttonEvent |
|
3105 |
for:v |
|
3106 |
type:#buttonPress:x:y: |
|
3107 |
arguments:(Array with:#select with:p x with:p y) |
|
3108 |
) |
|
3109 |
]. |
|
3110 |
||
3111 |
||
3112 |
! |
|
3113 |
||
607 | 3114 |
selectRowIndex:something |
3115 |
"set selection of rows |
|
542 | 3116 |
" |
607 | 3117 |
self selectColIndex:selectedColIndex rowIndex:something |
3118 |
||
3119 |
||
542 | 3120 |
! |
3121 |
||
3122 |
selectedColIndex |
|
3123 |
"returns selected column number or 0 |
|
3124 |
" |
|
3125 |
^ selectedColIndex |
|
3126 |
! |
|
3127 |
||
3128 |
selectedColumn |
|
3129 |
"returns selected column or nil |
|
3130 |
" |
|
3131 |
^ columnDescriptors at:selectedColIndex ifAbsent:nil. |
|
3132 |
! |
|
3133 |
||
3134 |
selectedRow |
|
607 | 3135 |
"returns selected row (or collection if multiple selection) or nil |
542 | 3136 |
" |
607 | 3137 |
multipleSelectOk ifFalse:[ |
3138 |
^ self at:selectedRowIndex ifAbsent:nil |
|
3139 |
]. |
|
3140 |
||
3141 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3142 |
^ selectedRowIndex collect:[:i| self at:i] |
|
3143 |
]. |
|
3144 |
^ nil |
|
3145 |
! |
|
3146 |
||
3147 |
selectedRow:something |
|
3148 |
"select something |
|
3149 |
" |
|
3150 |
self selectedRowIndex:something |
|
542 | 3151 |
! |
3152 |
||
3153 |
selectedRowIndex |
|
3154 |
"returns selected row number or 0 |
|
3155 |
" |
|
3156 |
^ selectedRowIndex |
|
3157 |
! |
|
3158 |
||
607 | 3159 |
selectedRowIndex:something |
3160 |
"set selection of rows |
|
3161 |
" |
|
3162 |
self selectColIndex:selectedColIndex rowIndex:something |
|
3163 |
||
3164 |
||
542 | 3165 |
! |
3166 |
||
3167 |
selectionChanged |
|
3168 |
"selection has changed |
|
3169 |
" |
|
1487 | 3170 |
|val| |
3171 |
||
3172 |
model notNil ifTrue:[ |
|
3173 |
val := self selectedRowIndex copy. |
|
3174 |
||
3175 |
(model respondsTo:#selectionIndex:) ifTrue:[ |
|
3176 |
model selectionIndex:val |
|
3177 |
] ifFalse:[ |
|
3178 |
useIndex ifFalse:[ model value:(self selectedRow) ] |
|
3179 |
ifTrue:[ model value:val ] |
|
3180 |
] |
|
3181 |
]. |
|
542 | 3182 |
|
3183 |
actionBlock notNil ifTrue:[ |
|
607 | 3184 |
actionBlock value:(self selectedRowIndex) |
3185 |
] |
|
3186 |
! |
|
3187 |
||
3188 |
selectionIndicesDo:aOneArgBlock |
|
3189 |
"evaluate block on each row selected; the argument to the row |
|
3190 |
is the index of the selected row |
|
3191 |
" |
|
3192 |
multipleSelectOk ifFalse:[ |
|
3193 |
selectedRowIndex ~~ 0 ifTrue:[ |
|
3194 |
aOneArgBlock value:selectedRowIndex |
|
3195 |
] |
|
3196 |
] ifTrue:[ |
|
3197 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3198 |
selectedRowIndex do:[:i| aOneArgBlock value:i ] |
|
3199 |
] |
|
542 | 3200 |
] |
3201 |
! |
|
3202 |
||
3203 |
setSelectColIndex:aColNr rowIndex:aRowNr |
|
3204 |
"change selection without notification |
|
3205 |
" |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3206 |
|editSpec rowNr colNr newCol oldCol oldRow sensor sglSelRow oldSz |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3207 |
keyBrdFwd filter edValue edView| |
542 | 3208 |
|
607 | 3209 |
rowNr := self validateSelection:aRowNr. |
542 | 3210 |
|
607 | 3211 |
multipleSelectOk ifTrue:[ |
3212 |
colNr := (rowNr size == 1) ifTrue:[aColNr] ifFalse:[0] |
|
3213 |
] ifFalse:[ |
|
3214 |
colNr := rowNr ~~ 0 ifTrue:[aColNr] ifFalse:[0] |
|
542 | 3215 |
]. |
3216 |
||
607 | 3217 |
(colNr := colNr ? 0) ~~ 0 ifTrue:[ |
3218 |
newCol := self columnAt:colNr. |
|
3219 |
newCol rendererType == #rowSelector ifTrue:[ |
|
3220 |
colNr := 0. |
|
3221 |
newCol := nil |
|
3222 |
] ifFalse:[ |
|
3223 |
multipleSelectOk ifTrue:[sglSelRow := rowNr at:1] |
|
3224 |
ifFalse:[sglSelRow := rowNr]. |
|
3225 |
||
3226 |
(newCol canSelect:sglSelRow) ifFalse:[ |
|
3227 |
newCol := nil. |
|
1112 | 3228 |
colNr := 0. |
3229 |
||
3230 |
selectRowOnDefault ifFalse:[ |
|
3231 |
rowNr := multipleSelectOk ifFalse:[0] ifTrue:[nil] |
|
3232 |
] |
|
607 | 3233 |
] |
3234 |
] |
|
3235 |
]. |
|
3236 |
||
3237 |
(rowNr = selectedRowIndex and:[colNr == selectedColIndex]) ifTrue:[ |
|
643 | 3238 |
^ self |
542 | 3239 |
]. |
3240 |
||
3241 |
"/ release old selection |
|
3242 |
||
612 | 3243 |
oldSz := self numberOfSelections. |
542 | 3244 |
oldCol := selectedColIndex. |
3245 |
oldRow := selectedRowIndex. |
|
612 | 3246 |
|
542 | 3247 |
selectedRowIndex := rowNr. |
3248 |
selectedColIndex := colNr. |
|
3249 |
||
612 | 3250 |
oldSz == 1 ifTrue:[ |
3251 |
multipleSelectOk ifTrue:[oldRow := oldRow at:1]. |
|
542 | 3252 |
|
612 | 3253 |
editValue notNil ifTrue:[ |
1215 | 3254 |
editValue removeDependent:self |
3255 |
]. |
|
3256 |
editView notNil ifTrue:[ |
|
3257 |
editView allSubViewsDo:[:aSubView| |
|
3258 |
aSubView perform:#accept ifNotUnderstood:nil. |
|
3259 |
] |
|
3260 |
]. |
|
3261 |
||
3262 |
editValue notNil ifTrue:[ |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3263 |
edValue := editValue value. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3264 |
edValue isSequenceable ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3265 |
edValue size == 0 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3266 |
edValue := nil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3267 |
] ifFalse:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3268 |
edValue isString not ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3269 |
edValue := edValue select:[:el| el notNil ]. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3270 |
edValue size == 0 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3271 |
edValue := nil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3272 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3273 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3274 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3275 |
]. |
1661 | 3276 |
(self columnAt:oldCol) at:oldRow put:edValue. |
3277 |
modifiedChannel notNil ifTrue:[ |
|
3278 |
modifiedChannel value:true |
|
3279 |
]. |
|
612 | 3280 |
editValue := nil |
3281 |
]. |
|
1111 | 3282 |
self destroyEditView. |
612 | 3283 |
]. |
3284 |
shown ifFalse:[^ self ]. |
|
542 | 3285 |
|
618 | 3286 |
oldSz > 1 ifTrue:[ "/ redraw old selection |
3287 |
oldRow do:[:aRowNr| "/ unselected if visible |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3288 |
self invalidateRowAt:aRowNr colAt:0 |
618 | 3289 |
] |
3290 |
] ifFalse:[ |
|
3291 |
oldSz == 1 ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3292 |
self invalidateRowAt:oldRow colAt:oldCol |
618 | 3293 |
] |
3294 |
]. |
|
3295 |
||
542 | 3296 |
"/ show new selection |
3297 |
||
3298 |
newCol notNil ifTrue:[ |
|
607 | 3299 |
self scrollToRowAt:sglSelRow colAt:colNr. |
833 | 3300 |
editSpec := newCol editorAt:sglSelRow. |
3301 |
||
3302 |
editSpec notNil ifTrue:[ |
|
1112 | 3303 |
editView := SimpleView extent:( (newCol width - (2 * separatorSize)) |
3304 |
@ (rowHeight - (2 * separatorSize)) |
|
607 | 3305 |
) |
3306 |
in:self. |
|
542 | 3307 |
self updateEditViewOrigin. |
1112 | 3308 |
|
1134 | 3309 |
(newCol containsText or:[newCol showSelectionHighLighted not]) ifTrue:[ |
1565 | 3310 |
editView viewBackground:(newCol backgroundColorAt:sglSelRow) |
1112 | 3311 |
] ifFalse:[ |
3312 |
editView viewBackground:hgLgBgColor |
|
3313 |
]. |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3314 |
edView := editSpec at:1. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3315 |
editView add:edView. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3316 |
oldSz := editSpec size. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3317 |
|
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3318 |
oldSz == 3 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3319 |
filter := [:aKey| #(#Tab #CursorUp #CursorDown) includes:aKey] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3320 |
] ifFalse:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3321 |
filter := [:aKey| aKey == #Tab] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3322 |
]. |
1111 | 3323 |
keyBrdFwd := KeyboardForwarder toView:self |
3324 |
condition:nil |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3325 |
filter:filter. |
1111 | 3326 |
|
3327 |
editView withAllSubViewsDo:[:aView| |
|
1112 | 3328 |
aView delegate:keyBrdFwd. |
3329 |
aView font:font. |
|
1111 | 3330 |
]. |
3331 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3332 |
(editValue := editSpec at:2 ifAbsent:nil) notNil ifTrue:[ |
809 | 3333 |
editValue addDependent:self. |
648 | 3334 |
]. |
542 | 3335 |
editView realize. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3336 |
edView canTab:true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3337 |
self windowGroup focusView:edView. |
1111 | 3338 |
|
542 | 3339 |
] ifFalse:[ |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3340 |
self invalidateRowAt:sglSelRow colAt:colNr |
612 | 3341 |
]. |
3342 |
] ifFalse:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3343 |
self selectionIndicesDo:[:i| self invalidateRowAt:i colAt:0 ]. |
612 | 3344 |
self scrollToRowAt:(self firstIndexSelected) colAt:0 |
3345 |
]. |
|
3346 |
||
3347 |
sensor := self sensor. "/ catch expose events |
|
3348 |
||
3349 |
[sensor hasExposeEventFor:nil] whileTrue:[ |
|
3350 |
self windowGroup processExposeEvents |
|
3351 |
]. |
|
3352 |
||
1661 | 3353 |
"Modified: / 30.1.2000 / 12:18:25 / cg" |
607 | 3354 |
! |
3355 |
||
3356 |
validateSelection:aSelection |
|
3357 |
|newSel| |
|
3358 |
||
3359 |
newSel := aSelection. |
|
3360 |
||
1497 | 3361 |
(list size == 0 or:[newSel isNil or:[newSel == 0]]) ifTrue:[ |
607 | 3362 |
^ multipleSelectOk ifFalse:[0] ifTrue:[nil] |
3363 |
]. |
|
3364 |
||
3365 |
newSel isNumber ifTrue:[ |
|
3366 |
^ multipleSelectOk ifFalse:[newSel] ifTrue:[OrderedCollection with:newSel] |
|
3367 |
]. |
|
3368 |
multipleSelectOk ifFalse:[ |
|
618 | 3369 |
newSel := self identityIndexOfRow:aSelection |
607 | 3370 |
] ifTrue:[ |
3371 |
newSel := nil. |
|
3372 |
||
3373 |
aSelection size ~~ 0 ifTrue:[ |
|
3374 |
aSelection first isNumber ifTrue:[ |
|
3375 |
newSel := aSelection |
|
3376 |
] ifFalse:[ |
|
3377 |
aSelection do:[:el||n| |
|
618 | 3378 |
(n := self identityIndexOfRow:el) ~~ 0 ifTrue:[ |
607 | 3379 |
newSel isNil ifTrue:[newSel := OrderedCollection new]. |
3380 |
newSel add:n |
|
3381 |
] |
|
3382 |
] |
|
3383 |
] |
|
3384 |
] |
|
3385 |
]. |
|
3386 |
^ newSel |
|
542 | 3387 |
! ! |
3388 |
||
3389 |
!DSVColumnView class methodsFor:'documentation'! |
|
3390 |
||
3391 |
version |
|
1778
51bbd960baf9
change registeredIcons from IdentityDictionary to Dictionary
ca
parents:
1776
diff
changeset
|
3392 |
^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.107 2000-07-17 13:23:30 ca Exp $' |
542 | 3393 |
! ! |