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