author | Claus Gittinger <cg@exept.de> |
Thu, 27 May 2004 16:27:37 +0200 | |
changeset 2711 | 6cbf18e03573 |
parent 2703 | 252b881f86ad |
child 2714 | f0d55d0e204d |
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 |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
19 |
instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
20 |
selectedColIndex selectedRowIndex selectRowOnDefault |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
21 |
buttonMotionAction buttonReleaseAction rowHeight minRowHeight |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
22 |
columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
23 |
rowIfAbsentBlock columnHolder registererImages list fgColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
24 |
separatorSize catchChangeEvents beDependentOfRows bgColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
25 |
actionBlock builder tabIntern doubleClickActionBlock |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
26 |
verticalSpacing horizontalSpacing rowSelectorForm |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
27 |
buttonLightColor buttonShadowColor buttonHalfLightColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
28 |
buttonHalfShadowColor checkToggleExtent checkToggleForm |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
29 |
checkToggleActiveImage checkTogglePassiveImage checkToggleLevel |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
30 |
comboButtonExtent comboButtonForm comboButtonLevel dropTarget |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
31 |
dropSource columnAdaptor tabAtEndAction tabAtStartAction |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
32 |
modifiedChannel autoScroll autoScrollBlock needFitColumns |
2637 | 33 |
scrollWhenUpdating separatorOneDColor selectionForegroundColor |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
34 |
selectionBackgroundColor previousExtent selectConditionBlock' |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
35 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
36 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
37 |
ButtonLightColor ButtonShadowColor CheckToggleActiveImage |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
38 |
CheckTogglePassiveImage ButtonHalfLightColor |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
39 |
ButtonHalfShadowColor ButtonEdgeStyle CheckToggleForm |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
40 |
CheckToggleLevel CheckToggleExtent ComboButtonForm |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
41 |
ComboButtonLevel ComboButtonExtent StopRedrawSignal' |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
42 |
poolDictionaries:'' |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
43 |
category:'Views-DataSet' |
542 | 44 |
! |
45 |
||
46 |
!DSVColumnView class methodsFor:'documentation'! |
|
47 |
||
48 |
copyright |
|
49 |
" |
|
50 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
51 |
All Rights Reserved |
|
52 |
||
53 |
This software is furnished under a license and may be used |
|
54 |
only in accordance with the terms of that license and with the |
|
55 |
inclusion of the above copyright notice. This software may not |
|
56 |
be provided or otherwise made available to, or used by, any |
|
57 |
other person. No title to or ownership of the software is |
|
58 |
hereby transferred. |
|
59 |
" |
|
60 |
||
61 |
||
62 |
||
63 |
! |
|
64 |
||
65 |
documentation |
|
66 |
" |
|
67 |
implements a scrollable selection view based on rows and columns |
|
68 |
||
69 |
[Instance variables:] |
|
70 |
||
71 |
editValue <Model> current editing model |
|
72 |
editView <View> current editing component |
|
1087 | 73 |
|
2398 | 74 |
buttonReleaseAction <Action or nil> called if the mouse button is released |
75 |
buttonMotionAction <Action or nil> called during mouse motion with one |
|
76 |
argument the point under the mouse. |
|
77 |
||
1087 | 78 |
multipleSelectOk <Boolean> multiple selection enabled/disabled |
79 |
||
542 | 80 |
selectedColIndex <Integer> selected column index or 0 |
1087 | 81 |
selectedRowIndex <Integer> selected row index or 0 |
82 |
||
542 | 83 |
rowHeight <Integer> maximum height of any row |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
84 |
minRowHeight <Integer> minimum height of all displayed labels |
1087 | 85 |
|
542 | 86 |
columnDescriptors <SequancableCollection> list of column descriptors |
1087 | 87 |
|
88 |
viewOrigin <Point> current view origin |
|
89 |
||
90 |
colorMap <Dictionary> store and register used colors on device |
|
91 |
||
92 |
rowFontAscent <SmallInteger> inset of a printable text in a row |
|
93 |
including separator and font ascent. |
|
94 |
||
95 |
lockRowIndex <SmallInteger> internal used to indicate a row which has |
|
96 |
changed its contents but no redraw should be |
|
97 |
done( at:put: ). |
|
98 |
||
99 |
columnHolder <ValueHolder> holder which keeps the list of column descriptors. |
|
100 |
||
101 |
registererImages <IdentityDictionary> list of images registered on the device |
|
102 |
||
542 | 103 |
list <SequancableCollection> list of rows |
1087 | 104 |
|
105 |
||
106 |
catchChangeEvents <Boolean> internal used to discard change notifications |
|
107 |
||
108 |
beDependentOfRows <Boolean> keep rows dependent; on default is disabled. |
|
567 | 109 |
in case of enabled a row can raise a change |
110 |
notification whithout a parameter which |
|
111 |
will force a redraw of the row or the |
|
112 |
readSelector of the column which will |
|
113 |
redraw the cell in the row only. |
|
542 | 114 |
|
1087 | 115 |
fgColor <Color> foreground color |
116 |
bgColor <Color> background color |
|
117 |
hgLgFgColor <Color> highlight foreground color (selected) |
|
118 |
hgLgBgColor <Color> highlight background color (selected) |
|
119 |
||
120 |
buttonLightColor <Color> LightColor ( drawing the edge of a button ) |
|
121 |
buttonShadowColor <Color> ShadowColor ( drawing the edge of a button ) |
|
122 |
buttonHalfLightColor <Color> HalfLightColor ( drawing the edge of a button ) |
|
123 |
buttonHalfShadowColor <Color> HalfShadowColor ( drawing the edge of a button ) |
|
124 |
||
125 |
actionBlock <a OneArgBlock> action block performed on select |
|
126 |
doubleClickActionBlock <a OneArgBlock> action block performed on double click |
|
127 |
rowIfAbsentBlock <a OneArgBlock> this block is performed on an emty list entry |
|
128 |
to retrive the item from the application. The |
|
129 |
argument to the block is the index into the list. |
|
130 |
The block should return the row instance which |
|
131 |
is put to the list under the index. |
|
132 |
||
133 |
builder <UIBuilder> builder set by application |
|
134 |
||
135 |
verticalSpacing <SmallInteger> vertical row spacing( top & bottom ) |
|
136 |
horizontalSpacing <SmallInteger> horizontal row spacing( left & right ) |
|
137 |
separatorSize <SmallInteger> line width of a vertical or horizontal separator |
|
138 |
||
139 |
rowSelectorForm <Form> form used by a row selector |
|
140 |
||
141 |
checkToggleForm <Form> form used by a checkToggle |
|
142 |
checkToggleExtent <Point> extent of a checkToggle |
|
143 |
checkToggleLevel <SmallInteger> level used to draw a check toggle |
|
144 |
||
145 |
comboButtonForm <Form> form used by a comboList or -Box |
|
146 |
comboButtonExtent <Point> extent of a comboList or -Box |
|
147 |
comboButtonLevel <SmallInteger> level used to draw a comboList or -Box |
|
148 |
||
149 |
dropTarget <DropTarget> drag & drop target |
|
150 |
dropSource <DropSource> drag & drop source |
|
151 |
||
542 | 152 |
[author:] |
153 |
Claus Atzkern |
|
154 |
||
155 |
[see also:] |
|
156 |
DataSetColumnSpec |
|
157 |
DataSetColumn |
|
158 |
DataSetView |
|
159 |
" |
|
160 |
! ! |
|
161 |
||
647 | 162 |
!DSVColumnView class methodsFor:'defaults'! |
607 | 163 |
|
1844 | 164 |
defaultFont |
165 |
^ SelectionInListView defaultFont |
|
166 |
! |
|
167 |
||
563 | 168 |
horizontalSpacing |
1087 | 169 |
"returns the default horizontal space between rows |
170 |
" |
|
563 | 171 |
^ 4 |
172 |
||
173 |
! |
|
174 |
||
542 | 175 |
updateStyleCache |
176 |
"extract values from the styleSheet and cache them in class variables |
|
177 |
" |
|
2146 | 178 |
<resource: #style (#textForegroundColor |
179 |
#'scrollableView.backgroundColor' |
|
582 | 180 |
#'selection.hilightForegroundColor' |
181 |
#'selection.hilightBackgroundColor' )> |
|
542 | 182 |
|
1333 | 183 |
DefaultForegroundColor := StyleSheet colorAt:#'textForegroundColor' default:(Color black). |
184 |
DefaultBackgroundColor := StyleSheet colorAt:#'scrollableView.backgroundColor' default:DefaultViewBackgroundColor. |
|
185 |
||
186 |
DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor. |
|
187 |
DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor. |
|
607 | 188 |
|
647 | 189 |
DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[ |
988 | 190 |
DefaultHilightBackgroundColor := Color black |
647 | 191 |
]. |
1333 | 192 |
ButtonLightColor := StyleSheet colorAt:#'button.lightColor'. |
193 |
ButtonShadowColor := StyleSheet colorAt:#'button.shadowColor'. |
|
194 |
ButtonHalfLightColor := StyleSheet colorAt:#'button.halfLightColor'. |
|
195 |
ButtonHalfShadowColor := StyleSheet colorAt:#'button.halfShadowColor'. |
|
196 |
ButtonEdgeStyle := StyleSheet at:#'button.edgeStyle'. |
|
197 |
CheckToggleActiveImage := StyleSheet at:#'checkToggle.activeImage'. |
|
1100 | 198 |
|
199 |
CheckToggleActiveImage isNil ifTrue:[ |
|
200 |
CheckTogglePassiveImage := nil |
|
201 |
] ifFalse:[ |
|
1333 | 202 |
CheckTogglePassiveImage := StyleSheet at:#'checkToggle.passiveImage'. |
1100 | 203 |
|
204 |
CheckTogglePassiveImage isNil ifTrue:[ |
|
205 |
CheckToggleActiveImage := nil |
|
206 |
] |
|
207 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
208 |
ComboButtonForm := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
209 |
ComboButtonLevel := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
210 |
ComboButtonExtent := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
211 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
212 |
CheckToggleForm := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
213 |
CheckToggleLevel := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
214 |
CheckToggleExtent := nil. |
647 | 215 |
|
542 | 216 |
" |
217 |
self updateStyleCache. |
|
218 |
" |
|
219 |
||
582 | 220 |
"Modified: / 26.10.1997 / 17:09:07 / cg" |
563 | 221 |
! |
222 |
||
223 |
verticalSpacing |
|
1087 | 224 |
"returns the default vertical space between rows |
225 |
" |
|
563 | 226 |
^ 2 |
227 |
||
542 | 228 |
! ! |
229 |
||
2711 | 230 |
!DSVColumnView class methodsFor:'image specs'! |
809 | 231 |
|
232 |
dragIconMulti |
|
988 | 233 |
"This resource specification was automatically generated |
234 |
by the ImageEditor of ST/X." |
|
235 |
||
236 |
"Do not manually edit this!! If it is corrupted, |
|
237 |
the ImageEditor may not be able to read the specification." |
|
238 |
||
809 | 239 |
" |
988 | 240 |
self dragIconMulti inspect |
241 |
ImageEditor openOnClass:self andSelector:#dragIconMulti |
|
809 | 242 |
" |
243 |
||
244 |
<resource: #image> |
|
245 |
||
246 |
^Icon |
|
247 |
constantNamed:#'DSVColumnView dragIconMulti' |
|
1926
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
248 |
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
|
249 |
! |
809 | 250 |
|
251 |
dragIconSingle |
|
988 | 252 |
"This resource specification was automatically generated |
253 |
by the ImageEditor of ST/X." |
|
254 |
||
255 |
"Do not manually edit this!! If it is corrupted, |
|
256 |
the ImageEditor may not be able to read the specification." |
|
257 |
||
809 | 258 |
" |
988 | 259 |
self dragIconSingle inspect |
260 |
ImageEditor openOnClass:self andSelector:#dragIconSingle |
|
809 | 261 |
" |
262 |
||
263 |
<resource: #image> |
|
264 |
||
265 |
^Icon |
|
266 |
constantNamed:#'DSVColumnView dragIconSingle' |
|
1926
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
267 |
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] |
2711 | 268 |
! |
269 |
||
270 |
rowSelectorImage |
|
271 |
"This resource specification was automatically generated |
|
272 |
by the ImageEditor of ST/X." |
|
273 |
||
274 |
"Do not manually edit this!! If it is corrupted, |
|
275 |
the ImageEditor may not be able to read the specification." |
|
276 |
||
277 |
" |
|
278 |
self rowSelectorImage inspect |
|
279 |
ImageEditor openOnClass:self andSelector:#rowSelectorImage |
|
280 |
Icon flushCachedIcons |
|
281 |
" |
|
282 |
||
283 |
<resource: #image> |
|
284 |
||
285 |
^Icon |
|
286 |
constantNamed:#'DSVColumnView class rowSelectorImage' |
|
287 |
ifAbsentPut:[(Depth2Image new) width: 11; height: 11; photometric:(#palette); bitsPerSample:(#(2)); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@0@@@1@@?1P@@A4@EW=@G?? O?:@@C(@?2 @@2@@@0@@') ; 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] |
|
1926
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
288 |
! ! |
809 | 289 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
290 |
!DSVColumnView class methodsFor:'signal constants'! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
291 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
292 |
stopRedrawSignal |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
293 |
"returns the signal which is raised during drawing if the |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
294 |
required label height is less than the current rowHeight |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
295 |
" |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
296 |
StopRedrawSignal isNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
297 |
StopRedrawSignal := Notification newSignalMayProceed:true. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
298 |
StopRedrawSignal nameClass:self message:#stopRedrawSignal. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
299 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
300 |
^ StopRedrawSignal |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
301 |
! ! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
302 |
|
2695 | 303 |
!DSVColumnView methodsFor:'AEG-Extensions'! |
304 |
||
305 |
doScrollCenterToColAt:aColNr |
|
306 |
"make column at a column number visible, positioning in the center |
|
307 |
" |
|
308 |
|x dX l x1 | |
|
309 |
||
310 |
(aColNr between:0 and:(self numberOfColumns)) ifFalse:[ |
|
311 |
^ self |
|
312 |
]. |
|
313 |
||
314 |
dX := 0. |
|
315 |
aColNr == 0 ifTrue:[^self]. |
|
316 |
x1 := self xVisibleOfColNr:aColNr. |
|
317 |
x := x1 - (width / 2) asInteger. |
|
318 |
x <= margin ifTrue:[ |
|
319 |
dX := margin - x |
|
320 |
] ifFalse:[ |
|
321 |
x := x1 + (width / 2) asInteger - 1. |
|
322 |
l := width - margin. |
|
323 |
x > l ifTrue:[dX := l - x] |
|
324 |
]. |
|
325 |
||
326 |
(dX == 0) ifFalse:[ |
|
327 |
self scrollTo: viewOrigin - (dX@0). |
|
328 |
]. |
|
329 |
||
330 |
! |
|
331 |
||
332 |
scrollCenterToColAt:aColNr |
|
333 |
"make column at a column number visible, positioning in the center |
|
334 |
" |
|
335 |
"/ |x dX l x1 | |
|
336 |
self pushEvent:#doScrollCenterToColAt: with:aColNr. |
|
337 |
"/ (aColNr between:0 and:(self numberOfColumns)) ifFalse:[ |
|
338 |
"/ ^ self |
|
339 |
"/ ]. |
|
340 |
"/ |
|
341 |
"/ dX := 0. |
|
342 |
"/ aColNr == 0 ifTrue:[^self]. |
|
343 |
"/ x1 := self xVisibleOfColNr:aColNr. |
|
344 |
"/ x := x1 - (width / 2) asInteger. |
|
345 |
"/ x <= margin ifTrue:[ |
|
346 |
"/ dX := margin - x |
|
347 |
"/ ] ifFalse:[ |
|
348 |
"/ x := x1 + (width / 2) asInteger - 1. |
|
349 |
"/ l := width - margin. |
|
350 |
"/ x > l ifTrue:[dX := l - x] |
|
351 |
"/ ]. |
|
352 |
"/ |
|
353 |
"/ (dX == 0) ifFalse:[ |
|
354 |
"/ self scrollTo: viewOrigin - (dX@0). |
|
355 |
"/ ] |
|
356 |
"/ |
|
357 |
||
358 |
! ! |
|
359 |
||
886 | 360 |
!DSVColumnView methodsFor:'accessing'! |
361 |
||
1042 | 362 |
builder |
1087 | 363 |
"get the builder (UIBuilder or nil) |
364 |
" |
|
1042 | 365 |
^ builder |
366 |
! |
|
367 |
||
368 |
builder:aBuilder |
|
1087 | 369 |
"set the builder (UIBuilder or nil) |
370 |
" |
|
1042 | 371 |
builder := aBuilder |
372 |
! |
|
373 |
||
886 | 374 |
columnView |
1087 | 375 |
"returns self |
376 |
" |
|
886 | 377 |
^ self |
1067
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
378 |
! |
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
379 |
|
2695 | 380 |
labelView |
381 |
||
382 |
^labelView |
|
383 |
! |
|
384 |
||
1487 | 385 |
labelView:aView |
386 |
labelView := aView for:self. |
|
387 |
||
2146 | 388 |
labelView layout:(LayoutFrame |
389 |
leftFraction:0 offset:0 |
|
390 |
rightFraction:1 offset:0 |
|
391 |
topFraction:0 offset:0 |
|
392 |
bottomFraction:0 offset:[self preferredLabelViewHeight]). |
|
1067
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
393 |
! |
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
394 |
|
1487 | 395 |
level:aLevel |
396 |
"change the level and thus the level of the labelView |
|
397 |
" |
|
398 |
aLevel ~~ level ifTrue:[ |
|
399 |
super level:aLevel. |
|
2146 | 400 |
"/ labelView level:aLevel. |
1487 | 401 |
] |
1087 | 402 |
! |
403 |
||
1661 | 404 |
modifiedChannel |
405 |
^ modifiedChannel |
|
406 |
||
407 |
"Created: / 30.1.2000 / 12:10:57 / cg" |
|
408 |
! |
|
409 |
||
410 |
modifiedChannel:something |
|
411 |
modifiedChannel := something. |
|
412 |
||
413 |
"Created: / 30.1.2000 / 12:10:57 / cg" |
|
414 |
! |
|
415 |
||
2146 | 416 |
preferredLabelViewHeight |
417 |
^ labelView preferredHeight + (labelView margin + self verticalSpacing * 2). |
|
418 |
! |
|
419 |
||
1087 | 420 |
rowFontAscent |
421 |
"returns the inset of a printable text in a row |
|
422 |
" |
|
423 |
^ rowFontAscent |
|
886 | 424 |
! ! |
425 |
||
1818 | 426 |
!DSVColumnView methodsFor:'accessing-actions'! |
542 | 427 |
|
428 |
action:aOneArgAction |
|
607 | 429 |
"set the action block to be performed on select |
430 |
" |
|
542 | 431 |
actionBlock := aOneArgAction |
432 |
||
433 |
||
434 |
! |
|
435 |
||
809 | 436 |
doubleClickAction:aOneArgAction |
437 |
"set the action block to be performed on doubleclick |
|
438 |
" |
|
439 |
doubleClickActionBlock := aOneArgAction |
|
440 |
||
441 |
||
442 |
! |
|
443 |
||
444 |
rowIfAbsent:aOneArgAction |
|
445 |
"set the action block to be performed on each 'nil' entry into the |
|
446 |
list. The argument to the block is the index into the list. The |
|
447 |
block returns the row which is put to the list |
|
448 |
" |
|
449 |
rowIfAbsentBlock := aOneArgAction |
|
450 |
||
451 |
||
1416 | 452 |
! |
453 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
454 |
selectConditionBlock |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
455 |
"get the select-conditionBlock; this block is evaluated before |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
456 |
any selection change is performed (passing the to-be-changed row number |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
457 |
index as arg). |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
458 |
The change will not be done, if the block returns false. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
459 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
460 |
^ selectConditionBlock |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
461 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
462 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
463 |
selectConditionBlock:aOneArgBlockOrNil |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
464 |
"set the select-conditionBlock; this block is evaluated before |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
465 |
any selection change is performed (passing the to-be-changed row number |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
466 |
index as arg). |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
467 |
The change will not be done, if the block returns false. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
468 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
469 |
selectConditionBlock := aOneArgBlockOrNil. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
470 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
471 |
|
1416 | 472 |
tabAtEndAction:aNoneArgAction |
473 |
"set the action, called without any argument at end of the list entering |
|
474 |
tab next. |
|
475 |
The default is to give the focus to the view after self in the focusSequence |
|
476 |
" |
|
477 |
tabAtEndAction := aNoneArgAction |
|
478 |
||
479 |
||
480 |
! |
|
481 |
||
482 |
tabAtStartAction:aNoneArgAction |
|
483 |
"set the action, called without any argument at start of the list entering |
|
484 |
tab previous. |
|
485 |
The default is to give the focus to the view before self in the focusSequence |
|
486 |
" |
|
487 |
tabAtStartAction := aNoneArgAction |
|
488 |
||
489 |
||
809 | 490 |
! ! |
491 |
||
1818 | 492 |
!DSVColumnView methodsFor:'accessing-behavior'! |
809 | 493 |
|
542 | 494 |
beDependentOfRows |
495 |
"make myself dependent of any row; in this case any change notification |
|
496 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
497 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
498 |
-> row changed:'what' |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
499 |
On default the attribute is set to false (disabled). |
542 | 500 |
" |
501 |
^ beDependentOfRows |
|
502 |
! |
|
503 |
||
504 |
beDependentOfRows:aBool |
|
505 |
"make myself dependent of any row; in this case any change notification |
|
506 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
507 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
508 |
-> row changed:'what' |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
509 |
On default the attribute is set to false (disabled). |
542 | 510 |
" |
511 |
aBool ~~ beDependentOfRows ifTrue:[ |
|
618 | 512 |
beDependentOfRows := aBool. |
513 |
||
1497 | 514 |
list size ~~ 0 ifTrue:[ |
618 | 515 |
list do:[:aRow| aRow notNil ifTrue:[ |
516 |
beDependentOfRows ifTrue:[aRow addDependent:self] |
|
517 |
ifFalse:[aRow removeDependent:self] |
|
518 |
] |
|
519 |
] |
|
542 | 520 |
] |
618 | 521 |
] |
607 | 522 |
! |
523 |
||
1805 | 524 |
enableChannel:aChannel |
525 |
enableChannel notNil ifTrue:[ |
|
526 |
enableChannel removeDependent:self |
|
527 |
]. |
|
528 |
(enableChannel := aChannel) notNil ifTrue:[ |
|
529 |
enableChannel addDependent:self |
|
530 |
]. |
|
531 |
! |
|
532 |
||
607 | 533 |
multipleSelectOk |
534 |
"allow/disallow multiple row selections; the default is false |
|
535 |
" |
|
536 |
^ multipleSelectOk |
|
537 |
! |
|
538 |
||
539 |
multipleSelectOk:aState |
|
540 |
"allow/disallow multiple row selections; the default is false |
|
541 |
" |
|
542 |
aState == multipleSelectOk ifFalse:[ |
|
543 |
multipleSelectOk := aState. |
|
544 |
self deselect |
|
545 |
] |
|
1112 | 546 |
! |
547 |
||
1938 | 548 |
opaqueColumnResize |
549 |
^ labelView opaqueColumnResize |
|
550 |
! |
|
551 |
||
552 |
opaqueColumnResize:aBoolean |
|
553 |
labelView opaqueColumnResize:aBoolean |
|
554 |
! |
|
555 |
||
1946
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
556 |
scrollWhenUpdating |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
557 |
"return the scroll behavior, when I get a new text |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
558 |
(via the model or the #contents/#list) |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
559 |
Possible returnValues are: |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
560 |
#keep / nil -> no change |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
561 |
#endOfText -> scroll to the end |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
562 |
#beginOfText -> scroll to the top |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
563 |
The default is #beginOfText. |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
564 |
This may be useful for fields which get new values assigned from |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
565 |
the program (i.e. not from the user)" |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
566 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
567 |
^ scrollWhenUpdating |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
568 |
! |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
569 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
570 |
scrollWhenUpdating:aSymbolOrNil |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
571 |
"define how to scroll, when I get a new text |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
572 |
(via the model or the #contents/#list) |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
573 |
Allowed arguments are: |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
574 |
#keep / nil -> no change |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
575 |
#endOfText -> scroll to the end |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
576 |
#beginOfText -> scroll to the top |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
577 |
The default is #beginOfText. |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
578 |
This may be useful for fields which get new values assigned from |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
579 |
the program (i.e. not from the user)" |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
580 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
581 |
scrollWhenUpdating := aSymbolOrNil |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
582 |
! |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
583 |
|
1112 | 584 |
selectRowOnDefault |
585 |
"in case of selecting a none selectable cell, the row is selected |
|
586 |
" |
|
587 |
^ selectRowOnDefault |
|
588 |
! |
|
589 |
||
590 |
selectRowOnDefault:aBool |
|
591 |
"in case of selecting a none selectable cell, the row is selected |
|
592 |
" |
|
593 |
selectRowOnDefault := aBool |
|
1487 | 594 |
! |
595 |
||
1668 | 596 |
tabIntern |
597 |
"returns true if tabing is supported in the widget |
|
598 |
" |
|
599 |
^ tabIntern |
|
600 |
! |
|
601 |
||
602 |
tabIntern:aBool |
|
603 |
"returns true if tabing is supported in the widget |
|
604 |
" |
|
605 |
tabIntern := aBool ? true |
|
606 |
! |
|
607 |
||
1487 | 608 |
useIndex |
609 |
"specify, if the selected components value or its index in the |
|
610 |
list should be sent to the model. The default is its index. |
|
611 |
" |
|
612 |
^ useIndex |
|
613 |
||
614 |
||
615 |
! |
|
616 |
||
617 |
useIndex:aBool |
|
618 |
"specify, if the selected components value or its index in the |
|
619 |
list should be sent to the model. The default is its index. |
|
620 |
" |
|
621 |
useIndex := aBool |
|
622 |
||
542 | 623 |
! ! |
624 |
||
1818 | 625 |
!DSVColumnView methodsFor:'accessing-colors'! |
824 | 626 |
|
627 |
backgroundColor |
|
628 |
"get the background color of the rows |
|
629 |
" |
|
630 |
^ bgColor |
|
631 |
||
632 |
||
633 |
! |
|
634 |
||
635 |
backgroundColor:aColor |
|
636 |
"set the background color of the rows |
|
637 |
" |
|
638 |
bgColor ~~ aColor ifTrue:[ |
|
639 |
super viewBackground:bgColor. |
|
640 |
||
641 |
self realized ifTrue:[ |
|
1480 | 642 |
bgColor := aColor onDevice:device. |
824 | 643 |
self invalidate |
644 |
] ifFalse:[ |
|
645 |
bgColor := aColor |
|
646 |
] |
|
647 |
] |
|
648 |
! |
|
649 |
||
650 |
foregroundColor |
|
651 |
"return the foreground color of the rows |
|
652 |
" |
|
653 |
^ fgColor |
|
654 |
||
655 |
! |
|
656 |
||
657 |
foregroundColor:aColor |
|
658 |
"set the foreground color of the rows |
|
659 |
" |
|
660 |
fgColor ~~ aColor ifTrue:[ |
|
661 |
self realized ifTrue:[ |
|
1480 | 662 |
fgColor := aColor onDevice:device. |
824 | 663 |
self invalidate |
664 |
] ifFalse:[ |
|
665 |
fgColor := aColor |
|
666 |
] |
|
667 |
] |
|
668 |
||
669 |
! |
|
670 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
671 |
selectionBackgroundColor |
824 | 672 |
"returns the background color of a selected row |
673 |
" |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
674 |
^ selectionBackgroundColor |
824 | 675 |
! |
676 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
677 |
selectionForegroundColor |
824 | 678 |
"returns the foreground color of a selected row |
679 |
" |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
680 |
^ selectionForegroundColor |
824 | 681 |
! |
682 |
||
683 |
separatorDarkColor |
|
684 |
"returns the dark color used for drawing a shadowed separator (3D) |
|
685 |
" |
|
686 |
^ shadowColor |
|
687 |
||
688 |
||
689 |
! |
|
690 |
||
691 |
separatorLightColor |
|
692 |
"returns the light color used for drawing a shadowed separator (3D) |
|
693 |
" |
|
694 |
^ lightColor |
|
695 |
||
696 |
||
2637 | 697 |
! |
698 |
||
699 |
separatorOneDColor |
|
700 |
"returns the color used for drawing a oneD separator |
|
701 |
" |
|
702 |
separatorOneDColor isNil ifTrue:[^ fgColor]. |
|
703 |
^ separatorOneDColor |
|
704 |
! |
|
705 |
||
706 |
separatorOneDColor:aColorOrNil |
|
707 |
"set the color used for drawing a oneD separator; if the color |
|
708 |
is nil, the current forgroundColor is used |
|
709 |
" |
|
710 |
separatorOneDColor = aColorOrNil ifTrue:[^ self]. |
|
711 |
separatorOneDColor := aColorOrNil. |
|
712 |
||
713 |
self realized ifTrue:[ |
|
714 |
separatorOneDColor notNil ifTrue:[ |
|
715 |
separatorOneDColor := separatorOneDColor onDevice:device. |
|
716 |
]. |
|
717 |
self invalidate. |
|
718 |
]. |
|
824 | 719 |
! ! |
720 |
||
1818 | 721 |
!DSVColumnView methodsFor:'accessing-columns'! |
542 | 722 |
|
723 |
columnAt:anIndex |
|
607 | 724 |
"returns the column at an index |
542 | 725 |
" |
1112 | 726 |
^ columnDescriptors at:anIndex ifAbsent:nil |
542 | 727 |
! |
728 |
||
886 | 729 |
columnDescriptors |
730 |
"returns list of column descriptors |
|
731 |
" |
|
732 |
^ columnDescriptors collect:[:aCol| aCol description ] |
|
733 |
! |
|
734 |
||
735 |
columnDescriptors:aColumnDescriptionList |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
736 |
"set the columnDescriptors; scroll to top and deselect |
542 | 737 |
" |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
738 |
| delta| |
612 | 739 |
|
886 | 740 |
self deselect. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
741 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
742 |
(viewOrigin x ~~ 0 or:[viewOrigin y ~~ 0]) ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
743 |
delta := viewOrigin negated. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
744 |
viewOrigin := 0@0. |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
745 |
self originChanged:delta |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
746 |
]. |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
747 |
self setColumnDescriptors:aColumnDescriptionList |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
748 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
749 |
|
2703 | 750 |
dataSetColumns |
751 |
"returns the list of DataSetColumns; each column reprasents a DataSetColumnSpec |
|
752 |
" |
|
753 |
^ columnDescriptors |
|
754 |
! |
|
755 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
756 |
firstColumn |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
757 |
"returns the first column |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
758 |
" |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
759 |
^ columnDescriptors at:1 |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
760 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
761 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
762 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
763 |
lastColumn |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
764 |
"returns the last column |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
765 |
" |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
766 |
^ columnDescriptors last |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
767 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
768 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
769 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
770 |
setColumnDescriptors:aColumnDescriptionList |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
771 |
"set the columnDescriptors; dont deselect and do not scroll to top |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
772 |
" |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
773 |
|cid| |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
774 |
|
1487 | 775 |
cid := 0. |
776 |
columnDescriptors := aColumnDescriptionList ? #(). |
|
777 |
||
778 |
columnDescriptors := columnDescriptors collect:[:el||dsc lbl| |
|
779 |
dsc := el isSequenceable ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:el] |
|
780 |
ifFalse:[el]. |
|
781 |
cid := cid + 1. |
|
782 |
lbl := DataSetLabel new description:dsc builder:builder on:labelView. |
|
783 |
DataSetColumn new on:self description:dsc columnNumber:cid label:lbl |
|
542 | 784 |
]. |
1487 | 785 |
|
786 |
preferredExtent := nil. |
|
787 |
labelView columns:columnDescriptors. |
|
542 | 788 |
|
612 | 789 |
shown ifTrue:[ |
1487 | 790 |
self fitColumns. |
563 | 791 |
]. |
542 | 792 |
! ! |
793 |
||
1818 | 794 |
!DSVColumnView methodsFor:'accessing-interactors'! |
809 | 795 |
|
1100 | 796 |
checkToggleActiveImage |
797 |
^ checkToggleActiveImage |
|
798 |
! |
|
799 |
||
809 | 800 |
checkToggleExtent |
1087 | 801 |
"returns the extent of a checkToggle |
802 |
" |
|
809 | 803 |
^ checkToggleExtent |
804 |
! |
|
805 |
||
806 |
checkToggleForm |
|
1087 | 807 |
"returns the form of a checkToggle |
808 |
" |
|
809 | 809 |
^ checkToggleForm |
810 |
! |
|
811 |
||
812 |
checkToggleLevel |
|
1087 | 813 |
"returns the level of a checkToggle button |
814 |
" |
|
809 | 815 |
^ checkToggleLevel |
816 |
! |
|
817 |
||
1100 | 818 |
checkTogglePassiveImage |
819 |
^ checkTogglePassiveImage |
|
820 |
! |
|
821 |
||
809 | 822 |
comboButtonExtent |
1087 | 823 |
"returns the extent of a comboList or -Box |
824 |
" |
|
809 | 825 |
^ comboButtonExtent |
826 |
! |
|
827 |
||
828 |
comboButtonForm |
|
1087 | 829 |
"returns the form of a comboList or -Box |
830 |
" |
|
809 | 831 |
^ comboButtonForm |
832 |
! |
|
833 |
||
834 |
comboButtonLevel |
|
1087 | 835 |
"returns the level of a comboList or -Box button |
836 |
" |
|
809 | 837 |
^ comboButtonLevel |
838 |
! |
|
839 |
||
840 |
rowSelectorExtent |
|
841 |
"returns the bitmap of a selected row |
|
842 |
" |
|
843 |
^ rowSelectorForm extent |
|
844 |
! |
|
845 |
||
846 |
rowSelectorForm |
|
2711 | 847 |
"returns the (arrow-) image shown for a selected row. |
848 |
(te arrow shown in the first column) |
|
809 | 849 |
" |
850 |
^ rowSelectorForm |
|
851 |
! ! |
|
852 |
||
1818 | 853 |
!DSVColumnView methodsFor:'accessing-mvc'! |
612 | 854 |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
855 |
columnAdaptor |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
856 |
"return the value of the instance variable 'columnAdaptor' (automatically generated)" |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
857 |
|
1711 | 858 |
columnAdaptor isValueModel ifTrue:[^ columnAdaptor value]. |
859 |
^ columnAdaptor |
|
860 |
! |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
861 |
|
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
862 |
columnAdaptor:something |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
863 |
"set the value of the instance variable 'columnAdaptor' (automatically generated)" |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
864 |
|
1711 | 865 |
columnAdaptor isValueModel ifTrue:[ |
866 |
columnAdaptor removeDependent:self |
|
867 |
]. |
|
868 |
(columnAdaptor := something) isValueModel ifTrue:[ |
|
869 |
columnAdaptor addDependent:self |
|
870 |
]. |
|
871 |
! |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
872 |
|
612 | 873 |
columnHolder |
1087 | 874 |
"get the valueHolder, which keeps the list of column descriptions |
875 |
" |
|
612 | 876 |
^ columnHolder |
877 |
||
878 |
! |
|
879 |
||
880 |
columnHolder:aValueHolder |
|
1087 | 881 |
"set the valueHolder, which keeps the list of column descriptions |
882 |
" |
|
612 | 883 |
|columns| |
884 |
||
885 |
columnHolder notNil ifTrue:[ |
|
886 |
columnHolder removeDependent:self |
|
887 |
]. |
|
888 |
||
889 |
(columnHolder := aValueHolder) notNil ifTrue:[ |
|
890 |
columnHolder addDependent:self. |
|
891 |
columns := columnHolder value. |
|
892 |
||
893 |
columns notNil ifTrue:[ |
|
894 |
self columnDescriptors:columns |
|
895 |
] |
|
896 |
]. |
|
897 |
||
1487 | 898 |
! |
899 |
||
900 |
listAt:index put:newElement |
|
901 |
"kludge callback, when an element hs to be replaced |
|
902 |
due to a col-adaptor returning a new row element |
|
903 |
" |
|
904 |
|list| |
|
905 |
||
906 |
(list := listHolder value) notNil ifTrue:[ |
|
907 |
list at:index put:newElement |
|
908 |
] |
|
909 |
! |
|
910 |
||
2318 | 911 |
listHolder |
912 |
"get the valueHolder which holds the list of rows |
|
913 |
" |
|
914 |
^ listHolder |
|
915 |
! |
|
916 |
||
1487 | 917 |
listHolder:aListHolder |
918 |
"set the valueHolder which holds the list of rows |
|
919 |
" |
|
920 |
listHolder ~~ aListHolder ifTrue:[ |
|
921 |
listHolder notNil ifTrue:[ |
|
922 |
listHolder removeDependent:self |
|
923 |
]. |
|
924 |
||
925 |
(listHolder := aListHolder) notNil ifTrue:[ |
|
926 |
listHolder addDependent:self |
|
927 |
] |
|
928 |
]. |
|
929 |
self pushEvent:#list: with:(listHolder value). |
|
930 |
||
931 |
! |
|
932 |
||
933 |
model:aModel |
|
934 |
"set the valueHolder which holds the selection and maybe the list of rows |
|
935 |
" |
|
936 |
model notNil ifTrue:[ |
|
937 |
model removeDependent:self. |
|
938 |
(model respondsTo:#list) ifTrue:[ |
|
939 |
(model list == listHolder) ifTrue:[ |
|
940 |
self listHolder:nil |
|
941 |
] |
|
942 |
] |
|
943 |
]. |
|
944 |
||
945 |
(model := aModel) notNil ifTrue:[ |
|
946 |
model addDependent:self. |
|
947 |
||
948 |
(aModel respondsTo:#list) ifTrue:[ |
|
949 |
self listHolder:model list |
|
950 |
] |
|
951 |
] |
|
952 |
||
612 | 953 |
! ! |
954 |
||
1818 | 955 |
!DSVColumnView methodsFor:'accessing-rows'! |
542 | 956 |
|
957 |
at:aRowNr |
|
958 |
"return the row at an index, aRowNr |
|
959 |
" |
|
618 | 960 |
|row| |
961 |
||
962 |
(row := list at:aRowNr) isNil ifTrue:[ |
|
963 |
lockRowIndex := aRowNr. |
|
964 |
||
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
965 |
(rowIfAbsentBlock notNil |
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
966 |
and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[ |
618 | 967 |
list at:aRowNr put:row. |
968 |
beDependentOfRows ifTrue:[row addDependent:self]. |
|
969 |
]. |
|
970 |
||
971 |
lockRowIndex := 0 |
|
972 |
]. |
|
973 |
^ row |
|
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
974 |
|
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
975 |
"Modified: / 31.7.1998 / 01:07:46 / cg" |
542 | 976 |
! |
977 |
||
978 |
at:aRowNr ifAbsent:exceptionBlock |
|
607 | 979 |
"return the row at a aRowNr. If the index is invalid, return the |
542 | 980 |
result of evaluating the exceptionblock |
981 |
" |
|
1497 | 982 |
(aRowNr between:1 and:list size) ifTrue:[ |
618 | 983 |
^ self at:aRowNr |
984 |
]. |
|
985 |
^ exceptionBlock value |
|
542 | 986 |
! |
987 |
||
988 |
at:aRowNr put:aRow |
|
989 |
"change the row at an index. The added row is returned |
|
990 |
" |
|
1956 | 991 |
lockRowIndex ~~ aRowNr ifTrue:[ |
992 |
(aRowNr <= list size and:[(list at:aRowNr) == aRow]) ifTrue:[ |
|
993 |
self invalidateRowAt:aRowNr |
|
994 |
] ifFalse:[ |
|
995 |
self replaceFrom:aRowNr to:aRowNr with:(Array with:aRow) startingAt:1. |
|
618 | 996 |
] |
542 | 997 |
]. |
1956 | 998 |
^ aRow |
542 | 999 |
! |
1000 |
||
1001 |
first |
|
1002 |
"return the first row |
|
1003 |
" |
|
618 | 1004 |
^ self at:1 |
1005 |
! |
|
1006 |
||
1007 |
identityIndexOfRow:aRow |
|
1008 |
"returns index of a row or 0 |
|
1009 |
" |
|
1010 |
(list size ~~ 0 and:[aRow notNil]) ifTrue:[ |
|
1011 |
^ list identityIndexOf:aRow |
|
1012 |
]. |
|
1013 |
^ 0 |
|
542 | 1014 |
! |
1015 |
||
1016 |
last |
|
1017 |
"return the last row |
|
1018 |
" |
|
1497 | 1019 |
^ self at:(list size) |
542 | 1020 |
! |
1021 |
||
1022 |
list |
|
1023 |
"get the list of rows |
|
1024 |
" |
|
1025 |
^ list |
|
1026 |
||
1027 |
||
1028 |
||
1029 |
! |
|
1030 |
||
1031 |
list:aList |
|
1032 |
"set the list of rows |
|
1033 |
" |
|
1259 | 1034 |
|makeDependent selectionHasChanged| |
656 | 1035 |
|
618 | 1036 |
"/ remove selection without redraw |
622 | 1037 |
|
1259 | 1038 |
selectionHasChanged := self hasSelection. |
1039 |
||
1111 | 1040 |
self destroyEditView. |
622 | 1041 |
|
618 | 1042 |
selectedColIndex := 0. |
1043 |
selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0]. |
|
542 | 1044 |
|
612 | 1045 |
shown ifFalse:[ |
1046 |
preferredExtent := nil |
|
1047 |
] ifTrue:[ |
|
1048 |
aList size ~~ 0 ifTrue:[ "/ otherwise keep old values |
|
2524 | 1049 |
columnDescriptors notNil ifTrue:[ |
1050 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
|
1051 |
]. |
|
612 | 1052 |
preferredExtent := nil. |
618 | 1053 |
] |
542 | 1054 |
]. |
1055 |
||
656 | 1056 |
(makeDependent := beDependentOfRows) ifTrue:[ |
1057 |
self beDependentOfRows:false. |
|
1058 |
]. |
|
643 | 1059 |
|
1060 |
aList size ~~ 0 ifTrue:[ |
|
1061 |
list := OrderedCollection new:(aList size). |
|
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
1062 |
aList do:[:el| list add:el ]. |
542 | 1063 |
] ifFalse:[ |
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1064 |
list := nil. |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1065 |
viewOrigin := 0 @ 0. |
542 | 1066 |
]. |
656 | 1067 |
self beDependentOfRows:makeDependent. |
542 | 1068 |
|
612 | 1069 |
shown ifTrue:[ |
1484 | 1070 |
self fitColumns |
1949 | 1071 |
] ifFalse:[ |
1072 |
needFitColumns := true |
|
637 | 1073 |
]. |
1259 | 1074 |
selectionHasChanged ifTrue:[ |
1075 |
self selectionChanged. |
|
1076 |
]. |
|
2044
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1077 |
self contentsChanged. |
542 | 1078 |
! ! |
1079 |
||
1818 | 1080 |
!DSVColumnView methodsFor:'accessing-visibility'! |
542 | 1081 |
|
1082 |
font:aFont |
|
1083 |
"set the font for all shown rows. |
|
1084 |
" |
|
1085 |
(aFont notNil and:[aFont ~~ font]) ifTrue:[ |
|
1480 | 1086 |
super font:(aFont onDevice:device). |
542 | 1087 |
realized ifTrue:[ |
1497 | 1088 |
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
|
1089 |
self preferredExtentChanged. |
542 | 1090 |
self invalidate. |
1091 |
self contentsChanged |
|
1842 | 1092 |
]. |
1093 |
labelView notNil ifTrue:[ |
|
1094 |
labelView font:font |
|
1095 |
]. |
|
542 | 1096 |
] |
1097 |
! |
|
1098 |
||
607 | 1099 |
has3Dseparators |
1100 |
"returns true if shown in 3D mode |
|
1101 |
" |
|
1102 |
^ separatorSize ~~ 1 |
|
542 | 1103 |
! |
1104 |
||
607 | 1105 |
has3Dseparators:aBool |
1106 |
"enable or disable 3D mode |
|
1107 |
" |
|
1108 |
|newSepSize| |
|
542 | 1109 |
|
637 | 1110 |
newSepSize := aBool ifTrue:[2] ifFalse:[1]. |
607 | 1111 |
|
1112 |
newSepSize ~~ separatorSize ifTrue:[ |
|
1113 |
separatorSize := newSepSize. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1114 |
|
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1115 |
realized ifTrue:[ |
1497 | 1116 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
1136 | 1117 |
self preferredExtentChanged. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1118 |
self invalidate. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1119 |
self contentsChanged |
647 | 1120 |
] |
542 | 1121 |
] |
1122 |
||
1123 |
||
1124 |
! |
|
1125 |
||
1126 |
horizontalSpacing |
|
1127 |
"horizontal spacing used by columns |
|
1128 |
" |
|
563 | 1129 |
^ horizontalSpacing |
1130 |
! |
|
1131 |
||
1132 |
horizontalSpacing:aNumber |
|
1133 |
"horizontal spacing used by columns |
|
1134 |
" |
|
1135 |
horizontalSpacing ~~ aNumber ifTrue:[ |
|
1136 |
horizontalSpacing := aNumber. |
|
1137 |
self preferredExtentChanged. |
|
1138 |
]. |
|
542 | 1139 |
! |
1140 |
||
1487 | 1141 |
showLabels |
1142 |
"control the labels view to be visible or unvisible |
|
1143 |
" |
|
1144 |
^ labelView isVisible |
|
1145 |
||
1146 |
! |
|
1147 |
||
1148 |
showLabels:aState |
|
1149 |
"control the labels view to be visible or unvisible |
|
1150 |
" |
|
1151 |
labelView isVisible:aState |
|
1152 |
! |
|
1153 |
||
542 | 1154 |
verticalSpacing |
1155 |
"vertical spacing used by columns |
|
1156 |
" |
|
563 | 1157 |
^ verticalSpacing |
1158 |
! |
|
1159 |
||
1160 |
verticalSpacing:aNumber |
|
1161 |
"vertical spacing used by columns |
|
1162 |
" |
|
1163 |
verticalSpacing ~~ aNumber ifTrue:[ |
|
1164 |
verticalSpacing := aNumber. |
|
1165 |
self preferredExtentChanged. |
|
1166 |
]. |
|
542 | 1167 |
! ! |
1168 |
||
1169 |
!DSVColumnView methodsFor:'adding & removing rows'! |
|
1170 |
||
1171 |
add:aRow |
|
618 | 1172 |
"insert row at end |
542 | 1173 |
" |
1497 | 1174 |
^ self add:aRow beforeIndex:(1 + list size) |
542 | 1175 |
! |
1176 |
||
1177 |
add:aRow afterIndex:aRowNr |
|
1178 |
"add a new row after slot aRowNr and redisplay; returns nil in case |
|
618 | 1179 |
of an invalid index or the row |
542 | 1180 |
" |
1181 |
^ self add:aRow beforeIndex:(aRowNr + 1) |
|
1182 |
! |
|
1183 |
||
1184 |
add:aRow beforeIndex:aRowNr |
|
1185 |
"add a new row before slot aRowNr and redisplay; returns nil in case |
|
618 | 1186 |
of an invalid index or the row |
542 | 1187 |
" |
861 | 1188 |
self addAll:(Array with:aRow) beforeIndex:aRowNr. |
1189 |
^ aRow. |
|
1190 |
! |
|
1191 |
||
1192 |
addAll:aList beforeIndex:start |
|
1193 |
"add a collection of rows before slot start and redisplay |
|
1194 |
" |
|
1195 |
|y0 y1 yD h dH size noSel| |
|
1196 |
||
1197 |
(size := aList size) == 0 ifTrue:[ |
|
1198 |
^ self |
|
1199 |
]. |
|
1200 |
||
1497 | 1201 |
list size == 0 ifTrue:[ |
861 | 1202 |
^ self list:aList |
618 | 1203 |
]. |
643 | 1204 |
|
618 | 1205 |
beDependentOfRows ifTrue:[ |
861 | 1206 |
aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]] |
542 | 1207 |
]. |
637 | 1208 |
|
861 | 1209 |
noSel := self numberOfSelections. |
1210 |
||
1211 |
noSel ~~ 0 ifTrue:[ |
|
1212 |
multipleSelectOk ifFalse:[ |
|
1213 |
selectedRowIndex >= start ifTrue:[ |
|
1214 |
selectedRowIndex := selectedRowIndex + size |
|
1215 |
] |
|
1216 |
] ifTrue:[ |
|
1217 |
1 to:noSel do:[:i||v| |
|
1218 |
(v := selectedRowIndex at:i) >= start ifTrue:[ |
|
1219 |
selectedRowIndex at:i put:(v + size) |
|
607 | 1220 |
] |
1221 |
] |
|
1222 |
] |
|
542 | 1223 |
]. |
861 | 1224 |
list addAll:aList beforeIndex:start. |
1225 |
self recomputeHeightOfContents. |
|
1226 |
||
1227 |
y0 := (start - 1) * rowHeight. |
|
1228 |
yD := size * rowHeight. |
|
1229 |
y1 := y0 + yD. |
|
542 | 1230 |
|
1231 |
y0 < viewOrigin y ifTrue:[ |
|
1232 |
self originWillChange. |
|
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1233 |
viewOrigin := viewOrigin x @ (yD + viewOrigin y). |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1234 |
"/ viewOrigin y:(yD + viewOrigin y). |
861 | 1235 |
self originChanged:(0 @ yD). |
1236 |
]. |
|
1237 |
||
1238 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
|
2044
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1239 |
self invalidate. |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1240 |
self contentsChanged. |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1241 |
^ self |
542 | 1242 |
]. |
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
1243 |
|
861 | 1244 |
y0 := self yVisibleOfRowNr:start. |
1258 | 1245 |
h := height - margin. |
1246 |
y1 := y0 + yD min:h. |
|
1247 |
||
1248 |
(y1 > margin and:[y0 < h]) ifTrue:[ |
|
1952 | 1249 |
"/ cg: if I have a non-solid background color, |
1250 |
"/ or individual items have a bgColor selector, |
|
1251 |
"/ invalidate the area (and readraw) instead of a scroll. |
|
1252 |
(viewBackground isImageOrForm |
|
1253 |
or:[ self anyColumnHasPotentialNonConstantBackground ]) |
|
1254 |
ifTrue:[ |
|
1255 |
"/ do not scroll but invalidate ... |
|
1256 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
|
1257 |
] ifFalse:[ |
|
1258 |
h := h - y1. |
|
1259 |
y0 := y0 max:margin. |
|
1260 |
dH := y1 - y0. |
|
1261 |
||
1262 |
start == list size ifFalse:[ |
|
1263 |
self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:h async:false |
|
1264 |
]. |
|
1265 |
self invalidateX:margin y:y0 width:width - margin - margin height:dH. |
|
1266 |
] |
|
542 | 1267 |
]. |
1268 |
self contentsChanged. |
|
567 | 1269 |
! |
1270 |
||
542 | 1271 |
addFirst:aRow |
618 | 1272 |
"insert a row at start |
542 | 1273 |
" |
1274 |
^ self add:aRow beforeIndex:1 |
|
1275 |
! |
|
1276 |
||
1487 | 1277 |
remove:aRow |
1278 |
"remove a row |
|
1279 |
" |
|
1280 |
|idx| |
|
1281 |
||
1282 |
idx := list identityIndexOf:aRow. |
|
1283 |
||
1284 |
idx ~~ 0 ifTrue:[ |
|
1285 |
self removeFrom:idx to:idx. |
|
1286 |
]. |
|
1287 |
^ aRow |
|
1288 |
! |
|
1289 |
||
542 | 1290 |
removeFirst |
1291 |
"remove first row; returns the removed row |
|
1292 |
" |
|
1112 | 1293 |
^ self removeIndex:1 |
542 | 1294 |
! |
1295 |
||
861 | 1296 |
removeFrom:startIndex to:stopIndex |
1297 |
"remove rows from start to stop |
|
542 | 1298 |
" |
861 | 1299 |
|coll noRedraw |
1300 |
noSel "{ Class: SmallInteger }" |
|
1301 |
size "{ Class: SmallInteger }" |
|
1302 |
start "{ Class: SmallInteger }" |
|
1303 |
stop "{ Class: SmallInteger }" |
|
1304 |
y0 "{ Class: SmallInteger }" |
|
1305 |
y1 "{ Class: SmallInteger }" |
|
1306 |
oY "{ Class: SmallInteger }" |
|
1307 |
dY "{ Class: SmallInteger }" |
|
1308 |
yB "{ Class: SmallInteger }" |
|
1309 |
h "{ Class: SmallInteger }" |
|
1310 |
| |
|
1311 |
||
1312 |
( (start := startIndex) < 1 |
|
1313 |
or:[(stop := stopIndex) > list size] |
|
1314 |
) ifTrue:[ |
|
1315 |
^ self subscriptBoundsError:start |
|
618 | 1316 |
]. |
861 | 1317 |
size := stop - start + 1. |
1318 |
||
1319 |
beDependentOfRows ifTrue:[ |
|
1320 |
list from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]]. |
|
1321 |
]. |
|
1322 |
noSel := self numberOfSelections. |
|
1323 |
||
1324 |
noSel ~~ 0 ifTrue:[ |
|
1325 |
noSel == 1 ifTrue:[ |
|
1326 |
noSel := self firstIndexSelected. |
|
1327 |
||
1328 |
noSel < start ifFalse:[ |
|
1329 |
noSel > stop ifTrue:[ |
|
1330 |
noSel := noSel - size. |
|
1331 |
||
1332 |
multipleSelectOk ifFalse:[selectedRowIndex := noSel] |
|
1333 |
ifTrue:[selectedRowIndex at:1 put:noSel] |
|
1334 |
] ifFalse:[ |
|
637 | 1335 |
editValue notNil ifTrue:[ |
1336 |
editValue removeDependent:self. |
|
1337 |
editValue := nil. |
|
1338 |
]. |
|
861 | 1339 |
self deselect. |
637 | 1340 |
] |
607 | 1341 |
] |
1342 |
] ifFalse:[ |
|
861 | 1343 |
coll := OrderedCollection new:noSel. |
1344 |
||
1345 |
selectedRowIndex do:[:i| |
|
1346 |
i < start ifTrue:[ |
|
1347 |
coll add:i |
|
1348 |
] ifFalse:[ |
|
1349 |
i > stop ifTrue:[ |
|
1350 |
coll add:(i - size) |
|
1351 |
] |
|
1352 |
] |
|
1353 |
]. |
|
1354 |
coll size == 0 ifTrue:[ |
|
1355 |
self deselect |
|
1356 |
] ifFalse:[ |
|
1357 |
selectedRowIndex := coll |
|
1358 |
] |
|
542 | 1359 |
] |
1360 |
]. |
|
861 | 1361 |
list removeFrom:start to:stop. |
1362 |
||
1363 |
y0 := start - 1 * rowHeight. |
|
1364 |
dY := size * rowHeight. |
|
1365 |
y1 := dY + y0. |
|
542 | 1366 |
yB := y1 + margin - viewOrigin y. |
1367 |
self recomputeHeightOfContents. |
|
1368 |
||
1369 |
y0 < (oY := viewOrigin y) ifTrue:[ |
|
1370 |
(noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY] |
|
861 | 1371 |
ifTrue:[dY := dY negated]. |
542 | 1372 |
self originWillChange. |
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1373 |
viewOrigin := viewOrigin x @ (dY + oY). |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1374 |
"/ viewOrigin y:(dY + oY). |
542 | 1375 |
self originChanged:(0 @ dY). |
1376 |
] ifFalse:[ |
|
1377 |
noRedraw := y0 > (height + viewOrigin y) |
|
1378 |
]. |
|
1379 |
||
1483 | 1380 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
1381 |
self invalidate. |
|
1382 |
^ self contentsChanged. |
|
1383 |
]. |
|
1384 |
||
542 | 1385 |
(noRedraw or:[shown not]) ifFalse:[ |
861 | 1386 |
y0 := self yVisibleOfRowNr:start. |
542 | 1387 |
y0 := y0 max:margin. |
1388 |
||
1951 | 1389 |
"/ cg: if I have a non-solid background color, |
1390 |
"/ or individual items have a bgColor selector, |
|
1391 |
"/ invalidate the area (and readraw) instead of a scroll. |
|
1392 |
(viewBackground isImageOrForm |
|
1393 |
or:[ self anyColumnHasPotentialNonConstantBackground ]) |
|
1394 |
ifTrue:[ |
|
1395 |
"/ do not scroll but invalidate ... |
|
1396 |
] ifFalse:[ |
|
1397 |
y1 := yB. |
|
1398 |
h := height - margin - yB. |
|
1399 |
||
1400 |
h > 0 ifTrue:[ |
|
1401 |
self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:false |
|
1402 |
]. |
|
1403 |
y0 := y0 + h. |
|
561 | 1404 |
]. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1405 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
542 | 1406 |
]. |
1407 |
self contentsChanged. |
|
861 | 1408 |
! |
1409 |
||
1410 |
removeIndex:aRowNr |
|
1411 |
"remove row at an index; returns the removed row |
|
1412 |
" |
|
1413 |
|row| |
|
1414 |
||
1415 |
row := list at:aRowNr ifAbsent:nil. |
|
1416 |
self removeFrom:aRowNr to:aRowNr. |
|
1417 |
^ row |
|
542 | 1418 |
! |
1419 |
||
1420 |
removeLast |
|
1421 |
"remove last row; the row is returned |
|
1422 |
" |
|
1497 | 1423 |
^ self removeIndex:(list size) |
1956 | 1424 |
! |
1425 |
||
1426 |
replaceFrom:start to:stop with:aCollection startingAt:repStart |
|
1427 |
"replace elements in the receiver between index start and stop, |
|
1428 |
with elements taken from replacementCollection starting at repStart. |
|
1429 |
Return the receiver. |
|
1430 |
" |
|
2032 | 1431 |
|inSelList listSize repStop run| |
1956 | 1432 |
|
1433 |
inSelList := OrderedCollection new. |
|
1434 |
listSize := list size. |
|
1435 |
repStop := repStart + (stop - start). |
|
1436 |
||
1437 |
list isNil ifTrue:[ |
|
1438 |
list := OrderedCollection new |
|
1439 |
]. |
|
1440 |
||
1441 |
[listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ]. |
|
1442 |
||
1443 |
start to:stop do:[:i| |aRow| |
|
1444 |
aRow := list at:i ifAbsent:nil. |
|
1445 |
||
1446 |
aRow notNil ifTrue:[ |
|
1447 |
beDependentOfRows ifTrue:[aRow removeDependent:self]. |
|
1448 |
||
1449 |
(self isInSelection:i) ifTrue:[ |
|
1450 |
inSelList add:i |
|
1451 |
]. |
|
1452 |
list at:i put:nil. |
|
1453 |
] |
|
1454 |
]. |
|
1455 |
||
1456 |
beDependentOfRows ifTrue:[ |
|
1457 |
aCollection from:repStart to:repStop do:[:aRow| |
|
1458 |
aRow notNil ifTrue:[aRow addDependent:self] |
|
1459 |
] |
|
1460 |
]. |
|
1461 |
||
1462 |
run := start. |
|
1463 |
aCollection from:repStart to:repStop do:[:aRow| |
|
1464 |
list at:run put:aRow. |
|
1465 |
run := run + 1. |
|
1466 |
]. |
|
1467 |
self invalidateRowsFrom:start to:stop. |
|
1468 |
||
1469 |
inSelList size ~~ 0 ifTrue:[ |
|
1470 |
self numberOfSelections == inSelList size ifTrue:[ |
|
1471 |
self deselect |
|
1472 |
] ifFalse:[ |
|
1473 |
selectedRowIndex := selectedRowIndex select:[:i| (inSelList identityIndexOf:i) == 0 ]. |
|
1474 |
self selectionChanged. |
|
1475 |
] |
|
1476 |
]. |
|
542 | 1477 |
! ! |
1478 |
||
1479 |
!DSVColumnView methodsFor:'change & update'! |
|
1480 |
||
1492 | 1481 |
changeWidthOfColumn:aColumn deltaX:aDeltaX |
1482 |
||
1483 |
aColumn setDescWidth:(aColumn width + aDeltaX). |
|
1484 |
preferredExtent notNil ifTrue:[self fitColumns] |
|
1485 |
! |
|
1486 |
||
1487 | 1487 |
update:what with:aPara from:chgObj |
542 | 1488 |
"one of my rows/cells changed its value |
1489 |
" |
|
2695 | 1490 |
|row listHoldersList arg1 arg2 col| |
1487 | 1491 |
|
1492 |
chgObj == columnHolder ifTrue:[ |
|
612 | 1493 |
^ self columnDescriptors:(columnHolder value) |
622 | 1494 |
]. |
1711 | 1495 |
|
1496 |
chgObj == columnAdaptor ifTrue:[ |
|
1497 |
col := columnAdaptor value. |
|
1498 |
columnDescriptors do:[:aCol| aCol columnAdaptor:col]. |
|
1499 |
^ self invalidate |
|
1500 |
]. |
|
1501 |
||
1487 | 1502 |
chgObj == editValue ifTrue:[ |
2695 | 1503 |
self updateColumnFromEditValue. |
1227 | 1504 |
^ self |
622 | 1505 |
]. |
1506 |
||
1487 | 1507 |
chgObj == model ifTrue:[ |
1508 |
(what == #selectionIndex or:[what == #selection]) ifTrue:[ |
|
1509 |
^ self selectRowIndex:(model selectionIndex copy) |
|
1510 |
]. |
|
1511 |
what == #list ifTrue:[ |
|
1512 |
^ self listHolder:model list |
|
1513 |
]. |
|
1514 |
what == #value ifTrue:[ |
|
1515 |
model == listHolder ifTrue:[ |
|
1516 |
self list:(listHolder value) |
|
1517 |
] ifFalse:[ |
|
1518 |
self selectRowIndex:model value |
|
1519 |
] |
|
1520 |
]. |
|
1521 |
^ self |
|
1522 |
]. |
|
1523 |
||
1524 |
chgObj == listHolder ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1525 |
listHoldersList := listHolder value. |
1487 | 1526 |
|
1527 |
what == #value ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1528 |
^ self list:listHoldersList |
1487 | 1529 |
]. |
1530 |
aPara isCollection ifTrue:[ |
|
1531 |
arg1 := aPara at:1. |
|
1532 |
arg2 := aPara at:2. |
|
1533 |
] ifFalse:[ |
|
1534 |
arg1 := arg2 := aPara |
|
1535 |
]. |
|
1536 |
||
1537 |
what == #at: ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1538 |
^ self at:arg1 put:(listHoldersList at:arg1) |
1487 | 1539 |
]. |
1540 |
||
1541 |
what == #insert: ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1542 |
^ self add:(listHoldersList at:arg1) beforeIndex:arg1 |
1487 | 1543 |
]. |
1544 |
||
1545 |
what == #remove: ifTrue:[ |
|
1546 |
^ self removeFrom:arg1 to:arg1 |
|
1547 |
]. |
|
1548 |
what == #removeFrom: ifTrue:[ |
|
1954 | 1549 |
listHoldersList size == 0 ifTrue:[self list:nil] |
1487 | 1550 |
ifFalse:[self removeFrom:arg1 to:arg2]. |
1551 |
^ self |
|
1552 |
]. |
|
1553 |
||
1554 |
what == #insertCollection: ifTrue:[ |
|
1555 |
arg2 ~~ 0 ifTrue:[ |
|
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1556 |
self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1)) beforeIndex:arg1 |
1487 | 1557 |
]. |
1558 |
^ self. |
|
1559 |
]. |
|
1560 |
what == #replace: ifTrue:[ |
|
1956 | 1561 |
self replaceFrom:arg1 to:arg2 with:listHoldersList startingAt:arg1. |
2537 | 1562 |
^ self |
1487 | 1563 |
]. |
2537 | 1564 |
self list:listHoldersList. |
1487 | 1565 |
^ self |
1566 |
]. |
|
1593 | 1567 |
arg1 := aPara ? what. |
1487 | 1568 |
row := (what isNumber) ifTrue:[what] ifFalse:[chgObj]. |
2190 | 1569 |
self invalidateVisibleRow:row readSelector:arg1. |
1593 | 1570 |
|
2695 | 1571 |
editView notNil ifTrue:[ |
1572 |
(self isInSelection:(self identityIndexOfRow:row)) ifTrue:[ |
|
1573 |
self updateEditorFromChangedRow |
|
1574 |
] |
|
1575 |
]. |
|
1576 |
||
1661 | 1577 |
"Modified: / 30.1.2000 / 12:16:49 / cg" |
2695 | 1578 |
! |
1579 |
||
1580 |
updateColumnFromEditValue |
|
1581 |
|editValueBefore firstSelectedIndex newValue realValue col| |
|
1582 |
||
1583 |
editValueBefore := editValue. |
|
1584 |
||
1585 |
firstSelectedIndex := self firstIndexSelected. |
|
1586 |
newValue := editValue value. |
|
1587 |
||
1588 |
col := self selectedColumn. |
|
1589 |
col at:firstSelectedIndex put:newValue. |
|
1590 |
realValue := col at:firstSelectedIndex. |
|
1591 |
||
1592 |
(realValue ~= newValue) ifTrue:[ |
|
1593 |
"/ some validation by the row-object; the stored value |
|
1594 |
"/ is different from what I think. |
|
1595 |
"/ update my input fields modelValue |
|
1596 |
||
1597 |
"/ just in case someone nilled or changed the editValue |
|
1598 |
"/ Q: is this CA's paranoia or could this really be done in the at:put: above ??? |
|
1599 |
(editValueBefore == editValue) ifTrue:[ |
|
1600 |
editValue value:realValue. |
|
1601 |
] |
|
1602 |
]. |
|
1603 |
||
1604 |
modifiedChannel notNil ifTrue:[ |
|
1605 |
modifiedChannel value:true. |
|
1606 |
]. |
|
1607 |
! |
|
1608 |
||
1609 |
updateEditorFromChangedRow |
|
1610 |
"/ self reopenEditor |
|
1611 |
||
1612 |
|rowsValue rowNr| |
|
1613 |
||
1614 |
(rowNr := selectedRowIndex) isNumber ifFalse:[ |
|
1615 |
rowNr := rowNr first. |
|
1616 |
]. |
|
1617 |
||
1618 |
rowsValue := (self columnAt:selectedColIndex) at:rowNr. |
|
2702 | 1619 |
|
1620 |
(editValue notNil and:[editValue value ~= rowsValue]) ifTrue:[ |
|
2695 | 1621 |
editValue value:rowsValue withoutNotifying:self. |
1622 |
editView withAllSubViewsDo:[:v | |
|
1623 |
v isInputField ifTrue:[ |
|
1624 |
v flash. |
|
1625 |
] |
|
1626 |
] |
|
2702 | 1627 |
]. |
809 | 1628 |
! ! |
1629 |
||
1630 |
!DSVColumnView methodsFor:'drag & drop'! |
|
1631 |
||
824 | 1632 |
canDrag |
1633 |
"returns true if dragging is enabled |
|
1634 |
" |
|
1635 |
^ dropSource notNil |
|
1636 |
||
1637 |
! |
|
1638 |
||
2575 | 1639 |
dragAutoScroll:aContext |
1640 |
"called by the DragAndDropManager to scroll during a drag/drop operation |
|
1641 |
if necassery (decided by the widget itself); If a scroll is done return |
|
1642 |
true otherwise false (used to restore the background) |
|
1643 |
" |
|
1644 |
|yInset absLnNr y| |
|
1645 |
||
1646 |
y := aContext targetPoint y. |
|
1647 |
yInset := margin + rowHeight. |
|
1648 |
y > yInset ifTrue:[ |
|
1649 |
y >= (height - yInset) ifFalse:[^ false]. |
|
1650 |
]. |
|
1651 |
||
1652 |
absLnNr := self yVisibleToRowNr:y. |
|
1653 |
absLnNr isNil ifTrue:[^ false]. |
|
1654 |
||
1655 |
(absLnNr > 1 and:[absLnNr < self size]) ifFalse:[ |
|
1656 |
^ false |
|
1657 |
]. |
|
1658 |
aContext contentsWillChange. |
|
1659 |
||
2580 | 1660 |
y > yInset |
1661 |
ifTrue:[self scrollDown:rowHeight] |
|
1662 |
ifFalse:[self scrollUp:rowHeight]. |
|
2575 | 1663 |
|
1664 |
^ true |
|
1665 |
! |
|
1666 |
||
824 | 1667 |
dropSource |
1668 |
"returns the dropSource or nil |
|
809 | 1669 |
" |
824 | 1670 |
^ dropSource |
1671 |
||
1672 |
||
1673 |
! |
|
1674 |
||
1675 |
dropSource:aDropSourceOrNil |
|
1676 |
"set the dropSource or nil |
|
1677 |
" |
|
1678 |
dropSource := aDropSourceOrNil. |
|
1679 |
||
809 | 1680 |
|
1681 |
! |
|
1682 |
||
824 | 1683 |
dropTarget |
1684 |
"returns the dropTarget or nil |
|
809 | 1685 |
" |
824 | 1686 |
^ dropTarget |
1687 |
||
1688 |
! |
|
1689 |
||
1690 |
dropTarget:aDropTragetOrNil |
|
1691 |
"set the dropTarget or nil |
|
1692 |
" |
|
1693 |
dropTarget := aDropTragetOrNil. |
|
1694 |
||
1695 |
! |
|
1696 |
||
1697 |
startDragAt:aPoint |
|
2398 | 1698 |
|
1699 |
dropSource notNil ifTrue:[ |
|
1700 |
dropSource startDragIn:self at:aPoint. |
|
1701 |
buttonReleaseAction := buttonMotionAction := nil. |
|
809 | 1702 |
] |
542 | 1703 |
! ! |
1704 |
||
637 | 1705 |
!DSVColumnView methodsFor:'drawing'! |
1706 |
||
1707 |
colorOnDevice:aColor |
|
1708 |
"returns color on device |
|
1709 |
" |
|
1710 |
|col| |
|
1711 |
||
641 | 1712 |
aColor = Color noColor ifFalse:[ |
1713 |
col := colorMap at:aColor ifAbsent:nil. |
|
637 | 1714 |
|
641 | 1715 |
col isNil ifTrue:[ |
1480 | 1716 |
colorMap at:aColor put:(col := aColor onDevice:device) |
641 | 1717 |
]. |
1718 |
^ col |
|
637 | 1719 |
]. |
641 | 1720 |
^ bgColor |
637 | 1721 |
! |
1722 |
||
1723 |
forceRedraw |
|
1724 |
"a redraw forced by any other component |
|
1725 |
" |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1726 |
shown ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1727 |
self invalidate |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1728 |
] |
637 | 1729 |
! |
1730 |
||
1731 |
invalidate |
|
1732 |
"recompute extent before repair range |
|
1733 |
" |
|
1734 |
self recomputeHeightOfContents. |
|
1735 |
super invalidate. |
|
1736 |
||
1737 |
||
1738 |
! |
|
1739 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1740 |
invalidateRowAt:aRowNr |
637 | 1741 |
"redraw total row at an index |
1742 |
" |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1743 |
self invalidateRowAt:aRowNr colAt:0 |
637 | 1744 |
! |
1745 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1746 |
invalidateRowAt:aRowNr colAt:aColNr |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1747 |
"redraw either a single column in a row, |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1748 |
or the complete visible row (in case of aColNr == 0). |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1749 |
If the row/column is hidden, no redraw is done |
637 | 1750 |
" |
1497 | 1751 |
|x "{ Class:SmallInteger }" |
1752 |
y "{ Class:SmallInteger }" |
|
1753 |
h "{ Class:SmallInteger }" |
|
1754 |
w "{ Class:SmallInteger }" |
|
2523
a7d71e57632f
care for non-existing column
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
1755 |
col| |
1497 | 1756 |
|
1757 |
(shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[ |
|
1131 | 1758 |
h := rowHeight. |
1497 | 1759 |
y := self yVisibleOfRowNr:aRowNr. |
1760 |
||
1761 |
y < margin ifTrue:[ |
|
637 | 1762 |
(h := h + y) <= margin ifTrue:[ |
1763 |
^ self |
|
1764 |
]. "/ row not visible |
|
1765 |
h := h - margin. |
|
1766 |
y := margin. |
|
1767 |
] ifFalse:[ |
|
1768 |
y >= height ifTrue:[^ self]. |
|
1769 |
]. |
|
1770 |
aColNr ~~ 0 ifTrue:[ "/ redraw column in row |
|
2523
a7d71e57632f
care for non-existing column
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
1771 |
col := (self columnAt:aColNr). |
a7d71e57632f
care for non-existing column
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
1772 |
w := col isNil ifTrue:0 ifFalse:[col width]. |
1497 | 1773 |
x := self xVisibleOfColNr:aColNr. |
1774 |
||
1775 |
x < margin ifTrue:[ |
|
637 | 1776 |
(w := w + x) <= margin ifTrue:[ |
1777 |
^ self |
|
1778 |
]. "/ column not visible |
|
1779 |
w := w - margin. |
|
1780 |
x := margin. |
|
1781 |
] ifFalse:[ |
|
1782 |
x >= width ifTrue:[^ self]. |
|
1783 |
] |
|
1784 |
] ifFalse:[ "/ redraw whole row |
|
1785 |
x := margin. |
|
1786 |
w := width. |
|
1787 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1788 |
self invalidateX:x y:y width:w height:h |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1789 |
] |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1790 |
! |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1791 |
|
2469
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1792 |
invalidateRows:aCollection |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1793 |
"redraw some visible rows" |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1794 |
|
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1795 |
shown ifTrue:[ |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1796 |
aCollection do:[:rowIndex | |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1797 |
self invalidateRowAt:rowIndex |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1798 |
] |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1799 |
] |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1800 |
! |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
1801 |
|
1956 | 1802 |
invalidateRowsFrom:aStart to:aStop |
1803 |
"redraw visible row from start to stop |
|
1804 |
" |
|
1805 |
|size start stop y0 y1| |
|
1806 |
||
1807 |
shown ifTrue:[ |
|
1808 |
size := list size. |
|
1809 |
start := aStart notNil ifTrue:[aStart max:1] ifFalse:[1]. |
|
1810 |
stop := aStop notNil ifTrue:[aStop min:size] ifFalse:[size]. |
|
1811 |
||
1812 |
start <= stop ifTrue:[ |
|
1813 |
y0 := (self yVisibleOfRowNr:start) max:margin. |
|
1814 |
y1 := ((self yVisibleOfRowNr:stop) + rowHeight) min:height. |
|
1815 |
||
1816 |
y0 < y1 ifTrue:[ |
|
1817 |
self invalidateX:margin y:y0 width:width height:(y1 - y0) |
|
1818 |
] |
|
1819 |
] |
|
1820 |
] |
|
1821 |
! |
|
1822 |
||
2190 | 1823 |
invalidateVisibleRow:aRow |
637 | 1824 |
"redraw row if visible |
1825 |
" |
|
2190 | 1826 |
self invalidateVisibleRow:aRow colAt:0 |
809 | 1827 |
! |
1828 |
||
2190 | 1829 |
invalidateVisibleRow:aRow colAt:aColNr |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1830 |
"redraw either a single column in a row, |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1831 |
or the complete visible row (in case of aColNr == 0). |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1832 |
If the row/column is hidden, no redraw is done |
809 | 1833 |
" |
637 | 1834 |
|start "{ Class:SmallInteger }" |
1835 |
stop "{ Class:SmallInteger }" |
|
1836 |
| |
|
1837 |
||
1838 |
(start := self indexOfFirstRowShown) ~~ 0 ifTrue:[ |
|
1497 | 1839 |
stop := (start + (height // rowHeight)) min:(list size). |
637 | 1840 |
|
1841 |
aRow isNumber ifTrue:[ |
|
1842 |
(aRow between:start and:stop) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1843 |
self invalidateRowAt:aRow colAt:aColNr |
637 | 1844 |
] |
1845 |
] ifFalse:[ |
|
1846 |
start to:stop do:[:i| |
|
1847 |
(self at:i) == aRow ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1848 |
^ self invalidateRowAt:i colAt:aColNr |
637 | 1849 |
] |
1850 |
] |
|
1851 |
] |
|
1852 |
] |
|
809 | 1853 |
! |
1854 |
||
2190 | 1855 |
invalidateVisibleRow:aRow readSelector:aSelector |
809 | 1856 |
"redraw a column identified by its read selector; if no column with |
1857 |
the specified read selector is detected, the whole line is drawn. |
|
1858 |
" |
|
1859 |
|row idx| |
|
1860 |
||
1861 |
aSelector isNil ifTrue:[ |
|
1862 |
idx := 0 |
|
1863 |
] ifFalse:[ |
|
1864 |
(row := aRow) isNumber ifTrue:[ |
|
1865 |
(row := self at:aRow) isNil ifTrue:[ ^ self ] |
|
1866 |
]. |
|
1867 |
idx := columnDescriptors findFirst:[:aCol||desc| |
|
1868 |
aCol description readSelector == aSelector |
|
1869 |
] |
|
1870 |
]. |
|
2190 | 1871 |
self invalidateVisibleRow:aRow colAt:idx |
637 | 1872 |
! |
1873 |
||
1874 |
redrawX:x y:y width:w height:h |
|
1875 |
"redraw part of myself immediately, given logical coordinates |
|
1876 |
" |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1877 |
|c0 savClip stopRedraw |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1878 |
start "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1879 |
stop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1880 |
x0 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1881 |
x1 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1882 |
maxX "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1883 |
yTop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1884 |
yBot "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1885 |
clHg "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1886 |
size "{ Class:SmallInteger }" |
637 | 1887 |
| |
1888 |
||
1889 |
shown ifFalse:[^ self]. |
|
1890 |
self paint:bgColor. |
|
1115 | 1891 |
|
1892 |
columnDescriptors isEmpty ifTrue:[ |
|
1893 |
^ self fillRectangleX:x y:y width:w height:h |
|
1894 |
]. |
|
1131 | 1895 |
size := list size. |
1115 | 1896 |
yTop := margin - viewOrigin y. |
1897 |
c0 := y - yTop max:0. |
|
1898 |
start := (c0 // rowHeight) + 1. |
|
1131 | 1899 |
stop := (c0 + h - 1 // rowHeight + 1) min:size. |
1115 | 1900 |
|
1901 |
stop < start ifTrue:[ |
|
1902 |
^ self fillRectangleX:x y:y width:w height:h |
|
1903 |
]. |
|
1904 |
savClip := clipRect. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1905 |
|
1115 | 1906 |
maxX := (x + w) min:(width - margin). |
1907 |
x0 := margin - viewOrigin x. |
|
1908 |
yTop := yTop + ((start - 1) * rowHeight). |
|
1131 | 1909 |
clHg := (stop - start + 1) * rowHeight. |
1910 |
yBot := yTop + clHg. |
|
1911 |
||
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1912 |
stopRedraw := false. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1913 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1914 |
self class stopRedrawSignal handle:[:ex| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1915 |
stopRedraw := true. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1916 |
] do:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1917 |
columnDescriptors do:[:aCol| |cw| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1918 |
x1 := x0 + aCol width. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1919 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1920 |
(x1 > x and:[x0 < maxX]) ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1921 |
|left right rect| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1922 |
left := x0 max:x. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1923 |
right := x1 min:maxX. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1924 |
rect := Rectangle left:left top:y width:(right - left) height:h. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1925 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1926 |
clipRect := nil. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1927 |
self clippingRectangle:rect. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1928 |
aCol redrawX:x0 y:yTop h:clHg from:start to:stop. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1929 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1930 |
x0 := x1 |
1115 | 1931 |
]. |
1932 |
]. |
|
1131 | 1933 |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1934 |
"/ restore old clipping rectangle |
1115 | 1935 |
self clippingRectangle:savClip. |
1131 | 1936 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1937 |
stopRedraw ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1938 |
self invalidate. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1939 |
self makeSelectionVisible. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1940 |
^ self |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1941 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1942 |
|
1131 | 1943 |
stop == size ifTrue:[ |
1115 | 1944 |
yTop := y + h. |
1945 |
yBot < (yTop - margin) ifTrue:[ |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1946 |
"/ clear to bottom of screen |
1115 | 1947 |
self paint:bgColor. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1948 |
self fillRectangleX:x y:yBot width:w height:(yTop - yBot). |
1112 | 1949 |
] |
1136 | 1950 |
]. |
1951 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1952 |
(c0 := w + x- x1) > 0 ifTrue:[ |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1953 |
"/ clear to right of screen |
1136 | 1954 |
self paint:bgColor. |
1955 |
self fillRectangleX:x1 y:y width:c0 height:h. |
|
1956 |
]. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1957 |
|
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1958 |
"/ draw the selection in the right part, after the last column |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1959 |
x1 < (width-margin) ifTrue:[ |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1960 |
self hasRowSelection ifTrue:[ |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1961 |
self selectionIndicesDo:[:selIdx | |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1962 |
|y| |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1963 |
|
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1964 |
y := self yVisibleOfRowNr:selIdx. |
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
1965 |
self paint:selectionBackgroundColor. |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1966 |
self |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1967 |
fillRectangleX:x1 y:y |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1968 |
width:(width-margin-x1) height:rowHeight. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1969 |
]. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1970 |
]. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
1971 |
]. |
1112 | 1972 |
! ! |
1973 |
||
1974 |
!DSVColumnView methodsFor:'drawing interactors'! |
|
1975 |
||
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1976 |
displayLabel:aLabel x:xLeft y:yTop |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1977 |
"display the label at x y; test whether the height of the label matches to the current |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1978 |
rowHeight. If not, an exception is raised and the rowHeight is recomputed |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1979 |
" |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1980 |
|y h | |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1981 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1982 |
aLabel notNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1983 |
aLabel isString ifTrue:[ |
2593
24ddc48c5ad4
bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents:
2592
diff
changeset
|
1984 |
y := yTop + self rowFontAscent. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1985 |
] ifFalse:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1986 |
h := aLabel heightOn:self. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1987 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1988 |
h > minRowHeight ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1989 |
minRowHeight := h. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1990 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1991 |
preferredExtent notNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1992 |
rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1993 |
preferredExtent := preferredExtent copy. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1994 |
preferredExtent y: (list size * rowHeight). |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1995 |
self contentsChanged. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1996 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1997 |
self class stopRedrawSignal raiseRequest. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
1998 |
]. |
2593
24ddc48c5ad4
bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents:
2592
diff
changeset
|
1999 |
y := yTop + (aLabel ascentOn:self). |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2000 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2001 |
aLabel displayOn:self x:xLeft y:y. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2002 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2003 |
! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2004 |
|
1131 | 2005 |
drawCheckToggleAtX:xTop y:yTop w:rowWidth state:aState |
1112 | 2006 |
"draw a check toggle button |
2007 |
" |
|
2008 |
|e form |
|
2009 |
y "{ Class:SmallInteger }" |
|
2010 |
x "{ Class:SmallInteger }" |
|
2011 |
h "{ Class:SmallInteger }" |
|
2012 |
w "{ Class:SmallInteger }" |
|
2013 |
| |
|
2014 |
w := checkToggleExtent x. |
|
2015 |
h := checkToggleExtent y. |
|
2016 |
y := yTop + (rowHeight - h // 2). |
|
2017 |
x := xTop + (rowWidth - w // 2). |
|
1529 | 2018 |
h odd ifTrue:[y := y + 1]. |
1112 | 2019 |
|
2020 |
(form := checkToggleActiveImage) isNil ifTrue:[ |
|
1131 | 2021 |
self paint:bgColor. |
2022 |
self fillRectangleX:x y:y width:w height:h. |
|
2023 |
self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self. |
|
2024 |
||
2695 | 2025 |
aState isBoolean ifFalse:[^ self]. |
2026 |
||
1112 | 2027 |
aState ifFalse:[ |
2028 |
^ self |
|
2029 |
]. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2030 |
self paint:fgColor on:bgColor. |
1112 | 2031 |
form := checkToggleForm |
2032 |
] ifFalse:[ |
|
2033 |
aState ifFalse:[form := checkTogglePassiveImage] |
|
859 | 2034 |
]. |
1112 | 2035 |
e := (checkToggleExtent - form extent) // 2. |
2036 |
self displayForm:form x:(x + e x) y:(y + e y). |
|
2037 |
! |
|
2038 |
||
1131 | 2039 |
drawComboButtonAtX:xTop y:yTop w:rowWidth |
1112 | 2040 |
"draw a combo button |
2041 |
" |
|
2042 |
|e |
|
2043 |
x "{ Class:SmallInteger }" |
|
2044 |
y "{ Class:SmallInteger }" |
|
2045 |
h "{ Class:SmallInteger }" |
|
2046 |
w "{ Class:SmallInteger }" |
|
2047 |
| |
|
2048 |
w := comboButtonExtent x. |
|
2049 |
h := comboButtonExtent y. |
|
2050 |
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
|
2051 |
x := xTop + (rowWidth - w - separatorSize - 1). |
1112 | 2052 |
e := (comboButtonExtent - comboButtonForm extent) // 2. |
2053 |
||
1131 | 2054 |
self paint:bgColor. |
2055 |
self fillRectangleX:x y:y width:w height:h. |
|
2056 |
self drawEdgesAtX:x y:y width:w height:h level:comboButtonLevel on:self. |
|
1136 | 2057 |
self paint:fgColor on:bgColor. |
1112 | 2058 |
self displayForm:comboButtonForm x:(x + e x) y:(y + e y) |
2059 |
||
2060 |
! |
|
2061 |
||
2062 |
drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC |
|
2063 |
"draw edges for a cell or label |
|
2064 |
" |
|
2065 |
aGC drawEdgesForX:x |
|
2066 |
y:y |
|
2067 |
width:w |
|
2068 |
height:h |
|
2069 |
level:aLevel |
|
2070 |
shadow:buttonShadowColor |
|
2071 |
light:buttonLightColor |
|
2072 |
halfShadow:buttonHalfShadowColor |
|
2073 |
halfLight:buttonHalfLightColor |
|
2074 |
style:ButtonEdgeStyle. |
|
2075 |
||
637 | 2076 |
! ! |
2077 |
||
542 | 2078 |
!DSVColumnView methodsFor:'enumerating columns'! |
2079 |
||
2080 |
columnsDo:aOneArgBlock |
|
2081 |
"evaluate the argument, aOneArgBlock for every column |
|
2082 |
" |
|
2083 |
columnDescriptors do:aOneArgBlock |
|
2084 |
||
2085 |
||
2086 |
! |
|
2087 |
||
2088 |
columnsFrom:start to:stop do:aOneArgBlock |
|
2089 |
"evaluate the argument, aOneArgBlock for the columns with index start to |
|
2090 |
stop in the collection of column descriptors |
|
2091 |
" |
|
2092 |
columnDescriptors from:start to:stop do:aOneArgBlock |
|
2093 |
||
2094 |
||
2095 |
! ! |
|
2096 |
||
2097 |
!DSVColumnView methodsFor:'event handling'! |
|
2098 |
||
2398 | 2099 |
buttonControlPressAtRowNr:aStartRow |
2100 |
|isSelected prvRow doAdd chgSet| |
|
2101 |
||
2102 |
buttonMotionAction := nil. |
|
2103 |
isSelected := self isInSelection:aStartRow. |
|
2104 |
||
2105 |
isSelected ifTrue:[ self removeRowFromSelection:aStartRow ] |
|
2106 |
ifFalse:[ self addRowToSelection:aStartRow ]. |
|
2107 |
||
2108 |
multipleSelectOk ifFalse:[ ^ self ]. |
|
2109 |
||
2110 |
prvRow := aStartRow. |
|
2111 |
chgSet := IdentitySet new. |
|
2112 |
doAdd := isSelected not. |
|
2113 |
||
2114 |
buttonMotionAction := [:p| |rowNr mustRestore step f| |
|
2115 |
rowNr := self yVisibleToRowNr:(p y). |
|
2116 |
||
2117 |
(rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[ |
|
2118 |
rowNr == aStartRow ifTrue:[ |
|
2119 |
mustRestore := true |
|
2120 |
] ifFalse:[ |
|
2121 |
rowNr > aStartRow ifTrue:[ mustRestore := (rowNr < prvRow) ] |
|
2122 |
ifFalse:[ mustRestore := (rowNr > prvRow) ]. |
|
2123 |
]. |
|
2124 |
prvRow > rowNr ifTrue:[ step := -1 ] |
|
2125 |
ifFalse:[ step := 1 ]. |
|
2126 |
mustRestore ifTrue:[ |
|
2127 |
[ prvRow ~~ rowNr ] whileTrue:[ |
|
2128 |
(chgSet removeIdentical:prvRow ifAbsent:nil) notNil ifTrue:[ |
|
2129 |
doAdd ifFalse:[ self addRowToSelection:prvRow ] |
|
2130 |
ifTrue:[ self removeRowFromSelection:prvRow ]. |
|
2131 |
]. |
|
2132 |
prvRow := prvRow + step. |
|
2133 |
]. |
|
2134 |
] ifFalse:[ |
|
2135 |
[ prvRow ~~ rowNr ] whileTrue:[ |
|
2136 |
prvRow := prvRow + step. |
|
2137 |
||
2138 |
doAdd ~~ (self isInSelection:rowNr) ifTrue:[ |
|
2139 |
chgSet add:prvRow. |
|
2140 |
||
2141 |
doAdd ifTrue:[ self addRowToSelection:prvRow ] |
|
2142 |
ifFalse:[ self removeRowFromSelection:prvRow ]. |
|
2143 |
] |
|
2144 |
]. |
|
2145 |
]. |
|
2146 |
]. |
|
2147 |
]. |
|
2148 |
! |
|
2149 |
||
607 | 2150 |
buttonMotion:buttonMask x:x y:y |
2151 |
"mouse-move while button was pressed - handle multiple selection changes |
|
2152 |
" |
|
1809 | 2153 |
self isEnabled ifFalse:[^ self]. |
2154 |
||
2398 | 2155 |
buttonMotionAction notNil ifTrue:[ |
2156 |
buttonMotionAction value:(x@y). |
|
2157 |
||
2158 |
buttonMotionAction notNil ifTrue:[ |
|
2159 |
autoScroll ifTrue:[ |
|
2160 |
"/ if moved outside of view, start autoscroll |
|
2161 |
(y < 0) ifTrue:[ |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2162 |
^ self startAutoScroll:#scrollUp distance:y. |
2398 | 2163 |
]. |
2164 |
(y > height) ifTrue:[ |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2165 |
^ self startAutoScroll:#scrollDown distance:(y - height). |
2398 | 2166 |
]. |
2167 |
] |
|
607 | 2168 |
] |
2169 |
]. |
|
2398 | 2170 |
self stopAutoScroll. |
607 | 2171 |
! |
2172 |
||
542 | 2173 |
buttonMultiPress:button x:x y:y |
2174 |
"a button was pressed twice - handle doubleclick here |
|
2175 |
" |
|
2398 | 2176 |
buttonMotionAction := buttonReleaseAction := nil. |
2177 |
||
1805 | 2178 |
self isEnabled ifFalse:[^ self]. |
2179 |
||
542 | 2180 |
((button == 1) or:[button == #select]) ifFalse:[ |
2181 |
^ super buttonMultiPress:button x:x y:y |
|
2182 |
]. |
|
607 | 2183 |
self numberOfSelections == 1 ifTrue:[ |
2184 |
self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[ |
|
2185 |
( selectedColIndex == 0 |
|
2186 |
or:[selectedColIndex == (self xVisibleToColNr:x)] |
|
2187 |
) ifTrue:[ |
|
2188 |
self doubleClicked |
|
2189 |
] |
|
542 | 2190 |
] |
2191 |
] |
|
2192 |
! |
|
2193 |
||
2194 |
buttonPress:button x:x y:y |
|
2195 |
"a button was pressed - handle selection here |
|
2196 |
" |
|
2398 | 2197 |
|rowNr colNr menu sensor clickPoint| |
2198 |
||
2199 |
buttonMotionAction := buttonReleaseAction := nil. |
|
542 | 2200 |
|
1805 | 2201 |
self isEnabled ifFalse:[^ self]. |
2202 |
||
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2203 |
sensor := self sensor. |
809 | 2204 |
|
667 | 2205 |
((button == 2) or:[button == #menu]) ifTrue:[ |
2398 | 2206 |
menu := self findMenuForSelection. |
2207 |
||
2208 |
menu notNil ifTrue:[ self startUpMenu:menu ] |
|
2209 |
ifFalse:[ super buttonPress:button x:x y:y ]. |
|
2210 |
^ self |
|
2211 |
]. |
|
2212 |
||
2213 |
( (rowNr := self yVisibleToRowNr:y) notNil |
|
2214 |
and:[(colNr := self xVisibleToColNr:x) notNil] |
|
2215 |
) ifFalse:[ |
|
2216 |
super buttonPress:button x:x y:y. |
|
2217 |
^ self |
|
2218 |
]. |
|
2219 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2220 |
(self isRowSelectable:rowNr) ifFalse:[^ self ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2221 |
|
2398 | 2222 |
sensor ctrlDown ifTrue:[ |
2223 |
self buttonControlPressAtRowNr:rowNr. |
|
2224 |
^ self |
|
2225 |
]. |
|
2226 |
||
2227 |
sensor shiftDown ifTrue:[ |
|
2228 |
(multipleSelectOk and:[selectedRowIndex size ~~ 0]) ifTrue:[ |
|
2229 |
self selectRowFrom:(selectedRowIndex min min:rowNr) |
|
2230 |
to:(selectedRowIndex max max:rowNr). |
|
2231 |
] ifFalse:[ |
|
2232 |
self selectColIndex:0 rowIndex:rowNr. |
|
2233 |
]. |
|
2234 |
^ self |
|
2235 |
]. |
|
2236 |
||
2237 |
(self canDrag and:[self isSelected:rowNr inColumn:colNr]) ifTrue:[ |
|
2238 |
clickPoint := x @ y. |
|
2239 |
buttonReleaseAction := [ self selectRowAt:rowNr colAt:colNr atPoint:(x @ y) ]. |
|
2240 |
||
2241 |
buttonMotionAction := [:aPoint| |
|
2242 |
(clickPoint dist:aPoint) > 5.0 ifTrue:[ |
|
2243 |
buttonReleaseAction := buttonMotionAction := nil. |
|
2244 |
self startDragAt:aPoint. |
|
2245 |
] |
|
2246 |
]. |
|
2247 |
^ self. |
|
2248 |
]. |
|
2249 |
||
2250 |
self withWaitCursorDo:[ |
|
2251 |
self selectRowAt:rowNr colAt:colNr atPoint:(x @ y) |
|
2252 |
]. |
|
2253 |
||
2254 |
(multipleSelectOk and:[selectedColIndex == 0 and:[selectedRowIndex size == 1]]) ifTrue:[ |
|
2255 |
buttonMotionAction := [:p| |r| |
|
2256 |
r := self yVisibleToRowNr:(p y). |
|
2257 |
r notNil ifTrue:[ self selectRowFrom:rowNr to:r ]. |
|
542 | 2258 |
] |
2259 |
]. |
|
2260 |
! |
|
2261 |
||
643 | 2262 |
buttonRelease:button x:x y:y |
2263 |
||
2398 | 2264 |
buttonMotionAction := nil. |
1749 | 2265 |
self stopAutoScroll. |
2266 |
||
2398 | 2267 |
buttonReleaseAction notNil ifTrue:[ |
2268 |
buttonReleaseAction value. |
|
2269 |
buttonReleaseAction := nil. |
|
643 | 2270 |
]. |
2271 |
super buttonRelease:button x:x y:y |
|
2272 |
! |
|
2273 |
||
809 | 2274 |
characterPress:aChar x:x y:y |
2275 |
"search row in column at x/y starting its printable label with cahracter. |
|
2276 |
" |
|
2277 |
|colNr rowNr lsize found column| |
|
2278 |
||
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2279 |
lsize := list size. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2280 |
|
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2281 |
"/ (rowIfAbsentBlock notNil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2282 |
"/ or:[x isNil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2283 |
"/ or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2284 |
"/ ^ self |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2285 |
"/ ]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2286 |
colNr := self findFirstColumnWithStringFrom:1 to:lsize. |
2535 | 2287 |
colNr isNil ifTrue:[ ^ self ]. |
2288 |
||
809 | 2289 |
rowNr := self lastIndexSelected. |
2290 |
column := self columnAt:colNr. |
|
2291 |
found := 0. |
|
2292 |
||
2293 |
lsize > rowNr ifTrue:[ |
|
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2294 |
"/ search to end |
809 | 2295 |
found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize. |
2296 |
]. |
|
2297 |
||
2298 |
(found == 0 and:[rowNr > 1]) ifTrue:[ |
|
2299 |
"/ search from begin |
|
2300 |
found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1) |
|
2301 |
]. |
|
2302 |
found ~~ 0 ifTrue:[ |
|
2303 |
self selectColIndex:colNr rowIndex:found. |
|
2304 |
]. |
|
2305 |
||
896
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2306 |
"Modified: / 21.5.1998 / 03:30:22 / cg" |
809 | 2307 |
! |
2308 |
||
542 | 2309 |
contentsChanged |
2310 |
"contents changed - move origin up if possible |
|
2311 |
" |
|
2312 |
|y| |
|
2313 |
||
2314 |
shown ifTrue:[ |
|
2315 |
self recomputeHeightOfContents. |
|
2316 |
y := self maxViewOriginY. |
|
2317 |
||
2318 |
viewOrigin y > y ifTrue:[ |
|
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
2319 |
scrollWhenUpdating ~~ false ifTrue:[ |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
2320 |
self scrollTo:(viewOrigin x @ y) |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
2321 |
] |
542 | 2322 |
] ifFalse:[ |
2323 |
self updateEditViewOrigin. |
|
2324 |
] |
|
2325 |
]. |
|
2326 |
super contentsChanged |
|
2327 |
! |
|
2328 |
||
2329 |
doubleClicked |
|
2330 |
"handle a double click |
|
2331 |
" |
|
637 | 2332 |
|col sel idx| |
2333 |
||
2334 |
self hasSelection ifTrue:[ |
|
2335 |
idx := self firstIndexSelected. |
|
2336 |
col := self selectedColumn. |
|
2337 |
(col notNil and:[(sel := col doubleClickedSelector) notNil]) ifTrue:[ |
|
2074 | 2338 |
col doubleClickOn:idx |
637 | 2339 |
] ifFalse:[ |
2340 |
doubleClickActionBlock notNil ifTrue:[ |
|
2341 |
doubleClickActionBlock value:idx |
|
2342 |
] |
|
2343 |
] |
|
2344 |
] |
|
542 | 2345 |
! |
2346 |
||
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2347 |
findFirstColumnWithStringFrom:start to:stop |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2348 |
start to:stop do:[:eachNr| |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2349 |
|row lbl| |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2350 |
row := self at:eachNr. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2351 |
columnDescriptors keysAndValuesDo:[:colNr :col | |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2352 |
lbl := col shownValueForRow:row rowNr:eachNr. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2353 |
|
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2354 |
(lbl isSequenceable and:[lbl isString not]) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2355 |
lbl := lbl at:1 ifAbsent:nil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2356 |
]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2357 |
|
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2358 |
(lbl respondsTo:#string) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2359 |
lbl := lbl string. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2360 |
]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2361 |
(lbl size > 0 and:[(lbl at:1) isCharacter]) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2362 |
^ colNr |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2363 |
] |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2364 |
] |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2365 |
]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2366 |
^ nil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2367 |
! |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2368 |
|
667 | 2369 |
findMenuForSelection |
2370 |
"find the middle button menu for the current selection; returns the menu or nil |
|
2371 |
" |
|
2372 |
|col row menu| |
|
2373 |
||
2374 |
self numberOfSelections == 1 ifTrue:[ |
|
2375 |
row := self at:(self firstIndexSelected). |
|
2376 |
col := self selectedColumn. |
|
2377 |
||
2074 | 2378 |
(col notNil and:[(menu := col menuForRow:row orAdaptor:columnAdaptor) notNil]) ifTrue:[ |
667 | 2379 |
^ menu |
2380 |
]. |
|
2381 |
col := columnDescriptors detect:[:c| c rendererType == #rowSelector] |
|
2382 |
ifNone:[nil]. |
|
2383 |
||
2384 |
col notNil ifTrue:[ |
|
1223
176702811314
kludge: when asking for an itemMenu, pass application to
tm
parents:
1215
diff
changeset
|
2385 |
^ col menuForRow:row inApplication:(self application) |
667 | 2386 |
] |
2387 |
]. |
|
2388 |
^ nil |
|
2389 |
! |
|
2390 |
||
1111 | 2391 |
keyPress:aKey x:x y:y |
542 | 2392 |
"a key was pressed - handle page-keys here |
2393 |
" |
|
2394 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
|
809 | 2395 |
#BeginOfText #EndOfText #ScrollUp #ScrollDown |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2396 |
#CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)> |
542 | 2397 |
|
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
2398 |
|maxColNr firstSelRowNr minSelRowNr maxSelRowNr selRowNr selColNr |
2470 | 2399 |
key column isTab listSize hasSelectables rawKey| |
1111 | 2400 |
|
1805 | 2401 |
self isEnabled ifFalse:[^ self]. |
2402 |
||
1416 | 2403 |
(listSize := list size) == 0 ifTrue:[ |
2404 |
^ super keyPress:aKey x:x y:y |
|
2405 |
]. |
|
1776 | 2406 |
aKey isCharacter ifTrue:[ |
2407 |
^ self characterPress:aKey x:x y:y |
|
542 | 2408 |
]. |
1111 | 2409 |
|
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2410 |
(aKey == #SelectAll) ifTrue:[ |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2411 |
multipleSelectOk ifTrue:[ |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2412 |
self selectAllRows. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2413 |
]. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2414 |
^ self |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2415 |
]. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
2416 |
|
1776 | 2417 |
aKey == #PreviousPage ifTrue:[^ self pageUp]. |
2418 |
aKey == #NextPage ifTrue:[^ self pageDown]. |
|
2419 |
aKey == #HalfPageUp ifTrue:[^ self halfPageUp]. |
|
2420 |
aKey == #HalfPageDown ifTrue:[^ self halfPageDown]. |
|
2421 |
aKey == #BeginOfText ifTrue:[^ self scrollToTop]. |
|
2422 |
aKey == #EndOfText ifTrue:[^ self scrollToBottom]. |
|
2423 |
aKey == #ScrollUp ifTrue:[^ self scrollUp]. |
|
2424 |
aKey == #ScrollDown ifTrue:[^ self scrollDown]. |
|
2425 |
||
1111 | 2426 |
aKey == #Return ifTrue:[ |
1416 | 2427 |
self numberOfSelections == 1 ifTrue:[self doubleClicked]. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2428 |
^ self |
542 | 2429 |
]. |
1111 | 2430 |
|
1668 | 2431 |
hasSelectables := false. |
2432 |
||
2433 |
columnDescriptors do:[:aCol| |
|
2434 |
(hasSelectables or:[aCol rendererType == #rowSelector]) ifFalse:[ |
|
2435 |
hasSelectables := aCol description canSelect |
|
2436 |
] |
|
2437 |
]. |
|
2470 | 2438 |
|
2439 |
rawKey := (WindowGroup lastEventQuerySignal query) rawKey. |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2440 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2441 |
(aKey == #CursorUp |
2470 | 2442 |
or:[aKey == #CursorDown |
2443 |
or:[rawKey == #Home |
|
2444 |
or:[rawKey == #End] |
|
2445 |
]]) ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2446 |
(hasSelectables or:[selectRowOnDefault]) ifTrue:[ |step start| |
2470 | 2447 |
minSelRowNr := self minIndexSelected. |
2448 |
maxSelRowNr := self maxIndexSelected. |
|
2449 |
||
1776 | 2450 |
selColNr := hasSelectables ifFalse:[0] |
2451 |
ifTrue:[selectedColIndex]. |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2452 |
|
1776 | 2453 |
aKey == #CursorUp ifTrue:[ |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2454 |
selRowNr := minSelRowNr > 1 ifTrue:[minSelRowNr - 1] ifFalse:[listSize]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2455 |
step := -1. |
1776 | 2456 |
] ifFalse:[ |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2457 |
aKey == #CursorDown ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2458 |
selRowNr := maxSelRowNr < listSize ifTrue:[maxSelRowNr + 1] ifFalse:[1]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2459 |
step := 1. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2460 |
] ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2461 |
aKey == #BeginOfLine ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2462 |
selRowNr := 1. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2463 |
step := 1. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2464 |
] ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2465 |
selRowNr := listSize. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2466 |
step := -1. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2467 |
] |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2468 |
] |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2469 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2470 |
start := selRowNr. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2471 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2472 |
[ self isRowSelectable:selRowNr ] whileFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2473 |
selRowNr := selRowNr + step. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2474 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2475 |
selRowNr == 0 ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2476 |
selRowNr := listSize. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2477 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2478 |
selRowNr > listSize ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2479 |
selRowNr := 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2480 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2481 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2482 |
selRowNr == start ifTrue:[^ self ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2483 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2484 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2485 |
((aKey == #CursorUp) or:[aKey == #CursorDown]) ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2486 |
(multipleSelectOk and:[self sensor shiftDown]) ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2487 |
self addRowToSelection:selRowNr. |
2370 | 2488 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2489 |
aKey == #CursorDown ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2490 |
self makeLineVisible:((selRowNr+1) min:listSize) |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2491 |
] ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2492 |
self makeLineVisible:((selRowNr-1) max:1) |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2493 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2494 |
^ self |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2495 |
] |
1776 | 2496 |
]. |
2497 |
self selectColIndex:selColNr rowIndex:selRowNr |
|
2498 |
]. |
|
2499 |
^ self |
|
2500 |
]. |
|
1668 | 2501 |
|
2502 |
hasSelectables ifFalse:[ |
|
2503 |
^ super keyPress:aKey x:x y:y |
|
2504 |
]. |
|
2505 |
||
1776 | 2506 |
"/ CURSOR LEFT/RIGHT or TABING |
2470 | 2507 |
(aKey == #CursorLeft or:[aKey == #CursorRight]) ifTrue:[ |
2508 |
isTab := false. |
|
2509 |
key := aKey. |
|
2510 |
] ifFalse:[ |
|
1668 | 2511 |
tabIntern ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2512 |
^ super keyPress:aKey x:x y:y |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2513 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2514 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2515 |
(aKey includesString:'Tab') ifTrue:[ |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
2516 |
key := (self sensor shiftDown or:[aKey includesString:'Left']) |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
2517 |
ifTrue:[#CursorLeft] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
2518 |
ifFalse:[#CursorRight] |
1416 | 2519 |
] ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2520 |
(aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[ |
1416 | 2521 |
^ super keyPress:aKey x:x y:y |
2522 |
]. |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2523 |
key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2524 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2525 |
isTab := true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2526 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2527 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2528 |
maxColNr := self numberOfColumns. |
1776 | 2529 |
selColNr := selectedColIndex. |
612 | 2530 |
|
2470 | 2531 |
firstSelRowNr := self firstIndexSelected. |
2532 |
||
1111 | 2533 |
key == #CursorLeft ifTrue:[ |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2534 |
selRowNr := firstSelRowNr. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2535 |
selRowNr == 0 ifTrue:[selRowNr := listSize]. |
1776 | 2536 |
selColNr == 0 ifTrue:[selColNr := maxColNr + 1]. |
2537 |
||
2538 |
[true] whileTrue:[ |
|
2539 |
(selColNr := selColNr - 1) == 0 ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2540 |
[ selRowNr := selRowNr - 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2541 |
selRowNr == 0 ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2542 |
isTab ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2543 |
tabAtStartAction notNil ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2544 |
tabAtStartAction value |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2545 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2546 |
self deselect. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2547 |
self windowGroup focusPreviousFrom:self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2548 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2549 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2550 |
^ self |
1416 | 2551 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2552 |
(self isRowSelectable:selRowNr) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2553 |
] whileFalse. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2554 |
|
1776 | 2555 |
selColNr := maxColNr |
1111 | 2556 |
]. |
1776 | 2557 |
column := self columnAt:selColNr. |
1416 | 2558 |
|
1111 | 2559 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
1776 | 2560 |
^ self selectColIndex:selColNr rowIndex:selRowNr. |
1111 | 2561 |
] |
2562 |
] |
|
542 | 2563 |
]. |
1776 | 2564 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
2565 |
selRowNr := firstSelRowNr. |
1776 | 2566 |
selRowNr == 0 ifTrue:[selRowNr := 1]. |
2567 |
||
2568 |
[true] whileTrue:[ |
|
2569 |
(selColNr := selColNr + 1) > maxColNr ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2570 |
[ selRowNr := selRowNr + 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2571 |
selRowNr > listSize ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2572 |
isTab ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2573 |
tabAtEndAction notNil ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2574 |
tabAtEndAction value |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2575 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2576 |
self deselect. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2577 |
self windowGroup focusNextFrom:self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2578 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2579 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2580 |
^ self |
1776 | 2581 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2582 |
(self isRowSelectable:selRowNr) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2583 |
] whileFalse. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2584 |
|
1776 | 2585 |
selColNr := 1 |
2586 |
]. |
|
2587 |
column := self columnAt:selColNr. |
|
2588 |
||
2589 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
|
2590 |
^ self selectColIndex:selColNr rowIndex:selRowNr |
|
2591 |
] |
|
2592 |
]. |
|
542 | 2593 |
! |
2594 |
||
2595 |
originChanged:delta |
|
2596 |
"this one is sent, after the origin of my contents has changed - |
|
2597 |
tell dependents (i.e. scrollers) about this |
|
2598 |
" |
|
2599 |
super originChanged:delta. |
|
2600 |
self updateEditViewOrigin. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2601 |
! |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2602 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2603 |
sizeChanged:how |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2604 |
"size changed - move origin up if possible |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2605 |
change the layout of the labelView dependent on my layout |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2606 |
" |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2607 |
|selectionWasVisible| |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2608 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2609 |
selectionWasVisible := self isSelectionVisibleIn:(previousExtent ? self extent). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2610 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2611 |
previousExtent := self extent. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2612 |
super sizeChanged:how. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2613 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2614 |
"/ no - must compute even if not visible. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2615 |
"/ (could be invisible in a notebook ...) |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2616 |
realized ifTrue:[ "used to be: shown" |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2617 |
"/ labelView isVisible ifTrue:[ |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2618 |
"/ lyt := labelView layout. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2619 |
"/ lyt leftOffset:(layout leftOffset). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2620 |
"/ lyt rightOffset:(layout rightOffset). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2621 |
"/ labelView layout:lyt. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2622 |
"/ ]. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2623 |
self fitColumns. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2624 |
selectionWasVisible ifTrue:[ |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2625 |
self makeSelectionVisible. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2626 |
] |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
2627 |
]. |
542 | 2628 |
! ! |
2629 |
||
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2630 |
!DSVColumnView methodsFor:'focus handling'! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2631 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2632 |
canTab |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2633 |
super canTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2634 |
^ editView isNil |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2635 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2636 |
^ false |
2101 | 2637 |
! |
2638 |
||
2639 |
wantsFocusWithPointerEnter |
|
2640 |
"views which like to take the keyboard focus |
|
2641 |
when the pointer enters can do so by redefining this |
|
2642 |
to return true" |
|
2643 |
||
2644 |
|pref| |
|
2645 |
||
2237 | 2646 |
editView ifNotNil:[^ false]. |
2647 |
||
2101 | 2648 |
pref := UserPreferences current focusFollowsMouse. |
2649 |
(pref ~~ false |
|
2650 |
and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true) |
|
2651 |
]) ifTrue:[ |
|
2652 |
list size > 0 ifTrue:[ |
|
2653 |
^ true |
|
2654 |
] |
|
2655 |
]. |
|
2656 |
^ false |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2657 |
! ! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
2658 |
|
542 | 2659 |
!DSVColumnView methodsFor:'gc operations'! |
2660 |
||
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2661 |
imageOnMyDevice:anImage |
1100 | 2662 |
"associate image to device and clear pixel mask; returns the new image. |
2663 |
" |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2664 |
|deviceImage| |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2665 |
|
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2666 |
anImage isNil ifTrue:[^ anImage]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2667 |
|
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2668 |
deviceImage := anImage onDevice:device. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2669 |
deviceImage isImage ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2670 |
deviceImage clearMaskedPixels. |
1100 | 2671 |
]. |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2672 |
^ deviceImage |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2673 |
"/ |image| |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2674 |
"/ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2675 |
"/ (image := anImage) notNil ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2676 |
"/ image device ~~ device ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2677 |
"/ image := image copy onDevice:device. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2678 |
"/ ]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2679 |
"/ image isImage ifTrue:[ |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2680 |
"/ image := image clearMaskedPixels |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2681 |
"/ ] |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2682 |
"/ ]. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2683 |
"/ ^ image |
1100 | 2684 |
! |
2685 |
||
542 | 2686 |
registerImage:anImage key:aKey |
2687 |
"any row can register an image with a unique identifier a key symbol |
|
2688 |
" |
|
2689 |
|img| |
|
2690 |
||
2691 |
(img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
|
2692 |
^ img |
|
2693 |
]. |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2694 |
img := self imageOnMyDevice:anImage. |
567 | 2695 |
registererImages at:aKey put:img. |
2696 |
^ img |
|
542 | 2697 |
! |
2698 |
||
2699 |
registeredImageAt:aKey |
|
2700 |
"any row can register an image with a unique identifier |
|
2701 |
" |
|
2702 |
^ registererImages at:aKey ifAbsent:nil |
|
2703 |
! |
|
2704 |
||
2705 |
releaseAllRegisteredImages |
|
2706 |
"release all registered images |
|
2707 |
" |
|
2708 |
registererImages := IdentityDictionary new. |
|
2709 |
! ! |
|
2710 |
||
2500 | 2711 |
!DSVColumnView methodsFor:'initialization & release'! |
542 | 2712 |
|
2713 |
create |
|
607 | 2714 |
"set color on device |
542 | 2715 |
" |
2716 |
super create. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2717 |
|
1480 | 2718 |
fgColor := fgColor onDevice:device. |
2719 |
bgColor := bgColor onDevice:device. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2720 |
selectionForegroundColor := selectionForegroundColor onDevice:device. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2721 |
selectionBackgroundColor := selectionBackgroundColor onDevice:device. |
1480 | 2722 |
|
2723 |
buttonShadowColor := buttonShadowColor onDevice:device. |
|
2724 |
buttonLightColor := buttonLightColor onDevice:device. |
|
809 | 2725 |
|
2726 |
buttonHalfShadowColor notNil ifTrue:[ |
|
1480 | 2727 |
buttonHalfShadowColor := buttonHalfShadowColor onDevice:device |
809 | 2728 |
]. |
2729 |
||
2730 |
buttonHalfLightColor notNil ifTrue:[ |
|
1480 | 2731 |
buttonHalfLightColor := buttonHalfLightColor onDevice:device |
809 | 2732 |
]. |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2733 |
rowSelectorForm := self imageOnMyDevice:rowSelectorForm. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2734 |
checkToggleActiveImage := self imageOnMyDevice:checkToggleActiveImage. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2735 |
checkTogglePassiveImage := self imageOnMyDevice:checkTogglePassiveImage. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2736 |
comboButtonForm := self imageOnMyDevice:comboButtonForm. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
2737 |
checkToggleForm := self imageOnMyDevice:checkToggleForm. |
542 | 2738 |
! |
2739 |
||
2740 |
initStyle |
|
607 | 2741 |
"setup colors |
2742 |
" |
|
1100 | 2743 |
|button widget| |
809 | 2744 |
|
542 | 2745 |
super initStyle. |
2746 |
||
2747 |
DefaultForegroundColor isNil ifTrue:[ |
|
2748 |
self class updateStyleCache |
|
2749 |
]. |
|
2750 |
fgColor := DefaultForegroundColor. |
|
2751 |
bgColor := DefaultBackgroundColor. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2752 |
selectionForegroundColor := DefaultHilightForegroundColor. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2753 |
selectionBackgroundColor := DefaultHilightBackgroundColor. |
809 | 2754 |
|
2755 |
shadowColor isNil ifTrue:[ |
|
2756 |
shadowColor := Color grayPercent:40. |
|
2757 |
]. |
|
2758 |
||
2759 |
lightColor isNil ifTrue:[ |
|
2760 |
lightColor := Color grayPercent:75 |
|
2761 |
]. |
|
2762 |
||
2763 |
buttonLightColor := ButtonLightColor ? lightColor. |
|
2764 |
buttonShadowColor := ButtonShadowColor ? shadowColor. |
|
2765 |
||
2766 |
(ButtonEdgeStyle == #soft) ifTrue:[ |
|
2767 |
buttonHalfShadowColor := ButtonHalfShadowColor. |
|
2768 |
buttonHalfLightColor := ButtonHalfLightColor. |
|
2769 |
||
2770 |
buttonHalfShadowColor isNil ifTrue:[ |
|
2771 |
buttonHalfShadowColor := buttonShadowColor lightened |
|
2772 |
] |
|
2773 |
]. |
|
1490 | 2774 |
|
2775 |
buttonHalfShadowColor isNil ifTrue:[ |
|
2776 |
buttonHalfShadowColor := Color gray |
|
2777 |
]. |
|
2778 |
||
2711 | 2779 |
rowSelectorForm := self class rowSelectorImage. |
1100 | 2780 |
checkToggleActiveImage := CheckToggleActiveImage. |
2781 |
checkTogglePassiveImage := CheckTogglePassiveImage. |
|
2782 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2783 |
ComboButtonForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2784 |
widget := ComboListView new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2785 |
button := widget menuButton. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2786 |
ComboButtonForm := button label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2787 |
ComboButtonLevel := button offLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2788 |
ComboButtonExtent := (button preferredExtent x) @ (widget preferredExtent y). |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2789 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2790 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2791 |
CheckToggleForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2792 |
widget := CheckToggle new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2793 |
CheckToggleForm := widget label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2794 |
CheckToggleLevel := widget offLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2795 |
CheckToggleExtent := widget preferredExtent. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2796 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2797 |
comboButtonForm := ComboButtonForm. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2798 |
comboButtonLevel := ComboButtonLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2799 |
comboButtonExtent := ComboButtonExtent. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2800 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2801 |
checkToggleForm := CheckToggleForm. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2802 |
checkToggleLevel := CheckToggleLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2803 |
checkToggleExtent := CheckToggleExtent. |
542 | 2804 |
! |
2805 |
||
2806 |
initialize |
|
2807 |
"set default attributes |
|
2808 |
" |
|
2809 |
super initialize. |
|
1487 | 2810 |
self lineWidth:0. |
2811 |
||
1668 | 2812 |
tabIntern := true. |
1487 | 2813 |
useIndex := true. |
1112 | 2814 |
viewOrigin := 0@0. |
1480 | 2815 |
font := font onDevice:device. |
1112 | 2816 |
rowHeight := font height. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2817 |
minRowHeight := rowHeight. |
1112 | 2818 |
multipleSelectOk := false. "/ multiselect disabled |
2819 |
selectedRowIndex := selectedColIndex := 0. "/ no selection |
|
1778
51bbd960baf9
change registeredIcons from IdentityDictionary to Dictionary
ca
parents:
1776
diff
changeset
|
2820 |
registererImages := Dictionary new. |
1112 | 2821 |
columnDescriptors := #(). |
2822 |
beDependentOfRows := false. |
|
2823 |
verticalSpacing := self class verticalSpacing. |
|
2824 |
horizontalSpacing := self class horizontalSpacing. |
|
2825 |
colorMap := Dictionary new. |
|
2826 |
catchChangeEvents := false. |
|
2827 |
rowFontAscent := 1. "/ dummy initialization |
|
2828 |
separatorSize := 1. "/ separators mode 2D |
|
2829 |
selectRowOnDefault := true. |
|
1749 | 2830 |
autoScroll := true. |
542 | 2831 |
! |
2832 |
||
705 | 2833 |
mapped |
2834 |
"set selection if exists after mapping |
|
2835 |
" |
|
2032 | 2836 |
"/ |idx| |
2837 |
"/ |
|
705 | 2838 |
super mapped. |
2011
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2839 |
"/ needFitColumns == true ifTrue:[ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2840 |
"/ self fitColumns |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2841 |
"/ ]. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2842 |
"/ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2843 |
"/ (idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2844 |
"/ self scrollToRowAt:idx colAt:0. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2845 |
"/ ]. |
705 | 2846 |
! |
2847 |
||
542 | 2848 |
realize |
607 | 2849 |
"recompute contents and fit columns to view |
542 | 2850 |
" |
1487 | 2851 |
|selection| |
2852 |
||
607 | 2853 |
self bitGravity:#NorthWest. |
542 | 2854 |
self recomputeHeightOfContents. |
1487 | 2855 |
|
2856 |
selection := 0. |
|
2857 |
||
2858 |
model notNil ifTrue:[ |
|
2859 |
(model respondsTo:#selectionIndex) ifTrue:[ |
|
2860 |
selection := model selectionIndex |
|
2861 |
] ifFalse:[ |
|
2862 |
model == listHolder ifFalse:[ |
|
2863 |
selection := model value |
|
2864 |
] |
|
2865 |
] |
|
2866 |
]. |
|
2867 |
self selectRowIndex:selection. |
|
2868 |
||
542 | 2869 |
super realize. |
607 | 2870 |
self fitColumns. |
2011
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2871 |
! |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2872 |
|
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2873 |
realized |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2874 |
"set selection if exists after mapping |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2875 |
" |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2876 |
|idx| |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2877 |
|
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2878 |
super realized. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2879 |
|
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2880 |
needFitColumns == true ifTrue:[ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2881 |
self fitColumns |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2882 |
]. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2883 |
|
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2884 |
(idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2885 |
self scrollToRowAt:idx colAt:0. |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
2886 |
]. |
2157 | 2887 |
! |
2888 |
||
2889 |
release |
|
2890 |
"remove dependencies |
|
2891 |
" |
|
2892 |
self columnHolder:nil. |
|
2893 |
||
2894 |
listHolder removeDependent:self. |
|
2895 |
||
2896 |
columnAdaptor isValueModel ifTrue:[ |
|
2897 |
columnAdaptor removeDependent:self |
|
2898 |
]. |
|
2899 |
||
2900 |
self beDependentOfRows:false. |
|
2901 |
super release |
|
607 | 2902 |
! ! |
2903 |
||
2904 |
!DSVColumnView methodsFor:'obsolete'! |
|
2905 |
||
2906 |
has3Dsepartors |
|
2907 |
"shouldn't be used any more |
|
2908 |
" |
|
2909 |
^ self has3Dseparators |
|
2910 |
! |
|
2911 |
||
2912 |
has3Dsepartors:aBool |
|
2913 |
"shouldn't be used any more |
|
2914 |
" |
|
2915 |
self has3Dseparators:aBool |
|
542 | 2916 |
|
2917 |
! ! |
|
2918 |
||
2919 |
!DSVColumnView methodsFor:'private'! |
|
2920 |
||
1951 | 2921 |
anyColumnHasBackground |
2922 |
columnDescriptors isNil ifTrue:[^ false]. |
|
2923 |
columnDescriptors do:[:eachCol | |
|
2924 |
|bg| |
|
2925 |
||
2926 |
bg := eachCol backgroundColor. |
|
2927 |
(bg notNil and:[bg isImageOrForm]) ifTrue:[^ true]. |
|
2928 |
eachCol bgSelector notNil ifTrue:[^ true]. |
|
2929 |
]. |
|
2930 |
^ false. |
|
2931 |
! |
|
2932 |
||
2933 |
anyColumnHasPotentialNonConstantBackground |
|
2934 |
columnDescriptors isNil ifTrue:[^ false]. |
|
2935 |
columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]]. |
|
2936 |
^ false. |
|
2937 |
! |
|
2938 |
||
1111 | 2939 |
destroyEditView |
2940 |
"destroy the edit view; release KeyboardForwarder |
|
2941 |
" |
|
2695 | 2942 |
editValue notNil ifTrue:[ |
2943 |
editValue removeDependent:self. |
|
2944 |
editValue := nil |
|
2945 |
]. |
|
1111 | 2946 |
editView notNil ifTrue:[ |
2947 |
editView withAllSubViewsDo:[:aView| |
|
2948 |
aView delegate:nil |
|
2949 |
]. |
|
2950 |
editView destroy. |
|
2951 |
editView := nil. |
|
2952 |
self windowGroup focusView:nil. |
|
2953 |
]. |
|
2954 |
||
2955 |
||
2956 |
! |
|
2957 |
||
637 | 2958 |
detectViewAt:aPoint in:aView |
1087 | 2959 |
"returns the view at a point |
2960 |
" |
|
2031 | 2961 |
aView isNil ifTrue:[^ nil]. |
2019
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2962 |
^ aView detectViewAt:aPoint. |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2963 |
|
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2964 |
"/ cg: old code was (refactored to use common code) |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2965 |
"/ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2966 |
"/ |p| |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2967 |
"/ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2968 |
"/ (aView notNil and:[aView subViews notNil]) ifTrue:[ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2969 |
"/ aView subViews do:[:sv| |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2970 |
"/ p := device translatePoint:aPoint fromView:self toView:sv. |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2971 |
"/ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2972 |
"/ (p x >= 0 and:[p y >= 0 and:[p x <= sv width and:[p y <= sv height]]]) ifTrue:[ |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2973 |
"/ ^ self detectViewAt:aPoint in:sv |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2974 |
"/ ] |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2975 |
"/ ] |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2976 |
"/ ]. |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2977 |
"/ ^ aView |
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2978 |
|
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
2979 |
"Modified: / 10.10.2001 / 13:53:24 / cg" |
637 | 2980 |
! |
2981 |
||
542 | 2982 |
fitColumns |
1484 | 2983 |
"fit columns to view; |
542 | 2984 |
" |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
2985 |
|selectedColumn list width changed dX sz oldOrgX newOrgX| |
1487 | 2986 |
|
2987 |
preferredExtent isNil ifTrue:[ |
|
2988 |
self preferredExtent. |
|
2989 |
]. |
|
1484 | 2990 |
|
2991 |
columnDescriptors isEmpty ifTrue:[ |
|
2992 |
^ self |
|
2993 |
]. |
|
1492 | 2994 |
width := 0. |
2995 |
list := OrderedCollection new. |
|
1484 | 2996 |
|
2997 |
columnDescriptors do:[:aCol| |
|
2998 |
aCol canResize ifTrue:[ |
|
2999 |
changed := true. |
|
3000 |
aCol invalidate. |
|
1492 | 3001 |
aCol hasRelativeWidth ifFalse:[list add:aCol]. |
1484 | 3002 |
]. |
1492 | 3003 |
width := width + aCol minWidth. |
1484 | 3004 |
]. |
1492 | 3005 |
preferredExtent x:width. |
3006 |
width := self innerWidth - width. |
|
3007 |
||
3008 |
(list notEmpty and:[width > 0]) ifTrue:[ |
|
3009 |
sz := list size. |
|
3010 |
width >= sz ifTrue:[ |
|
3011 |
dX := width // sz. |
|
1484 | 3012 |
list do:[:aCol|aCol growWidth:dX]. |
1492 | 3013 |
width := width - (dX * sz). |
1484 | 3014 |
]. |
1492 | 3015 |
width ~~ 0 ifTrue:[list last growWidth:width]. |
1484 | 3016 |
]. |
1492 | 3017 |
|
612 | 3018 |
shown ifTrue:[ |
1492 | 3019 |
self invalidate. |
1487 | 3020 |
labelView invalidate. |
542 | 3021 |
|
1498 | 3022 |
(oldOrgX := viewOrigin x) ~~ 0 ifTrue:[ |
3023 |
"/ UPDATE VIEW-ORIGIN X |
|
3024 |
||
3025 |
width := preferredExtent x. |
|
3026 |
newOrgX := (width - self innerWidth) max:0. |
|
3027 |
||
3028 |
newOrgX < oldOrgX ifTrue:[ |
|
3029 |
self originWillChange. |
|
3030 |
viewOrigin := newOrgX @ (viewOrigin y). |
|
3031 |
self originChanged:((newOrgX - oldOrgX) @ 0). |
|
3032 |
] |
|
3033 |
]. |
|
3034 |
||
1930
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3035 |
"/ cg: do not scroll to selection when a column-size is changed |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3036 |
|
1930
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3037 |
"/ self hasSelection ifTrue:[ |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3038 |
"/ editView notNil ifTrue:[ |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3039 |
"/ 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
|
3040 |
"/ ]. |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3041 |
"/ self scrollToSelection. |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3042 |
"/ ]. |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3043 |
|
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3044 |
"/ ca: but resize the editView |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3045 |
|
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3046 |
editView notNil ifTrue:[ |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3047 |
selectedColumn := self selectedColumn. |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3048 |
selectedColumn notNil ifTrue:[ |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3049 |
editView width:(selectedColumn width - (2 * separatorSize)). |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3050 |
] |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3051 |
]. |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3052 |
|
1498 | 3053 |
self contentsChanged. |
542 | 3054 |
]. |
3055 |
! |
|
3056 |
||
3057 |
maxViewOriginY |
|
3058 |
"returns the maximum possible y of the view origin |
|
3059 |
" |
|
3060 |
|y| |
|
3061 |
||
3062 |
y := self heightOfContents - self innerHeight. |
|
3063 |
^ y max:0 |
|
3064 |
||
3065 |
! |
|
3066 |
||
3067 |
updateEditViewOrigin |
|
3068 |
"update origin of the editView |
|
3069 |
" |
|
3070 |
|x y| |
|
3071 |
||
3072 |
editView notNil ifTrue:[ |
|
607 | 3073 |
y := self yVisibleOfRowNr:(self firstIndexSelected). |
1498 | 3074 |
x := self xVisibleOfColNr:selectedColIndex. |
542 | 3075 |
|
1112 | 3076 |
editView origin:(x @ y + separatorSize). |
542 | 3077 |
]. |
3078 |
||
3079 |
! |
|
3080 |
||
3081 |
xVisibleOfColNr:aColNr |
|
3082 |
"returns visible x assigned to a column number |
|
3083 |
" |
|
1497 | 3084 |
|x |
3085 |
end "{ Class:SmallInteger }" |
|
3086 |
| |
|
542 | 3087 |
x := margin - viewOrigin x. |
1497 | 3088 |
|
1498 | 3089 |
aColNr > 1 ifTrue:[ |
1497 | 3090 |
end := aColNr - 1. |
3091 |
||
3092 |
columnDescriptors from:1 to:end do:[:aCol| |
|
3093 |
x := x + aCol width |
|
3094 |
] |
|
3095 |
]. |
|
542 | 3096 |
^ x |
3097 |
||
3098 |
! |
|
3099 |
||
3100 |
xVisibleToColNr:x |
|
607 | 3101 |
"returns the column number assigned to a physical x or nil |
3102 |
" |
|
1497 | 3103 |
|x0 |
3104 |
nr "{ Class:SmallInteger }" |
|
3105 |
| |
|
542 | 3106 |
|
3107 |
x0 := x + viewOrigin x - margin. |
|
3108 |
nr := 1. |
|
3109 |
||
1497 | 3110 |
columnDescriptors do:[:aCol| |
1951 | 3111 |
x0 := x0 - aCol width. |
3112 |
x0 <= 0 ifTrue:[^ nr]. |
|
542 | 3113 |
nr := nr + 1. |
3114 |
]. |
|
3115 |
^ nil. |
|
3116 |
||
3117 |
! |
|
3118 |
||
3119 |
yVisibleOfRowNr:aRowNr |
|
3120 |
"returns visible y assigned to the row number |
|
3121 |
" |
|
3122 |
^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
|
3123 |
||
3124 |
! |
|
3125 |
||
3126 |
yVisibleToRowNr:y |
|
607 | 3127 |
"returns the row number assigned to a physical y or nil |
542 | 3128 |
" |
2398 | 3129 |
|rowNr| |
3130 |
||
3131 |
rowNr := (y + viewOrigin y - margin) // rowHeight + 1. |
|
3132 |
||
3133 |
(rowNr between:1 and:(list size)) ifTrue:[ |
|
3134 |
^ rowNr |
|
3135 |
]. |
|
3136 |
^ nil |
|
542 | 3137 |
! ! |
3138 |
||
3139 |
!DSVColumnView methodsFor:'queries'! |
|
3140 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3141 |
hasOpenEditor |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3142 |
^ editView notNil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3143 |
! |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3144 |
|
563 | 3145 |
indexOfFirstRowShown |
3146 |
"returns index of first row shown |
|
3147 |
" |
|
3148 |
|idx| |
|
3149 |
||
1498 | 3150 |
idx := (viewOrigin y // rowHeight) + 1. |
1497 | 3151 |
^ (idx <= list size) ifTrue:[idx] ifFalse:[0] |
563 | 3152 |
|
3153 |
! |
|
3154 |
||
1805 | 3155 |
isEnabled |
3156 |
^ enableChannel value ~~ false |
|
3157 |
! |
|
3158 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3159 |
isRowSelectable:aRowNumber |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3160 |
"returne true if a row number is selectable |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3161 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3162 |
(aRowNumber notNil and:[aRowNumber ~~ 0]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3163 |
selectConditionBlock isNil ifTrue:[^ true]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3164 |
^ (selectConditionBlock value:aRowNumber) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3165 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3166 |
^ false |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3167 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3168 |
|
542 | 3169 |
numberOfColumns |
3170 |
"returns number of columns |
|
3171 |
" |
|
3172 |
^ columnDescriptors size |
|
3173 |
||
3174 |
! |
|
3175 |
||
3176 |
numberOfRows |
|
3177 |
"returns number of raws |
|
3178 |
" |
|
1497 | 3179 |
^ list size |
542 | 3180 |
|
3181 |
! |
|
3182 |
||
3183 |
rowHeight |
|
3184 |
"get the height of the highest row in pixels |
|
3185 |
" |
|
3186 |
^ rowHeight |
|
3187 |
||
3188 |
! |
|
3189 |
||
3190 |
separatorSize |
|
3191 |
"returns vertical/horizontal size of a separator dependent on the |
|
3192 |
3D effect. |
|
3193 |
" |
|
607 | 3194 |
^ separatorSize |
542 | 3195 |
|
3196 |
! |
|
3197 |
||
3198 |
size |
|
3199 |
"returns number of raws |
|
3200 |
" |
|
3201 |
^ list size |
|
3202 |
||
3203 |
! ! |
|
3204 |
||
3205 |
!DSVColumnView methodsFor:'recomputation'! |
|
3206 |
||
647 | 3207 |
hasPreferredExtent |
3208 |
"returns true if preferred extent is accumulated |
|
3209 |
" |
|
3210 |
^ preferredExtent notNil |
|
3211 |
! |
|
3212 |
||
542 | 3213 |
preferredExtent |
647 | 3214 |
"recompute preferred extent; raise notification |
542 | 3215 |
" |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
3216 |
|x| |
542 | 3217 |
|
3218 |
preferredExtent notNil ifTrue:[ |
|
3219 |
^ preferredExtent |
|
3220 |
]. |
|
3221 |
x := 3. |
|
1497 | 3222 |
|
3223 |
columnDescriptors do:[:aCol| |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
3224 |
minRowHeight := (aCol heightOfHighestRow) max:minRowHeight. |
1497 | 3225 |
x := x + (aCol minWidth). |
542 | 3226 |
]. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
3227 |
rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
1497 | 3228 |
preferredExtent := x @ (list size * rowHeight). |
1201 | 3229 |
rowFontAscent := font ascent. |
3230 |
||
542 | 3231 |
^ preferredExtent |
3232 |
! |
|
3233 |
||
3234 |
preferredExtentChanged |
|
1087 | 3235 |
"called if the preffered extent changed |
3236 |
" |
|
1497 | 3237 |
|x "{ Class:SmallInteger }" |
3238 |
y "{ Class:SmallInteger }" |
|
3239 |
| |
|
542 | 3240 |
y := viewOrigin y. |
3241 |
x := viewOrigin x. |
|
3242 |
||
3243 |
(y ~~ 0 or:[x ~~ 0]) ifTrue:[ |
|
3244 |
self originWillChange. |
|
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
3245 |
|
542 | 3246 |
viewOrigin := 0 @ 0. |
3247 |
preferredExtent := nil. |
|
3248 |
self originChanged:(x negated @ y negated). |
|
3249 |
] |
|
3250 |
! |
|
3251 |
||
3252 |
recomputeHeightOfContents |
|
1087 | 3253 |
"recompute height of contents( scrolling ) |
3254 |
" |
|
542 | 3255 |
preferredExtent notNil ifTrue:[ |
1497 | 3256 |
preferredExtent y:(rowHeight * list size) |
542 | 3257 |
] ifFalse:[ |
3258 |
self preferredExtent |
|
3259 |
]. |
|
3260 |
! ! |
|
3261 |
||
3262 |
!DSVColumnView methodsFor:'scroller interface'! |
|
3263 |
||
3264 |
heightOfContents |
|
3265 |
"return the height of the contents in pixels |
|
3266 |
" |
|
1498 | 3267 |
preferredExtent isNil ifTrue:[ |
3268 |
self preferredExtent |
|
3269 |
]. |
|
3270 |
^ preferredExtent y |
|
542 | 3271 |
! |
3272 |
||
3273 |
innerHeight |
|
3274 |
"returns the inner height of the contents shown |
|
3275 |
" |
|
3276 |
^ height - margin - margin |
|
3277 |
||
3278 |
! |
|
3279 |
||
3280 |
verticalScrollStep |
|
3281 |
"return the amount to scroll when stepping up/down. |
|
3282 |
" |
|
3283 |
^ rowHeight |
|
3284 |
||
3285 |
||
3286 |
||
3287 |
! |
|
3288 |
||
3289 |
viewOrigin |
|
3290 |
"return the viewOrigin; thats the coordinate of the contents |
|
3291 |
which is shown topLeft in the view. |
|
3292 |
" |
|
3293 |
^ viewOrigin |
|
3294 |
||
3295 |
! |
|
3296 |
||
3297 |
widthOfContents |
|
3298 |
"return the width of the contents in pixels |
|
3299 |
" |
|
647 | 3300 |
preferredExtent isNil ifTrue:[ |
3301 |
self preferredExtent |
|
3302 |
]. |
|
3303 |
^ preferredExtent x |
|
542 | 3304 |
|
3305 |
! |
|
3306 |
||
3307 |
xOriginOfContents |
|
3308 |
"return the horizontal origin of the contents in pixels |
|
3309 |
" |
|
3310 |
^ viewOrigin x |
|
3311 |
||
3312 |
! |
|
3313 |
||
3314 |
yOriginOfContents |
|
3315 |
"return the vertical origin of the contents in pixels |
|
3316 |
" |
|
3317 |
^ viewOrigin y |
|
3318 |
||
3319 |
! ! |
|
3320 |
||
3321 |
!DSVColumnView methodsFor:'scrolling'! |
|
3322 |
||
3323 |
scrollTo:anOrigin redraw:doRedraw |
|
3324 |
"change origin to have newOrigin be visible at the top-left. |
|
3325 |
" |
|
1497 | 3326 |
|newOrg dltOrg wg |
3327 |
h "{ Class:SmallInteger }" |
|
3328 |
w "{ Class:SmallInteger }" |
|
3329 |
x "{ Class:SmallInteger }" |
|
3330 |
x0 "{ Class:SmallInteger }" |
|
3331 |
x1 "{ Class:SmallInteger }" |
|
3332 |
y "{ Class:SmallInteger }" |
|
3333 |
y0 "{ Class:SmallInteger }" |
|
3334 |
y1 "{ Class:SmallInteger }" |
|
3335 |
dX "{ Class:SmallInteger }" |
|
3336 |
dY "{ Class:SmallInteger }" |
|
3337 |
innerHG "{ Class:SmallInteger }" |
|
3338 |
innerWT "{ Class:SmallInteger }" |
|
2146 | 3339 |
lMargin |
1497 | 3340 |
| |
2146 | 3341 |
|
542 | 3342 |
shown ifFalse:[ |
3343 |
^ self |
|
3344 |
]. |
|
612 | 3345 |
|
1448 | 3346 |
(wg := self windowGroup) notNil ifTrue:[ |
3347 |
wg processRealExposeEventsFor:self. |
|
542 | 3348 |
]. |
612 | 3349 |
|
542 | 3350 |
innerWT := self innerWidth. |
3351 |
innerHG := self innerHeight. |
|
3352 |
||
3353 |
h := viewOrigin y. |
|
3354 |
||
3355 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents |
|
3356 |
y > (dY := self maxViewOriginY) ifTrue:[ |
|
3357 |
y := dY max:h |
|
3358 |
] |
|
3359 |
] ifFalse:[ |
|
3360 |
y := y max:0. |
|
3361 |
]. |
|
3362 |
||
3363 |
(x := anOrigin x) > 0 ifTrue:[ |
|
3364 |
x := x min:(self widthOfContents - innerWT). |
|
3365 |
]. |
|
3366 |
x := x max:0. |
|
3367 |
newOrg := (x @ y). |
|
3368 |
dltOrg := newOrg - viewOrigin. |
|
3369 |
dX := dltOrg x. |
|
3370 |
dY := dltOrg y. |
|
3371 |
||
3372 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
|
3373 |
^ self |
|
3374 |
]. |
|
3375 |
self originWillChange. |
|
3376 |
viewOrigin := newOrg. |
|
3377 |
||
3378 |
doRedraw ifFalse:[ |
|
3379 |
^ self originChanged:dltOrg |
|
3380 |
]. |
|
3381 |
||
3382 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL |
|
3383 |
dY := dY abs. |
|
3384 |
||
3385 |
(dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3386 |
self invalidate. |
542 | 3387 |
] ifFalse:[ "/ COPY VERTICAL |
3388 |
y0 := y1 := margin + dY. |
|
3389 |
h := innerHG - dY. |
|
3390 |
||
3391 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0] |
|
3392 |
ifFalse:[y1 := margin. y := y1 + h]. |
|
3393 |
||
1460 | 3394 |
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
|
3395 |
self invalidateX:margin y:y width:innerWT height:(innerHG - h). |
542 | 3396 |
] |
3397 |
] ifFalse:[ "/ SCROLL HORIZONTAL |
|
3398 |
dX := dX abs. |
|
3399 |
||
3400 |
innerWT - dX < 20 ifTrue:[ |
|
1487 | 3401 |
labelView invalidate. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3402 |
self invalidate. |
542 | 3403 |
] ifFalse:[ "/ COPY HORIZONTAL |
643 | 3404 |
x0 := x1 := dX + margin. |
2146 | 3405 |
w := width - dX. |
3406 |
lMargin := labelView margin. |
|
3407 |
||
3408 |
dltOrg x < 0 ifTrue:[ |
|
3409 |
" ->" |
|
3410 |
x0 := x := margin. |
|
3411 |
self copyFrom:self x:margin y:margin toX:margin+dX y:margin width:innerWT-dX height:innerHG async:false. |
|
3412 |
self invalidateX:margin y:margin width:dX height:innerHG. |
|
3413 |
||
3414 |
labelView notNil ifTrue:[ |
|
3415 |
labelView copyFrom:labelView x:lMargin y:lMargin toX:lMargin+dX y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false. |
|
3416 |
labelView invalidateX:lMargin y:lMargin width:dX height:labelView innerHeight. |
|
3417 |
]. |
|
3418 |
] ifFalse:[ |
|
3419 |
x1 := margin. x := w. |
|
3420 |
self copyFrom:self x:margin+dX y:margin toX:margin y:margin width:innerWT-dX height:innerHG async:false. |
|
3421 |
self invalidateX:width-margin-dX y:margin width:dX height:innerHG. |
|
3422 |
||
3423 |
labelView notNil ifTrue:[ |
|
3424 |
labelView copyFrom:labelView x:lMargin+dX y:lMargin toX:lMargin y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false. |
|
3425 |
labelView invalidateX:labelView width-lMargin-dX y:lMargin width:dX height:labelView innerHeight. |
|
3426 |
]. |
|
1487 | 3427 |
]. |
2146 | 3428 |
labelView repairDamage. |
542 | 3429 |
] |
3430 |
]. |
|
3431 |
self originChanged:dltOrg. |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
3432 |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
3433 |
wg notNil ifTrue:[ |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
3434 |
wg processRealExposeEventsFor:self. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
3435 |
]. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
3436 |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
3437 |
"Modified: / 7.9.1998 / 16:39:49 / cg" |
542 | 3438 |
! |
3439 |
||
3440 |
scrollToRowAt:aRowNr colAt:aColNr |
|
3441 |
"make row at a row number in column at a column number visible |
|
3442 |
" |
|
1497 | 3443 |
|x "{ Class:SmallInteger }" |
3444 |
y "{ Class:SmallInteger }" |
|
3445 |
l "{ Class:SmallInteger }" |
|
3446 |
dY "{ Class:SmallInteger }" |
|
3447 |
dX "{ Class:SmallInteger }" |
|
3448 |
| |
|
3449 |
||
3450 |
( (aRowNr between:1 and:(list size)) |
|
3451 |
and:[aColNr between:0 and:(columnDescriptors size)] |
|
542 | 3452 |
) ifFalse:[ |
3453 |
^ self |
|
3454 |
]. |
|
3455 |
||
3456 |
dY := dX := 0. |
|
3457 |
y := self yVisibleOfRowNr:aRowNr. |
|
3458 |
||
3459 |
y < margin ifTrue:[ |
|
3460 |
dY := margin - y. |
|
3461 |
] ifFalse:[ |
|
3462 |
y := y + rowHeight. |
|
3463 |
l := height - margin. |
|
3464 |
y > l ifTrue:[dY := l - y] |
|
3465 |
]. |
|
3466 |
||
3467 |
aColNr == 0 ifTrue:[ |
|
3468 |
dY == 0 ifTrue:[^ self]. |
|
3469 |
dX := 0. |
|
3470 |
] ifFalse:[ |
|
3471 |
x := self xVisibleOfColNr:aColNr. |
|
3472 |
||
1163 | 3473 |
x <= margin ifTrue:[ |
542 | 3474 |
dX := margin - x |
3475 |
] ifFalse:[ |
|
1497 | 3476 |
x := x + (columnDescriptors at:aColNr) width. |
542 | 3477 |
l := width - margin. |
3478 |
x > l ifTrue:[dX := l - x] |
|
3479 |
] |
|
3480 |
]. |
|
3481 |
||
3482 |
(dX == 0 and:[dY == 0]) ifFalse:[ |
|
3483 |
self scrollTo:(viewOrigin - (dX @ dY)). |
|
3484 |
] |
|
3485 |
||
3486 |
||
3487 |
! |
|
3488 |
||
3489 |
scrollToSelection |
|
3490 |
"make selection visible |
|
3491 |
" |
|
607 | 3492 |
|rowNr| |
3493 |
||
3494 |
(rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
1497 | 3495 |
self scrollToRowAt:rowNr colAt:selectedColIndex |
542 | 3496 |
] |
3497 |
||
1506 | 3498 |
! |
3499 |
||
3500 |
scrollVerticalTo:aPixelOffset |
|
3501 |
"change origin to make aPixelOffset be the top line" |
|
3502 |
||
3503 |
|orgX orgY| |
|
3504 |
||
3505 |
orgX := viewOrigin x. |
|
3506 |
orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight. |
|
3507 |
^ self scrollTo:(orgX @ orgY). |
|
3508 |
||
1749 | 3509 |
! |
3510 |
||
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3511 |
startAutoScroll:aSelectorOrBlock distance:aDistance |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3512 |
"setup for auto-scroll (when button-press-moving below/above view); |
1749 | 3513 |
- timeDelta for scroll is computed from distance |
3514 |
" |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3515 |
|timeDelta scrollBlock| |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3516 |
|
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3517 |
autoScroll ifFalse:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3518 |
self stopAutoScroll. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3519 |
^ self |
1749 | 3520 |
]. |
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3521 |
|
1749 | 3522 |
autoScrollBlock notNil ifTrue:[ |
3523 |
Processor removeTimedBlock:autoScrollBlock. |
|
3524 |
] ifFalse:[ |
|
3525 |
self compressMotionEvents:false. |
|
3526 |
]. |
|
3527 |
||
3528 |
timeDelta := 0.5 / (aDistance abs). |
|
3529 |
||
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3530 |
scrollBlock := |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3531 |
[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3532 |
aSelectorOrBlock isSymbol ifTrue:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3533 |
self perform:aSelectorOrBlock. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3534 |
] ifFalse:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3535 |
aSelectorOrBlock value |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3536 |
]. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3537 |
autoScrollBlock notNil ifTrue:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3538 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3539 |
] |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3540 |
]. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3541 |
|
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
3542 |
autoScrollBlock := [self sensor pushUserEvent:#value for:scrollBlock]. |
1749 | 3543 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
3544 |
! |
|
3545 |
||
3546 |
stopAutoScroll |
|
3547 |
"stop any autoScroll |
|
3548 |
" |
|
3549 |
autoScrollBlock notNil ifTrue:[ |
|
3550 |
Processor removeTimedBlock:autoScrollBlock. |
|
3551 |
autoScrollBlock := nil. |
|
3552 |
self compressMotionEvents:true. |
|
3553 |
]. |
|
3554 |
||
3555 |
||
542 | 3556 |
! ! |
3557 |
||
3558 |
!DSVColumnView methodsFor:'selection'! |
|
3559 |
||
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3560 |
addRowToSelection:aRowNr |
2370 | 3561 |
"add a row to the selection |
3562 |
if a column is selected, the column will be closed |
|
3563 |
" |
|
3564 |
|newSelection| |
|
3565 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3566 |
(self isRowSelectable:aRowNr) ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3567 |
^ self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3568 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3569 |
|
2398 | 3570 |
self numberOfSelections == 0 ifTrue:[ |
3571 |
self selectColIndex:0 rowIndex:aRowNr. |
|
2370 | 3572 |
^ self |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3573 |
]. |
2398 | 3574 |
(self isInSelection:aRowNr) ifTrue:[^ self]. |
3575 |
||
3576 |
multipleSelectOk ifFalse:[ |
|
3577 |
self selectColIndex:0 rowIndex:aRowNr. |
|
2370 | 3578 |
^ self |
3579 |
]. |
|
2371 | 3580 |
newSelection := selectedRowIndex copyWith:aRowNr. |
2370 | 3581 |
|
3582 |
selectedColIndex ~~ 0 ifTrue:[ |
|
3583 |
self selectColIndex:0 rowIndex:newSelection. |
|
2398 | 3584 |
] ifFalse:[ |
3585 |
selectedRowIndex := selectedRowIndex copyWith:aRowNr. |
|
3586 |
self invalidateRowAt:aRowNr. |
|
3587 |
self selectionChanged. |
|
2370 | 3588 |
]. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3589 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3590 |
|
607 | 3591 |
deselect |
3592 |
"deselect |
|
3593 |
" |
|
3594 |
self selectColIndex:0 rowIndex:0 |
|
3595 |
! |
|
3596 |
||
3597 |
firstIndexSelected |
|
809 | 3598 |
"returns index of first row selected or 0 |
607 | 3599 |
" |
3600 |
multipleSelectOk ifFalse:[ |
|
3601 |
^ selectedRowIndex |
|
3602 |
]. |
|
3603 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3604 |
^ selectedRowIndex at:1 |
|
3605 |
]. |
|
3606 |
^ 0 |
|
3607 |
! |
|
3608 |
||
2695 | 3609 |
forceAcceptInEditor |
3610 |
editView |
|
3611 |
allSubViewsDo:[:aSubView | |
|
3612 |
(aSubView respondsTo:#accept) ifTrue:[ |
|
3613 |
aSubView accept |
|
3614 |
]. |
|
3615 |
] |
|
3616 |
! |
|
3617 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3618 |
hasRowSelection |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3619 |
"returns true if a selection exists, and its a complete row |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3620 |
(as opposed to either no selection, or a columnSelection) |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3621 |
" |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3622 |
^ self hasSelection and:[selectedColIndex == 0] |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3623 |
! |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3624 |
|
542 | 3625 |
hasSelection |
607 | 3626 |
"returns true if a selection exists |
542 | 3627 |
" |
607 | 3628 |
^ self numberOfSelections ~~ 0 |
542 | 3629 |
|
3630 |
||
3631 |
! |
|
3632 |
||
607 | 3633 |
isInSelection:aRowNr |
3634 |
"return true, if row, aRowNr is in the selection |
|
542 | 3635 |
" |
607 | 3636 |
aRowNr ~~ 0 ifTrue:[ |
3637 |
multipleSelectOk ifFalse:[ |
|
3638 |
^ aRowNr == selectedRowIndex |
|
3639 |
]. |
|
3640 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3641 |
^ selectedRowIndex includes:aRowNr |
|
3642 |
] |
|
3643 |
]. |
|
3644 |
^ false |
|
3645 |
! |
|
3646 |
||
647 | 3647 |
isRowSelected:aRowNr |
3648 |
"return true, if row is in the selection |
|
3649 |
" |
|
3650 |
selectedColIndex == 0 ifTrue:[ |
|
3651 |
^ self isInSelection:aRowNr |
|
3652 |
]. |
|
3653 |
^ false |
|
3654 |
! |
|
3655 |
||
2263 | 3656 |
isRowVisible:aRowNr |
3657 |
|y h| |
|
3658 |
||
3659 |
h := rowHeight. |
|
3660 |
y := self yVisibleOfRowNr:aRowNr. |
|
3661 |
||
3662 |
y < margin ifTrue:[ |
|
3663 |
(h := h + y) <= margin ifTrue:[ |
|
3664 |
^ false |
|
3665 |
]. |
|
3666 |
] ifFalse:[ |
|
3667 |
y >= (height-margin) ifTrue:[^ false]. |
|
3668 |
]. |
|
3669 |
^ true |
|
3670 |
! |
|
3671 |
||
607 | 3672 |
isSelected:aRowNr inColumn:aColNr |
612 | 3673 |
"returns true if cell in a row; a row number, in a column, a column |
3674 |
number is selected. |
|
3675 |
" |
|
1042 | 3676 |
multipleSelectOk ifFalse:[ |
3677 |
aRowNr ~~ selectedRowIndex ifTrue:[ |
|
3678 |
^ false |
|
3679 |
] |
|
3680 |
] ifTrue:[ |
|
3681 |
(selectedRowIndex size ~~ 0 and:[selectedRowIndex includes:aRowNr]) ifFalse:[ |
|
3682 |
^ false |
|
3683 |
] |
|
607 | 3684 |
]. |
1042 | 3685 |
^ (selectedColIndex == 0 or:[selectedColIndex == aColNr]) |
3686 |
||
607 | 3687 |
! |
3688 |
||
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3689 |
isSelectionVisibleIn:anExtentPoint |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3690 |
self selectionIndicesDo:[:selRowNr | |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3691 |
|y| |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3692 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3693 |
y := self yVisibleOfRowNr:selRowNr. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3694 |
(y between:margin and:(anExtentPoint y - margin)) ifTrue:[^ true]. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3695 |
]. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3696 |
^ false. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3697 |
! |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3698 |
|
809 | 3699 |
lastIndexSelected |
3700 |
"returns index of last row selected or 0 |
|
3701 |
" |
|
3702 |
multipleSelectOk ifFalse:[ |
|
3703 |
^ selectedRowIndex |
|
3704 |
]. |
|
3705 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3706 |
^ selectedRowIndex last |
|
3707 |
]. |
|
3708 |
^ 0 |
|
3709 |
! |
|
3710 |
||
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3711 |
makeLineVisible:aLine |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3712 |
"scroll to make aLine visible |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3713 |
" |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3714 |
|colNr| |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3715 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3716 |
aLine == 0 ifTrue:[^ self]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3717 |
(self isRowVisible:aLine) ifTrue:[^ self]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3718 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3719 |
(selectedColIndex notNil and:[selectedColIndex ~~ 0]) ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3720 |
colNr := selectedColIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3721 |
] ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3722 |
colNr := 1 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3723 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3724 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3725 |
self scrollToRowAt:aLine colAt:colNr |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3726 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3727 |
|
2246 | 3728 |
makeSelectionVisible |
3729 |
"scroll to make the selection line visible |
|
3730 |
" |
|
3731 |
|rowNr colNr| |
|
3732 |
||
3733 |
rowNr := self firstIndexSelected. |
|
3734 |
rowNr == 0 ifTrue:[^ self]. |
|
3735 |
||
3736 |
(selectedColIndex notNil and:[selectedColIndex ~~ 0]) ifTrue:[ |
|
3737 |
colNr := selectedColIndex |
|
3738 |
] ifFalse:[ |
|
3739 |
colNr := 1 |
|
3740 |
]. |
|
3741 |
self scrollToRowAt:rowNr colAt:colNr |
|
3742 |
! |
|
3743 |
||
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3744 |
maxIndexSelected |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3745 |
"return the largest index selected or 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3746 |
" |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3747 |
multipleSelectOk ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3748 |
^ selectedRowIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3749 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3750 |
selectedRowIndex size ~~ 0 ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3751 |
^ selectedRowIndex max |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3752 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3753 |
^ 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3754 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3755 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3756 |
minIndexSelected |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3757 |
"return the smallest index selected or 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3758 |
" |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3759 |
multipleSelectOk ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3760 |
^ selectedRowIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3761 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3762 |
selectedRowIndex size ~~ 0 ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3763 |
^ selectedRowIndex min |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3764 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3765 |
^ 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3766 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3767 |
|
607 | 3768 |
numberOfSelections |
3769 |
"return the number of selected rows |
|
3770 |
" |
|
3771 |
multipleSelectOk ifFalse:[ |
|
3772 |
^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
|
3773 |
]. |
|
3774 |
^ selectedRowIndex size |
|
542 | 3775 |
! |
3776 |
||
2398 | 3777 |
removeRowFromSelection:aRowNr |
3778 |
"remove a row from the selection |
|
3779 |
" |
|
3780 |
(self isInSelection:aRowNr) ifFalse:[^ self]. |
|
3781 |
||
3782 |
self numberOfSelections == 1 ifTrue:[ |
|
3783 |
self deselect. |
|
3784 |
] ifFalse:[ |
|
3785 |
selectedRowIndex := selectedRowIndex copyWithout:aRowNr. |
|
3786 |
self invalidateRowAt:aRowNr. |
|
3787 |
self selectionChanged. |
|
3788 |
]. |
|
3789 |
! |
|
3790 |
||
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3791 |
selectAllRows |
1971 | 3792 |
"select all |
3793 |
" |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3794 |
multipleSelectOk ifFalse:[^ self]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3795 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3796 |
selectedRowIndex := (1 to:list size) select:[:idx| self isRowSelectable:idx ]. |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3797 |
self selectionChanged. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3798 |
self invalidate. |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3799 |
! |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3800 |
|
542 | 3801 |
selectColIndex:aColNr rowIndex:aRowNr |
3802 |
"change selection with notification |
|
3803 |
" |
|
3804 |
|oC oR| |
|
3805 |
||
607 | 3806 |
oC := self selectedColIndex. |
3807 |
oR := self selectedRowIndex. |
|
542 | 3808 |
|
3809 |
self setSelectColIndex:aColNr rowIndex:aRowNr. |
|
3810 |
||
607 | 3811 |
(oC ~~ self selectedColIndex or:[oR ~= self selectedRowIndex]) ifTrue:[ |
542 | 3812 |
self selectionChanged |
3813 |
]. |
|
3814 |
! |
|
3815 |
||
607 | 3816 |
selectRow:something |
542 | 3817 |
"select a row |
3818 |
" |
|
607 | 3819 |
^ self selectedRowIndex:something |
542 | 3820 |
! |
3821 |
||
809 | 3822 |
selectRowAt:rowNr colAt:colNr atPoint:aPoint |
3823 |
|v p| |
|
3824 |
||
3825 |
self selectColIndex:colNr rowIndex:rowNr. |
|
3826 |
||
2044
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
3827 |
((v := self detectViewAt:aPoint ignoreInvisible:true) notNil |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
3828 |
and:[v ~~ self]) |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
3829 |
ifTrue:[ |
2019
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
3830 |
p := device translatePoint:aPoint fromView:self toView:v. |
2125 | 3831 |
"/ simulate clicking into the editor |
2470 | 3832 |
self sensor |
3833 |
pushEvent:(WindowEvent buttonPress:#select x:p x y:p y view:v); |
|
3834 |
pushEvent:(WindowEvent buttonRelease:#select x:p x y:p y view:v) |
|
809 | 3835 |
]. |
3836 |
! |
|
3837 |
||
2398 | 3838 |
selectRowFrom:start to:stop |
2470 | 3839 |
|step oldSelection newSelection| |
2398 | 3840 |
|
3841 |
start == stop ifTrue:[ |
|
3842 |
self selectColIndex:0 rowIndex:start. |
|
3843 |
^ self |
|
3844 |
]. |
|
3845 |
||
2470 | 3846 |
step := (start <= stop) ifTrue:1 ifFalse:-1. |
3847 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3848 |
newSelection := (start to:stop by:step) select:[:idx| self isRowSelectable: idx ]. |
2398 | 3849 |
|
3850 |
selectedColIndex ~~ 0 ifTrue:[ |
|
2470 | 3851 |
self selectColIndex:0 rowIndex:newSelection. |
2398 | 3852 |
^ self |
3853 |
]. |
|
2470 | 3854 |
|
3855 |
oldSelection := selectedRowIndex ? #(). |
|
3856 |
selectedRowIndex := newSelection. |
|
3857 |
||
3858 |
newSelection |
|
3859 |
select:[:i | (oldSelection includes:i) not] |
|
3860 |
thenDo:[:i | self invalidateRowAt:i]. |
|
3861 |
||
3862 |
oldSelection |
|
3863 |
select:[:i | (newSelection includes:i) not] |
|
3864 |
thenDo:[:i | self invalidateRowAt:i]. |
|
3865 |
||
2398 | 3866 |
self selectionChanged. |
3867 |
! |
|
3868 |
||
607 | 3869 |
selectRowIndex:something |
3870 |
"set selection of rows |
|
542 | 3871 |
" |
607 | 3872 |
self selectColIndex:selectedColIndex rowIndex:something |
3873 |
||
3874 |
||
542 | 3875 |
! |
3876 |
||
3877 |
selectedColIndex |
|
3878 |
"returns selected column number or 0 |
|
3879 |
" |
|
3880 |
^ selectedColIndex |
|
3881 |
! |
|
3882 |
||
3883 |
selectedColumn |
|
3884 |
"returns selected column or nil |
|
3885 |
" |
|
3886 |
^ columnDescriptors at:selectedColIndex ifAbsent:nil. |
|
3887 |
! |
|
3888 |
||
3889 |
selectedRow |
|
607 | 3890 |
"returns selected row (or collection if multiple selection) or nil |
542 | 3891 |
" |
607 | 3892 |
multipleSelectOk ifFalse:[ |
3893 |
^ self at:selectedRowIndex ifAbsent:nil |
|
3894 |
]. |
|
3895 |
||
3896 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3897 |
^ selectedRowIndex collect:[:i| self at:i] |
|
3898 |
]. |
|
3899 |
^ nil |
|
3900 |
! |
|
3901 |
||
3902 |
selectedRow:something |
|
3903 |
"select something |
|
3904 |
" |
|
3905 |
self selectedRowIndex:something |
|
542 | 3906 |
! |
3907 |
||
3908 |
selectedRowIndex |
|
3909 |
"returns selected row number or 0 |
|
3910 |
" |
|
3911 |
^ selectedRowIndex |
|
3912 |
! |
|
3913 |
||
607 | 3914 |
selectedRowIndex:something |
2470 | 3915 |
"set the row selection (single or multiple rows); |
3916 |
does NOT change the selectoed column. |
|
607 | 3917 |
" |
3918 |
self selectColIndex:selectedColIndex rowIndex:something |
|
542 | 3919 |
! |
3920 |
||
3921 |
selectionChanged |
|
3922 |
"selection has changed |
|
3923 |
" |
|
1487 | 3924 |
|val| |
3925 |
||
3926 |
model notNil ifTrue:[ |
|
3927 |
val := self selectedRowIndex copy. |
|
3928 |
||
3929 |
(model respondsTo:#selectionIndex:) ifTrue:[ |
|
3930 |
model selectionIndex:val |
|
3931 |
] ifFalse:[ |
|
3932 |
useIndex ifFalse:[ model value:(self selectedRow) ] |
|
3933 |
ifTrue:[ model value:val ] |
|
3934 |
] |
|
3935 |
]. |
|
542 | 3936 |
|
3937 |
actionBlock notNil ifTrue:[ |
|
607 | 3938 |
actionBlock value:(self selectedRowIndex) |
3939 |
] |
|
3940 |
! |
|
3941 |
||
3942 |
selectionIndicesDo:aOneArgBlock |
|
3943 |
"evaluate block on each row selected; the argument to the row |
|
3944 |
is the index of the selected row |
|
3945 |
" |
|
3946 |
multipleSelectOk ifFalse:[ |
|
3947 |
selectedRowIndex ~~ 0 ifTrue:[ |
|
3948 |
aOneArgBlock value:selectedRowIndex |
|
3949 |
] |
|
3950 |
] ifTrue:[ |
|
3951 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
3952 |
selectedRowIndex do:[:i| aOneArgBlock value:i ] |
|
3953 |
] |
|
542 | 3954 |
] |
3955 |
! |
|
3956 |
||
2470 | 3957 |
setSelectColIndex:colNrArg rowIndex:rowNrArg |
542 | 3958 |
"change selection without notification |
3959 |
" |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3960 |
|editSpec rowNr colNr newCol oldCol oldRow sensor sglSelRow oldSz |
2695 | 3961 |
keyBrdFwd filter edView| |
542 | 3962 |
|
2470 | 3963 |
rowNr := self validateSelection:rowNrArg. |
2695 | 3964 |
|
2470 | 3965 |
colNr := colNrArg. |
2695 | 3966 |
rowNr == 0 ifTrue:[ |
3967 |
colNr := 0. |
|
3968 |
] ifFalse:[ |
|
3969 |
multipleSelectOk ifTrue:[ |
|
3970 |
(rowNr size == 1) ifFalse:[colNr := 0] |
|
3971 |
]. |
|
542 | 3972 |
]. |
3973 |
||
607 | 3974 |
(colNr := colNr ? 0) ~~ 0 ifTrue:[ |
3975 |
newCol := self columnAt:colNr. |
|
3976 |
newCol rendererType == #rowSelector ifTrue:[ |
|
3977 |
colNr := 0. |
|
3978 |
newCol := nil |
|
3979 |
] ifFalse:[ |
|
3980 |
multipleSelectOk ifTrue:[sglSelRow := rowNr at:1] |
|
3981 |
ifFalse:[sglSelRow := rowNr]. |
|
3982 |
||
3983 |
(newCol canSelect:sglSelRow) ifFalse:[ |
|
3984 |
newCol := nil. |
|
1112 | 3985 |
colNr := 0. |
3986 |
||
3987 |
selectRowOnDefault ifFalse:[ |
|
3988 |
rowNr := multipleSelectOk ifFalse:[0] ifTrue:[nil] |
|
3989 |
] |
|
607 | 3990 |
] |
3991 |
] |
|
3992 |
]. |
|
3993 |
||
3994 |
(rowNr = selectedRowIndex and:[colNr == selectedColIndex]) ifTrue:[ |
|
643 | 3995 |
^ self |
542 | 3996 |
]. |
3997 |
||
3998 |
"/ release old selection |
|
3999 |
||
612 | 4000 |
oldSz := self numberOfSelections. |
542 | 4001 |
oldCol := selectedColIndex. |
4002 |
oldRow := selectedRowIndex. |
|
612 | 4003 |
|
4004 |
oldSz == 1 ifTrue:[ |
|
4005 |
multipleSelectOk ifTrue:[oldRow := oldRow at:1]. |
|
2695 | 4006 |
self updateColumnFromEditValueAndDestroyEditView. |
612 | 4007 |
]. |
1968
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
4008 |
selectedRowIndex := rowNr. |
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
4009 |
selectedColIndex := colNr. |
857cd9f14570
fixed store-into-wrong-col bug (imageEditors color table)
Claus Gittinger <cg@exept.de>
parents:
1959
diff
changeset
|
4010 |
|
612 | 4011 |
shown ifFalse:[^ self ]. |
542 | 4012 |
|
618 | 4013 |
oldSz > 1 ifTrue:[ "/ redraw old selection |
4014 |
oldRow do:[:aRowNr| "/ unselected if visible |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
4015 |
self invalidateRowAt:aRowNr colAt:0 |
618 | 4016 |
] |
4017 |
] ifFalse:[ |
|
4018 |
oldSz == 1 ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
4019 |
self invalidateRowAt:oldRow colAt:oldCol |
618 | 4020 |
] |
4021 |
]. |
|
4022 |
||
542 | 4023 |
"/ show new selection |
4024 |
||
4025 |
newCol notNil ifTrue:[ |
|
607 | 4026 |
self scrollToRowAt:sglSelRow colAt:colNr. |
833 | 4027 |
editSpec := newCol editorAt:sglSelRow. |
4028 |
||
4029 |
editSpec notNil ifTrue:[ |
|
1112 | 4030 |
editView := SimpleView extent:( (newCol width - (2 * separatorSize)) |
4031 |
@ (rowHeight - (2 * separatorSize)) |
|
607 | 4032 |
) |
4033 |
in:self. |
|
542 | 4034 |
self updateEditViewOrigin. |
1112 | 4035 |
|
1134 | 4036 |
(newCol containsText or:[newCol showSelectionHighLighted not]) ifTrue:[ |
1565 | 4037 |
editView viewBackground:(newCol backgroundColorAt:sglSelRow) |
1112 | 4038 |
] ifFalse:[ |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4039 |
editView viewBackground:selectionBackgroundColor |
1112 | 4040 |
]. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
4041 |
edView := editSpec at:1. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
4042 |
editView add:edView. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
4043 |
oldSz := editSpec size. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
4044 |
|
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
4045 |
oldSz == 3 ifTrue:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
4046 |
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
|
4047 |
] ifFalse:[ |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
4048 |
filter := [:aKey| aKey == #Tab] |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
4049 |
]. |
1111 | 4050 |
keyBrdFwd := KeyboardForwarder toView:self |
4051 |
condition:nil |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
4052 |
filter:filter. |
1111 | 4053 |
|
4054 |
editView withAllSubViewsDo:[:aView| |
|
1112 | 4055 |
aView delegate:keyBrdFwd. |
4056 |
aView font:font. |
|
1111 | 4057 |
]. |
4058 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
4059 |
(editValue := editSpec at:2 ifAbsent:nil) notNil ifTrue:[ |
809 | 4060 |
editValue addDependent:self. |
648 | 4061 |
]. |
542 | 4062 |
editView realize. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
4063 |
edView canTab:true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
4064 |
self windowGroup focusView:edView. |
1111 | 4065 |
|
542 | 4066 |
] ifFalse:[ |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
4067 |
self invalidateRowAt:sglSelRow colAt:colNr |
612 | 4068 |
]. |
4069 |
] ifFalse:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
4070 |
self selectionIndicesDo:[:i| self invalidateRowAt:i colAt:0 ]. |
612 | 4071 |
self scrollToRowAt:(self firstIndexSelected) colAt:0 |
4072 |
]. |
|
4073 |
||
4074 |
sensor := self sensor. "/ catch expose events |
|
4075 |
||
4076 |
[sensor hasExposeEventFor:nil] whileTrue:[ |
|
4077 |
self windowGroup processExposeEvents |
|
4078 |
]. |
|
4079 |
||
1661 | 4080 |
"Modified: / 30.1.2000 / 12:18:25 / cg" |
607 | 4081 |
! |
4082 |
||
2695 | 4083 |
updateColumnFromEditValueAndDestroyEditView |
4084 |
|edValue selCol selRow| |
|
4085 |
||
4086 |
selCol := selectedColIndex. |
|
4087 |
selRow := selectedRowIndex. |
|
4088 |
editValue notNil ifTrue:[ |
|
4089 |
editValue removeDependent:self |
|
4090 |
]. |
|
4091 |
editView notNil ifTrue:[ |
|
4092 |
self forceAcceptInEditor |
|
4093 |
]. |
|
4094 |
editValue notNil ifTrue:[ |
|
4095 |
edValue := editValue value. |
|
4096 |
edValue isSequenceable ifTrue:[ |
|
4097 |
edValue size == 0 ifTrue:[ |
|
4098 |
edValue := nil |
|
4099 |
] ifFalse:[ |
|
4100 |
edValue isString ifFalse:[ |
|
4101 |
edValue := edValue select:[:el | el notNil ]. |
|
4102 |
edValue size == 0 ifTrue:[ |
|
4103 |
edValue := nil |
|
4104 |
] |
|
4105 |
] |
|
4106 |
] |
|
4107 |
]. |
|
4108 |
selRow isNumber ifFalse:[ |
|
4109 |
"/ ??? should we do ???: |
|
4110 |
"/ selRow do:[:eachRow | |
|
4111 |
"/ (self columnAt:selCol) at:eachRow put:edValue. |
|
4112 |
"/ ] |
|
4113 |
selRow := selRow first |
|
4114 |
]. |
|
4115 |
(self columnAt:selCol) at:selRow put:edValue. |
|
4116 |
modifiedChannel notNil ifTrue:[ |
|
4117 |
modifiedChannel value:true |
|
4118 |
]. |
|
4119 |
editValue := nil |
|
4120 |
]. |
|
4121 |
self destroyEditView. |
|
4122 |
! |
|
4123 |
||
607 | 4124 |
validateSelection:aSelection |
4125 |
|newSel| |
|
4126 |
||
4127 |
newSel := aSelection. |
|
4128 |
||
1497 | 4129 |
(list size == 0 or:[newSel isNil or:[newSel == 0]]) ifTrue:[ |
607 | 4130 |
^ multipleSelectOk ifFalse:[0] ifTrue:[nil] |
4131 |
]. |
|
4132 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4133 |
multipleSelectOk ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4134 |
newSel isNumber ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4135 |
newSel := self identityIndexOfRow:aSelection. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4136 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4137 |
^ (self isRowSelectable:newSel) ifTrue:[newSel] ifFalse:[0]. |
607 | 4138 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4139 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4140 |
"multiple selection |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4141 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4142 |
aSelection size ~~ 0 ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4143 |
aSelection first isNumber ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4144 |
newSel := aSelection select:[:idx| self isRowSelectable:idx ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4145 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4146 |
newSel := aSelection |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4147 |
collect:[:el| self identityIndexOfRow:el ] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4148 |
thenSelect:[:idx| self isRowSelectable:idx ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4149 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4150 |
newSel notEmpty ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4151 |
^ newSel |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4152 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4153 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4154 |
(newSel isNumber and:[self isRowSelectable:newSel]) ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4155 |
^ Array with:newSel |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4156 |
]. |
607 | 4157 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4158 |
^ nil |
542 | 4159 |
! ! |
4160 |
||
4161 |
!DSVColumnView class methodsFor:'documentation'! |
|
4162 |
||
4163 |
version |
|
2711 | 4164 |
^ '$Header: /cvs/stx/stx/libwidg2/DSVColumnView.st,v 1.184 2004-05-27 14:27:37 cg Exp $' |
542 | 4165 |
! ! |