author | Claus Gittinger <cg@exept.de> |
Wed, 23 Feb 2000 15:27:10 +0100 | |
changeset 1721 | 92249c0b9300 |
parent 1711 | 97e1fd579b89 |
child 1722 | 9972e8bb1424 |
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 |
|
1711 | 698 |
columnAdaptor isValueModel ifTrue:[^ columnAdaptor value]. |
699 |
^ columnAdaptor |
|
700 |
! |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
701 |
|
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
702 |
columnAdaptor:something |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
703 |
"set the value of the instance variable 'columnAdaptor' (automatically generated)" |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
704 |
|
1711 | 705 |
columnAdaptor isValueModel ifTrue:[ |
706 |
columnAdaptor removeDependent:self |
|
707 |
]. |
|
708 |
(columnAdaptor := something) isValueModel ifTrue:[ |
|
709 |
columnAdaptor addDependent:self |
|
710 |
]. |
|
711 |
! |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
712 |
|
612 | 713 |
columnHolder |
1087 | 714 |
"get the valueHolder, which keeps the list of column descriptions |
715 |
" |
|
612 | 716 |
^ columnHolder |
717 |
||
718 |
! |
|
719 |
||
720 |
columnHolder:aValueHolder |
|
1087 | 721 |
"set the valueHolder, which keeps the list of column descriptions |
722 |
" |
|
612 | 723 |
|columns| |
724 |
||
725 |
columnHolder notNil ifTrue:[ |
|
726 |
columnHolder removeDependent:self |
|
727 |
]. |
|
728 |
||
729 |
(columnHolder := aValueHolder) notNil ifTrue:[ |
|
730 |
columnHolder addDependent:self. |
|
731 |
columns := columnHolder value. |
|
732 |
||
733 |
columns notNil ifTrue:[ |
|
734 |
self columnDescriptors:columns |
|
735 |
] |
|
736 |
]. |
|
737 |
||
1487 | 738 |
! |
739 |
||
740 |
listAt:index put:newElement |
|
741 |
"kludge callback, when an element hs to be replaced |
|
742 |
due to a col-adaptor returning a new row element |
|
743 |
" |
|
744 |
|list| |
|
745 |
||
746 |
(list := listHolder value) notNil ifTrue:[ |
|
747 |
list at:index put:newElement |
|
748 |
] |
|
749 |
! |
|
750 |
||
751 |
listHolder:aListHolder |
|
752 |
"set the valueHolder which holds the list of rows |
|
753 |
" |
|
754 |
listHolder ~~ aListHolder ifTrue:[ |
|
755 |
listHolder notNil ifTrue:[ |
|
756 |
listHolder removeDependent:self |
|
757 |
]. |
|
758 |
||
759 |
(listHolder := aListHolder) notNil ifTrue:[ |
|
760 |
listHolder addDependent:self |
|
761 |
] |
|
762 |
]. |
|
763 |
self pushEvent:#list: with:(listHolder value). |
|
764 |
||
765 |
! |
|
766 |
||
1721
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
767 |
menuPerformer |
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
768 |
"redefined to avoid sending the menuMessage to my valueHolder" |
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
769 |
|
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
770 |
menuPerformer notNil ifTrue:[^ menuPerformer]. |
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
771 |
^ self |
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
772 |
|
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
773 |
|
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
774 |
! |
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
775 |
|
1487 | 776 |
model:aModel |
777 |
"set the valueHolder which holds the selection and maybe the list of rows |
|
778 |
" |
|
779 |
model notNil ifTrue:[ |
|
780 |
model removeDependent:self. |
|
781 |
(model respondsTo:#list) ifTrue:[ |
|
782 |
(model list == listHolder) ifTrue:[ |
|
783 |
self listHolder:nil |
|
784 |
] |
|
785 |
] |
|
786 |
]. |
|
787 |
||
788 |
(model := aModel) notNil ifTrue:[ |
|
789 |
model addDependent:self. |
|
790 |
||
791 |
(aModel respondsTo:#list) ifTrue:[ |
|
792 |
self listHolder:model list |
|
793 |
] |
|
794 |
] |
|
795 |
||
612 | 796 |
! ! |
797 |
||
542 | 798 |
!DSVColumnView methodsFor:'accessing rows'! |
799 |
||
800 |
at:aRowNr |
|
801 |
"return the row at an index, aRowNr |
|
802 |
" |
|
618 | 803 |
|row| |
804 |
||
805 |
(row := list at:aRowNr) isNil ifTrue:[ |
|
806 |
lockRowIndex := aRowNr. |
|
807 |
||
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
808 |
(rowIfAbsentBlock notNil |
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
809 |
and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[ |
618 | 810 |
list at:aRowNr put:row. |
811 |
beDependentOfRows ifTrue:[row addDependent:self]. |
|
812 |
]. |
|
813 |
||
814 |
lockRowIndex := 0 |
|
815 |
]. |
|
816 |
^ row |
|
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
817 |
|
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
818 |
"Modified: / 31.7.1998 / 01:07:46 / cg" |
542 | 819 |
! |
820 |
||
821 |
at:aRowNr ifAbsent:exceptionBlock |
|
607 | 822 |
"return the row at a aRowNr. If the index is invalid, return the |
542 | 823 |
result of evaluating the exceptionblock |
824 |
" |
|
1497 | 825 |
(aRowNr between:1 and:list size) ifTrue:[ |
618 | 826 |
^ self at:aRowNr |
827 |
]. |
|
828 |
^ exceptionBlock value |
|
542 | 829 |
! |
830 |
||
831 |
at:aRowNr put:aRow |
|
832 |
"change the row at an index. The added row is returned |
|
833 |
" |
|
618 | 834 |
|row| |
835 |
||
836 |
lockRowIndex == aRowNr ifTrue:[ |
|
837 |
^ self |
|
838 |
]. |
|
839 |
row := list at:aRowNr. |
|
840 |
row == aRow ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
841 |
^ self invalidateRowAt:aRowNr |
618 | 842 |
]. |
843 |
||
542 | 844 |
beDependentOfRows ifTrue:[ |
618 | 845 |
(row := list at:aRowNr) notNil ifTrue:[ |
846 |
row removeDependent:self |
|
847 |
] |
|
542 | 848 |
]. |
618 | 849 |
|
607 | 850 |
list at:aRowNr put:aRow. |
618 | 851 |
|
852 |
aRow notNil ifTrue:[ "/ free list |
|
853 |
beDependentOfRows ifTrue:[ |
|
854 |
aRow addDependent:self |
|
855 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
856 |
self invalidateRowAt:aRowNr |
618 | 857 |
]. |
542 | 858 |
^ aRow. |
859 |
! |
|
860 |
||
861 |
first |
|
862 |
"return the first row |
|
863 |
" |
|
618 | 864 |
^ self at:1 |
865 |
! |
|
866 |
||
867 |
identityIndexOfRow:aRow |
|
868 |
"returns index of a row or 0 |
|
869 |
" |
|
870 |
(list size ~~ 0 and:[aRow notNil]) ifTrue:[ |
|
871 |
^ list identityIndexOf:aRow |
|
872 |
]. |
|
873 |
^ 0 |
|
542 | 874 |
! |
875 |
||
876 |
last |
|
877 |
"return the last row |
|
878 |
" |
|
1497 | 879 |
^ self at:(list size) |
542 | 880 |
! |
881 |
||
882 |
list |
|
883 |
"get the list of rows |
|
884 |
" |
|
885 |
^ list |
|
886 |
||
887 |
||
888 |
||
889 |
! |
|
890 |
||
891 |
list:aList |
|
892 |
"set the list of rows |
|
893 |
" |
|
1259 | 894 |
|makeDependent selectionHasChanged| |
656 | 895 |
|
618 | 896 |
"/ remove selection without redraw |
622 | 897 |
|
1259 | 898 |
selectionHasChanged := self hasSelection. |
899 |
||
622 | 900 |
editValue notNil ifTrue:[ |
901 |
editValue removeDependent:self. |
|
902 |
editValue := nil |
|
903 |
]. |
|
1111 | 904 |
self destroyEditView. |
622 | 905 |
|
618 | 906 |
selectedColIndex := 0. |
907 |
selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0]. |
|
542 | 908 |
|
612 | 909 |
shown ifFalse:[ |
910 |
preferredExtent := nil |
|
911 |
] ifTrue:[ |
|
912 |
aList size ~~ 0 ifTrue:[ "/ otherwise keep old values |
|
1497 | 913 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
612 | 914 |
preferredExtent := nil. |
618 | 915 |
] |
542 | 916 |
]. |
917 |
||
656 | 918 |
(makeDependent := beDependentOfRows) ifTrue:[ |
919 |
self beDependentOfRows:false. |
|
920 |
]. |
|
643 | 921 |
|
922 |
aList size ~~ 0 ifTrue:[ |
|
923 |
list := OrderedCollection new:(aList size). |
|
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
924 |
aList do:[:el| list add:el ]. |
542 | 925 |
] ifFalse:[ |
643 | 926 |
list := nil |
542 | 927 |
]. |
656 | 928 |
self beDependentOfRows:makeDependent. |
542 | 929 |
|
612 | 930 |
shown ifTrue:[ |
1484 | 931 |
self fitColumns |
637 | 932 |
]. |
1259 | 933 |
selectionHasChanged ifTrue:[ |
934 |
self selectionChanged. |
|
935 |
]. |
|
542 | 936 |
|
937 |
||
938 |
! ! |
|
939 |
||
940 |
!DSVColumnView methodsFor:'accessing visibility'! |
|
941 |
||
942 |
font:aFont |
|
943 |
"set the font for all shown rows. |
|
944 |
" |
|
945 |
(aFont notNil and:[aFont ~~ font]) ifTrue:[ |
|
1480 | 946 |
super font:(aFont onDevice:device). |
542 | 947 |
realized ifTrue:[ |
1497 | 948 |
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
|
949 |
self preferredExtentChanged. |
542 | 950 |
self invalidate. |
951 |
self contentsChanged |
|
643 | 952 |
] |
542 | 953 |
] |
954 |
||
955 |
! |
|
956 |
||
607 | 957 |
has3Dseparators |
958 |
"returns true if shown in 3D mode |
|
959 |
" |
|
960 |
^ separatorSize ~~ 1 |
|
542 | 961 |
! |
962 |
||
607 | 963 |
has3Dseparators:aBool |
964 |
"enable or disable 3D mode |
|
965 |
" |
|
966 |
|newSepSize| |
|
542 | 967 |
|
637 | 968 |
newSepSize := aBool ifTrue:[2] ifFalse:[1]. |
607 | 969 |
|
970 |
newSepSize ~~ separatorSize ifTrue:[ |
|
971 |
separatorSize := newSepSize. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
972 |
|
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
973 |
realized ifTrue:[ |
1497 | 974 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
1136 | 975 |
self preferredExtentChanged. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
976 |
self invalidate. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
977 |
self contentsChanged |
647 | 978 |
] |
542 | 979 |
] |
980 |
||
981 |
||
982 |
! |
|
983 |
||
984 |
horizontalSpacing |
|
985 |
"horizontal spacing used by columns |
|
986 |
" |
|
563 | 987 |
^ horizontalSpacing |
988 |
! |
|
989 |
||
990 |
horizontalSpacing:aNumber |
|
991 |
"horizontal spacing used by columns |
|
992 |
" |
|
993 |
horizontalSpacing ~~ aNumber ifTrue:[ |
|
994 |
horizontalSpacing := aNumber. |
|
995 |
self preferredExtentChanged. |
|
996 |
]. |
|
542 | 997 |
! |
998 |
||
1487 | 999 |
showLabels |
1000 |
"control the labels view to be visible or unvisible |
|
1001 |
" |
|
1002 |
^ labelView isVisible |
|
1003 |
||
1004 |
! |
|
1005 |
||
1006 |
showLabels:aState |
|
1007 |
"control the labels view to be visible or unvisible |
|
1008 |
" |
|
1009 |
labelView isVisible:aState |
|
1010 |
! |
|
1011 |
||
542 | 1012 |
verticalSpacing |
1013 |
"vertical spacing used by columns |
|
1014 |
" |
|
563 | 1015 |
^ verticalSpacing |
1016 |
! |
|
1017 |
||
1018 |
verticalSpacing:aNumber |
|
1019 |
"vertical spacing used by columns |
|
1020 |
" |
|
1021 |
verticalSpacing ~~ aNumber ifTrue:[ |
|
1022 |
verticalSpacing := aNumber. |
|
1023 |
self preferredExtentChanged. |
|
1024 |
]. |
|
542 | 1025 |
! ! |
1026 |
||
1027 |
!DSVColumnView methodsFor:'adding & removing rows'! |
|
1028 |
||
1029 |
add:aRow |
|
618 | 1030 |
"insert row at end |
542 | 1031 |
" |
1497 | 1032 |
^ self add:aRow beforeIndex:(1 + list size) |
542 | 1033 |
! |
1034 |
||
1035 |
add:aRow afterIndex:aRowNr |
|
1036 |
"add a new row after slot aRowNr and redisplay; returns nil in case |
|
618 | 1037 |
of an invalid index or the row |
542 | 1038 |
" |
1039 |
^ self add:aRow beforeIndex:(aRowNr + 1) |
|
1040 |
! |
|
1041 |
||
1042 |
add:aRow beforeIndex:aRowNr |
|
1043 |
"add a new row before slot aRowNr and redisplay; returns nil in case |
|
618 | 1044 |
of an invalid index or the row |
542 | 1045 |
" |
861 | 1046 |
self addAll:(Array with:aRow) beforeIndex:aRowNr. |
1047 |
^ aRow. |
|
1048 |
! |
|
1049 |
||
1050 |
addAll:aList beforeIndex:start |
|
1051 |
"add a collection of rows before slot start and redisplay |
|
1052 |
" |
|
1053 |
|y0 y1 yD h dH size noSel| |
|
1054 |
||
1055 |
(size := aList size) == 0 ifTrue:[ |
|
1056 |
^ self |
|
1057 |
]. |
|
1058 |
||
1497 | 1059 |
list size == 0 ifTrue:[ |
861 | 1060 |
^ self list:aList |
618 | 1061 |
]. |
643 | 1062 |
|
618 | 1063 |
beDependentOfRows ifTrue:[ |
861 | 1064 |
aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]] |
542 | 1065 |
]. |
637 | 1066 |
|
861 | 1067 |
noSel := self numberOfSelections. |
1068 |
||
1069 |
noSel ~~ 0 ifTrue:[ |
|
1070 |
multipleSelectOk ifFalse:[ |
|
1071 |
selectedRowIndex >= start ifTrue:[ |
|
1072 |
selectedRowIndex := selectedRowIndex + size |
|
1073 |
] |
|
1074 |
] ifTrue:[ |
|
1075 |
1 to:noSel do:[:i||v| |
|
1076 |
(v := selectedRowIndex at:i) >= start ifTrue:[ |
|
1077 |
selectedRowIndex at:i put:(v + size) |
|
607 | 1078 |
] |
1079 |
] |
|
1080 |
] |
|
542 | 1081 |
]. |
861 | 1082 |
list addAll:aList beforeIndex:start. |
1083 |
self recomputeHeightOfContents. |
|
1084 |
||
1085 |
y0 := (start - 1) * rowHeight. |
|
1086 |
yD := size * rowHeight. |
|
1087 |
y1 := y0 + yD. |
|
542 | 1088 |
|
1089 |
y0 < viewOrigin y ifTrue:[ |
|
1090 |
self originWillChange. |
|
861 | 1091 |
viewOrigin y:(yD + viewOrigin y). |
1092 |
self originChanged:(0 @ yD). |
|
1093 |
]. |
|
1094 |
||
1095 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
|
1483 | 1096 |
self invalidate. |
861 | 1097 |
^ self contentsChanged. |
542 | 1098 |
]. |
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
1099 |
|
861 | 1100 |
y0 := self yVisibleOfRowNr:start. |
1258 | 1101 |
h := height - margin. |
1102 |
y1 := y0 + yD min:h. |
|
1103 |
||
1104 |
(y1 > margin and:[y0 < h]) ifTrue:[ |
|
861 | 1105 |
h := h - y1. |
1106 |
y0 := y0 max:margin. |
|
1107 |
dH := y1 - y0. |
|
1108 |
||
1109 |
start == list size ifFalse:[ |
|
1487 | 1110 |
self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:h async:false |
861 | 1111 |
]. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1112 |
self invalidateX:margin y:y0 width:width - margin - margin height:dH. |
542 | 1113 |
]. |
1114 |
self contentsChanged. |
|
861 | 1115 |
|
567 | 1116 |
! |
1117 |
||
542 | 1118 |
addFirst:aRow |
618 | 1119 |
"insert a row at start |
542 | 1120 |
" |
1121 |
^ self add:aRow beforeIndex:1 |
|
1122 |
! |
|
1123 |
||
1487 | 1124 |
remove:aRow |
1125 |
"remove a row |
|
1126 |
" |
|
1127 |
|idx| |
|
1128 |
||
1129 |
idx := list identityIndexOf:aRow. |
|
1130 |
||
1131 |
idx ~~ 0 ifTrue:[ |
|
1132 |
self removeFrom:idx to:idx. |
|
1133 |
]. |
|
1134 |
^ aRow |
|
1135 |
! |
|
1136 |
||
542 | 1137 |
removeFirst |
1138 |
"remove first row; returns the removed row |
|
1139 |
" |
|
1112 | 1140 |
^ self removeIndex:1 |
542 | 1141 |
! |
1142 |
||
861 | 1143 |
removeFrom:startIndex to:stopIndex |
1144 |
"remove rows from start to stop |
|
542 | 1145 |
" |
861 | 1146 |
|coll noRedraw |
1147 |
noSel "{ Class: SmallInteger }" |
|
1148 |
size "{ Class: SmallInteger }" |
|
1149 |
start "{ Class: SmallInteger }" |
|
1150 |
stop "{ Class: SmallInteger }" |
|
1151 |
y0 "{ Class: SmallInteger }" |
|
1152 |
y1 "{ Class: SmallInteger }" |
|
1153 |
oY "{ Class: SmallInteger }" |
|
1154 |
dY "{ Class: SmallInteger }" |
|
1155 |
yB "{ Class: SmallInteger }" |
|
1156 |
h "{ Class: SmallInteger }" |
|
1157 |
| |
|
1158 |
||
1159 |
( (start := startIndex) < 1 |
|
1160 |
or:[(stop := stopIndex) > list size] |
|
1161 |
) ifTrue:[ |
|
1162 |
^ self subscriptBoundsError:start |
|
618 | 1163 |
]. |
861 | 1164 |
size := stop - start + 1. |
1165 |
||
1166 |
beDependentOfRows ifTrue:[ |
|
1167 |
list from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]]. |
|
1168 |
]. |
|
1169 |
noSel := self numberOfSelections. |
|
1170 |
||
1171 |
noSel ~~ 0 ifTrue:[ |
|
1172 |
noSel == 1 ifTrue:[ |
|
1173 |
noSel := self firstIndexSelected. |
|
1174 |
||
1175 |
noSel < start ifFalse:[ |
|
1176 |
noSel > stop ifTrue:[ |
|
1177 |
noSel := noSel - size. |
|
1178 |
||
1179 |
multipleSelectOk ifFalse:[selectedRowIndex := noSel] |
|
1180 |
ifTrue:[selectedRowIndex at:1 put:noSel] |
|
1181 |
] ifFalse:[ |
|
637 | 1182 |
editValue notNil ifTrue:[ |
1183 |
editValue removeDependent:self. |
|
1184 |
editValue := nil. |
|
1185 |
]. |
|
861 | 1186 |
self deselect. |
637 | 1187 |
] |
607 | 1188 |
] |
1189 |
] ifFalse:[ |
|
861 | 1190 |
coll := OrderedCollection new:noSel. |
1191 |
||
1192 |
selectedRowIndex do:[:i| |
|
1193 |
i < start ifTrue:[ |
|
1194 |
coll add:i |
|
1195 |
] ifFalse:[ |
|
1196 |
i > stop ifTrue:[ |
|
1197 |
coll add:(i - size) |
|
1198 |
] |
|
1199 |
] |
|
1200 |
]. |
|
1201 |
coll size == 0 ifTrue:[ |
|
1202 |
self deselect |
|
1203 |
] ifFalse:[ |
|
1204 |
selectedRowIndex := coll |
|
1205 |
] |
|
542 | 1206 |
] |
1207 |
]. |
|
861 | 1208 |
list removeFrom:start to:stop. |
1209 |
||
1210 |
y0 := start - 1 * rowHeight. |
|
1211 |
dY := size * rowHeight. |
|
1212 |
y1 := dY + y0. |
|
542 | 1213 |
yB := y1 + margin - viewOrigin y. |
1214 |
self recomputeHeightOfContents. |
|
1215 |
||
1216 |
y0 < (oY := viewOrigin y) ifTrue:[ |
|
1217 |
(noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY] |
|
861 | 1218 |
ifTrue:[dY := dY negated]. |
542 | 1219 |
self originWillChange. |
1220 |
viewOrigin y:(dY + oY). |
|
1221 |
self originChanged:(0 @ dY). |
|
1222 |
] ifFalse:[ |
|
1223 |
noRedraw := y0 > (height + viewOrigin y) |
|
1224 |
]. |
|
1225 |
||
1483 | 1226 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
1227 |
self invalidate. |
|
1228 |
^ self contentsChanged. |
|
1229 |
]. |
|
1230 |
||
542 | 1231 |
(noRedraw or:[shown not]) ifFalse:[ |
1232 |
y1 := yB. |
|
861 | 1233 |
y0 := self yVisibleOfRowNr:start. |
542 | 1234 |
h := height - margin - yB. |
1235 |
y0 := y0 max:margin. |
|
1236 |
||
561 | 1237 |
h > 0 ifTrue:[ |
1487 | 1238 |
self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:false |
561 | 1239 |
]. |
542 | 1240 |
y0 := y0 + h. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1241 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
542 | 1242 |
]. |
1243 |
self contentsChanged. |
|
861 | 1244 |
|
1245 |
! |
|
1246 |
||
1247 |
removeIndex:aRowNr |
|
1248 |
"remove row at an index; returns the removed row |
|
1249 |
" |
|
1250 |
|row| |
|
1251 |
||
1252 |
row := list at:aRowNr ifAbsent:nil. |
|
1253 |
self removeFrom:aRowNr to:aRowNr. |
|
1254 |
^ row |
|
542 | 1255 |
! |
1256 |
||
1257 |
removeLast |
|
1258 |
"remove last row; the row is returned |
|
1259 |
" |
|
1497 | 1260 |
^ self removeIndex:(list size) |
542 | 1261 |
! ! |
1262 |
||
1263 |
!DSVColumnView methodsFor:'change & update'! |
|
1264 |
||
1492 | 1265 |
changeWidthOfColumn:aColumn deltaX:aDeltaX |
1266 |
||
1267 |
aColumn setDescWidth:(aColumn width + aDeltaX). |
|
1268 |
preferredExtent notNil ifTrue:[self fitColumns] |
|
1269 |
! |
|
1270 |
||
1487 | 1271 |
sizeChanged:how |
1272 |
"size changed - move origin up if possible |
|
1273 |
change the layout of the labelView dependent on my layout |
|
1274 |
" |
|
1275 |
|lyt| |
|
1276 |
||
1277 |
super sizeChanged:how. |
|
1278 |
||
1279 |
shown ifTrue:[ |
|
1280 |
labelView isVisible ifTrue:[ |
|
1281 |
lyt := labelView layout. |
|
1282 |
lyt leftOffset:(layout leftOffset). |
|
1283 |
lyt rightOffset:(layout rightOffset). |
|
1284 |
labelView layout:lyt. |
|
1285 |
]. |
|
1286 |
self fitColumns. |
|
1287 |
] |
|
859 | 1288 |
! |
1289 |
||
1487 | 1290 |
update:what with:aPara from:chgObj |
542 | 1291 |
"one of my rows/cells changed its value |
1292 |
" |
|
1673
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1293 |
|row newValue realValue list arg1 arg2 col idx| |
1487 | 1294 |
|
1295 |
chgObj == columnHolder ifTrue:[ |
|
612 | 1296 |
^ self columnDescriptors:(columnHolder value) |
622 | 1297 |
]. |
1711 | 1298 |
|
1299 |
chgObj == columnAdaptor ifTrue:[ |
|
1300 |
col := columnAdaptor value. |
|
1301 |
columnDescriptors do:[:aCol| aCol columnAdaptor:col]. |
|
1302 |
^ self invalidate |
|
1303 |
]. |
|
1304 |
||
1487 | 1305 |
chgObj == editValue ifTrue:[ |
1227 | 1306 |
newValue := editValue value. |
1673
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1307 |
col := self selectedColumn. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1308 |
idx := self firstIndexSelected. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1309 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1310 |
col at:idx put:newValue. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1311 |
realValue := col at:idx. |
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1312 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1313 |
"/ !!!! 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
|
1314 |
|
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1315 |
(chgObj == editValue and:[realValue ~= newValue]) ifTrue:[ |
1227 | 1316 |
"/ some validation by the row-object; the stored value |
1317 |
"/ is different from what I think. |
|
1318 |
"/ update my input fields modelValue |
|
1319 |
editValue value:realValue. |
|
1320 |
]. |
|
1673
67898506ba03
bug fix in update:with:from: model can changed during setting
ca
parents:
1668
diff
changeset
|
1321 |
|
1661 | 1322 |
modifiedChannel notNil ifTrue:[ |
1323 |
modifiedChannel value:true. |
|
1324 |
]. |
|
1227 | 1325 |
^ self |
622 | 1326 |
]. |
1327 |
||
1487 | 1328 |
chgObj == model ifTrue:[ |
1329 |
(what == #selectionIndex or:[what == #selection]) ifTrue:[ |
|
1330 |
^ self selectRowIndex:(model selectionIndex copy) |
|
1331 |
]. |
|
1332 |
what == #list ifTrue:[ |
|
1333 |
^ self listHolder:model list |
|
1334 |
]. |
|
1335 |
what == #value ifTrue:[ |
|
1336 |
model == listHolder ifTrue:[ |
|
1337 |
self list:(listHolder value) |
|
1338 |
] ifFalse:[ |
|
1339 |
self selectRowIndex:model value |
|
1340 |
] |
|
1341 |
]. |
|
1342 |
^ self |
|
1343 |
]. |
|
1344 |
||
1345 |
chgObj == listHolder ifTrue:[ |
|
1346 |
list := listHolder value. |
|
1347 |
||
1348 |
what == #value ifTrue:[ |
|
1349 |
^ self list:list |
|
1350 |
]. |
|
1351 |
aPara isCollection ifTrue:[ |
|
1352 |
arg1 := aPara at:1. |
|
1353 |
arg2 := aPara at:2. |
|
1354 |
] ifFalse:[ |
|
1355 |
arg1 := arg2 := aPara |
|
1356 |
]. |
|
1357 |
||
1358 |
what == #at: ifTrue:[ |
|
1359 |
^ self at:arg1 put:(list at:arg1) |
|
1360 |
]. |
|
1361 |
||
1362 |
what == #insert: ifTrue:[ |
|
1363 |
^ self add:(list at:arg1) beforeIndex:arg1 |
|
1364 |
]. |
|
1365 |
||
1366 |
what == #remove: ifTrue:[ |
|
1367 |
^ self removeFrom:arg1 to:arg1 |
|
1368 |
]. |
|
1369 |
what == #removeFrom: ifTrue:[ |
|
1370 |
list size == 0 ifTrue:[self list:nil] |
|
1371 |
ifFalse:[self removeFrom:arg1 to:arg2]. |
|
1372 |
^ self |
|
1373 |
]. |
|
1374 |
||
1375 |
what == #insertCollection: ifTrue:[ |
|
1376 |
arg2 ~~ 0 ifTrue:[ |
|
1377 |
self addAll:(list copyFrom:arg1 to:(arg1 + arg2 - 1)) beforeIndex:arg1 |
|
1378 |
]. |
|
1379 |
^ self. |
|
1380 |
]. |
|
1381 |
what == #replace: ifTrue:[ |
|
1382 |
arg1 to:arg2 do:[:i| self at:i put:(list at:i) ]. |
|
1383 |
^ self |
|
1384 |
]. |
|
1385 |
^ self |
|
1386 |
]. |
|
1593 | 1387 |
arg1 := aPara ? what. |
1487 | 1388 |
row := (what isNumber) ifTrue:[what] ifFalse:[chgObj]. |
1593 | 1389 |
self redrawVisibleRow:row readSelector:arg1. |
1390 |
||
1661 | 1391 |
"Modified: / 30.1.2000 / 12:16:49 / cg" |
809 | 1392 |
! ! |
1393 |
||
1394 |
!DSVColumnView methodsFor:'drag & drop'! |
|
1395 |
||
824 | 1396 |
canDrag |
1397 |
"returns true if dragging is enabled |
|
1398 |
" |
|
1399 |
^ dropSource notNil |
|
1400 |
||
1401 |
! |
|
1402 |
||
1403 |
dropSource |
|
1404 |
"returns the dropSource or nil |
|
809 | 1405 |
" |
824 | 1406 |
^ dropSource |
1407 |
||
1408 |
||
1409 |
! |
|
1410 |
||
1411 |
dropSource:aDropSourceOrNil |
|
1412 |
"set the dropSource or nil |
|
1413 |
" |
|
1414 |
dropSource := aDropSourceOrNil. |
|
1415 |
||
809 | 1416 |
|
1417 |
! |
|
1418 |
||
824 | 1419 |
dropTarget |
1420 |
"returns the dropTarget or nil |
|
809 | 1421 |
" |
824 | 1422 |
^ dropTarget |
1423 |
||
1424 |
! |
|
1425 |
||
1426 |
dropTarget:aDropTragetOrNil |
|
1427 |
"set the dropTarget or nil |
|
1428 |
" |
|
1429 |
dropTarget := aDropTragetOrNil. |
|
1430 |
||
1431 |
! |
|
1432 |
||
1433 |
startDragAt:aPoint |
|
1434 |
(dragIsActive not and:[dropSource notNil]) ifTrue:[ |
|
809 | 1435 |
dragIsActive := true. |
824 | 1436 |
dropSource startDragIn:self at:aPoint |
809 | 1437 |
] |
824 | 1438 |
|
542 | 1439 |
! ! |
1440 |
||
637 | 1441 |
!DSVColumnView methodsFor:'drawing'! |
1442 |
||
1443 |
colorOnDevice:aColor |
|
1444 |
"returns color on device |
|
1445 |
" |
|
1446 |
|col| |
|
1447 |
||
641 | 1448 |
aColor = Color noColor ifFalse:[ |
1449 |
col := colorMap at:aColor ifAbsent:nil. |
|
637 | 1450 |
|
641 | 1451 |
col isNil ifTrue:[ |
1480 | 1452 |
colorMap at:aColor put:(col := aColor onDevice:device) |
641 | 1453 |
]. |
1454 |
^ col |
|
637 | 1455 |
]. |
641 | 1456 |
^ bgColor |
637 | 1457 |
! |
1458 |
||
1459 |
forceRedraw |
|
1460 |
"a redraw forced by any other component |
|
1461 |
" |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1462 |
shown ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1463 |
self invalidate |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1464 |
] |
637 | 1465 |
! |
1466 |
||
1467 |
invalidate |
|
1468 |
"recompute extent before repair range |
|
1469 |
" |
|
1470 |
self recomputeHeightOfContents. |
|
1471 |
super invalidate. |
|
1472 |
||
1473 |
||
1474 |
! |
|
1475 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1476 |
invalidateRowAt:aRowNr |
637 | 1477 |
"redraw total row at an index |
1478 |
" |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1479 |
self invalidateRowAt:aRowNr colAt:0 |
637 | 1480 |
! |
1481 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1482 |
invalidateRowAt:aRowNr colAt:aColNr |
637 | 1483 |
"redraw visible row in case of aColNr == 0 or the column in a row; |
1484 |
in case that the row/column is hidden no redraw is done |
|
1485 |
" |
|
1497 | 1486 |
|x "{ Class:SmallInteger }" |
1487 |
y "{ Class:SmallInteger }" |
|
1488 |
h "{ Class:SmallInteger }" |
|
1489 |
w "{ Class:SmallInteger }" |
|
1490 |
| |
|
1491 |
||
1492 |
(shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[ |
|
1131 | 1493 |
h := rowHeight. |
1497 | 1494 |
y := self yVisibleOfRowNr:aRowNr. |
1495 |
||
1496 |
y < margin ifTrue:[ |
|
637 | 1497 |
(h := h + y) <= margin ifTrue:[ |
1498 |
^ self |
|
1499 |
]. "/ row not visible |
|
1500 |
h := h - margin. |
|
1501 |
y := margin. |
|
1502 |
] ifFalse:[ |
|
1503 |
y >= height ifTrue:[^ self]. |
|
1504 |
]. |
|
1505 |
aColNr ~~ 0 ifTrue:[ "/ redraw column in row |
|
1506 |
w := (self columnAt:aColNr) width. |
|
1497 | 1507 |
x := self xVisibleOfColNr:aColNr. |
1508 |
||
1509 |
x < margin ifTrue:[ |
|
637 | 1510 |
(w := w + x) <= margin ifTrue:[ |
1511 |
^ self |
|
1512 |
]. "/ column not visible |
|
1513 |
w := w - margin. |
|
1514 |
x := margin. |
|
1515 |
] ifFalse:[ |
|
1516 |
x >= width ifTrue:[^ self]. |
|
1517 |
] |
|
1518 |
] ifFalse:[ "/ redraw whole row |
|
1519 |
x := margin. |
|
1520 |
w := width. |
|
1521 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1522 |
self invalidateX:x y:y width:w height:h |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1523 |
] |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1524 |
! |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1525 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1526 |
invalidateX:x y:y width:w height:h |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1527 |
"invalidate a rectangle |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1528 |
" |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1529 |
shown ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1530 |
self invalidate:(Rectangle left:x top:y width:w height:h) |
637 | 1531 |
] |
1532 |
! |
|
1533 |
||
1534 |
redrawVisibleRow:aRow |
|
1535 |
"redraw row if visible |
|
1536 |
" |
|
809 | 1537 |
self redrawVisibleRow:aRow colAt:0 |
1538 |
||
1539 |
! |
|
1540 |
||
1541 |
redrawVisibleRow:aRow colAt:aColNr |
|
1542 |
"redraw row if visible |
|
1543 |
" |
|
637 | 1544 |
|start "{ Class:SmallInteger }" |
1545 |
stop "{ Class:SmallInteger }" |
|
1546 |
| |
|
1547 |
||
1548 |
(start := self indexOfFirstRowShown) ~~ 0 ifTrue:[ |
|
1497 | 1549 |
stop := (start + (height // rowHeight)) min:(list size). |
637 | 1550 |
|
1551 |
aRow isNumber ifTrue:[ |
|
1552 |
(aRow between:start and:stop) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1553 |
self invalidateRowAt:aRow colAt:aColNr |
637 | 1554 |
] |
1555 |
] ifFalse:[ |
|
1556 |
start to:stop do:[:i| |
|
1557 |
(self at:i) == aRow ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1558 |
^ self invalidateRowAt:i colAt:aColNr |
637 | 1559 |
] |
1560 |
] |
|
1561 |
] |
|
1562 |
] |
|
809 | 1563 |
|
1564 |
||
1565 |
! |
|
1566 |
||
1567 |
redrawVisibleRow:aRow readSelector:aSelector |
|
1568 |
"redraw a column identified by its read selector; if no column with |
|
1569 |
the specified read selector is detected, the whole line is drawn. |
|
1570 |
" |
|
1571 |
|row idx| |
|
1572 |
||
1573 |
aSelector isNil ifTrue:[ |
|
1574 |
idx := 0 |
|
1575 |
] ifFalse:[ |
|
1576 |
(row := aRow) isNumber ifTrue:[ |
|
1577 |
(row := self at:aRow) isNil ifTrue:[ ^ self ] |
|
1578 |
]. |
|
1579 |
idx := columnDescriptors findFirst:[:aCol||desc| |
|
1580 |
aCol description readSelector == aSelector |
|
1581 |
] |
|
1582 |
]. |
|
1583 |
self redrawVisibleRow:aRow colAt:idx |
|
1584 |
||
1585 |
||
1586 |
||
1587 |
||
637 | 1588 |
! |
1589 |
||
1590 |
redrawX:x y:y width:w height:h |
|
1591 |
"redraw part of myself immediately, given logical coordinates |
|
1592 |
" |
|
1112 | 1593 |
|c0 savClip rctg |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1594 |
start "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1595 |
stop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1596 |
x0 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1597 |
x1 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1598 |
maxX "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1599 |
yTop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1600 |
yBot "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1601 |
clHg "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1602 |
size "{ Class:SmallInteger }" |
637 | 1603 |
| |
1604 |
||
1605 |
shown ifFalse:[^ self]. |
|
1606 |
self paint:bgColor. |
|
1115 | 1607 |
|
1608 |
columnDescriptors isEmpty ifTrue:[ |
|
1609 |
^ self fillRectangleX:x y:y width:w height:h |
|
1610 |
]. |
|
1131 | 1611 |
size := list size. |
1115 | 1612 |
yTop := margin - viewOrigin y. |
1613 |
c0 := y - yTop max:0. |
|
1614 |
start := (c0 // rowHeight) + 1. |
|
1131 | 1615 |
stop := (c0 + h - 1 // rowHeight + 1) min:size. |
1115 | 1616 |
|
1617 |
stop < start ifTrue:[ |
|
1618 |
^ self fillRectangleX:x y:y width:w height:h |
|
1619 |
]. |
|
1620 |
savClip := clipRect. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1621 |
|
1115 | 1622 |
maxX := (x + w) min:(width - margin). |
1623 |
x0 := margin - viewOrigin x. |
|
1624 |
yTop := yTop + ((start - 1) * rowHeight). |
|
1625 |
rctg := Rectangle left:x top:y width:w height:h. |
|
1131 | 1626 |
clHg := (stop - start + 1) * rowHeight. |
1627 |
yBot := yTop + clHg. |
|
1628 |
||
1629 |
columnDescriptors do:[:aCol| |
|
1115 | 1630 |
x1 := x0 + aCol width. |
1631 |
||
1632 |
(x1 > x and:[x0 < maxX]) ifTrue:[ |
|
1633 |
rctg width:((x1 min:maxX) - x). |
|
1634 |
clipRect := nil. |
|
1635 |
self clippingRectangle:rctg. |
|
1131 | 1636 |
aCol redrawX:x0 y:yTop h:clHg from:start to:stop. |
1115 | 1637 |
]. |
1638 |
x0 := x1 |
|
1639 |
]. |
|
1131 | 1640 |
|
1641 |
"/ restore old clipping rectangle |
|
1115 | 1642 |
self clippingRectangle:savClip. |
1131 | 1643 |
|
1644 |
stop == size ifTrue:[ |
|
1115 | 1645 |
yTop := y + h. |
1646 |
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
|
1647 |
"/ clear to bottom of screen |
1115 | 1648 |
self paint:bgColor. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1649 |
self fillRectangleX:x y:yBot width:w height:(yTop - yBot). |
1112 | 1650 |
] |
1136 | 1651 |
]. |
1652 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1653 |
(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
|
1654 |
"/ clear to right of screen |
1136 | 1655 |
self paint:bgColor. |
1656 |
self fillRectangleX:x1 y:y width:c0 height:h. |
|
1657 |
]. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1658 |
|
1112 | 1659 |
! ! |
1660 |
||
1661 |
!DSVColumnView methodsFor:'drawing interactors'! |
|
1662 |
||
1131 | 1663 |
drawCheckToggleAtX:xTop y:yTop w:rowWidth state:aState |
1112 | 1664 |
"draw a check toggle button |
1665 |
" |
|
1666 |
|e form |
|
1667 |
y "{ Class:SmallInteger }" |
|
1668 |
x "{ Class:SmallInteger }" |
|
1669 |
h "{ Class:SmallInteger }" |
|
1670 |
w "{ Class:SmallInteger }" |
|
1671 |
| |
|
1672 |
w := checkToggleExtent x. |
|
1673 |
h := checkToggleExtent y. |
|
1674 |
y := yTop + (rowHeight - h // 2). |
|
1675 |
x := xTop + (rowWidth - w // 2). |
|
1529 | 1676 |
h odd ifTrue:[y := y + 1]. |
1112 | 1677 |
|
1678 |
(form := checkToggleActiveImage) isNil ifTrue:[ |
|
1131 | 1679 |
self paint:bgColor. |
1680 |
self fillRectangleX:x y:y width:w height:h. |
|
1681 |
self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self. |
|
1682 |
||
1112 | 1683 |
aState ifFalse:[ |
1684 |
^ self |
|
1685 |
]. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1686 |
self paint:fgColor on:bgColor. |
1112 | 1687 |
form := checkToggleForm |
1688 |
] ifFalse:[ |
|
1689 |
aState ifFalse:[form := checkTogglePassiveImage] |
|
859 | 1690 |
]. |
1112 | 1691 |
e := (checkToggleExtent - form extent) // 2. |
1692 |
self displayForm:form x:(x + e x) y:(y + e y). |
|
1693 |
||
1694 |
||
1695 |
||
1696 |
||
1697 |
||
1698 |
! |
|
1699 |
||
1131 | 1700 |
drawComboButtonAtX:xTop y:yTop w:rowWidth |
1112 | 1701 |
"draw a combo button |
1702 |
" |
|
1703 |
|e |
|
1704 |
x "{ Class:SmallInteger }" |
|
1705 |
y "{ Class:SmallInteger }" |
|
1706 |
h "{ Class:SmallInteger }" |
|
1707 |
w "{ Class:SmallInteger }" |
|
1708 |
| |
|
1709 |
w := comboButtonExtent x. |
|
1710 |
h := comboButtonExtent y. |
|
1711 |
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
|
1712 |
x := xTop + (rowWidth - w - separatorSize - 1). |
1112 | 1713 |
e := (comboButtonExtent - comboButtonForm extent) // 2. |
1714 |
||
1131 | 1715 |
self paint:bgColor. |
1716 |
self fillRectangleX:x y:y width:w height:h. |
|
1717 |
self drawEdgesAtX:x y:y width:w height:h level:comboButtonLevel on:self. |
|
1136 | 1718 |
self paint:fgColor on:bgColor. |
1112 | 1719 |
self displayForm:comboButtonForm x:(x + e x) y:(y + e y) |
1720 |
||
1721 |
! |
|
1722 |
||
1723 |
drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC |
|
1724 |
"draw edges for a cell or label |
|
1725 |
" |
|
1726 |
aGC drawEdgesForX:x |
|
1727 |
y:y |
|
1728 |
width:w |
|
1729 |
height:h |
|
1730 |
level:aLevel |
|
1731 |
shadow:buttonShadowColor |
|
1732 |
light:buttonLightColor |
|
1733 |
halfShadow:buttonHalfShadowColor |
|
1734 |
halfLight:buttonHalfLightColor |
|
1735 |
style:ButtonEdgeStyle. |
|
1736 |
||
637 | 1737 |
! ! |
1738 |
||
542 | 1739 |
!DSVColumnView methodsFor:'enumerating columns'! |
1740 |
||
1741 |
columnsDo:aOneArgBlock |
|
1742 |
"evaluate the argument, aOneArgBlock for every column |
|
1743 |
" |
|
1744 |
columnDescriptors do:aOneArgBlock |
|
1745 |
||
1746 |
||
1747 |
! |
|
1748 |
||
1749 |
columnsFrom:start to:stop do:aOneArgBlock |
|
1750 |
"evaluate the argument, aOneArgBlock for the columns with index start to |
|
1751 |
stop in the collection of column descriptors |
|
1752 |
" |
|
1753 |
columnDescriptors from:start to:stop do:aOneArgBlock |
|
1754 |
||
1755 |
||
1756 |
! ! |
|
1757 |
||
1758 |
!DSVColumnView methodsFor:'event handling'! |
|
1759 |
||
607 | 1760 |
buttonMotion:buttonMask x:x y:y |
1761 |
"mouse-move while button was pressed - handle multiple selection changes |
|
1762 |
" |
|
991 | 1763 |
|idx scr p| |
607 | 1764 |
|
809 | 1765 |
dragAccessPoint notNil ifTrue:[ |
1766 |
dragIsActive ifFalse:[ |
|
824 | 1767 |
p := x @ y. |
1768 |
(clickPosition dist:p) > 5.0 ifTrue:[ self startDragAt:p ] |
|
809 | 1769 |
]. |
1770 |
^ self |
|
1771 |
]. |
|
607 | 1772 |
self sensor ctrlDown ifTrue:[^ self ]. |
1773 |
||
1774 |
(multipleSelectOk and:[selectedColIndex == 0 and:[selectedRowIndex notNil]]) ifFalse:[ |
|
1775 |
^ self |
|
1776 |
]. |
|
1777 |
"is it the select or 1-button ?" |
|
1778 |
||
1023
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1779 |
self sensor leftButtonPressed ifFalse:[^ self]. |
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1780 |
"/ (device buttonMotionMask:buttonMask includesButton:#select) ifFalse:[ |
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1781 |
"/ (device buttonMotionMask:buttonMask includesButton:1) ifFalse:[ |
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1782 |
"/ ^ self |
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1783 |
"/ ]. |
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1784 |
"/ ]. |
607 | 1785 |
scr := 0. |
1786 |
||
1787 |
y > height ifTrue:[ |
|
1788 |
scr := rowHeight. |
|
1789 |
idx := self yVisibleToRowNr:(height + rowHeight). |
|
1790 |
] ifFalse:[ |
|
1791 |
y < 0 ifTrue:[ |
|
1792 |
scr := rowHeight negated. |
|
1793 |
idx := self yVisibleToRowNr:scr. |
|
1794 |
] ifFalse:[ |
|
1795 |
idx := self yVisibleToRowNr:y. |
|
1796 |
] |
|
1797 |
]. |
|
643 | 1798 |
(idx isNil or:[idx < 1 or:[self isInSelection:idx]]) ifTrue:[ |
607 | 1799 |
^ self |
1800 |
]. |
|
1801 |
selectedRowIndex := selectedRowIndex asOrderedCollection. |
|
643 | 1802 |
|
1803 |
clickPosition notNil ifTrue:[ |
|
1804 |
(clickPosition - idx) abs > 1 ifTrue:[|s e| |
|
1805 |
clickPosition < idx ifTrue:[ |
|
1806 |
s := clickPosition + 1. |
|
1807 |
e := idx - 1. |
|
1808 |
] ifFalse:[ |
|
1809 |
s := idx + 1. |
|
1810 |
e := clickPosition - 1. |
|
1811 |
]. |
|
1812 |
s to:e do:[:i| |
|
1813 |
(self isInSelection:i) ifFalse:[ |
|
1814 |
selectedRowIndex add:i. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1815 |
self invalidateRowAt:i colAt:0. |
643 | 1816 |
] |
1817 |
] |
|
1818 |
] |
|
1819 |
]. |
|
1820 |
selectedRowIndex add:(clickPosition := idx). |
|
607 | 1821 |
|
1822 |
scr == 0 ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1823 |
self invalidateRowAt:idx colAt:0. |
607 | 1824 |
] ifFalse:[ |
1825 |
self scrollTo:(viewOrigin + (0 @ scr)) redraw:true |
|
1826 |
]. |
|
1023
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1827 |
|
59c1888ca494
use another left-button-down test in #buttonMotion.
Claus Gittinger <cg@exept.de>
parents:
1008
diff
changeset
|
1828 |
"Modified: / 28.7.1998 / 16:01:11 / cg" |
607 | 1829 |
! |
1830 |
||
542 | 1831 |
buttonMultiPress:button x:x y:y |
1832 |
"a button was pressed twice - handle doubleclick here |
|
1833 |
" |
|
1834 |
((button == 1) or:[button == #select]) ifFalse:[ |
|
1835 |
^ super buttonMultiPress:button x:x y:y |
|
1836 |
]. |
|
607 | 1837 |
self numberOfSelections == 1 ifTrue:[ |
1838 |
self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[ |
|
1839 |
( selectedColIndex == 0 |
|
1840 |
or:[selectedColIndex == (self xVisibleToColNr:x)] |
|
1841 |
) ifTrue:[ |
|
1842 |
self doubleClicked |
|
1843 |
] |
|
542 | 1844 |
] |
1845 |
] |
|
1846 |
||
1847 |
||
1848 |
||
1849 |
||
1850 |
! |
|
1851 |
||
1852 |
buttonPress:button x:x y:y |
|
1853 |
"a button was pressed - handle selection here |
|
1854 |
" |
|
1603 | 1855 |
|rowNr colNr menu sz first| |
542 | 1856 |
|
809 | 1857 |
clickPosition := nil. |
1858 |
dragAccessPoint := nil. |
|
1859 |
dragIsActive := false. |
|
1860 |
||
667 | 1861 |
((button == 2) or:[button == #menu]) ifTrue:[ |
1862 |
(menu := self findMenuForSelection) notNil ifTrue:[ |
|
1863 |
^ menu startUp |
|
1864 |
] |
|
1865 |
] ifFalse:[ |
|
1866 |
( (button == 1 or:[button == #select]) |
|
1867 |
and:[(rowNr := self yVisibleToRowNr:y) notNil |
|
1868 |
and:[(colNr := self xVisibleToColNr:x) notNil]] |
|
1869 |
) ifTrue:[ |
|
1603 | 1870 |
multipleSelectOk ifTrue:[ |
1871 |
self sensor ctrlDown ifTrue:[ |
|
1872 |
selectedColIndex ~~ 0 ifTrue:[ |
|
1873 |
colNr := 0 |
|
1874 |
] ifFalse:[ |
|
1875 |
(sz := self numberOfSelections == 0) ifFalse:[ |
|
1876 |
(self isInSelection:rowNr) ifTrue:[ |
|
1877 |
sz == 1 ifTrue:[ |
|
1878 |
self selectColIndex:0 rowIndex:nil. |
|
1879 |
^ self sensor flushMotionEventsFor:self. |
|
1880 |
]. |
|
1881 |
selectedRowIndex remove:rowNr. |
|
1882 |
] ifFalse:[ |
|
1883 |
selectedRowIndex add:rowNr |
|
1884 |
]. |
|
1885 |
self invalidateRowAt:rowNr. |
|
1886 |
self selectionChanged. |
|
1887 |
^ self sensor flushMotionEventsFor:self. |
|
1888 |
] |
|
1889 |
] |
|
667 | 1890 |
] ifFalse:[ |
1603 | 1891 |
( selectedColIndex == 0 |
1892 |
and:[(first := self firstIndexSelected) ~~ 0 |
|
1893 |
and:[self sensor shiftDown]] |
|
1894 |
) ifTrue:[|step list| |
|
1895 |
list := OrderedCollection new. |
|
1896 |
step := first < rowNr ifTrue:[1] ifFalse:[-1]. |
|
1897 |
first to:rowNr by:step do:[:i|list add:i]. |
|
1898 |
self selectedRowIndex:list. |
|
1899 |
^ self. |
|
607 | 1900 |
] |
667 | 1901 |
] |
1902 |
]. |
|
824 | 1903 |
(self canDrag and:[self isSelected:rowNr inColumn:colNr]) ifTrue:[ |
1904 |
clickPosition := x @ y. |
|
809 | 1905 |
dragAccessPoint := (colNr @ rowNr). |
1906 |
] ifFalse:[ |
|
1907 |
self selectRowAt:rowNr colAt:colNr atPoint:(x @ y) |
|
667 | 1908 |
]. |
1909 |
^ self |
|
542 | 1910 |
] |
1911 |
]. |
|
667 | 1912 |
super buttonPress:button x:x y:y |
1913 |
||
542 | 1914 |
|
1915 |
||
1916 |
! |
|
1917 |
||
643 | 1918 |
buttonRelease:button x:x y:y |
1919 |
||
1920 |
clickPosition notNil ifTrue:[ |
|
809 | 1921 |
dragAccessPoint notNil ifTrue:[ |
1922 |
dragIsActive ifFalse:[ |
|
1923 |
self selectRowAt:(dragAccessPoint y) |
|
1924 |
colAt:(dragAccessPoint x) |
|
1925 |
atPoint:clickPosition |
|
1926 |
]. |
|
1927 |
dragAccessPoint := nil. |
|
824 | 1928 |
dragIsActive := false. |
809 | 1929 |
] ifFalse:[ |
1930 |
self selectionChanged |
|
1931 |
]. |
|
643 | 1932 |
clickPosition := nil. |
1933 |
]. |
|
1934 |
super buttonRelease:button x:x y:y |
|
1935 |
||
1936 |
||
1937 |
! |
|
1938 |
||
809 | 1939 |
characterPress:aChar x:x y:y |
1940 |
"search row in column at x/y starting its printable label with cahracter. |
|
1941 |
" |
|
1942 |
|colNr rowNr lsize found column| |
|
1943 |
||
872
ad92183a6e6b
pass unhandled keys up (for focus control)
Claus Gittinger <cg@exept.de>
parents:
861
diff
changeset
|
1944 |
(rowIfAbsentBlock notNil |
896
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1945 |
or:[x isNil |
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1946 |
or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[ |
809 | 1947 |
^ self |
1948 |
]. |
|
1949 |
rowNr := self lastIndexSelected. |
|
1497 | 1950 |
lsize := list size. |
809 | 1951 |
column := self columnAt:colNr. |
1952 |
found := 0. |
|
1953 |
||
1954 |
lsize > rowNr ifTrue:[ |
|
1955 |
"/ search to end |
|
1956 |
found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize. |
|
1957 |
]. |
|
1958 |
||
1959 |
(found == 0 and:[rowNr > 1]) ifTrue:[ |
|
1960 |
"/ search from begin |
|
1961 |
found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1) |
|
1962 |
]. |
|
1963 |
found ~~ 0 ifTrue:[ |
|
1964 |
self selectColIndex:colNr rowIndex:found. |
|
1965 |
]. |
|
1966 |
||
896
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
1967 |
"Modified: / 21.5.1998 / 03:30:22 / cg" |
809 | 1968 |
! |
1969 |
||
542 | 1970 |
contentsChanged |
1971 |
"contents changed - move origin up if possible |
|
1972 |
" |
|
1973 |
|y| |
|
1974 |
||
1975 |
shown ifTrue:[ |
|
1976 |
self recomputeHeightOfContents. |
|
1977 |
y := self maxViewOriginY. |
|
1978 |
||
1979 |
viewOrigin y > y ifTrue:[ |
|
1980 |
self scrollTo:(viewOrigin x @ y) |
|
1981 |
] ifFalse:[ |
|
1982 |
self updateEditViewOrigin. |
|
1983 |
] |
|
1984 |
]. |
|
1985 |
super contentsChanged |
|
1986 |
||
1987 |
||
1988 |
! |
|
1989 |
||
1990 |
doubleClicked |
|
1991 |
"handle a double click |
|
1992 |
" |
|
637 | 1993 |
|col sel idx| |
1994 |
||
1995 |
self hasSelection ifTrue:[ |
|
1996 |
idx := self firstIndexSelected. |
|
1997 |
col := self selectedColumn. |
|
1998 |
(col notNil and:[(sel := col doubleClickedSelector) notNil]) ifTrue:[ |
|
1999 |
(self at:idx) perform:sel |
|
2000 |
] ifFalse:[ |
|
2001 |
doubleClickActionBlock notNil ifTrue:[ |
|
2002 |
doubleClickActionBlock value:idx |
|
2003 |
] |
|
2004 |
] |
|
2005 |
] |
|
542 | 2006 |
! |
2007 |
||
667 | 2008 |
findMenuForSelection |
2009 |
"find the middle button menu for the current selection; returns the menu or nil |
|
2010 |
" |
|
2011 |
|col row menu| |
|
2012 |
||
2013 |
self numberOfSelections == 1 ifTrue:[ |
|
2014 |
row := self at:(self firstIndexSelected). |
|
2015 |
col := self selectedColumn. |
|
2016 |
||
2017 |
(col notNil and:[(menu := col menuForRow:row) notNil]) ifTrue:[ |
|
2018 |
^ menu |
|
2019 |
]. |
|
2020 |
col := columnDescriptors detect:[:c| c rendererType == #rowSelector] |
|
2021 |
ifNone:[nil]. |
|
2022 |
||
2023 |
col notNil ifTrue:[ |
|
1223
176702811314
kludge: when asking for an itemMenu, pass application to
tm
parents:
1215
diff
changeset
|
2024 |
^ col menuForRow:row inApplication:(self application) |
667 | 2025 |
] |
2026 |
]. |
|
2027 |
^ nil |
|
2028 |
! |
|
2029 |
||
1111 | 2030 |
keyPress:aKey x:x y:y |
542 | 2031 |
"a key was pressed - handle page-keys here |
2032 |
" |
|
2033 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
|
809 | 2034 |
#BeginOfText #EndOfText #ScrollUp #ScrollDown |
542 | 2035 |
#CursorUp #CursorDown #CursorRight #CursorLeft)> |
2036 |
||
1668 | 2037 |
|sensor n maxColNr idx selRowNr key column isTab listSize noSel hasSelectables| |
1111 | 2038 |
|
2039 |
(sensor := self sensor) isNil ifTrue:[ |
|
2040 |
^ self |
|
542 | 2041 |
]. |
1416 | 2042 |
(listSize := list size) == 0 ifTrue:[ |
2043 |
^ super keyPress:aKey x:x y:y |
|
2044 |
]. |
|
1111 | 2045 |
|
2046 |
(aKey == #PreviousPage) ifTrue:[^ self pageUp]. |
|
2047 |
(aKey == #NextPage) ifTrue:[^ self pageDown]. |
|
2048 |
(aKey == #HalfPageUp) ifTrue:[^ self halfPageUp]. |
|
2049 |
(aKey == #HalfPageDown) ifTrue:[^ self halfPageDown]. |
|
2050 |
(aKey == #BeginOfText) ifTrue:[^ self scrollToTop]. |
|
2051 |
(aKey == #EndOfText) ifTrue:[^ self scrollToBottom]. |
|
2052 |
(aKey isCharacter) ifTrue:[^ self characterPress:aKey x:x y:y ]. |
|
2053 |
||
2054 |
(aKey == #ScrollUp or:[aKey == #ScrollDown]) ifTrue:[ |
|
2055 |
n := (1 + (sensor compressKeyPressEventsWithKey:aKey)) * self verticalScrollStep. |
|
1416 | 2056 |
aKey == #ScrollUp ifTrue:[self scrollUp:n] ifFalse:[self scrollDown:n]. |
2057 |
^ self |
|
542 | 2058 |
]. |
1111 | 2059 |
|
2060 |
aKey == #Return ifTrue:[ |
|
1416 | 2061 |
self numberOfSelections == 1 ifTrue:[self doubleClicked]. |
2062 |
^ self |
|
542 | 2063 |
]. |
1111 | 2064 |
|
1668 | 2065 |
hasSelectables := false. |
2066 |
||
2067 |
columnDescriptors do:[:aCol| |
|
2068 |
(hasSelectables or:[aCol rendererType == #rowSelector]) ifFalse:[ |
|
2069 |
hasSelectables := aCol description canSelect |
|
2070 |
] |
|
2071 |
]. |
|
2072 |
||
2073 |
hasSelectables ifFalse:[ |
|
2074 |
^ super keyPress:aKey x:x y:y |
|
2075 |
]. |
|
2076 |
||
1416 | 2077 |
selRowNr := self firstIndexSelected. |
2078 |
n := 1 + (sensor compressKeyPressEventsWithKey:aKey). |
|
1111 | 2079 |
(aKey == #CursorUp or:[aKey == #CursorDown]) ifTrue:[ |
1416 | 2080 |
selRowNr == 0 ifTrue:[ |
2081 |
n := aKey == #CursorUp ifTrue:[listSize] ifFalse:[1] |
|
2082 |
] ifFalse:[ |
|
2083 |
n := (n \\ listSize) max:1. |
|
2084 |
||
1111 | 2085 |
aKey == #CursorUp ifTrue:[ |
1416 | 2086 |
(n := selRowNr - n) <= 0 ifTrue:[n := listSize + n] |
1111 | 2087 |
] ifFalse:[ |
1416 | 2088 |
(n := selRowNr + n) > listSize ifTrue:[n := n - listSize] |
2089 |
] |
|
542 | 2090 |
]. |
1416 | 2091 |
^ self selectColIndex:selectedColIndex rowIndex:n |
1111 | 2092 |
]. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2093 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2094 |
(aKey == #CursorLeft or:[aKey == #CursorRight]) ifFalse:[ |
1668 | 2095 |
tabIntern ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2096 |
^ super keyPress:aKey x:x y:y |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2097 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2098 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2099 |
(aKey includesString:'Tab') ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2100 |
key := (sensor shiftDown or:[aKey includesString:'Left']) ifTrue:[#CursorLeft] |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2101 |
ifFalse:[#CursorRight] |
1416 | 2102 |
] ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2103 |
(aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[ |
1416 | 2104 |
^ super keyPress:aKey x:x y:y |
2105 |
]. |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2106 |
key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2107 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2108 |
isTab := true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2109 |
] ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2110 |
isTab := false. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2111 |
key := aKey. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2112 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2113 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2114 |
maxColNr := self numberOfColumns. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2115 |
idx := selectedColIndex. |
612 | 2116 |
|
1111 | 2117 |
key == #CursorLeft ifTrue:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2118 |
selRowNr == 0 ifTrue:[selRowNr := listSize]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2119 |
idx == 0 ifTrue:[idx := maxColNr + 1]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2120 |
|
1111 | 2121 |
[n ~~ 0] whileTrue:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2122 |
idx := idx - 1. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2123 |
idx == 0 ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2124 |
(selRowNr := selRowNr - 1) == 0 ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2125 |
isTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2126 |
tabAtStartAction notNil ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2127 |
tabAtStartAction value |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2128 |
] ifFalse:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2129 |
self deselect. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2130 |
self windowGroup focusPreviousFrom:self |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2131 |
] |
1416 | 2132 |
]. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2133 |
^ self |
1111 | 2134 |
]. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2135 |
idx := maxColNr |
1111 | 2136 |
]. |
2137 |
column := self columnAt:idx. |
|
1416 | 2138 |
|
1111 | 2139 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
2140 |
n := n - 1 |
|
542 | 2141 |
] |
1111 | 2142 |
] |
2143 |
] ifFalse:[ |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2144 |
selRowNr == 0 ifTrue:[selRowNr := 1]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2145 |
|
1111 | 2146 |
[n ~~ 0] whileTrue:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2147 |
idx := idx + 1. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2148 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2149 |
idx > maxColNr ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2150 |
(selRowNr := selRowNr + 1) > listSize ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2151 |
isTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2152 |
tabAtEndAction notNil ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2153 |
tabAtEndAction value |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2154 |
] ifFalse:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2155 |
self deselect. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2156 |
self windowGroup focusNextFrom:self |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2157 |
] |
1416 | 2158 |
]. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2159 |
^ self |
1111 | 2160 |
]. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2161 |
idx := 1 |
1111 | 2162 |
]. |
2163 |
column := self columnAt:idx. |
|
1416 | 2164 |
|
1111 | 2165 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
2166 |
n := n - 1 |
|
2167 |
] |
|
2168 |
] |
|
542 | 2169 |
]. |
1111 | 2170 |
self selectColIndex:idx rowIndex:selRowNr. |
2171 |
||
2172 |
||
1416 | 2173 |
|
542 | 2174 |
! |
2175 |
||
2176 |
originChanged:delta |
|
2177 |
"this one is sent, after the origin of my contents has changed - |
|
2178 |
tell dependents (i.e. scrollers) about this |
|
2179 |
" |
|
2180 |
super originChanged:delta. |
|
2181 |
self updateEditViewOrigin. |
|
2182 |
! ! |
|
2183 |
||
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2184 |
!DSVColumnView methodsFor:'focus handling'! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2185 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2186 |
canTab |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2187 |
super canTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2188 |
^ editView isNil |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2189 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2190 |
^ false |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2191 |
! ! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2192 |
|
542 | 2193 |
!DSVColumnView methodsFor:'gc operations'! |
2194 |
||
1100 | 2195 |
imageOnDevice:anImage |
2196 |
"associate image to device and clear pixel mask; returns the new image. |
|
2197 |
" |
|
2198 |
|image| |
|
2199 |
||
2200 |
(image := anImage) notNil ifTrue:[ |
|
2201 |
image device ~~ device ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2202 |
image := image copy onDevice:device. |
1100 | 2203 |
]. |
2204 |
image isImage ifTrue:[ |
|
2205 |
image := image clearMaskedPixels |
|
2206 |
] |
|
2207 |
]. |
|
2208 |
^ image |
|
2209 |
||
2210 |
! |
|
2211 |
||
542 | 2212 |
registerImage:anImage key:aKey |
2213 |
"any row can register an image with a unique identifier a key symbol |
|
2214 |
" |
|
2215 |
|img| |
|
2216 |
||
2217 |
(img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
|
2218 |
^ img |
|
2219 |
]. |
|
1112 | 2220 |
img := self imageOnDevice:anImage. |
567 | 2221 |
registererImages at:aKey put:img. |
2222 |
^ img |
|
542 | 2223 |
! |
2224 |
||
2225 |
registeredImageAt:aKey |
|
2226 |
"any row can register an image with a unique identifier |
|
2227 |
" |
|
2228 |
^ registererImages at:aKey ifAbsent:nil |
|
2229 |
! |
|
2230 |
||
2231 |
releaseAllRegisteredImages |
|
2232 |
"release all registered images |
|
2233 |
" |
|
2234 |
registererImages := IdentityDictionary new. |
|
2235 |
! ! |
|
2236 |
||
1326 | 2237 |
!DSVColumnView methodsFor:'initialize / release'! |
542 | 2238 |
|
2239 |
create |
|
607 | 2240 |
"set color on device |
542 | 2241 |
" |
2242 |
super create. |
|
1480 | 2243 |
fgColor := fgColor onDevice:device. |
2244 |
bgColor := bgColor onDevice:device. |
|
2245 |
hgLgFgColor := hgLgFgColor onDevice:device. |
|
2246 |
hgLgBgColor := hgLgBgColor onDevice:device. |
|
2247 |
||
2248 |
buttonShadowColor := buttonShadowColor onDevice:device. |
|
2249 |
buttonLightColor := buttonLightColor onDevice:device. |
|
809 | 2250 |
|
2251 |
buttonHalfShadowColor notNil ifTrue:[ |
|
1480 | 2252 |
buttonHalfShadowColor := buttonHalfShadowColor onDevice:device |
809 | 2253 |
]. |
2254 |
||
2255 |
buttonHalfLightColor notNil ifTrue:[ |
|
1480 | 2256 |
buttonHalfLightColor := buttonHalfLightColor onDevice:device |
809 | 2257 |
]. |
1100 | 2258 |
rowSelectorForm := self imageOnDevice:rowSelectorForm. |
2259 |
checkToggleActiveImage := self imageOnDevice:checkToggleActiveImage. |
|
2260 |
checkTogglePassiveImage := self imageOnDevice:checkTogglePassiveImage. |
|
2261 |
comboButtonForm := self imageOnDevice:comboButtonForm. |
|
2262 |
checkToggleForm := self imageOnDevice:checkToggleForm. |
|
2263 |
||
2264 |
||
542 | 2265 |
! |
2266 |
||
2267 |
destroy |
|
2268 |
"remove dependencies |
|
2269 |
" |
|
618 | 2270 |
self columnHolder:nil. |
1487 | 2271 |
listHolder removeDependent:self. |
2272 |
||
1711 | 2273 |
columnAdaptor isValueModel ifTrue:[ |
2274 |
columnAdaptor removeDependent:self |
|
2275 |
]. |
|
2276 |
||
618 | 2277 |
self beDependentOfRows:false. |
542 | 2278 |
super destroy |
2279 |
! |
|
2280 |
||
2281 |
initStyle |
|
607 | 2282 |
"setup colors |
2283 |
" |
|
1100 | 2284 |
|button widget| |
809 | 2285 |
|
542 | 2286 |
super initStyle. |
2287 |
||
2288 |
DefaultForegroundColor isNil ifTrue:[ |
|
2289 |
self class updateStyleCache |
|
2290 |
]. |
|
2291 |
fgColor := DefaultForegroundColor. |
|
2292 |
bgColor := DefaultBackgroundColor. |
|
2293 |
hgLgFgColor := DefaultHilightForegroundColor. |
|
2294 |
hgLgBgColor := DefaultHilightBackgroundColor. |
|
809 | 2295 |
|
2296 |
shadowColor isNil ifTrue:[ |
|
2297 |
shadowColor := Color grayPercent:40. |
|
2298 |
]. |
|
2299 |
||
2300 |
lightColor isNil ifTrue:[ |
|
2301 |
lightColor := Color grayPercent:75 |
|
2302 |
]. |
|
2303 |
||
2304 |
buttonLightColor := ButtonLightColor ? lightColor. |
|
2305 |
buttonShadowColor := ButtonShadowColor ? shadowColor. |
|
2306 |
||
2307 |
(ButtonEdgeStyle == #soft) ifTrue:[ |
|
2308 |
buttonHalfShadowColor := ButtonHalfShadowColor. |
|
2309 |
buttonHalfLightColor := ButtonHalfLightColor. |
|
2310 |
||
2311 |
buttonHalfShadowColor isNil ifTrue:[ |
|
2312 |
buttonHalfShadowColor := buttonShadowColor lightened |
|
2313 |
] |
|
2314 |
]. |
|
1490 | 2315 |
|
2316 |
buttonHalfShadowColor isNil ifTrue:[ |
|
2317 |
buttonHalfShadowColor := Color gray |
|
2318 |
]. |
|
2319 |
||
1100 | 2320 |
rowSelectorForm := self class rowSelector. |
2321 |
checkToggleActiveImage := CheckToggleActiveImage. |
|
2322 |
checkTogglePassiveImage := CheckTogglePassiveImage. |
|
2323 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2324 |
ComboButtonForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2325 |
widget := ComboListView new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2326 |
button := widget menuButton. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2327 |
ComboButtonForm := button label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2328 |
ComboButtonLevel := button offLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2329 |
ComboButtonExtent := (button preferredExtent x) @ (widget preferredExtent y). |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2330 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2331 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2332 |
CheckToggleForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2333 |
widget := CheckToggle new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2334 |
CheckToggleForm := widget label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2335 |
CheckToggleLevel := widget offLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2336 |
CheckToggleExtent := widget preferredExtent. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2337 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2338 |
comboButtonForm := ComboButtonForm. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2339 |
comboButtonLevel := ComboButtonLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2340 |
comboButtonExtent := ComboButtonExtent. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2341 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2342 |
checkToggleForm := CheckToggleForm. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2343 |
checkToggleLevel := CheckToggleLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2344 |
checkToggleExtent := CheckToggleExtent. |
542 | 2345 |
! |
2346 |
||
2347 |
initialize |
|
2348 |
"set default attributes |
|
2349 |
" |
|
2350 |
super initialize. |
|
1487 | 2351 |
self lineWidth:0. |
2352 |
||
1668 | 2353 |
tabIntern := true. |
1487 | 2354 |
useIndex := true. |
1112 | 2355 |
viewOrigin := 0@0. |
1480 | 2356 |
font := font onDevice:device. |
1112 | 2357 |
rowHeight := font height. |
2358 |
multipleSelectOk := false. "/ multiselect disabled |
|
2359 |
selectedRowIndex := selectedColIndex := 0. "/ no selection |
|
2360 |
registererImages := IdentityDictionary new. |
|
2361 |
columnDescriptors := #(). |
|
2362 |
beDependentOfRows := false. |
|
2363 |
verticalSpacing := self class verticalSpacing. |
|
2364 |
horizontalSpacing := self class horizontalSpacing. |
|
2365 |
colorMap := Dictionary new. |
|
2366 |
catchChangeEvents := false. |
|
2367 |
dragIsActive := false. |
|
2368 |
rowFontAscent := 1. "/ dummy initialization |
|
2369 |
separatorSize := 1. "/ separators mode 2D |
|
2370 |
selectRowOnDefault := true. |
|
542 | 2371 |
! |
2372 |
||
705 | 2373 |
mapped |
2374 |
"set selection if exists after mapping |
|
2375 |
" |
|
2376 |
|idx| |
|
2377 |
||
2378 |
super mapped. |
|
2379 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2380 |
(idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
705 | 2381 |
self scrollToRowAt:idx colAt:0. |
2382 |
]. |
|
2383 |
! |
|
2384 |
||
542 | 2385 |
realize |
607 | 2386 |
"recompute contents and fit columns to view |
542 | 2387 |
" |
1487 | 2388 |
|selection| |
2389 |
||
607 | 2390 |
self bitGravity:#NorthWest. |
542 | 2391 |
self recomputeHeightOfContents. |
1487 | 2392 |
|
2393 |
selection := 0. |
|
2394 |
||
2395 |
model notNil ifTrue:[ |
|
2396 |
(model respondsTo:#selectionIndex) ifTrue:[ |
|
2397 |
selection := model selectionIndex |
|
2398 |
] ifFalse:[ |
|
2399 |
model == listHolder ifFalse:[ |
|
2400 |
selection := model value |
|
2401 |
] |
|
2402 |
] |
|
2403 |
]. |
|
2404 |
self selectRowIndex:selection. |
|
2405 |
||
542 | 2406 |
super realize. |
607 | 2407 |
self fitColumns. |
2408 |
! ! |
|
2409 |
||
2410 |
!DSVColumnView methodsFor:'obsolete'! |
|
2411 |
||
2412 |
has3Dsepartors |
|
2413 |
"shouldn't be used any more |
|
2414 |
" |
|
2415 |
^ self has3Dseparators |
|
2416 |
! |
|
2417 |
||
2418 |
has3Dsepartors:aBool |
|
2419 |
"shouldn't be used any more |
|
2420 |
" |
|
2421 |
self has3Dseparators:aBool |
|
542 | 2422 |
|
2423 |
! ! |
|
2424 |
||
2425 |
!DSVColumnView methodsFor:'private'! |
|
2426 |
||
1111 | 2427 |
destroyEditView |
2428 |
"destroy the edit view; release KeyboardForwarder |
|
2429 |
" |
|
2430 |
editView notNil ifTrue:[ |
|
2431 |
editView withAllSubViewsDo:[:aView| |
|
2432 |
aView delegate:nil |
|
2433 |
]. |
|
2434 |
editView destroy. |
|
2435 |
editView := nil. |
|
2436 |
self windowGroup focusView:nil. |
|
2437 |
]. |
|
2438 |
||
2439 |
||
2440 |
! |
|
2441 |
||
637 | 2442 |
detectViewAt:aPoint in:aView |
1087 | 2443 |
"returns the view at a point |
2444 |
" |
|
637 | 2445 |
|p| |
2446 |
||
2447 |
(aView notNil and:[aView subViews notNil]) ifTrue:[ |
|
2448 |
aView subViews do:[:sv| |
|
2449 |
p := device translatePoint:aPoint from:(self id) to:(sv id). |
|
2450 |
||
2451 |
(p x >= 0 and:[p y >= 0 and:[p x <= sv width and:[p y <= sv height]]]) ifTrue:[ |
|
2452 |
^ self detectViewAt:aPoint in:sv |
|
2453 |
] |
|
2454 |
] |
|
2455 |
]. |
|
2456 |
^ aView |
|
2457 |
! |
|
2458 |
||
542 | 2459 |
fitColumns |
1484 | 2460 |
"fit columns to view; |
542 | 2461 |
" |
1498 | 2462 |
|list width changed dX sz oldOrgX newOrgX| |
1487 | 2463 |
|
2464 |
preferredExtent isNil ifTrue:[ |
|
2465 |
self preferredExtent. |
|
2466 |
]. |
|
1484 | 2467 |
|
2468 |
columnDescriptors isEmpty ifTrue:[ |
|
2469 |
^ self |
|
2470 |
]. |
|
1492 | 2471 |
width := 0. |
2472 |
list := OrderedCollection new. |
|
1484 | 2473 |
|
2474 |
columnDescriptors do:[:aCol| |
|
2475 |
aCol canResize ifTrue:[ |
|
2476 |
changed := true. |
|
2477 |
aCol invalidate. |
|
1492 | 2478 |
aCol hasRelativeWidth ifFalse:[list add:aCol]. |
1484 | 2479 |
]. |
1492 | 2480 |
width := width + aCol minWidth. |
1484 | 2481 |
]. |
1492 | 2482 |
preferredExtent x:width. |
2483 |
width := self innerWidth - width. |
|
2484 |
||
2485 |
(list notEmpty and:[width > 0]) ifTrue:[ |
|
2486 |
sz := list size. |
|
2487 |
width >= sz ifTrue:[ |
|
2488 |
dX := width // sz. |
|
1484 | 2489 |
list do:[:aCol|aCol growWidth:dX]. |
1492 | 2490 |
width := width - (dX * sz). |
1484 | 2491 |
]. |
1492 | 2492 |
width ~~ 0 ifTrue:[list last growWidth:width]. |
1484 | 2493 |
]. |
1492 | 2494 |
|
612 | 2495 |
shown ifTrue:[ |
1492 | 2496 |
self invalidate. |
1487 | 2497 |
labelView invalidate. |
542 | 2498 |
|
1498 | 2499 |
(oldOrgX := viewOrigin x) ~~ 0 ifTrue:[ |
2500 |
"/ UPDATE VIEW-ORIGIN X |
|
2501 |
||
2502 |
width := preferredExtent x. |
|
2503 |
newOrgX := (width - self innerWidth) max:0. |
|
2504 |
||
2505 |
newOrgX < oldOrgX ifTrue:[ |
|
2506 |
self originWillChange. |
|
2507 |
viewOrigin := newOrgX @ (viewOrigin y). |
|
2508 |
self originChanged:((newOrgX - oldOrgX) @ 0). |
|
2509 |
] |
|
2510 |
]. |
|
2511 |
||
612 | 2512 |
self hasSelection ifTrue:[ |
2513 |
editView notNil ifTrue:[ |
|
1490 | 2514 |
editView width:(self selectedColumn width - (2 * separatorSize)). |
612 | 2515 |
]. |
2516 |
self scrollToSelection. |
|
542 | 2517 |
]. |
1498 | 2518 |
self contentsChanged. |
542 | 2519 |
]. |
647 | 2520 |
|
542 | 2521 |
! |
2522 |
||
2523 |
maxViewOriginY |
|
2524 |
"returns the maximum possible y of the view origin |
|
2525 |
" |
|
2526 |
|y| |
|
2527 |
||
2528 |
y := self heightOfContents - self innerHeight. |
|
2529 |
^ y max:0 |
|
2530 |
||
2531 |
! |
|
2532 |
||
2533 |
updateEditViewOrigin |
|
2534 |
"update origin of the editView |
|
2535 |
" |
|
2536 |
|x y| |
|
2537 |
||
2538 |
editView notNil ifTrue:[ |
|
607 | 2539 |
y := self yVisibleOfRowNr:(self firstIndexSelected). |
1498 | 2540 |
x := self xVisibleOfColNr:selectedColIndex. |
542 | 2541 |
|
1112 | 2542 |
editView origin:(x @ y + separatorSize). |
542 | 2543 |
]. |
2544 |
||
2545 |
! |
|
2546 |
||
2547 |
xVisibleOfColNr:aColNr |
|
2548 |
"returns visible x assigned to a column number |
|
2549 |
" |
|
1497 | 2550 |
|x |
2551 |
end "{ Class:SmallInteger }" |
|
2552 |
| |
|
542 | 2553 |
x := margin - viewOrigin x. |
1497 | 2554 |
|
1498 | 2555 |
aColNr > 1 ifTrue:[ |
1497 | 2556 |
end := aColNr - 1. |
2557 |
||
2558 |
columnDescriptors from:1 to:end do:[:aCol| |
|
2559 |
x := x + aCol width |
|
2560 |
] |
|
2561 |
]. |
|
542 | 2562 |
^ x |
2563 |
||
2564 |
! |
|
2565 |
||
2566 |
xVisibleToColNr:x |
|
607 | 2567 |
"returns the column number assigned to a physical x or nil |
2568 |
" |
|
1497 | 2569 |
|x0 |
2570 |
nr "{ Class:SmallInteger }" |
|
2571 |
| |
|
542 | 2572 |
|
2573 |
x0 := x + viewOrigin x - margin. |
|
2574 |
nr := 1. |
|
2575 |
||
1497 | 2576 |
columnDescriptors do:[:aCol| |
542 | 2577 |
(x0 := x0 - aCol width) <= 0 ifTrue:[^ nr]. |
2578 |
nr := nr + 1. |
|
2579 |
]. |
|
2580 |
^ nil. |
|
2581 |
||
2582 |
! |
|
2583 |
||
2584 |
yVisibleOfRowNr:aRowNr |
|
2585 |
"returns visible y assigned to the row number |
|
2586 |
" |
|
2587 |
^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
|
2588 |
||
2589 |
! |
|
2590 |
||
2591 |
yVisibleToRowNr:y |
|
607 | 2592 |
"returns the row number assigned to a physical y or nil |
542 | 2593 |
" |
2594 |
|y0| |
|
2595 |
||
2596 |
y0 := (y + viewOrigin y - margin) // rowHeight + 1. |
|
1497 | 2597 |
^ (y0 <= list size) ifTrue:[y0] ifFalse:[nil] |
542 | 2598 |
|
2599 |
! ! |
|
2600 |
||
2601 |
!DSVColumnView methodsFor:'queries'! |
|
2602 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2603 |
hasOpenEditor |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2604 |
^ editView notNil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2605 |
! |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2606 |
|
563 | 2607 |
indexOfFirstRowShown |
2608 |
"returns index of first row shown |
|
2609 |
" |
|
2610 |
|idx| |
|
2611 |
||
1498 | 2612 |
idx := (viewOrigin y // rowHeight) + 1. |
1497 | 2613 |
^ (idx <= list size) ifTrue:[idx] ifFalse:[0] |
563 | 2614 |
|
2615 |
! |
|
2616 |
||
542 | 2617 |
numberOfColumns |
2618 |
"returns number of columns |
|
2619 |
" |
|
2620 |
^ columnDescriptors size |
|
2621 |
||
2622 |
! |
|
2623 |
||
2624 |
numberOfRows |
|
2625 |
"returns number of raws |
|
2626 |
" |
|
1497 | 2627 |
^ list size |
542 | 2628 |
|
2629 |
! |
|
2630 |
||
2631 |
rowHeight |
|
2632 |
"get the height of the highest row in pixels |
|
2633 |
" |
|
2634 |
^ rowHeight |
|
2635 |
||
2636 |
! |
|
2637 |
||
2638 |
separatorSize |
|
2639 |
"returns vertical/horizontal size of a separator dependent on the |
|
2640 |
3D effect. |
|
2641 |
" |
|
607 | 2642 |
^ separatorSize |
542 | 2643 |
|
2644 |
! |
|
2645 |
||
2646 |
size |
|
2647 |
"returns number of raws |
|
2648 |
" |
|
2649 |
^ list size |
|
2650 |
||
2651 |
! ! |
|
2652 |
||
2653 |
!DSVColumnView methodsFor:'recomputation'! |
|
2654 |
||
647 | 2655 |
hasPreferredExtent |
2656 |
"returns true if preferred extent is accumulated |
|
2657 |
" |
|
2658 |
^ preferredExtent notNil |
|
2659 |
! |
|
2660 |
||
542 | 2661 |
preferredExtent |
647 | 2662 |
"recompute preferred extent; raise notification |
542 | 2663 |
" |
1497 | 2664 |
|x "{ Class:SmallInteger }" |
2665 |
h "{ Class:SmallInteger }" |
|
2666 |
| |
|
542 | 2667 |
|
2668 |
preferredExtent notNil ifTrue:[ |
|
2669 |
^ preferredExtent |
|
2670 |
]. |
|
2671 |
x := 3. |
|
1521 | 2672 |
h := 0. |
1497 | 2673 |
|
2674 |
columnDescriptors do:[:aCol| |
|
2675 |
h := (aCol heightOfHighestRow) max:h. |
|
2676 |
x := x + (aCol minWidth). |
|
542 | 2677 |
]. |
1521 | 2678 |
h == 0 ifTrue:[h := font height]. |
1497 | 2679 |
rowHeight := (h + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
2680 |
preferredExtent := x @ (list size * rowHeight). |
|
1201 | 2681 |
rowFontAscent := font ascent. |
2682 |
||
542 | 2683 |
^ preferredExtent |
2684 |
||
2685 |
||
2686 |
! |
|
2687 |
||
2688 |
preferredExtentChanged |
|
1087 | 2689 |
"called if the preffered extent changed |
2690 |
" |
|
1497 | 2691 |
|x "{ Class:SmallInteger }" |
2692 |
y "{ Class:SmallInteger }" |
|
2693 |
| |
|
542 | 2694 |
y := viewOrigin y. |
2695 |
x := viewOrigin x. |
|
2696 |
||
2697 |
(y ~~ 0 or:[x ~~ 0]) ifTrue:[ |
|
2698 |
self originWillChange. |
|
2699 |
viewOrigin := 0 @ 0. |
|
2700 |
preferredExtent := nil. |
|
2701 |
self originChanged:(x negated @ y negated). |
|
2702 |
] |
|
2703 |
! |
|
2704 |
||
2705 |
recomputeHeightOfContents |
|
1087 | 2706 |
"recompute height of contents( scrolling ) |
2707 |
" |
|
542 | 2708 |
preferredExtent notNil ifTrue:[ |
1497 | 2709 |
preferredExtent y:(rowHeight * list size) |
542 | 2710 |
] ifFalse:[ |
2711 |
self preferredExtent |
|
2712 |
]. |
|
2713 |
! ! |
|
2714 |
||
2715 |
!DSVColumnView methodsFor:'scroller interface'! |
|
2716 |
||
2717 |
heightOfContents |
|
2718 |
"return the height of the contents in pixels |
|
2719 |
" |
|
1498 | 2720 |
preferredExtent isNil ifTrue:[ |
2721 |
self preferredExtent |
|
2722 |
]. |
|
2723 |
^ preferredExtent y |
|
542 | 2724 |
! |
2725 |
||
2726 |
innerHeight |
|
2727 |
"returns the inner height of the contents shown |
|
2728 |
" |
|
2729 |
^ height - margin - margin |
|
2730 |
||
2731 |
! |
|
2732 |
||
2733 |
innerWidth |
|
2734 |
"returns the inner width of the contents shown |
|
2735 |
" |
|
2736 |
^ width - margin - margin |
|
2737 |
||
2738 |
! |
|
2739 |
||
2740 |
verticalScrollStep |
|
2741 |
"return the amount to scroll when stepping up/down. |
|
2742 |
" |
|
2743 |
^ rowHeight |
|
2744 |
||
2745 |
||
2746 |
||
2747 |
! |
|
2748 |
||
2749 |
viewOrigin |
|
2750 |
"return the viewOrigin; thats the coordinate of the contents |
|
2751 |
which is shown topLeft in the view. |
|
2752 |
" |
|
2753 |
^ viewOrigin |
|
2754 |
||
2755 |
! |
|
2756 |
||
2757 |
widthOfContents |
|
2758 |
"return the width of the contents in pixels |
|
2759 |
" |
|
647 | 2760 |
preferredExtent isNil ifTrue:[ |
2761 |
self preferredExtent |
|
2762 |
]. |
|
2763 |
^ preferredExtent x |
|
542 | 2764 |
|
2765 |
! |
|
2766 |
||
2767 |
xOriginOfContents |
|
2768 |
"return the horizontal origin of the contents in pixels |
|
2769 |
" |
|
2770 |
^ viewOrigin x |
|
2771 |
||
2772 |
! |
|
2773 |
||
2774 |
yOriginOfContents |
|
2775 |
"return the vertical origin of the contents in pixels |
|
2776 |
" |
|
2777 |
^ viewOrigin y |
|
2778 |
||
2779 |
! ! |
|
2780 |
||
2781 |
!DSVColumnView methodsFor:'scrolling'! |
|
2782 |
||
2783 |
scrollTo:anOrigin redraw:doRedraw |
|
2784 |
"change origin to have newOrigin be visible at the top-left. |
|
2785 |
" |
|
1497 | 2786 |
|newOrg dltOrg wg |
2787 |
h "{ Class:SmallInteger }" |
|
2788 |
w "{ Class:SmallInteger }" |
|
2789 |
x "{ Class:SmallInteger }" |
|
2790 |
x0 "{ Class:SmallInteger }" |
|
2791 |
x1 "{ Class:SmallInteger }" |
|
2792 |
y "{ Class:SmallInteger }" |
|
2793 |
y0 "{ Class:SmallInteger }" |
|
2794 |
y1 "{ Class:SmallInteger }" |
|
2795 |
dX "{ Class:SmallInteger }" |
|
2796 |
dY "{ Class:SmallInteger }" |
|
2797 |
innerHG "{ Class:SmallInteger }" |
|
2798 |
innerWT "{ Class:SmallInteger }" |
|
2799 |
| |
|
542 | 2800 |
shown ifFalse:[ |
2801 |
^ self |
|
2802 |
]. |
|
612 | 2803 |
|
1448 | 2804 |
(wg := self windowGroup) notNil ifTrue:[ |
2805 |
wg processRealExposeEventsFor:self. |
|
542 | 2806 |
]. |
612 | 2807 |
|
542 | 2808 |
innerWT := self innerWidth. |
2809 |
innerHG := self innerHeight. |
|
2810 |
||
2811 |
h := viewOrigin y. |
|
2812 |
||
2813 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents |
|
2814 |
y > (dY := self maxViewOriginY) ifTrue:[ |
|
2815 |
y := dY max:h |
|
2816 |
] |
|
2817 |
] ifFalse:[ |
|
2818 |
y := y max:0. |
|
2819 |
]. |
|
2820 |
||
2821 |
(x := anOrigin x) > 0 ifTrue:[ |
|
2822 |
x := x min:(self widthOfContents - innerWT). |
|
2823 |
]. |
|
2824 |
x := x max:0. |
|
2825 |
newOrg := (x @ y). |
|
2826 |
dltOrg := newOrg - viewOrigin. |
|
2827 |
dX := dltOrg x. |
|
2828 |
dY := dltOrg y. |
|
2829 |
||
2830 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
|
2831 |
^ self |
|
2832 |
]. |
|
2833 |
self originWillChange. |
|
2834 |
viewOrigin := newOrg. |
|
2835 |
||
2836 |
doRedraw ifFalse:[ |
|
2837 |
^ self originChanged:dltOrg |
|
2838 |
]. |
|
2839 |
||
2840 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL |
|
2841 |
dY := dY abs. |
|
2842 |
||
2843 |
(dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2844 |
self invalidate. |
542 | 2845 |
] ifFalse:[ "/ COPY VERTICAL |
2846 |
y0 := y1 := margin + dY. |
|
2847 |
h := innerHG - dY. |
|
2848 |
||
2849 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0] |
|
2850 |
ifFalse:[y1 := margin. y := y1 + h]. |
|
2851 |
||
1460 | 2852 |
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
|
2853 |
self invalidateX:margin y:y width:innerWT height:(innerHG - h). |
542 | 2854 |
] |
2855 |
] ifFalse:[ "/ SCROLL HORIZONTAL |
|
2856 |
dX := dX abs. |
|
2857 |
||
2858 |
innerWT - dX < 20 ifTrue:[ |
|
1487 | 2859 |
labelView invalidate. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2860 |
self invalidate. |
542 | 2861 |
] ifFalse:[ "/ COPY HORIZONTAL |
643 | 2862 |
x0 := x1 := dX + margin. |
542 | 2863 |
w := width - dX - margin. |
2864 |
||
643 | 2865 |
dltOrg x < 0 ifTrue:[x0 := x := margin ] |
2866 |
ifFalse:[x1 := margin. x := w]. |
|
542 | 2867 |
|
1460 | 2868 |
self copyFrom:self x:x0 y:margin toX:x1 y:margin width:w height:innerHG async:false. |
1487 | 2869 |
|
2870 |
labelView notNil ifTrue:[ |
|
2871 |
labelView copyFromX:x0 y:margin toX:x1 y:margin width:w invalidateX:x. |
|
2872 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2873 |
self invalidateX:x y:margin width:(width - w) height:innerHG. |
542 | 2874 |
] |
2875 |
]. |
|
2876 |
self originChanged:dltOrg. |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
2877 |
|
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
2878 |
"Modified: / 7.9.1998 / 16:39:49 / cg" |
542 | 2879 |
! |
2880 |
||
2881 |
scrollToRowAt:aRowNr colAt:aColNr |
|
2882 |
"make row at a row number in column at a column number visible |
|
2883 |
" |
|
1497 | 2884 |
|x "{ Class:SmallInteger }" |
2885 |
y "{ Class:SmallInteger }" |
|
2886 |
l "{ Class:SmallInteger }" |
|
2887 |
dY "{ Class:SmallInteger }" |
|
2888 |
dX "{ Class:SmallInteger }" |
|
2889 |
| |
|
2890 |
||
2891 |
( (aRowNr between:1 and:(list size)) |
|
2892 |
and:[aColNr between:0 and:(columnDescriptors size)] |
|
542 | 2893 |
) ifFalse:[ |
2894 |
^ self |
|
2895 |
]. |
|
2896 |
||
2897 |
dY := dX := 0. |
|
2898 |
y := self yVisibleOfRowNr:aRowNr. |
|
2899 |
||
2900 |
y < margin ifTrue:[ |
|
2901 |
dY := margin - y. |
|
2902 |
] ifFalse:[ |
|
2903 |
y := y + rowHeight. |
|
2904 |
l := height - margin. |
|
2905 |
y > l ifTrue:[dY := l - y] |
|
2906 |
]. |
|
2907 |
||
2908 |
aColNr == 0 ifTrue:[ |
|
2909 |
dY == 0 ifTrue:[^ self]. |
|
2910 |
dX := 0. |
|
2911 |
] ifFalse:[ |
|
2912 |
x := self xVisibleOfColNr:aColNr. |
|
2913 |
||
1163 | 2914 |
x <= margin ifTrue:[ |
542 | 2915 |
dX := margin - x |
2916 |
] ifFalse:[ |
|
1497 | 2917 |
x := x + (columnDescriptors at:aColNr) width. |
542 | 2918 |
l := width - margin. |
2919 |
x > l ifTrue:[dX := l - x] |
|
2920 |
] |
|
2921 |
]. |
|
2922 |
||
2923 |
(dX == 0 and:[dY == 0]) ifFalse:[ |
|
2924 |
self scrollTo:(viewOrigin - (dX @ dY)). |
|
2925 |
] |
|
2926 |
||
2927 |
||
2928 |
! |
|
2929 |
||
2930 |
scrollToSelection |
|
2931 |
"make selection visible |
|
2932 |
" |
|
607 | 2933 |
|rowNr| |
2934 |
||
2935 |
(rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
1497 | 2936 |
self scrollToRowAt:rowNr colAt:selectedColIndex |
542 | 2937 |
] |
2938 |
||
1506 | 2939 |
! |
2940 |
||
2941 |
scrollVerticalTo:aPixelOffset |
|
2942 |
"change origin to make aPixelOffset be the top line" |
|
2943 |
||
2944 |
|orgX orgY| |
|
2945 |
||
2946 |
orgX := viewOrigin x. |
|
2947 |
orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight. |
|
2948 |
^ self scrollTo:(orgX @ orgY). |
|
2949 |
||
542 | 2950 |
! ! |
2951 |
||
2952 |
!DSVColumnView methodsFor:'selection'! |
|
2953 |
||
607 | 2954 |
deselect |
2955 |
"deselect |
|
2956 |
" |
|
2957 |
self selectColIndex:0 rowIndex:0 |
|
2958 |
! |
|
2959 |
||
2960 |
firstIndexSelected |
|
809 | 2961 |
"returns index of first row selected or 0 |
607 | 2962 |
" |
2963 |
multipleSelectOk ifFalse:[ |
|
2964 |
^ selectedRowIndex |
|
2965 |
]. |
|
2966 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2967 |
^ selectedRowIndex at:1 |
|
2968 |
]. |
|
2969 |
^ 0 |
|
2970 |
! |
|
2971 |
||
542 | 2972 |
hasSelection |
607 | 2973 |
"returns true if a selection exists |
542 | 2974 |
" |
607 | 2975 |
^ self numberOfSelections ~~ 0 |
542 | 2976 |
|
2977 |
||
2978 |
! |
|
2979 |
||
607 | 2980 |
isInSelection:aRowNr |
2981 |
"return true, if row, aRowNr is in the selection |
|
542 | 2982 |
" |
607 | 2983 |
aRowNr ~~ 0 ifTrue:[ |
2984 |
multipleSelectOk ifFalse:[ |
|
2985 |
^ aRowNr == selectedRowIndex |
|
2986 |
]. |
|
2987 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2988 |
^ selectedRowIndex includes:aRowNr |
|
2989 |
] |
|
2990 |
]. |
|
2991 |
^ false |
|
2992 |
! |
|
2993 |
||
647 | 2994 |
isRowSelected:aRowNr |
2995 |
"return true, if row is in the selection |
|
2996 |
" |
|
2997 |
selectedColIndex == 0 ifTrue:[ |
|
2998 |
^ self isInSelection:aRowNr |
|
2999 |
]. |
|
3000 |
^ false |
|
3001 |
! |
|
3002 |
||
607 | 3003 |
isSelected:aRowNr inColumn:aColNr |
612 | 3004 |
"returns true if cell in a row; a row number, in a column, a column |
3005 |
number is selected. |
|
3006 |
" |
|
1042 | 3007 |
multipleSelectOk ifFalse:[ |
3008 |
aRowNr ~~ selectedRowIndex ifTrue:[ |
|
3009 |
^ false |
|
3010 |
] |
|
3011 |
] ifTrue:[ |
|
3012 |
(selectedRowIndex size ~~ 0 and:[selectedRowIndex includes:aRowNr]) ifFalse:[ |
|
3013 |
^ false |
|
3014 |
] |
|
607 | 3015 |
]. |
1042 | 3016 |
^ (selectedColIndex == 0 or:[selectedColIndex == aColNr]) |
3017 |
||
607 | 3018 |
! |
3019 |
||
809 | 3020 |
lastIndexSelected |
3021 |
"returns index of last row selected or 0 |
|
3022 |
" |
|
3023 |
multipleSelectOk ifFalse:[ |
|
3024 |
^ selectedRowIndex |
|
3025 |
]. |
|
3026 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3027 |
^ selectedRowIndex last |
|
3028 |
]. |
|
3029 |
^ 0 |
|
3030 |
! |
|
3031 |
||
607 | 3032 |
numberOfSelections |
3033 |
"return the number of selected rows |
|
3034 |
" |
|
3035 |
multipleSelectOk ifFalse:[ |
|
3036 |
^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
|
3037 |
]. |
|
3038 |
^ selectedRowIndex size |
|
542 | 3039 |
! |
3040 |
||
3041 |
selectColIndex:aColNr rowIndex:aRowNr |
|
3042 |
"change selection with notification |
|
3043 |
" |
|
3044 |
|oC oR| |
|
3045 |
||
607 | 3046 |
oC := self selectedColIndex. |
3047 |
oR := self selectedRowIndex. |
|
542 | 3048 |
|
3049 |
self setSelectColIndex:aColNr rowIndex:aRowNr. |
|
3050 |
||
607 | 3051 |
(oC ~~ self selectedColIndex or:[oR ~= self selectedRowIndex]) ifTrue:[ |
542 | 3052 |
self selectionChanged |
3053 |
]. |
|
3054 |
! |
|
3055 |
||
607 | 3056 |
selectRow:something |
542 | 3057 |
"select a row |
3058 |
" |
|
607 | 3059 |
^ self selectedRowIndex:something |
542 | 3060 |
! |
3061 |
||
809 | 3062 |
selectRowAt:rowNr colAt:colNr atPoint:aPoint |
3063 |
|v p| |
|
3064 |
||
3065 |
self selectColIndex:colNr rowIndex:rowNr. |
|
3066 |
||
3067 |
(v := self detectViewAt:aPoint in:editView) notNil ifTrue:[ |
|
3068 |
p := device translatePoint:aPoint from:(self id) to:(v id). |
|
3069 |
||
3070 |
self sensor pushEvent:(WindowEvent buttonEvent |
|
3071 |
for:v |
|
3072 |
type:#buttonPress:x:y: |
|
3073 |
arguments:(Array with:#select with:p x with:p y) |
|
3074 |
) |
|
3075 |
]. |
|
3076 |
||
3077 |
||
3078 |
! |
|
3079 |
||
607 | 3080 |
selectRowIndex:something |
3081 |
"set selection of rows |
|
542 | 3082 |
" |
607 | 3083 |
self selectColIndex:selectedColIndex rowIndex:something |
3084 |
||
3085 |
||
542 | 3086 |
! |
3087 |
||
3088 |
selectedColIndex |
|
3089 |
"returns selected column number or 0 |
|
3090 |
" |
|
3091 |
^ selectedColIndex |
|
3092 |
! |
|
3093 |
||
3094 |
selectedColumn |
|
3095 |
"returns selected column or nil |
|
3096 |
" |
|
3097 |
^ columnDescriptors at:selectedColIndex ifAbsent:nil. |
|
3098 |
! |
|
3099 |
||
3100 |
selectedRow |
|
607 | 3101 |
"returns selected row (or collection if multiple selection) or nil |
542 | 3102 |
" |
607 | 3103 |
multipleSelectOk ifFalse:[ |
3104 |
^ self at:selectedRowIndex ifAbsent:nil |
|
3105 |
]. |
|
3106 |
||
3107 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3108 |
^ selectedRowIndex collect:[:i| self at:i] |
|
3109 |
]. |
|
3110 |
^ nil |
|
3111 |
! |
|
3112 |
||
3113 |
selectedRow:something |
|
3114 |
"select something |
|
3115 |
" |
|
3116 |
self selectedRowIndex:something |
|
542 | 3117 |
! |
3118 |
||
3119 |
selectedRowIndex |
|
3120 |
"returns selected row number or 0 |
|
3121 |
" |
|
3122 |
^ selectedRowIndex |
|
3123 |
! |
|
3124 |
||
607 | 3125 |
selectedRowIndex:something |
3126 |
"set selection of rows |
|
3127 |
" |
|
3128 |
self selectColIndex:selectedColIndex rowIndex:something |
|
3129 |
||
3130 |
||
542 | 3131 |
! |
3132 |
||
3133 |
selectionChanged |
|
3134 |
"selection has changed |
|
3135 |
" |
|
1487 | 3136 |
|val| |
3137 |
||
3138 |
model notNil ifTrue:[ |
|
3139 |
val := self selectedRowIndex copy. |
|
3140 |
||
3141 |
(model respondsTo:#selectionIndex:) ifTrue:[ |
|
3142 |
model selectionIndex:val |
|
3143 |
] ifFalse:[ |
|
3144 |
useIndex ifFalse:[ model value:(self selectedRow) ] |
|
3145 |
ifTrue:[ model value:val ] |
|
3146 |
] |
|
3147 |
]. |
|
542 | 3148 |
|
3149 |
actionBlock notNil ifTrue:[ |
|
607 | 3150 |
actionBlock value:(self selectedRowIndex) |
3151 |
] |
|
3152 |
! |
|
3153 |
||
3154 |
selectionIndicesDo:aOneArgBlock |
|
3155 |
"evaluate block on each row selected; the argument to the row |
|
3156 |
is the index of the selected row |
|
3157 |
" |
|
3158 |
multipleSelectOk ifFalse:[ |
|
3159 |
selectedRowIndex ~~ 0 ifTrue:[ |
|
3160 |
aOneArgBlock value:selectedRowIndex |
|
3161 |
] |
|
3162 |
] ifTrue:[ |
|
3163 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3164 |
selectedRowIndex do:[:i| aOneArgBlock value:i ] |
|
3165 |
] |
|
542 | 3166 |
] |
3167 |
! |
|
3168 |
||
3169 |
setSelectColIndex:aColNr rowIndex:aRowNr |
|
3170 |
"change selection without notification |
|
3171 |
" |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3172 |
|editSpec rowNr colNr newCol oldCol oldRow sensor sglSelRow oldSz |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3173 |
keyBrdFwd filter edValue edView| |
542 | 3174 |
|
607 | 3175 |
rowNr := self validateSelection:aRowNr. |
542 | 3176 |
|
607 | 3177 |
multipleSelectOk ifTrue:[ |
3178 |
colNr := (rowNr size == 1) ifTrue:[aColNr] ifFalse:[0] |
|
3179 |
] ifFalse:[ |
|
3180 |
colNr := rowNr ~~ 0 ifTrue:[aColNr] ifFalse:[0] |
|
542 | 3181 |
]. |
3182 |
||
607 | 3183 |
(colNr := colNr ? 0) ~~ 0 ifTrue:[ |
3184 |
newCol := self columnAt:colNr. |
|
3185 |
newCol rendererType == #rowSelector ifTrue:[ |
|
3186 |
colNr := 0. |
|
3187 |
newCol := nil |
|
3188 |
] ifFalse:[ |
|
3189 |
multipleSelectOk ifTrue:[sglSelRow := rowNr at:1] |
|
3190 |
ifFalse:[sglSelRow := rowNr]. |
|
3191 |
||
3192 |
(newCol canSelect:sglSelRow) ifFalse:[ |
|
3193 |
newCol := nil. |
|
1112 | 3194 |
colNr := 0. |
3195 |
||
3196 |
selectRowOnDefault ifFalse:[ |
|
3197 |
rowNr := multipleSelectOk ifFalse:[0] ifTrue:[nil] |
|
3198 |
] |
|
607 | 3199 |
] |
3200 |
] |
|
3201 |
]. |
|
3202 |
||
3203 |
(rowNr = selectedRowIndex and:[colNr == selectedColIndex]) ifTrue:[ |
|
643 | 3204 |
^ self |
542 | 3205 |
]. |
3206 |
||
3207 |
"/ release old selection |
|
3208 |
||
612 | 3209 |
oldSz := self numberOfSelections. |
542 | 3210 |
oldCol := selectedColIndex. |
3211 |
oldRow := selectedRowIndex. |
|
612 | 3212 |
|
542 | 3213 |
selectedRowIndex := rowNr. |
3214 |
selectedColIndex := colNr. |
|
3215 |
||
612 | 3216 |
oldSz == 1 ifTrue:[ |
3217 |
multipleSelectOk ifTrue:[oldRow := oldRow at:1]. |
|
542 | 3218 |
|
612 | 3219 |
editValue notNil ifTrue:[ |
1215 | 3220 |
editValue removeDependent:self |
3221 |
]. |
|
3222 |
editView notNil ifTrue:[ |
|
3223 |
editView allSubViewsDo:[:aSubView| |
|
3224 |
aSubView perform:#accept ifNotUnderstood:nil. |
|
3225 |
] |
|
3226 |
]. |
|
3227 |
||
3228 |
editValue notNil ifTrue:[ |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3229 |
edValue := editValue value. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3230 |
edValue isSequenceable ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3231 |
edValue size == 0 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3232 |
edValue := nil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3233 |
] ifFalse:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3234 |
edValue isString not ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3235 |
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
|
3236 |
edValue size == 0 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3237 |
edValue := nil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3238 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3239 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3240 |
] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3241 |
]. |
1661 | 3242 |
(self columnAt:oldCol) at:oldRow put:edValue. |
3243 |
modifiedChannel notNil ifTrue:[ |
|
3244 |
modifiedChannel value:true |
|
3245 |
]. |
|
612 | 3246 |
editValue := nil |
3247 |
]. |
|
1111 | 3248 |
self destroyEditView. |
612 | 3249 |
]. |
3250 |
shown ifFalse:[^ self ]. |
|
542 | 3251 |
|
618 | 3252 |
oldSz > 1 ifTrue:[ "/ redraw old selection |
3253 |
oldRow do:[:aRowNr| "/ unselected if visible |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3254 |
self invalidateRowAt:aRowNr colAt:0 |
618 | 3255 |
] |
3256 |
] ifFalse:[ |
|
3257 |
oldSz == 1 ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3258 |
self invalidateRowAt:oldRow colAt:oldCol |
618 | 3259 |
] |
3260 |
]. |
|
3261 |
||
542 | 3262 |
"/ show new selection |
3263 |
||
3264 |
newCol notNil ifTrue:[ |
|
607 | 3265 |
self scrollToRowAt:sglSelRow colAt:colNr. |
833 | 3266 |
editSpec := newCol editorAt:sglSelRow. |
3267 |
||
3268 |
editSpec notNil ifTrue:[ |
|
1112 | 3269 |
editView := SimpleView extent:( (newCol width - (2 * separatorSize)) |
3270 |
@ (rowHeight - (2 * separatorSize)) |
|
607 | 3271 |
) |
3272 |
in:self. |
|
542 | 3273 |
self updateEditViewOrigin. |
1112 | 3274 |
|
1134 | 3275 |
(newCol containsText or:[newCol showSelectionHighLighted not]) ifTrue:[ |
1565 | 3276 |
editView viewBackground:(newCol backgroundColorAt:sglSelRow) |
1112 | 3277 |
] ifFalse:[ |
3278 |
editView viewBackground:hgLgBgColor |
|
3279 |
]. |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3280 |
edView := editSpec at:1. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3281 |
editView add:edView. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3282 |
oldSz := editSpec size. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3283 |
|
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3284 |
oldSz == 3 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3285 |
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
|
3286 |
] ifFalse:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3287 |
filter := [:aKey| aKey == #Tab] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3288 |
]. |
1111 | 3289 |
keyBrdFwd := KeyboardForwarder toView:self |
3290 |
condition:nil |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3291 |
filter:filter. |
1111 | 3292 |
|
3293 |
editView withAllSubViewsDo:[:aView| |
|
1112 | 3294 |
aView delegate:keyBrdFwd. |
3295 |
aView font:font. |
|
1111 | 3296 |
]. |
3297 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3298 |
(editValue := editSpec at:2 ifAbsent:nil) notNil ifTrue:[ |
809 | 3299 |
editValue addDependent:self. |
648 | 3300 |
]. |
542 | 3301 |
editView realize. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3302 |
edView canTab:true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3303 |
self windowGroup focusView:edView. |
1111 | 3304 |
|
542 | 3305 |
] ifFalse:[ |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3306 |
self invalidateRowAt:sglSelRow colAt:colNr |
612 | 3307 |
]. |
3308 |
] ifFalse:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3309 |
self selectionIndicesDo:[:i| self invalidateRowAt:i colAt:0 ]. |
612 | 3310 |
self scrollToRowAt:(self firstIndexSelected) colAt:0 |
3311 |
]. |
|
3312 |
||
3313 |
sensor := self sensor. "/ catch expose events |
|
3314 |
||
3315 |
[sensor hasExposeEventFor:nil] whileTrue:[ |
|
3316 |
self windowGroup processExposeEvents |
|
3317 |
]. |
|
3318 |
||
1661 | 3319 |
"Modified: / 30.1.2000 / 12:18:25 / cg" |
607 | 3320 |
! |
3321 |
||
3322 |
validateSelection:aSelection |
|
3323 |
|newSel| |
|
3324 |
||
3325 |
newSel := aSelection. |
|
3326 |
||
1497 | 3327 |
(list size == 0 or:[newSel isNil or:[newSel == 0]]) ifTrue:[ |
607 | 3328 |
^ multipleSelectOk ifFalse:[0] ifTrue:[nil] |
3329 |
]. |
|
3330 |
||
3331 |
newSel isNumber ifTrue:[ |
|
3332 |
^ multipleSelectOk ifFalse:[newSel] ifTrue:[OrderedCollection with:newSel] |
|
3333 |
]. |
|
3334 |
multipleSelectOk ifFalse:[ |
|
618 | 3335 |
newSel := self identityIndexOfRow:aSelection |
607 | 3336 |
] ifTrue:[ |
3337 |
newSel := nil. |
|
3338 |
||
3339 |
aSelection size ~~ 0 ifTrue:[ |
|
3340 |
aSelection first isNumber ifTrue:[ |
|
3341 |
newSel := aSelection |
|
3342 |
] ifFalse:[ |
|
3343 |
aSelection do:[:el||n| |
|
618 | 3344 |
(n := self identityIndexOfRow:el) ~~ 0 ifTrue:[ |
607 | 3345 |
newSel isNil ifTrue:[newSel := OrderedCollection new]. |
3346 |
newSel add:n |
|
3347 |
] |
|
3348 |
] |
|
3349 |
] |
|
3350 |
] |
|
3351 |
]. |
|
3352 |
^ newSel |
|
542 | 3353 |
! ! |
3354 |
||
3355 |
!DSVColumnView class methodsFor:'documentation'! |
|
3356 |
||
3357 |
version |
|
1721
92249c0b9300
#menuPerformer redefined to avoid sending menuMessages
Claus Gittinger <cg@exept.de>
parents:
1711
diff
changeset
|
3358 |
^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.102 2000-02-23 14:27:10 cg Exp $' |
542 | 3359 |
! ! |