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