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