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