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