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