author | Claus Gittinger <cg@exept.de> |
Mon, 03 Feb 2020 19:20:54 +0100 | |
changeset 6220 | 146bef92a240 |
parent 6180 | a2037f3ba84c |
child 6236 | ddfc83270532 |
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 |
" |
|
1754 | 12 |
"{ Package: 'stx:libwidg2' }" |
13 |
||
4772 | 14 |
"{ NameSpace: Smalltalk }" |
15 |
||
542 | 16 |
View subclass:#DSVColumnView |
6054 | 17 |
instanceVariableNames:'labelView listHolder editValue editView multipleSelectOk useIndex |
18 |
selectedColIndexHolder selectedRowIndex selectRowOnDefault |
|
19 |
buttonMotionAction buttonReleaseAction rowHeight minRowHeight |
|
20 |
columnDescriptors viewOrigin colorMap rowFontAscent lockRowIndex |
|
21 |
rowIfAbsentBlock columnHolder registererImages list fgColor |
|
22 |
separatorSize catchChangeEvents beDependentOfRows bgColor |
|
23 |
actionBlock builder tabIntern doubleClickActionBlock |
|
24 |
verticalSpacing horizontalSpacing rowSelectorForm |
|
25 |
buttonLightColor buttonShadowColor buttonHalfLightColor |
|
26 |
buttonHalfShadowColor checkToggleExtent checkToggleForm |
|
27 |
checkToggleActiveImage checkTogglePassiveImage |
|
28 |
checkToggleDisabledActiveImage checkToggleDisabledPassiveImage |
|
29 |
checkToggleLevel radioButtonActiveImage radioButtonPassiveImage |
|
30 |
radioButtonDisabledActiveImage radioButtonDisabledPassiveImage |
|
31 |
comboButtonExtent comboButtonForm comboButtonDisabledForm |
|
32 |
comboButtonLevel dropSource columnAdaptor tabAtEndAction |
|
33 |
tabAtStartAction modifiedChannel autoScroll autoScrollBlock |
|
34 |
needFitColumns scrollWhenUpdating separatorOneDColor |
|
35 |
selectionForegroundColor selectionForegroundColorNoFocus |
|
36 |
selectionBackgroundColor selectionBackgroundColorNoFocus |
|
37 |
selectionFrameColor selectionFrameColorNoFocus previousExtent |
|
38 |
selectConditionBlock scrollRowWise autoScrollToColumn |
|
39 |
cachedPreferredExtent sortListInPlace labelFgColor labelBgColor |
|
40 |
updateListHolderWhenSorting ignoreReselect didEditWithDialog' |
|
41 |
classVariableNames:'DefaultForegroundColor DefaultBackgroundColor |
|
42 |
DefaultHilightForegroundColor DefaultHilightBackgroundColor |
|
43 |
DefaultHilightFrameColor ButtonLightColor ButtonShadowColor |
|
44 |
CheckToggleActiveImage CheckTogglePassiveImage |
|
45 |
CheckToggleDisabledActiveImage CheckToggleDisabledPassiveImage |
|
46 |
ButtonHalfLightColor ButtonHalfShadowColor ButtonEdgeStyle |
|
47 |
CheckToggleForm CheckToggleLevel CheckToggleExtent |
|
48 |
ComboButtonForm ComboButtonDisabledForm ComboButtonLevel |
|
49 |
ComboButtonExtent StopRedrawSignal RadioButtonActiveImage |
|
50 |
RadioButtonPassiveImage RadioButtonDisabledActiveImage |
|
51 |
RadioButtonDisabledPassiveImage PreselectAllWhenOpeningEditor |
|
52 |
DefaultHilightForegroundColorNoFocus |
|
53 |
DefaultHilightBackgroundColorNoFocus DefaultLabelForegroundColor |
|
54 |
DefaultLabelBackgroundColor' |
|
55 |
poolDictionaries:'' |
|
56 |
category:'Views-DataSet' |
|
542 | 57 |
! |
58 |
||
59 |
!DSVColumnView class methodsFor:'documentation'! |
|
60 |
||
61 |
copyright |
|
62 |
" |
|
63 |
COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG |
|
64 |
All Rights Reserved |
|
65 |
||
66 |
This software is furnished under a license and may be used |
|
67 |
only in accordance with the terms of that license and with the |
|
68 |
inclusion of the above copyright notice. This software may not |
|
69 |
be provided or otherwise made available to, or used by, any |
|
70 |
other person. No title to or ownership of the software is |
|
71 |
hereby transferred. |
|
72 |
" |
|
73 |
||
74 |
||
75 |
||
76 |
! |
|
77 |
||
78 |
documentation |
|
79 |
" |
|
2788
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
80 |
ColumnView part of a DataSetView. |
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
81 |
implements a scrollable selection view based on rows and columns. |
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
82 |
Used as the contents-part of a DataSetView. |
542 | 83 |
|
84 |
[Instance variables:] |
|
85 |
||
86 |
editValue <Model> current editing model |
|
87 |
editView <View> current editing component |
|
1087 | 88 |
|
2398 | 89 |
buttonReleaseAction <Action or nil> called if the mouse button is released |
90 |
buttonMotionAction <Action or nil> called during mouse motion with one |
|
91 |
argument the point under the mouse. |
|
92 |
||
1087 | 93 |
multipleSelectOk <Boolean> multiple selection enabled/disabled |
94 |
||
542 | 95 |
selectedColIndex <Integer> selected column index or 0 |
1087 | 96 |
selectedRowIndex <Integer> selected row index or 0 |
97 |
||
542 | 98 |
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
|
99 |
minRowHeight <Integer> minimum height of all displayed labels |
1087 | 100 |
|
542 | 101 |
columnDescriptors <SequancableCollection> list of column descriptors |
1087 | 102 |
|
103 |
viewOrigin <Point> current view origin |
|
104 |
||
105 |
colorMap <Dictionary> store and register used colors on device |
|
106 |
||
107 |
rowFontAscent <SmallInteger> inset of a printable text in a row |
|
108 |
including separator and font ascent. |
|
109 |
||
110 |
lockRowIndex <SmallInteger> internal used to indicate a row which has |
|
111 |
changed its contents but no redraw should be |
|
112 |
done( at:put: ). |
|
113 |
||
114 |
columnHolder <ValueHolder> holder which keeps the list of column descriptors. |
|
115 |
||
116 |
registererImages <IdentityDictionary> list of images registered on the device |
|
117 |
||
542 | 118 |
list <SequancableCollection> list of rows |
1087 | 119 |
|
120 |
||
121 |
catchChangeEvents <Boolean> internal used to discard change notifications |
|
122 |
||
6220 | 123 |
beDependentOfRows <Boolean> keep rows dependent; by default is disabled. |
567 | 124 |
in case of enabled a row can raise a change |
125 |
notification whithout a parameter which |
|
126 |
will force a redraw of the row or the |
|
127 |
readSelector of the column which will |
|
128 |
redraw the cell in the row only. |
|
542 | 129 |
|
1087 | 130 |
fgColor <Color> foreground color |
131 |
bgColor <Color> background color |
|
132 |
hgLgFgColor <Color> highlight foreground color (selected) |
|
133 |
hgLgBgColor <Color> highlight background color (selected) |
|
134 |
||
135 |
buttonLightColor <Color> LightColor ( drawing the edge of a button ) |
|
136 |
buttonShadowColor <Color> ShadowColor ( drawing the edge of a button ) |
|
137 |
buttonHalfLightColor <Color> HalfLightColor ( drawing the edge of a button ) |
|
138 |
buttonHalfShadowColor <Color> HalfShadowColor ( drawing the edge of a button ) |
|
139 |
||
140 |
actionBlock <a OneArgBlock> action block performed on select |
|
141 |
doubleClickActionBlock <a OneArgBlock> action block performed on double click |
|
5308 | 142 |
rowIfAbsentBlock <a OneArgBlock> this block is performed on an empty list entry |
1087 | 143 |
to retrive the item from the application. The |
144 |
argument to the block is the index into the list. |
|
145 |
The block should return the row instance which |
|
146 |
is put to the list under the index. |
|
147 |
||
148 |
builder <UIBuilder> builder set by application |
|
149 |
||
150 |
verticalSpacing <SmallInteger> vertical row spacing( top & bottom ) |
|
151 |
horizontalSpacing <SmallInteger> horizontal row spacing( left & right ) |
|
152 |
separatorSize <SmallInteger> line width of a vertical or horizontal separator |
|
153 |
||
154 |
rowSelectorForm <Form> form used by a row selector |
|
155 |
||
156 |
checkToggleForm <Form> form used by a checkToggle |
|
157 |
checkToggleExtent <Point> extent of a checkToggle |
|
158 |
checkToggleLevel <SmallInteger> level used to draw a check toggle |
|
159 |
||
160 |
comboButtonForm <Form> form used by a comboList or -Box |
|
161 |
comboButtonExtent <Point> extent of a comboList or -Box |
|
162 |
comboButtonLevel <SmallInteger> level used to draw a comboList or -Box |
|
163 |
||
164 |
dropTarget <DropTarget> drag & drop target |
|
165 |
dropSource <DropSource> drag & drop source |
|
166 |
||
542 | 167 |
[author:] |
168 |
Claus Atzkern |
|
169 |
||
170 |
[see also:] |
|
171 |
DataSetColumnSpec |
|
172 |
DataSetColumn |
|
173 |
DataSetView |
|
174 |
" |
|
175 |
! ! |
|
176 |
||
647 | 177 |
!DSVColumnView class methodsFor:'defaults'! |
607 | 178 |
|
1844 | 179 |
defaultFont |
180 |
^ SelectionInListView defaultFont |
|
181 |
! |
|
182 |
||
563 | 183 |
horizontalSpacing |
1087 | 184 |
"returns the default horizontal space between rows |
185 |
" |
|
563 | 186 |
^ 4 |
187 |
||
188 |
! |
|
189 |
||
3961
6cd0b3929aa2
added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents:
3960
diff
changeset
|
190 |
preselectAllWhenOpeningEditor:aBoolean |
6cd0b3929aa2
added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents:
3960
diff
changeset
|
191 |
PreselectAllWhenOpeningEditor := aBoolean |
6cd0b3929aa2
added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents:
3960
diff
changeset
|
192 |
|
6cd0b3929aa2
added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents:
3960
diff
changeset
|
193 |
"Created: / 02-11-2010 / 22:00:28 / cg" |
6cd0b3929aa2
added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents:
3960
diff
changeset
|
194 |
! |
6cd0b3929aa2
added: #preselectAllWhenOpeningEditor:
Claus Gittinger <cg@exept.de>
parents:
3960
diff
changeset
|
195 |
|
542 | 196 |
updateStyleCache |
2777 | 197 |
"extract values from the styleSheet and cache them in class variables" |
198 |
||
5723 | 199 |
<resource: #style (#textForegroundColor |
2146 | 200 |
#'scrollableView.backgroundColor' |
2777 | 201 |
#'button.lightColor' |
202 |
#'button.shadowColor' |
|
203 |
#'button.halfLightColor' |
|
204 |
#'button.halfShadowColor' |
|
205 |
#'button.edgeStyle' |
|
206 |
#'checkToggle.activeImage' |
|
207 |
#'checkToggle.passiveImage' |
|
3504 | 208 |
#'radioButton.activeImage' |
209 |
#'radioButton.passiveImage' |
|
582 | 210 |
#'selection.hilightForegroundColor' |
5723 | 211 |
#'selection.hilightBackgroundColor' |
4875 | 212 |
#'selection.hilightFrameColor' |
213 |
#'dataSet.labelView.foregroundColor' |
|
214 |
#'dataSet.labelView.backgroundColor' |
|
3988 | 215 |
)> |
542 | 216 |
|
1333 | 217 |
DefaultForegroundColor := StyleSheet colorAt:#'textForegroundColor' default:(Color black). |
3986 | 218 |
"/ DefaultBackgroundColor := StyleSheet colorAt:#'scrollableView.backgroundColor' default:DefaultViewBackgroundColor. |
219 |
DefaultBackgroundColor := StyleSheet colorAt:#'selection.backgroundColor' default:DefaultViewBackgroundColor. |
|
1333 | 220 |
|
221 |
DefaultHilightForegroundColor := StyleSheet colorAt:#'selection.hilightForegroundColor' default:DefaultBackgroundColor. |
|
222 |
DefaultHilightBackgroundColor := StyleSheet colorAt:#'selection.hilightBackgroundColor' default:DefaultForegroundColor. |
|
4644 | 223 |
DefaultHilightForegroundColorNoFocus := StyleSheet colorAt:#'selection.hilightForegroundColorNoFocus'. |
224 |
DefaultHilightBackgroundColorNoFocus := StyleSheet colorAt:#'selection.hilightBackgroundColorNoFocus'. |
|
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
225 |
DefaultHilightFrameColor := StyleSheet colorAt:#'selection.hilightFrameColor'. "/ no default; nil means: no frame |
607 | 226 |
|
647 | 227 |
DefaultHilightForegroundColor = DefaultHilightBackgroundColor ifTrue:[ |
988 | 228 |
DefaultHilightBackgroundColor := Color black |
647 | 229 |
]. |
1333 | 230 |
ButtonLightColor := StyleSheet colorAt:#'button.lightColor'. |
231 |
ButtonShadowColor := StyleSheet colorAt:#'button.shadowColor'. |
|
232 |
ButtonHalfLightColor := StyleSheet colorAt:#'button.halfLightColor'. |
|
233 |
ButtonHalfShadowColor := StyleSheet colorAt:#'button.halfShadowColor'. |
|
234 |
ButtonEdgeStyle := StyleSheet at:#'button.edgeStyle'. |
|
3504 | 235 |
|
1333 | 236 |
CheckToggleActiveImage := StyleSheet at:#'checkToggle.activeImage'. |
1100 | 237 |
CheckToggleActiveImage isNil ifTrue:[ |
238 |
CheckTogglePassiveImage := nil |
|
239 |
] ifFalse:[ |
|
1333 | 240 |
CheckTogglePassiveImage := StyleSheet at:#'checkToggle.passiveImage'. |
1100 | 241 |
CheckTogglePassiveImage isNil ifTrue:[ |
242 |
CheckToggleActiveImage := nil |
|
243 |
] |
|
244 |
]. |
|
5890 | 245 |
"/ CheckToggleDisabledActiveImage := StyleSheet at:#'checkToggle.disabledActiveImage'. |
246 |
"/ CheckToggleDisabledPassiveImage := StyleSheet at:#'checkToggle.disabledPassiveImage'. |
|
247 |
||
3504 | 248 |
CheckToggleForm := nil. |
249 |
CheckToggleLevel := nil. |
|
250 |
CheckToggleExtent := nil. |
|
251 |
||
252 |
RadioButtonActiveImage := StyleSheet at:#'radioButton.activeImage'. |
|
253 |
RadioButtonPassiveImage := StyleSheet at:#'radioButton.passiveImage'. |
|
5890 | 254 |
"/ RadioButtonDisabledActiveImage := StyleSheet at:#'radioButton.disabledActiveImage'. |
255 |
"/ RadioButtonDisabledPassiveImage := StyleSheet at:#'radioButton.disabledPassiveImage'. |
|
3504 | 256 |
(RadioButtonActiveImage isNil or:[ RadioButtonPassiveImage isNil ]) ifTrue:[ |
257 |
RadioButtonActiveImage := RadioButton roundOnForm. |
|
258 |
RadioButtonPassiveImage := RadioButton roundOffForm. |
|
259 |
]. |
|
260 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
261 |
ComboButtonForm := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
262 |
ComboButtonLevel := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
263 |
ComboButtonExtent := nil. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
264 |
|
4875 | 265 |
DefaultLabelBackgroundColor := StyleSheet at:#'dataSet.labelView.backgroundColor' default:nil. |
266 |
DefaultLabelForegroundColor := StyleSheet at:#'dataSet.labelView.foregroundColor' default:nil. |
|
5723 | 267 |
|
2777 | 268 |
" |
269 |
self updateStyleCache. |
|
270 |
" |
|
542 | 271 |
|
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
272 |
"Modified: / 20-01-2011 / 08:44:28 / cg" |
5890 | 273 |
"Modified (comment): / 17-08-2018 / 17:06:46 / Claus Gittinger" |
563 | 274 |
! |
275 |
||
276 |
verticalSpacing |
|
1087 | 277 |
"returns the default vertical space between rows |
278 |
" |
|
563 | 279 |
^ 2 |
280 |
||
542 | 281 |
! ! |
282 |
||
2711 | 283 |
!DSVColumnView class methodsFor:'image specs'! |
809 | 284 |
|
285 |
dragIconMulti |
|
988 | 286 |
"This resource specification was automatically generated |
287 |
by the ImageEditor of ST/X." |
|
288 |
||
289 |
"Do not manually edit this!! If it is corrupted, |
|
290 |
the ImageEditor may not be able to read the specification." |
|
291 |
||
809 | 292 |
" |
988 | 293 |
self dragIconMulti inspect |
294 |
ImageEditor openOnClass:self andSelector:#dragIconMulti |
|
5100 | 295 |
Icon flushCachedIcons |
809 | 296 |
" |
297 |
||
298 |
<resource: #image> |
|
299 |
||
300 |
^Icon |
|
5723 | 301 |
constantNamed:'DSVColumnView class dragIconMulti' |
5100 | 302 |
ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:' |
303 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@<@@@@O@@@@C3??L@<??3@OO?<<C3??O@<??0@OO?<@C3???0<???<OO???C3???0<???<OO???@C? |
|
304 |
??0@???<@O???@C???0@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') |
|
305 |
colorMapFromArray:#[0 0 0 255 255 255] |
|
306 |
mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:' |
|
307 |
@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C????@????0O????C????0?????O????3????????????????????????????????????????????? |
|
308 |
????????@????0O???<C????@????0@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself] |
|
1926
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
309 |
! |
809 | 310 |
|
311 |
dragIconSingle |
|
988 | 312 |
"This resource specification was automatically generated |
313 |
by the ImageEditor of ST/X." |
|
314 |
||
315 |
"Do not manually edit this!! If it is corrupted, |
|
316 |
the ImageEditor may not be able to read the specification." |
|
317 |
||
809 | 318 |
" |
988 | 319 |
self dragIconSingle inspect |
320 |
ImageEditor openOnClass:self andSelector:#dragIconSingle |
|
5100 | 321 |
Icon flushCachedIcons |
809 | 322 |
" |
323 |
||
324 |
<resource: #image> |
|
325 |
||
326 |
^Icon |
|
5723 | 327 |
constantNamed:'DSVColumnView class dragIconSingle' |
5100 | 328 |
ifAbsentPut:[(Depth1Image width:32 height:32) bits:(ByteArray fromPackedString:' |
329 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@O?<0@C??L@@??30@O?<<@C??@@@??0@@O???@C???0@???<@O???@C???0@???<@O???@C???0@???<@O???@C?? |
|
330 |
?0@???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b') |
|
331 |
colorMapFromArray:#[0 0 0 255 255 255] |
|
332 |
mask:((ImageMask width:32 height:32) bits:(ByteArray fromPackedString:' |
|
333 |
@@@@@@@@@@@@@@@@@@@@@O??<@C???@@???<@O???@C???<@????@O???<C????@????0O???<C????@????0O???<C????@????0O???<C????@????0O?? |
|
334 |
?<C????@????0O???<@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@b'); yourself); yourself] |
|
2711 | 335 |
! |
336 |
||
337 |
rowSelectorImage |
|
338 |
"This resource specification was automatically generated |
|
339 |
by the ImageEditor of ST/X." |
|
5723 | 340 |
|
2711 | 341 |
"Do not manually edit this!! If it is corrupted, |
342 |
the ImageEditor may not be able to read the specification." |
|
5723 | 343 |
|
2711 | 344 |
" |
345 |
self rowSelectorImage inspect |
|
346 |
ImageEditor openOnClass:self andSelector:#rowSelectorImage |
|
5723 | 347 |
Icon flushCachedIcons |
348 |
" |
|
349 |
||
350 |
<resource: #image> |
|
351 |
||
352 |
^Icon |
|
353 |
constantNamed:'DSVColumnView class rowSelectorImage' |
|
354 |
ifAbsentPut:[(Depth2Image width:11 height:11) bits:(ByteArray fromPackedString:'@ @@@#@@*#0@@C,@O>(0N*($J*$P@BT@*!!P@@!!@@@ @@') |
|
355 |
colorMapFromArray:#[0 0 0 127 127 127 170 170 170 255 255 255] |
|
356 |
mask:((ImageMask width:11 height:11) bits:(ByteArray fromPackedString:'C@@N@@<@?8C?0O? ?<C? @<@C @L@@@a'); yourself); yourself] |
|
1926
9bcb6b59ea37
if never set, the default menuPerformer is
Claus Gittinger <cg@exept.de>
parents:
1844
diff
changeset
|
357 |
! ! |
809 | 358 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
359 |
!DSVColumnView class methodsFor:'signal constants'! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
360 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
361 |
stopRedrawSignal |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
362 |
"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
|
363 |
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
|
364 |
" |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
365 |
StopRedrawSignal isNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
366 |
StopRedrawSignal := Notification newSignalMayProceed:true. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
367 |
StopRedrawSignal nameClass:self message:#stopRedrawSignal. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
368 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
369 |
^ StopRedrawSignal |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
370 |
! ! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
371 |
|
886 | 372 |
!DSVColumnView methodsFor:'accessing'! |
373 |
||
1042 | 374 |
builder |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
375 |
"get the builder (UIBuilder or nil)" |
5723 | 376 |
|
1042 | 377 |
^ builder |
378 |
! |
|
379 |
||
5723 | 380 |
builder:aBuilder |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
381 |
"set the builder (UIBuilder or nil)" |
5723 | 382 |
|
1042 | 383 |
builder := aBuilder |
384 |
! |
|
385 |
||
886 | 386 |
columnView |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
387 |
"returns self" |
5723 | 388 |
|
886 | 389 |
^ self |
1067
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
390 |
! |
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
391 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
392 |
heightOfContents |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
393 |
"return the height of the contents in pixels" |
5723 | 394 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
395 |
cachedPreferredExtent isNil ifTrue:[ |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
396 |
self preferredExtent |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
397 |
]. |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
398 |
^ cachedPreferredExtent y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
399 |
! |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
400 |
|
2695 | 401 |
labelView |
402 |
||
403 |
^labelView |
|
404 |
! |
|
405 |
||
1487 | 406 |
labelView:aView |
407 |
labelView := aView for:self. |
|
408 |
||
2146 | 409 |
labelView layout:(LayoutFrame |
5723 | 410 |
leftFraction:0 offset:0 |
411 |
rightFraction:1 offset:0 |
|
412 |
topFraction:0 offset:0 |
|
2146 | 413 |
bottomFraction:0 offset:[self preferredLabelViewHeight]). |
1067
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
414 |
! |
c66188014600
keep a reference to my dataSetView.
Claus Gittinger <cg@exept.de>
parents:
1042
diff
changeset
|
415 |
|
5723 | 416 |
level:aLevel |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
417 |
"change the level and thus the level of the labelView" |
5723 | 418 |
|
1487 | 419 |
aLevel ~~ level ifTrue:[ |
420 |
super level:aLevel. |
|
2146 | 421 |
"/ labelView level:aLevel. |
1487 | 422 |
] |
1087 | 423 |
! |
424 |
||
2146 | 425 |
preferredLabelViewHeight |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
426 |
^ labelView preferredHeight "/ + (labelView margin + self verticalSpacing * 2). |
2146 | 427 |
! |
428 |
||
1087 | 429 |
rowFontAscent |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
430 |
"returns the inset of a printable text in a row" |
5723 | 431 |
|
1087 | 432 |
^ rowFontAscent |
2960 | 433 |
! |
434 |
||
435 |
selectedColIndex:newSelectedColIndex |
|
436 |
self selectedColIndexHolder value:newSelectedColIndex |
|
437 |
! |
|
438 |
||
439 |
selectedColIndexHolder |
|
440 |
selectedColIndexHolder isNil ifTrue:[ |
|
441 |
selectedColIndexHolder := ValueHolder new. |
|
442 |
]. |
|
443 |
^ selectedColIndexHolder |
|
886 | 444 |
! ! |
445 |
||
1818 | 446 |
!DSVColumnView methodsFor:'accessing-actions'! |
542 | 447 |
|
5723 | 448 |
action:aOneArgAction |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
449 |
"set the action block to be performed on select" |
5723 | 450 |
|
542 | 451 |
actionBlock := aOneArgAction |
452 |
! |
|
453 |
||
5723 | 454 |
doubleClickAction:aOneArgAction |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
455 |
"set the action block to be performed on doubleclick" |
5723 | 456 |
|
809 | 457 |
doubleClickActionBlock := aOneArgAction |
458 |
! |
|
459 |
||
5723 | 460 |
rowIfAbsent:aOneArgAction |
809 | 461 |
"set the action block to be performed on each 'nil' entry into the |
462 |
list. The argument to the block is the index into the list. The |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
463 |
block returns the row which is put to the list" |
5723 | 464 |
|
809 | 465 |
rowIfAbsentBlock := aOneArgAction |
1416 | 466 |
! |
467 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
468 |
selectConditionBlock |
5723 | 469 |
"get the select-conditionBlock; this block is evaluated before |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
470 |
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
|
471 |
index as arg). |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
472 |
The change will not be done, if the block returns false. " |
5723 | 473 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
474 |
^ selectConditionBlock |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
475 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
476 |
|
5723 | 477 |
selectConditionBlock:aOneArgBlockOrNil |
478 |
"set the select-conditionBlock; this block is evaluated before |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
479 |
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
|
480 |
index as arg). |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
481 |
The change will not be done, if the block returns false. " |
5723 | 482 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
483 |
selectConditionBlock := aOneArgBlockOrNil. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
484 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
485 |
|
5723 | 486 |
tabAtEndAction:aNoneArgAction |
1416 | 487 |
"set the action, called without any argument at end of the list entering |
488 |
tab next. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
489 |
The default is to give the focus to the view after self in the focusSequence" |
5723 | 490 |
|
1416 | 491 |
tabAtEndAction := aNoneArgAction |
492 |
! |
|
493 |
||
5723 | 494 |
tabAtStartAction:aNoneArgAction |
1416 | 495 |
"set the action, called without any argument at start of the list entering |
496 |
tab previous. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
497 |
The default is to give the focus to the view before self in the focusSequence" |
5723 | 498 |
|
1416 | 499 |
tabAtStartAction := aNoneArgAction |
809 | 500 |
! ! |
501 |
||
1818 | 502 |
!DSVColumnView methodsFor:'accessing-behavior'! |
809 | 503 |
|
3130
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
504 |
autoScrollToColumn |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
505 |
"return true, if I scroll to the column, when one is selected." |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
506 |
|
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
507 |
^ autoScrollToColumn |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
508 |
|
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
509 |
"Created: / 22-10-2006 / 11:01:25 / cg" |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
510 |
! |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
511 |
|
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
512 |
autoScrollToColumn:aBoolean |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
513 |
"control, if I should scroll to the column, when one is selected. |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
514 |
The default is true" |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
515 |
|
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
516 |
autoScrollToColumn := aBoolean |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
517 |
|
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
518 |
"Created: / 22-10-2006 / 11:01:46 / cg" |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
519 |
! |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
520 |
|
542 | 521 |
beDependentOfRows |
522 |
"make myself dependent of any row; in this case any change notification |
|
523 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
524 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
525 |
-> row changed:'what' |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
526 |
By default, the attribute is set to false (disabled)." |
5723 | 527 |
|
542 | 528 |
^ beDependentOfRows |
529 |
! |
|
530 |
||
5723 | 531 |
beDependentOfRows:aBool |
542 | 532 |
"make myself dependent of any row; in this case any change notification |
533 |
raised by a row is catched and the cell identified by the 'readSelector' |
|
534 |
is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
|
535 |
-> row changed:'what' |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
536 |
By default, the attribute is set to false (disabled)." |
5723 | 537 |
|
542 | 538 |
aBool ~~ beDependentOfRows ifTrue:[ |
618 | 539 |
beDependentOfRows := aBool. |
2836 | 540 |
aBool ifTrue:[ |
541 |
self makeDependentOfRows |
|
542 |
] ifFalse:[ |
|
543 |
self makeIndependentOfRows |
|
544 |
]. |
|
618 | 545 |
] |
607 | 546 |
! |
547 |
||
1805 | 548 |
enableChannel:aChannel |
549 |
enableChannel notNil ifTrue:[ |
|
550 |
enableChannel removeDependent:self |
|
551 |
]. |
|
552 |
(enableChannel := aChannel) notNil ifTrue:[ |
|
553 |
enableChannel addDependent:self |
|
554 |
]. |
|
555 |
! |
|
556 |
||
5664 | 557 |
ignoreReselect |
558 |
"controls if clicking on an already selected item should |
|
559 |
be ignored or should perform the select action again. |
|
560 |
By default, these are ignored" |
|
561 |
||
562 |
^ ignoreReselect |
|
563 |
||
564 |
"Created: / 22-10-2006 / 11:01:25 / cg" |
|
565 |
! |
|
566 |
||
567 |
ignoreReselect:aBoolean |
|
568 |
"controls if clicking on an already selected item should |
|
569 |
be ignored or should perform the select action again. |
|
570 |
By default, these are ignored" |
|
571 |
||
572 |
ignoreReselect := aBoolean |
|
573 |
||
574 |
"Created: / 22-10-2006 / 11:01:25 / cg" |
|
575 |
! |
|
576 |
||
5723 | 577 |
makeDependentOfRows |
2836 | 578 |
"make myself dependent of any row" |
5723 | 579 |
|
2836 | 580 |
list size ~~ 0 ifTrue:[ |
5723 | 581 |
list do:[:aRow | |
2836 | 582 |
aRow notNil ifTrue:[ |
583 |
aRow addDependent:self |
|
584 |
] |
|
585 |
] |
|
586 |
] |
|
587 |
! |
|
588 |
||
5723 | 589 |
makeIndependentOfRows |
2836 | 590 |
"make myself independent of any row" |
5723 | 591 |
|
2836 | 592 |
list size ~~ 0 ifTrue:[ |
5723 | 593 |
list do:[:aRow | |
2836 | 594 |
aRow notNil ifTrue:[ |
595 |
aRow removeDependent:self |
|
596 |
] |
|
597 |
] |
|
598 |
] |
|
599 |
! |
|
600 |
||
607 | 601 |
multipleSelectOk |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
602 |
"allow/disallow multiple row selections; the default is false" |
5723 | 603 |
|
607 | 604 |
^ multipleSelectOk |
605 |
! |
|
606 |
||
5723 | 607 |
multipleSelectOk:sBoolean |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
608 |
"allow/disallow multiple row selections; the default is false" |
3140 | 609 |
|
610 |
|colIdx rowIdx| |
|
611 |
||
5447 | 612 |
sBoolean == multipleSelectOk ifTrue:[^ self ]. |
3140 | 613 |
colIdx := rowIdx := 0. |
614 |
||
615 |
self hasSelection ifTrue:[ |
|
616 |
colIdx := self selectedColIndex. |
|
617 |
rowIdx := self selectedRowIndex. |
|
618 |
||
619 |
rowIdx isSequenceable ifTrue:[ |
|
620 |
rowIdx := rowIdx at:1 ifAbsent:0 |
|
621 |
]. |
|
622 |
self setSelectColIndex:0 rowIndex:0 openEditor:false. |
|
623 |
]. |
|
5447 | 624 |
multipleSelectOk := sBoolean. |
3140 | 625 |
self selectColIndex:colIdx rowIndex:rowIdx openEditor:false. |
5447 | 626 |
|
627 |
"Modified (format): / 04-02-2017 / 21:31:30 / cg" |
|
1112 | 628 |
! |
629 |
||
1938 | 630 |
opaqueColumnResize |
631 |
^ labelView opaqueColumnResize |
|
632 |
! |
|
633 |
||
634 |
opaqueColumnResize:aBoolean |
|
635 |
labelView opaqueColumnResize:aBoolean |
|
636 |
! |
|
637 |
||
1946
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
638 |
scrollWhenUpdating |
5723 | 639 |
"return the scroll behavior, when I get a new text |
1946
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
640 |
(via the model or the #contents/#list) |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
641 |
Possible returnValues are: |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
642 |
#keep / nil -> no change |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
643 |
#endOfText -> scroll to the end |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
644 |
#beginOfText -> scroll to the top |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
645 |
The default is #beginOfText. |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
646 |
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
|
647 |
the program (i.e. not from the user)" |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
648 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
649 |
^ scrollWhenUpdating |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
650 |
! |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
651 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
652 |
scrollWhenUpdating:aSymbolOrNil |
5723 | 653 |
"define how to scroll, when I get a new text |
1946
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
654 |
(via the model or the #contents/#list) |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
655 |
Allowed arguments are: |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
656 |
#keep / nil -> no change |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
657 |
#endOfText -> scroll to the end |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
658 |
#beginOfText -> scroll to the top |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
659 |
The default is #beginOfText. |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
660 |
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
|
661 |
the program (i.e. not from the user)" |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
662 |
|
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
663 |
scrollWhenUpdating := aSymbolOrNil |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
664 |
! |
0738b9f8c19f
preps for scrollWhenUpdating flag
Claus Gittinger <cg@exept.de>
parents:
1941
diff
changeset
|
665 |
|
1112 | 666 |
selectRowOnDefault |
3449
2ba8e55953aa
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
667 |
"if true, in case of selecting a none selectable cell, the row is selected. |
2ba8e55953aa
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
668 |
If false, nothing is selected. The default is true." |
5723 | 669 |
|
1112 | 670 |
^ selectRowOnDefault |
671 |
! |
|
672 |
||
5723 | 673 |
selectRowOnDefault:aBool |
3449
2ba8e55953aa
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
674 |
"if true, in case of selecting a none selectable cell, the row is selected. |
2ba8e55953aa
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
675 |
If false, nothing is selected. The default is true." |
5723 | 676 |
|
1112 | 677 |
selectRowOnDefault := aBool |
1487 | 678 |
! |
679 |
||
5195 | 680 |
sortListInPlace |
5723 | 681 |
"when false (default for backward compatibility): |
5195 | 682 |
if sorting, create a copy |
683 |
of the list, which is wrong when useIndex is on, |
|
684 |
as the application will get the index in the sorted |
|
685 |
list, which is probably different from tha apps list mode. |
|
686 |
When true (should be default, but that might break many |
|
687 |
users), the passed in list is sorted in place (i.e. possibly |
|
688 |
sorting the application's list)." |
|
5723 | 689 |
|
5195 | 690 |
^ sortListInPlace |
691 |
! |
|
692 |
||
693 |
sortListInPlace:aBoolean |
|
5723 | 694 |
"when false (default for backward compatibility): |
5195 | 695 |
if sorting, create a copy |
696 |
of the list, which is wrong when useIndex is on, |
|
697 |
as the application will get the index in the sorted |
|
698 |
list, which is probably different from tha apps list mode. |
|
699 |
When true (should be default, but that might break many |
|
700 |
users), the passed in list is sorted in place (i.e. possibly |
|
701 |
sorting the application's list)." |
|
5723 | 702 |
|
5195 | 703 |
sortListInPlace := aBoolean. |
704 |
! |
|
705 |
||
1668 | 706 |
tabIntern |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
707 |
"returns true if tabing is supported in the widget" |
5723 | 708 |
|
1668 | 709 |
^ tabIntern |
710 |
! |
|
711 |
||
5723 | 712 |
tabIntern:aBool |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
713 |
"returns true if tabing is supported in the widget" |
5723 | 714 |
|
1668 | 715 |
tabIntern := aBool ? true |
716 |
! |
|
717 |
||
5194 | 718 |
updateListHolderWhenSorting |
719 |
"return true if the the listHolder's value are be updated, |
|
720 |
when I sort a list. |
|
721 |
By default, this is false so it must be set explicitly |
|
722 |
(for bug-backward compatibility, |
|
723 |
and to avoid introducing new side effects)." |
|
724 |
||
5723 | 725 |
^ updateListHolderWhenSorting |
5194 | 726 |
! |
727 |
||
728 |
updateListHolderWhenSorting:aBoolean |
|
729 |
"define if the the listHolder's value should be updated, |
|
730 |
when I sort a list. |
|
731 |
By default, this is false so it must be set explicitly |
|
732 |
(for bug-backward compatibility, |
|
733 |
and to avoid introducing new side effects)." |
|
734 |
||
735 |
updateListHolderWhenSorting := aBoolean |
|
736 |
! |
|
737 |
||
1487 | 738 |
useIndex |
739 |
"specify, if the selected components value or its index in the |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
740 |
list should be sent to the model. The default is its index." |
5723 | 741 |
|
1487 | 742 |
^ useIndex |
743 |
! |
|
744 |
||
5723 | 745 |
useIndex:aBool |
1487 | 746 |
"specify, if the selected components value or its index in the |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
747 |
list should be sent to the model. The default is its index." |
5723 | 748 |
|
1487 | 749 |
useIndex := aBool |
542 | 750 |
! ! |
751 |
||
5639 | 752 |
!DSVColumnView methodsFor:'accessing-channels'! |
753 |
||
754 |
modifiedChannel |
|
755 |
^ modifiedChannel |
|
756 |
||
757 |
"Created: / 30.1.2000 / 12:10:57 / cg" |
|
758 |
! |
|
759 |
||
760 |
modifiedChannel:something |
|
761 |
modifiedChannel := something. |
|
762 |
||
763 |
"Created: / 30.1.2000 / 12:10:57 / cg" |
|
764 |
! ! |
|
765 |
||
766 |
!DSVColumnView methodsFor:'accessing-color & font'! |
|
824 | 767 |
|
768 |
backgroundColor |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
769 |
"get the background color of the rows" |
5723 | 770 |
|
824 | 771 |
^ bgColor |
772 |
! |
|
773 |
||
5723 | 774 |
backgroundColor:aColor |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
775 |
"set the background color of the rows" |
5723 | 776 |
|
824 | 777 |
bgColor ~~ aColor ifTrue:[ |
778 |
super viewBackground:bgColor. |
|
779 |
self realized ifTrue:[ |
|
4991 | 780 |
bgColor := aColor onDevice:device. |
824 | 781 |
self invalidate |
782 |
] ifFalse:[ |
|
783 |
bgColor := aColor |
|
784 |
] |
|
785 |
] |
|
786 |
! |
|
787 |
||
788 |
foregroundColor |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
789 |
"return the foreground color of the rows" |
5723 | 790 |
|
824 | 791 |
^ fgColor |
792 |
! |
|
793 |
||
5723 | 794 |
foregroundColor:aColor |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
795 |
"set the foreground color of the rows" |
5723 | 796 |
|
824 | 797 |
fgColor ~~ aColor ifTrue:[ |
798 |
self realized ifTrue:[ |
|
4991 | 799 |
fgColor := aColor onDevice:device. |
824 | 800 |
self invalidate |
801 |
] ifFalse:[ |
|
802 |
fgColor := aColor |
|
803 |
] |
|
804 |
] |
|
805 |
! |
|
806 |
||
4875 | 807 |
labelBackgroundColor |
808 |
"get the background color of the label row" |
|
5723 | 809 |
|
4875 | 810 |
^ labelBgColor ? bgColor |
811 |
! |
|
812 |
||
813 |
labelForegroundColor |
|
814 |
"get the foreground color of the label row" |
|
5723 | 815 |
|
4875 | 816 |
^ labelFgColor ? fgColor |
817 |
! |
|
818 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
819 |
selectionBackgroundColor |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
820 |
"returns the background color of a selected row" |
5723 | 821 |
|
3138 | 822 |
self hasFocus ifTrue:[ |
823 |
^ selectionBackgroundColor |
|
824 |
]. |
|
825 |
^ selectionBackgroundColorNoFocus. |
|
824 | 826 |
! |
827 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
828 |
selectionForegroundColor |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
829 |
"returns the foreground color of a selected row" |
3138 | 830 |
|
831 |
self hasFocus ifTrue:[ |
|
832 |
^ selectionForegroundColor |
|
833 |
]. |
|
834 |
^ selectionForegroundColorNoFocus. |
|
824 | 835 |
! |
836 |
||
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
837 |
selectionFrameColor |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
838 |
"returns the frame color of a selected row" |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
839 |
|
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
840 |
self hasFocus ifTrue:[ |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
841 |
^ selectionFrameColor |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
842 |
]. |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
843 |
^ selectionFrameColorNoFocus. |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
844 |
|
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
845 |
"Created: / 20-01-2011 / 08:45:08 / cg" |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
846 |
! |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
847 |
|
824 | 848 |
separatorDarkColor |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
849 |
"returns the dark color used for drawing a shadowed separator (3D)" |
5723 | 850 |
|
824 | 851 |
^ shadowColor |
852 |
! |
|
853 |
||
854 |
separatorLightColor |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
855 |
"returns the light color used for drawing a shadowed separator (3D)" |
5723 | 856 |
|
824 | 857 |
^ lightColor |
2637 | 858 |
! |
859 |
||
860 |
separatorOneDColor |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
861 |
"returns the color used for drawing a oneD separator" |
5723 | 862 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
863 |
separatorOneDColor isNil ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
864 |
^ fgColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
865 |
]. |
2637 | 866 |
^ separatorOneDColor |
867 |
! |
|
868 |
||
5723 | 869 |
separatorOneDColor:aColorOrNil |
2637 | 870 |
"set the color used for drawing a oneD separator; if the color |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
871 |
is nil, the current forgroundColor is used" |
5723 | 872 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
873 |
separatorOneDColor = aColorOrNil ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
874 |
^ self |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
875 |
]. |
2637 | 876 |
separatorOneDColor := aColorOrNil. |
877 |
self realized ifTrue:[ |
|
878 |
separatorOneDColor notNil ifTrue:[ |
|
4991 | 879 |
separatorOneDColor := separatorOneDColor onDevice:device. |
2637 | 880 |
]. |
881 |
self invalidate. |
|
882 |
]. |
|
824 | 883 |
! ! |
884 |
||
1818 | 885 |
!DSVColumnView methodsFor:'accessing-columns'! |
542 | 886 |
|
3504 | 887 |
columnAt:anIndex |
888 |
<resource: #obsolete> |
|
5723 | 889 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
890 |
"returns the column at an index" |
3504 | 891 |
|
892 |
self obsoleteMethodWarning:'use columnDescriptorAt:'. |
|
893 |
^ self columnDescriptorAt:anIndex |
|
894 |
! |
|
895 |
||
5723 | 896 |
columnDescriptorAt:anIndex |
3504 | 897 |
"returns the columnDescriptor at an index" |
5723 | 898 |
|
1112 | 899 |
^ columnDescriptors at:anIndex ifAbsent:nil |
542 | 900 |
! |
901 |
||
886 | 902 |
columnDescriptors |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
903 |
"returns list of column descriptors" |
5723 | 904 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
905 |
^ columnDescriptors collect:[:aCol | aCol description ] |
886 | 906 |
! |
907 |
||
5723 | 908 |
columnDescriptors:aColumnDescriptionList |
909 |
"set the columnDescriptors; |
|
5602 | 910 |
scroll to top and deselect" |
5723 | 911 |
|
5602 | 912 |
self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:true |
913 |
||
914 |
"Modified: / 13-09-2017 / 15:05:05 / cg" |
|
915 |
! |
|
916 |
||
5723 | 917 |
columnDescriptors:aColumnDescriptionList deselect:deselect scrollToTop:scrollToTop |
918 |
"set the columnDescriptors; |
|
5602 | 919 |
if deselect is true, then deselect; |
920 |
if scrollToTop is true, then scroll to top; |
|
921 |
otherwise, take the current selection and try to make it visible" |
|
5723 | 922 |
|
5602 | 923 |
|delta indexOfFirstRow| |
924 |
||
925 |
deselect ifTrue:[ |
|
926 |
self deselect. |
|
927 |
]. |
|
5723 | 928 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
929 |
(viewOrigin x ~~ 0 or:[ viewOrigin y ~~ 0 ]) ifTrue:[ |
5602 | 930 |
scrollToTop ifTrue:[ |
931 |
delta := viewOrigin negated. |
|
932 |
viewOrigin := 0 @ 0. |
|
933 |
self originChanged:delta |
|
934 |
] ifFalse:[ |
|
935 |
indexOfFirstRow := self yVisibleToRowNr:0. |
|
936 |
]. |
|
937 |
]. |
|
938 |
self setColumnDescriptors:aColumnDescriptionList. |
|
5723 | 939 |
|
5602 | 940 |
indexOfFirstRow notNil ifTrue:[ |
941 |
self scrollToRowAt:indexOfFirstRow colAt:1. |
|
942 |
]. |
|
943 |
||
944 |
"Created: / 13-09-2017 / 15:04:50 / cg" |
|
945 |
! |
|
946 |
||
5723 | 947 |
columnDescriptors:aColumnDescriptionList scrollToTop:scrollToTop |
948 |
"set the columnDescriptors and deselect; |
|
5602 | 949 |
if scrollToTop is true, then scroll to top; |
950 |
otherwise, take the current selection and try to make it visible" |
|
5723 | 951 |
|
5602 | 952 |
self columnDescriptors:aColumnDescriptionList deselect:true scrollToTop:scrollToTop |
953 |
||
954 |
"Created: / 13-09-2017 / 15:03:15 / cg" |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
955 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
956 |
|
2703 | 957 |
dataSetColumns |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
958 |
"returns the list of DataSetColumns; each column represents a DataSetColumnSpec" |
5723 | 959 |
|
2703 | 960 |
^ columnDescriptors |
961 |
! |
|
962 |
||
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
963 |
firstColumn |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
964 |
"returns the first column" |
5723 | 965 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
966 |
^ columnDescriptors at:1 |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
967 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
968 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
969 |
lastColumn |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
970 |
"returns the last column" |
5723 | 971 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
972 |
^ columnDescriptors last |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
973 |
! |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
974 |
|
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
975 |
setColumnDescriptors:aColumnDescriptionList |
5310 | 976 |
"set the columnDescriptors; don't deselect and do not scroll to top" |
5723 | 977 |
|
2154
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
978 |
|cid| |
cb22be939082
split strings; some refactoring
Claus Gittinger <cg@exept.de>
parents:
2152
diff
changeset
|
979 |
|
1487 | 980 |
cid := 0. |
3536 | 981 |
|
982 |
aColumnDescriptionList isEmptyOrNil ifTrue:[ |
|
983 |
columnDescriptors := OrderedCollection new. |
|
984 |
] ifFalse:[ |
|
5723 | 985 |
columnDescriptors := aColumnDescriptionList |
3536 | 986 |
collect: |
987 |
[:el||dsc lbl| |
|
5723 | 988 |
dsc := el isSequenceable |
3536 | 989 |
ifTrue:[DataSetColumnSpec decodeFromLiteralArray:el] |
990 |
ifFalse:[el]. |
|
991 |
cid := cid + 1. |
|
992 |
lbl := DataSetLabel new description:dsc builder:builder on:labelView. |
|
993 |
DataSetColumn new on:self description:dsc columnNumber:cid label:lbl |
|
994 |
]. |
|
995 |
]. |
|
1487 | 996 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
997 |
cachedPreferredExtent := nil. |
1487 | 998 |
labelView columns:columnDescriptors. |
542 | 999 |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1000 |
self fitColumns. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1001 |
|
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
1002 |
"Modified: / 07-01-2012 / 16:46:59 / cg" |
5602 | 1003 |
"Modified (format): / 13-09-2017 / 15:04:01 / cg" |
542 | 1004 |
! ! |
1005 |
||
1818 | 1006 |
!DSVColumnView methodsFor:'accessing-interactors'! |
809 | 1007 |
|
1100 | 1008 |
checkToggleActiveImage |
1009 |
^ checkToggleActiveImage |
|
1010 |
! |
|
1011 |
||
809 | 1012 |
checkToggleExtent |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1013 |
"returns the extent of a checkToggle" |
5723 | 1014 |
|
809 | 1015 |
^ checkToggleExtent |
1016 |
! |
|
1017 |
||
1018 |
checkToggleForm |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1019 |
"returns the form of a checkToggle" |
5723 | 1020 |
|
809 | 1021 |
^ checkToggleForm |
1022 |
! |
|
1023 |
||
1024 |
checkToggleLevel |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1025 |
"returns the level of a checkToggle button" |
5723 | 1026 |
|
809 | 1027 |
^ checkToggleLevel |
1028 |
! |
|
1029 |
||
1100 | 1030 |
checkTogglePassiveImage |
1031 |
^ checkTogglePassiveImage |
|
1032 |
! |
|
1033 |
||
809 | 1034 |
comboButtonExtent |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1035 |
"returns the extent of a comboList or -Box" |
5723 | 1036 |
|
809 | 1037 |
^ comboButtonExtent |
1038 |
! |
|
1039 |
||
1040 |
comboButtonForm |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1041 |
"returns the form of a comboList or -Box" |
5723 | 1042 |
|
809 | 1043 |
^ comboButtonForm |
1044 |
! |
|
1045 |
||
1046 |
comboButtonLevel |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1047 |
"returns the level of a comboList or -Box button" |
5723 | 1048 |
|
809 | 1049 |
^ comboButtonLevel |
1050 |
! |
|
1051 |
||
3504 | 1052 |
radioButtonExtent |
1053 |
"returns the extent of a radio button" |
|
5723 | 1054 |
|
3504 | 1055 |
^ radioButtonActiveImage extent |
1056 |
! |
|
1057 |
||
809 | 1058 |
rowSelectorExtent |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1059 |
"returns the bitmap of a selected row" |
5723 | 1060 |
|
809 | 1061 |
^ rowSelectorForm extent |
1062 |
! |
|
1063 |
||
1064 |
rowSelectorForm |
|
2711 | 1065 |
"returns the (arrow-) image shown for a selected row. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1066 |
(the arrow shown in the first column)" |
5723 | 1067 |
|
809 | 1068 |
^ rowSelectorForm |
1069 |
! ! |
|
1070 |
||
1818 | 1071 |
!DSVColumnView methodsFor:'accessing-mvc'! |
612 | 1072 |
|
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1073 |
columnAdaptor |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1074 |
"return the value of the instance variable 'columnAdaptor' (automatically generated)" |
5723 | 1075 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1076 |
columnAdaptor isValueModel ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1077 |
^ columnAdaptor value |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1078 |
]. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1079 |
^ columnAdaptor |
1711 | 1080 |
! |
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1081 |
|
5969 | 1082 |
columnAdaptor:usuallyAnApplication |
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1083 |
"set the value of the instance variable 'columnAdaptor' (automatically generated)" |
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1084 |
|
1711 | 1085 |
columnAdaptor isValueModel ifTrue:[ |
1086 |
columnAdaptor removeDependent:self |
|
1087 |
]. |
|
5969 | 1088 |
(columnAdaptor := usuallyAnApplication) isValueModel ifTrue:[ |
1711 | 1089 |
columnAdaptor addDependent:self |
1090 |
]. |
|
5969 | 1091 |
|
1092 |
"Modified (format): / 21-11-2018 / 19:32:57 / Claus Gittinger" |
|
1711 | 1093 |
! |
1008
7874385db982
changes to support columnAdaptors
Claus Gittinger <cg@exept.de>
parents:
991
diff
changeset
|
1094 |
|
612 | 1095 |
columnHolder |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1096 |
"get the valueHolder, which keeps the list of column descriptions" |
5723 | 1097 |
|
612 | 1098 |
^ columnHolder |
1099 |
! |
|
1100 |
||
5723 | 1101 |
columnHolder:aValueHolder |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1102 |
"set the valueHolder, which keeps the list of column descriptions" |
5723 | 1103 |
|
612 | 1104 |
|columns| |
1105 |
||
1106 |
columnHolder notNil ifTrue:[ |
|
1107 |
columnHolder removeDependent:self |
|
1108 |
]. |
|
1109 |
(columnHolder := aValueHolder) notNil ifTrue:[ |
|
1110 |
columnHolder addDependent:self. |
|
1111 |
columns := columnHolder value. |
|
1112 |
columns notNil ifTrue:[ |
|
1113 |
self columnDescriptors:columns |
|
1114 |
] |
|
1115 |
]. |
|
1487 | 1116 |
! |
1117 |
||
5723 | 1118 |
listAt:index put:newElement |
1487 | 1119 |
"kludge callback, when an element hs to be replaced |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1120 |
due to a col-adaptor returning a new row element" |
5723 | 1121 |
|
1487 | 1122 |
|list| |
1123 |
||
1124 |
(list := listHolder value) notNil ifTrue:[ |
|
1125 |
list at:index put:newElement |
|
1126 |
] |
|
1127 |
! |
|
1128 |
||
2318 | 1129 |
listHolder |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1130 |
"get the valueHolder which holds the list of rows" |
5723 | 1131 |
|
2318 | 1132 |
^ listHolder |
1133 |
! |
|
1134 |
||
5723 | 1135 |
listHolder:aListHolder |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1136 |
"set the valueHolder which holds the list of rows" |
5723 | 1137 |
|
1487 | 1138 |
listHolder ~~ aListHolder ifTrue:[ |
1139 |
listHolder notNil ifTrue:[ |
|
1140 |
listHolder removeDependent:self |
|
1141 |
]. |
|
1142 |
(listHolder := aListHolder) notNil ifTrue:[ |
|
1143 |
listHolder addDependent:self |
|
1144 |
] |
|
1145 |
]. |
|
1146 |
self pushEvent:#list: with:(listHolder value). |
|
1147 |
! |
|
1148 |
||
5723 | 1149 |
model:aModel |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1150 |
"set the valueHolder which holds the selection and maybe the list of rows" |
5723 | 1151 |
|
1487 | 1152 |
model notNil ifTrue:[ |
1153 |
model removeDependent:self. |
|
1154 |
(model respondsTo:#list) ifTrue:[ |
|
1155 |
(model list == listHolder) ifTrue:[ |
|
1156 |
self listHolder:nil |
|
1157 |
] |
|
1158 |
] |
|
1159 |
]. |
|
1160 |
(model := aModel) notNil ifTrue:[ |
|
1161 |
model addDependent:self. |
|
1162 |
(aModel respondsTo:#list) ifTrue:[ |
|
1163 |
self listHolder:model list |
|
1164 |
] |
|
1165 |
] |
|
612 | 1166 |
! ! |
1167 |
||
1818 | 1168 |
!DSVColumnView methodsFor:'accessing-rows'! |
542 | 1169 |
|
1170 |
at:aRowNr |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1171 |
"return the row at an index, aRowNr" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1172 |
|
618 | 1173 |
|row| |
1174 |
||
3994 | 1175 |
list isNil ifTrue:[^ nil]. |
3757 | 1176 |
(row := list at:aRowNr ifAbsent:nil) isNil ifTrue:[ |
618 | 1177 |
lockRowIndex := aRowNr. |
1178 |
||
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
1179 |
(rowIfAbsentBlock notNil |
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
1180 |
and:[(row := rowIfAbsentBlock value:aRowNr) notNil]) ifTrue:[ |
618 | 1181 |
list at:aRowNr put:row. |
1182 |
beDependentOfRows ifTrue:[row addDependent:self]. |
|
1183 |
]. |
|
1184 |
||
1185 |
lockRowIndex := 0 |
|
1186 |
]. |
|
1187 |
^ row |
|
1034
bd02c4cd7582
care for nonexisting rowIfAbsentBlock when a nil-row is encountered.
Claus Gittinger <cg@exept.de>
parents:
1023
diff
changeset
|
1188 |
|
3994 | 1189 |
"Modified: / 22-01-2011 / 09:14:48 / cg" |
542 | 1190 |
! |
1191 |
||
5723 | 1192 |
at:aRowNr ifAbsent:exceptionBlock |
607 | 1193 |
"return the row at a aRowNr. If the index is invalid, return the |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1194 |
result of evaluating the exceptionblock" |
5723 | 1195 |
|
1497 | 1196 |
(aRowNr between:1 and:list size) ifTrue:[ |
618 | 1197 |
^ self at:aRowNr |
1198 |
]. |
|
1199 |
^ exceptionBlock value |
|
542 | 1200 |
! |
1201 |
||
5723 | 1202 |
at:aRowNr put:aRow |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1203 |
"change the row at an index. The added row is returned" |
5723 | 1204 |
|
1956 | 1205 |
lockRowIndex ~~ aRowNr ifTrue:[ |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1206 |
(aRowNr <= list size and:[ (list at:aRowNr) == aRow ]) ifTrue:[ |
1956 | 1207 |
self invalidateRowAt:aRowNr |
1208 |
] ifFalse:[ |
|
5723 | 1209 |
self |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1210 |
replaceFrom:aRowNr |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1211 |
to:aRowNr |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1212 |
with:(Array with:aRow) |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1213 |
startingAt:1. |
618 | 1214 |
] |
542 | 1215 |
]. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1216 |
^ aRow |
542 | 1217 |
! |
1218 |
||
1219 |
first |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1220 |
"return the first row" |
5723 | 1221 |
|
618 | 1222 |
^ self at:1 |
1223 |
! |
|
1224 |
||
5723 | 1225 |
identityIndexOfRow:aRow |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1226 |
"returns index of a row or 0" |
5723 | 1227 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1228 |
(list size ~~ 0 and:[ aRow notNil ]) ifTrue:[ |
618 | 1229 |
^ list identityIndexOf:aRow |
1230 |
]. |
|
1231 |
^ 0 |
|
542 | 1232 |
! |
1233 |
||
1234 |
last |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1235 |
"return the last row" |
5723 | 1236 |
|
1497 | 1237 |
^ self at:(list size) |
542 | 1238 |
! |
1239 |
||
1240 |
list |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1241 |
"get the list of rows" |
5723 | 1242 |
|
542 | 1243 |
^ list |
1244 |
! |
|
1245 |
||
3773 | 1246 |
list:aRawList |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1247 |
"set the list of rows" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1248 |
|
3897 | 1249 |
|newList selectionHasChanged sortColNr sortSelectorOrBlock sortBlockSelector sortBlock| |
656 | 1250 |
|
618 | 1251 |
"/ remove selection without redraw |
622 | 1252 |
|
1259 | 1253 |
selectionHasChanged := self hasSelection. |
1254 |
||
1111 | 1255 |
self destroyEditView. |
622 | 1256 |
|
2960 | 1257 |
self selectedColIndex:0. |
618 | 1258 |
selectedRowIndex := multipleSelectOk ifTrue:[nil] ifFalse:[0]. |
542 | 1259 |
|
612 | 1260 |
shown ifFalse:[ |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1261 |
cachedPreferredExtent := nil |
612 | 1262 |
] ifTrue:[ |
5723 | 1263 |
aRawList size == 0 ifTrue:[ |
2834 | 1264 |
"/ keep old column-width information |
1265 |
] ifFalse:[ |
|
2524 | 1266 |
columnDescriptors notNil ifTrue:[ |
1267 |
columnDescriptors do:[:aCol| aCol invalidate ]. |
|
1268 |
]. |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1269 |
cachedPreferredExtent := nil. |
618 | 1270 |
] |
542 | 1271 |
]. |
1272 |
||
2836 | 1273 |
beDependentOfRows ifTrue:[ |
1274 |
self makeIndependentOfRows |
|
656 | 1275 |
]. |
643 | 1276 |
|
3773 | 1277 |
aRawList size == 0 ifTrue:[ |
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1278 |
list := nil. |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1279 |
viewOrigin := 0 @ 0. |
2834 | 1280 |
] ifFalse:[ |
3773 | 1281 |
"/ list := OrderedCollection withAll:aRawList. |
4613 | 1282 |
sortListInPlace ifTrue:[ |
1283 |
newList := aRawList |
|
1284 |
] ifFalse:[ |
|
1285 |
newList := aRawList copyAsOrderedCollection. |
|
1286 |
]. |
|
3773 | 1287 |
(sortColNr := labelView indexOfSortColumn) notNil ifTrue:[ |
3897 | 1288 |
sortBlockSelector := (columnDescriptors at:sortColNr) sortBlockSelector. |
1289 |
sortBlockSelector notNil ifTrue:[ |
|
3964 | 1290 |
sortBlock := self application aspectFor:sortBlockSelector. |
3897 | 1291 |
newList sort:sortBlock |
1292 |
] ifFalse:[ |
|
1293 |
sortSelectorOrBlock := (columnDescriptors at:sortColNr) sortSelector. |
|
1294 |
sortSelectorOrBlock notNil ifTrue:[ |
|
1295 |
sortSelectorOrBlock isBlock ifTrue:[ |
|
1296 |
newList sort:sortSelectorOrBlock |
|
1297 |
] ifFalse:[ |
|
1298 |
newList sort:[:a :b | (a perform:sortSelectorOrBlock) < (b perform:sortSelectorOrBlock)] |
|
1299 |
]. |
|
3773 | 1300 |
]. |
1301 |
]. |
|
1302 |
labelView reverseSort ifTrue:[ |
|
1303 |
newList reverse. |
|
1304 |
]. |
|
1305 |
]. |
|
1306 |
list := newList. |
|
5723 | 1307 |
|
5194 | 1308 |
sortListInPlace ifFalse:[ |
1309 |
listHolder notNil ifTrue:[ |
|
1310 |
updateListHolderWhenSorting ifTrue:[ |
|
1311 |
listHolder value:newList withoutNotifying:self. |
|
1312 |
]. |
|
1313 |
]. |
|
1314 |
]. |
|
5723 | 1315 |
|
2836 | 1316 |
beDependentOfRows ifTrue:[ |
1317 |
self makeDependentOfRows |
|
1318 |
]. |
|
542 | 1319 |
]. |
1320 |
||
612 | 1321 |
shown ifTrue:[ |
1484 | 1322 |
self fitColumns |
1949 | 1323 |
] ifFalse:[ |
1324 |
needFitColumns := true |
|
637 | 1325 |
]. |
1259 | 1326 |
selectionHasChanged ifTrue:[ |
1327 |
self selectionChanged. |
|
1328 |
]. |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1329 |
cachedPreferredExtent := nil. |
2044
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1330 |
self contentsChanged. |
3897 | 1331 |
|
3964 | 1332 |
"Modified: / 08-11-2010 / 22:07:49 / cg" |
542 | 1333 |
! ! |
1334 |
||
1818 | 1335 |
!DSVColumnView methodsFor:'accessing-visibility'! |
542 | 1336 |
|
5723 | 1337 |
font:aFont |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1338 |
"set the font for all shown rows." |
5563 | 1339 |
|newGCFont| |
1340 |
||
1341 |
(aFont isNil or:[aFont = self font]) ifTrue:[ |
|
1342 |
^ self |
|
1343 |
]. |
|
5723 | 1344 |
|
5563 | 1345 |
columnDescriptors isEmptyOrNil ifTrue:[ |
4521 | 1346 |
super font:aFont. |
5563 | 1347 |
self labelView font:aFont. |
1348 |
rowFontAscent := self font ascent. |
|
5602 | 1349 |
rowHeight := verticalSpacing + (self font height) + verticalSpacing + separatorSize. |
5563 | 1350 |
minRowHeight := rowHeight. |
1351 |
^ self |
|
1352 |
]. |
|
1353 |
||
1354 |
"/ close current editor if open |
|
1355 |
self destroyEditView. |
|
1356 |
||
1357 |
newGCFont := aFont. |
|
1358 |
realized ifTrue:[ |
|
1359 |
|visibleColumns font oldSize newSize factor minimum| |
|
1360 |
||
1361 |
newGCFont := aFont onDevice:self graphicsDevice. |
|
1362 |
factor := (newGCFont height / gc font height) asFloat. |
|
1363 |
||
1364 |
minimum := self separatorSize + (2 * self horizontalSpacing). |
|
1365 |
||
1366 |
factor = 1 ifFalse:[ |
|
1367 |
"/ there are columns which are more or less invisible (exlude rowSelector) |
|
1368 |
visibleColumns := columnDescriptors select:[:eachColumn| |
|
1369 |
(eachColumn rendererType ~~ #rowSelector and:[eachColumn width > minimum]) |
|
1370 |
]. |
|
1371 |
]. |
|
1372 |
visibleColumns notEmptyOrNil ifTrue:[ |
|
1373 |
factor < 1 ifTrue:[ |
|
1374 |
"/ check if zoomOut is allowed |
|
1375 |
visibleColumns do:[: eachColumn| |
|
1376 |
(eachColumn width * factor) > (minimum+1) ifFalse:[^ self]. |
|
1377 |
]. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1378 |
]. |
5563 | 1379 |
visibleColumns do:[:eachColumn| |
1380 |
eachColumn setDescWidth:(eachColumn width * factor) rounded. |
|
1381 |
||
1382 |
font := eachColumn label font. |
|
1383 |
font notNil ifTrue:[ |
|
1384 |
font sizeUnit ~~ #px ifTrue:[ |
|
1385 |
oldSize := font size. |
|
1386 |
newSize := (oldSize * factor) rounded. |
|
1387 |
||
1388 |
(newSize ~= oldSize and:[newSize >= 4]) ifTrue:[ |
|
1389 |
font := font asSize:newSize. |
|
1390 |
font notNil ifTrue:[eachColumn label font:font]. |
|
1391 |
]. |
|
1392 |
]. |
|
1393 |
]. |
|
1394 |
]. |
|
1842 | 1395 |
]. |
5563 | 1396 |
]. |
1397 |
||
1398 |
super font:newGCFont. |
|
5723 | 1399 |
|
5563 | 1400 |
rowFontAscent := self font ascent. |
1401 |
rowHeight := verticalSpacing + self font height + verticalSpacing + separatorSize. |
|
1402 |
minRowHeight := rowHeight. |
|
1403 |
||
1404 |
columnDescriptors do:[:eachColumn| eachColumn invalidate]. |
|
1405 |
||
1406 |
labelView font:self font. |
|
1407 |
self labelView fontChanged. |
|
1408 |
||
1409 |
cachedPreferredExtent := nil. |
|
1410 |
viewOrigin := 0 @ 0. |
|
1411 |
||
1412 |
realized ifTrue:[ |
|
1413 |
self fitColumns. |
|
1414 |
superView recomputeLayouts. |
|
1415 |
self invalidate. |
|
1416 |
self labelView invalidate. |
|
1417 |
self contentsChanged. |
|
1418 |
self makeSelectionVisible. |
|
1419 |
]. |
|
5602 | 1420 |
|
1421 |
"Modified (format): / 13-09-2017 / 15:34:22 / cg" |
|
542 | 1422 |
! |
1423 |
||
607 | 1424 |
has3Dseparators |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1425 |
"returns true if shown in 3D mode" |
5723 | 1426 |
|
607 | 1427 |
^ separatorSize ~~ 1 |
542 | 1428 |
! |
1429 |
||
5723 | 1430 |
has3Dseparators:aBool |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1431 |
"enable or disable 3D mode" |
5723 | 1432 |
|
607 | 1433 |
|newSepSize| |
542 | 1434 |
|
3672 | 1435 |
newSepSize := aBool ifTrue:[2] ifFalse:[1]. |
607 | 1436 |
newSepSize ~~ separatorSize ifTrue:[ |
1437 |
separatorSize := newSepSize. |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1438 |
realized ifTrue:[ |
5723 | 1439 |
columnDescriptors do:[:aCol | |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1440 |
aCol invalidate |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1441 |
]. |
1136 | 1442 |
self preferredExtentChanged. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1443 |
self invalidate. |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
1444 |
self contentsChanged |
647 | 1445 |
] |
542 | 1446 |
] |
1447 |
! |
|
1448 |
||
1449 |
horizontalSpacing |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1450 |
"horizontal spacing used by columns" |
5723 | 1451 |
|
563 | 1452 |
^ horizontalSpacing |
1453 |
! |
|
1454 |
||
5723 | 1455 |
horizontalSpacing:aNumber |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1456 |
"horizontal spacing used by columns" |
5723 | 1457 |
|
563 | 1458 |
horizontalSpacing ~~ aNumber ifTrue:[ |
1459 |
horizontalSpacing := aNumber. |
|
1460 |
self preferredExtentChanged. |
|
1461 |
]. |
|
542 | 1462 |
! |
1463 |
||
1487 | 1464 |
showLabels |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1465 |
"control the labels view to be visible or unvisible" |
5723 | 1466 |
|
1487 | 1467 |
^ labelView isVisible |
1468 |
! |
|
1469 |
||
5723 | 1470 |
showLabels:aBoolean |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1471 |
"control the labels view to be visible or unvisible" |
5723 | 1472 |
|
5447 | 1473 |
labelView isVisible:aBoolean |
1474 |
||
1475 |
"Modified (format): / 04-02-2017 / 21:31:43 / cg" |
|
1487 | 1476 |
! |
1477 |
||
542 | 1478 |
verticalSpacing |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1479 |
"vertical spacing used by columns" |
5723 | 1480 |
|
563 | 1481 |
^ verticalSpacing |
1482 |
! |
|
1483 |
||
5723 | 1484 |
verticalSpacing:aNumber |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1485 |
"vertical spacing used by columns" |
5723 | 1486 |
|
563 | 1487 |
verticalSpacing ~~ aNumber ifTrue:[ |
1488 |
verticalSpacing := aNumber. |
|
1489 |
self preferredExtentChanged. |
|
1490 |
]. |
|
542 | 1491 |
! ! |
1492 |
||
1493 |
!DSVColumnView methodsFor:'adding & removing rows'! |
|
1494 |
||
5723 | 1495 |
add:aRow |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1496 |
"insert row at end" |
5723 | 1497 |
|
1497 | 1498 |
^ self add:aRow beforeIndex:(1 + list size) |
542 | 1499 |
! |
1500 |
||
5723 | 1501 |
add:aRow afterIndex:aRowNr |
542 | 1502 |
"add a new row after slot aRowNr and redisplay; returns nil in case |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1503 |
of an invalid index or the row" |
5723 | 1504 |
|
542 | 1505 |
^ self add:aRow beforeIndex:(aRowNr + 1) |
1506 |
! |
|
1507 |
||
5723 | 1508 |
add:aRow beforeIndex:aRowNr |
542 | 1509 |
"add a new row before slot aRowNr and redisplay; returns nil in case |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1510 |
of an invalid index or the row" |
5723 | 1511 |
|
861 | 1512 |
self addAll:(Array with:aRow) beforeIndex:aRowNr. |
1513 |
^ aRow. |
|
1514 |
! |
|
1515 |
||
1516 |
addAll:aList beforeIndex:start |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1517 |
"add a collection of rows before slot start and redisplay" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1518 |
|
861 | 1519 |
|y0 y1 yD h dH size noSel| |
1520 |
||
1521 |
(size := aList size) == 0 ifTrue:[ |
|
1522 |
^ self |
|
1523 |
]. |
|
1524 |
||
618 | 1525 |
beDependentOfRows ifTrue:[ |
861 | 1526 |
aList do:[:aRow| aRow notNil ifTrue:[aRow addDependent:self]] |
542 | 1527 |
]. |
637 | 1528 |
|
4116 | 1529 |
list isNil ifTrue:[ |
1530 |
self list:aList. |
|
1531 |
] ifFalse:[ |
|
1532 |
noSel := self numberOfSelections. |
|
1533 |
||
1534 |
noSel ~~ 0 ifTrue:[ |
|
1535 |
multipleSelectOk ifFalse:[ |
|
1536 |
selectedRowIndex >= start ifTrue:[ |
|
1537 |
selectedRowIndex := selectedRowIndex + size |
|
1538 |
] |
|
1539 |
] ifTrue:[ |
|
1540 |
1 to:noSel do:[:i||v| |
|
1541 |
(v := selectedRowIndex at:i) >= start ifTrue:[ |
|
1542 |
selectedRowIndex at:i put:(v + size) |
|
1543 |
] |
|
607 | 1544 |
] |
1545 |
] |
|
4116 | 1546 |
]. |
1547 |
list addAll:aList beforeIndex:start. |
|
1548 |
]. |
|
1549 |
||
861 | 1550 |
self recomputeHeightOfContents. |
1551 |
||
1552 |
y0 := (start - 1) * rowHeight. |
|
1553 |
yD := size * rowHeight. |
|
1554 |
y1 := y0 + yD. |
|
542 | 1555 |
|
1556 |
y0 < viewOrigin y ifTrue:[ |
|
1557 |
self originWillChange. |
|
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1558 |
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
|
1559 |
"/ viewOrigin y:(yD + viewOrigin y). |
861 | 1560 |
self originChanged:(0 @ yD). |
1561 |
]. |
|
1562 |
||
1563 |
(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
|
1564 |
self invalidate. |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1565 |
self contentsChanged. |
8e36106065f0
fixed: click on a checkToggle (buttonPress event)
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
1566 |
^ self |
542 | 1567 |
]. |
645
53c78cc2ee08
redraw twice in case of expose event during adding a new entry
ca
parents:
643
diff
changeset
|
1568 |
|
861 | 1569 |
y0 := self yVisibleOfRowNr:start. |
1258 | 1570 |
h := height - margin. |
1571 |
y1 := y0 + yD min:h. |
|
1572 |
||
1573 |
(y1 > margin and:[y0 < h]) ifTrue:[ |
|
1952 | 1574 |
"/ cg: if I have a non-solid background color, |
1575 |
"/ or individual items have a bgColor selector, |
|
1576 |
"/ invalidate the area (and readraw) instead of a scroll. |
|
5723 | 1577 |
(viewBackground isImageOrForm |
1952 | 1578 |
or:[ self anyColumnHasPotentialNonConstantBackground ]) |
1579 |
ifTrue:[ |
|
1580 |
"/ do not scroll but invalidate ... |
|
1581 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
|
1582 |
] ifFalse:[ |
|
1583 |
h := h - y1. |
|
1584 |
y0 := y0 max:margin. |
|
1585 |
dH := y1 - y0. |
|
1586 |
||
1587 |
start == list size ifFalse:[ |
|
1588 |
self copyFrom:self x:0 y:y0 toX:0 y:y1 width:width height:h async:false |
|
1589 |
]. |
|
1590 |
self invalidateX:margin y:y0 width:width - margin - margin height:dH. |
|
1591 |
] |
|
542 | 1592 |
]. |
3478
85c3eb472b36
scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents:
3458
diff
changeset
|
1593 |
|
542 | 1594 |
self contentsChanged. |
3478
85c3eb472b36
scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents:
3458
diff
changeset
|
1595 |
|
85c3eb472b36
scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents:
3458
diff
changeset
|
1596 |
(scrollWhenUpdating == #end or:[scrollWhenUpdating == #endOfText]) ifTrue:[ |
85c3eb472b36
scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents:
3458
diff
changeset
|
1597 |
self scrollToBottom. |
85c3eb472b36
scrollToBottom if scrollWhenUpdating is #endOfText in #addAll:beforeIndex:
fm
parents:
3458
diff
changeset
|
1598 |
]. |
567 | 1599 |
! |
1600 |
||
5723 | 1601 |
addFirst:aRow |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1602 |
"insert a row at start" |
5723 | 1603 |
|
542 | 1604 |
^ self add:aRow beforeIndex:1 |
1605 |
! |
|
1606 |
||
5723 | 1607 |
remove:aRow |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1608 |
"remove a row" |
5723 | 1609 |
|
1487 | 1610 |
|idx| |
1611 |
||
1612 |
idx := list identityIndexOf:aRow. |
|
1613 |
idx ~~ 0 ifTrue:[ |
|
1614 |
self removeFrom:idx to:idx. |
|
1615 |
]. |
|
1616 |
^ aRow |
|
1617 |
! |
|
1618 |
||
542 | 1619 |
removeFirst |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1620 |
"remove first row; returns the removed row" |
5723 | 1621 |
|
1112 | 1622 |
^ self removeIndex:1 |
542 | 1623 |
! |
1624 |
||
861 | 1625 |
removeFrom:startIndex to:stopIndex |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1626 |
"remove rows from start to stop" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1627 |
|
861 | 1628 |
|coll noRedraw |
1629 |
noSel "{ Class: SmallInteger }" |
|
1630 |
size "{ Class: SmallInteger }" |
|
1631 |
start "{ Class: SmallInteger }" |
|
1632 |
stop "{ Class: SmallInteger }" |
|
1633 |
y0 "{ Class: SmallInteger }" |
|
1634 |
y1 "{ Class: SmallInteger }" |
|
1635 |
oY "{ Class: SmallInteger }" |
|
1636 |
dY "{ Class: SmallInteger }" |
|
1637 |
yB "{ Class: SmallInteger }" |
|
1638 |
h "{ Class: SmallInteger }" |
|
6094 | 1639 |
myList| |
1640 |
||
1641 |
myList := list. |
|
1642 |
||
861 | 1643 |
( (start := startIndex) < 1 |
6094 | 1644 |
or:[(stop := stopIndex) > myList size] |
861 | 1645 |
) ifTrue:[ |
1646 |
^ self subscriptBoundsError:start |
|
618 | 1647 |
]. |
861 | 1648 |
size := stop - start + 1. |
1649 |
||
1650 |
beDependentOfRows ifTrue:[ |
|
6094 | 1651 |
myList from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]]. |
861 | 1652 |
]. |
1653 |
noSel := self numberOfSelections. |
|
1654 |
||
1655 |
noSel ~~ 0 ifTrue:[ |
|
1656 |
noSel == 1 ifTrue:[ |
|
1657 |
noSel := self firstIndexSelected. |
|
1658 |
||
1659 |
noSel < start ifFalse:[ |
|
1660 |
noSel > stop ifTrue:[ |
|
1661 |
noSel := noSel - size. |
|
1662 |
||
1663 |
multipleSelectOk ifFalse:[selectedRowIndex := noSel] |
|
1664 |
ifTrue:[selectedRowIndex at:1 put:noSel] |
|
1665 |
] ifFalse:[ |
|
637 | 1666 |
editValue notNil ifTrue:[ |
1667 |
editValue removeDependent:self. |
|
1668 |
editValue := nil. |
|
1669 |
]. |
|
861 | 1670 |
self deselect. |
637 | 1671 |
] |
607 | 1672 |
] |
1673 |
] ifFalse:[ |
|
861 | 1674 |
coll := OrderedCollection new:noSel. |
1675 |
||
1676 |
selectedRowIndex do:[:i| |
|
1677 |
i < start ifTrue:[ |
|
1678 |
coll add:i |
|
1679 |
] ifFalse:[ |
|
1680 |
i > stop ifTrue:[ |
|
1681 |
coll add:(i - size) |
|
1682 |
] |
|
1683 |
] |
|
1684 |
]. |
|
1685 |
coll size == 0 ifTrue:[ |
|
1686 |
self deselect |
|
1687 |
] ifFalse:[ |
|
1688 |
selectedRowIndex := coll |
|
1689 |
] |
|
542 | 1690 |
] |
1691 |
]. |
|
6094 | 1692 |
myList removeFrom:start to:stop. |
861 | 1693 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1694 |
y0 := (start - 1) * rowHeight. |
861 | 1695 |
dY := size * rowHeight. |
1696 |
y1 := dY + y0. |
|
542 | 1697 |
yB := y1 + margin - viewOrigin y. |
1698 |
self recomputeHeightOfContents. |
|
1699 |
||
1700 |
y0 < (oY := viewOrigin y) ifTrue:[ |
|
1701 |
(noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY] |
|
861 | 1702 |
ifTrue:[dY := dY negated]. |
542 | 1703 |
self originWillChange. |
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1704 |
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
|
1705 |
"/ viewOrigin y:(dY + oY). |
5723 | 1706 |
self originChanged:(0 @ dY). |
542 | 1707 |
] ifFalse:[ |
1708 |
noRedraw := y0 > (height + viewOrigin y) |
|
1709 |
]. |
|
1710 |
||
1483 | 1711 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
1712 |
self invalidate. |
|
1713 |
^ self contentsChanged. |
|
1714 |
]. |
|
1715 |
||
542 | 1716 |
(noRedraw or:[shown not]) ifFalse:[ |
861 | 1717 |
y0 := self yVisibleOfRowNr:start. |
542 | 1718 |
y0 := y0 max:margin. |
1719 |
||
1951 | 1720 |
"/ cg: if I have a non-solid background color, |
1721 |
"/ or individual items have a bgColor selector, |
|
1722 |
"/ invalidate the area (and readraw) instead of a scroll. |
|
5723 | 1723 |
(viewBackground isImageOrForm |
1951 | 1724 |
or:[ self anyColumnHasPotentialNonConstantBackground ]) |
1725 |
ifTrue:[ |
|
1726 |
"/ do not scroll but invalidate ... |
|
1727 |
] ifFalse:[ |
|
1728 |
y1 := yB. |
|
1729 |
h := height - margin - yB. |
|
1730 |
||
1731 |
h > 0 ifTrue:[ |
|
1732 |
self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:false |
|
1733 |
]. |
|
1734 |
y0 := y0 + h. |
|
561 | 1735 |
]. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1736 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
542 | 1737 |
]. |
1738 |
self contentsChanged. |
|
6094 | 1739 |
|
1740 |
"Modified: / 23-07-2019 / 11:38:00 / Claus Gittinger" |
|
861 | 1741 |
! |
1742 |
||
5723 | 1743 |
removeIndex:aRowNr |
6072 | 1744 |
"remove row at an index. |
1745 |
Returns the removed row" |
|
5723 | 1746 |
|
861 | 1747 |
|row| |
1748 |
||
1749 |
row := list at:aRowNr ifAbsent:nil. |
|
1750 |
self removeFrom:aRowNr to:aRowNr. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1751 |
^ row |
6072 | 1752 |
|
1753 |
"Modified (comment): / 24-06-2019 / 12:47:34 / Claus Gittinger" |
|
542 | 1754 |
! |
1755 |
||
1756 |
removeLast |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1757 |
"remove last row; the row is returned" |
5723 | 1758 |
|
1497 | 1759 |
^ self removeIndex:(list size) |
1956 | 1760 |
! |
1761 |
||
1762 |
replaceFrom:start to:stop with:aCollection startingAt:repStart |
|
1763 |
"replace elements in the receiver between index start and stop, |
|
1764 |
with elements taken from replacementCollection starting at repStart. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1765 |
Return the receiver." |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1766 |
|
2032 | 1767 |
|inSelList listSize repStop run| |
1956 | 1768 |
|
1769 |
inSelList := OrderedCollection new. |
|
1770 |
listSize := list size. |
|
1771 |
repStop := repStart + (stop - start). |
|
1772 |
||
1773 |
list isNil ifTrue:[ |
|
1774 |
list := OrderedCollection new |
|
1775 |
]. |
|
1776 |
||
1777 |
[listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ]. |
|
1778 |
||
1779 |
start to:stop do:[:i| |aRow| |
|
1780 |
aRow := list at:i ifAbsent:nil. |
|
5723 | 1781 |
|
1956 | 1782 |
aRow notNil ifTrue:[ |
1783 |
beDependentOfRows ifTrue:[aRow removeDependent:self]. |
|
1784 |
||
1785 |
(self isInSelection:i) ifTrue:[ |
|
1786 |
inSelList add:i |
|
1787 |
]. |
|
1788 |
list at:i put:nil. |
|
1789 |
] |
|
1790 |
]. |
|
1791 |
||
1792 |
beDependentOfRows ifTrue:[ |
|
1793 |
aCollection from:repStart to:repStop do:[:aRow| |
|
1794 |
aRow notNil ifTrue:[aRow addDependent:self] |
|
1795 |
] |
|
1796 |
]. |
|
1797 |
||
1798 |
run := start. |
|
1799 |
aCollection from:repStart to:repStop do:[:aRow| |
|
1800 |
list at:run put:aRow. |
|
1801 |
run := run + 1. |
|
1802 |
]. |
|
1803 |
self invalidateRowsFrom:start to:stop. |
|
1804 |
||
1805 |
inSelList size ~~ 0 ifTrue:[ |
|
1806 |
self numberOfSelections == inSelList size ifTrue:[ |
|
1807 |
self deselect |
|
1808 |
] ifFalse:[ |
|
1809 |
selectedRowIndex := selectedRowIndex select:[:i| (inSelList identityIndexOf:i) == 0 ]. |
|
1810 |
self selectionChanged. |
|
1811 |
] |
|
1812 |
]. |
|
542 | 1813 |
! ! |
1814 |
||
1815 |
!DSVColumnView methodsFor:'change & update'! |
|
1816 |
||
1492 | 1817 |
changeWidthOfColumn:aColumn deltaX:aDeltaX |
1818 |
||
1819 |
aColumn setDescWidth:(aColumn width + aDeltaX). |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1820 |
cachedPreferredExtent notNil ifTrue:[self fitColumns] |
1492 | 1821 |
! |
1822 |
||
5723 | 1823 |
update:what with:aPara from:chgObj |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1824 |
"one of my rows/cells changed its value" |
5723 | 1825 |
|
2695 | 1826 |
|row listHoldersList arg1 arg2 col| |
1487 | 1827 |
|
1828 |
chgObj == columnHolder ifTrue:[ |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1829 |
cachedPreferredExtent := nil. |
5723 | 1830 |
self columnDescriptors:(columnHolder value). |
1831 |
^ self. |
|
622 | 1832 |
]. |
1711 | 1833 |
chgObj == columnAdaptor ifTrue:[ |
1834 |
col := columnAdaptor value. |
|
5723 | 1835 |
columnDescriptors do:[:aCol | |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1836 |
aCol columnAdaptor:col |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1837 |
]. |
2776 | 1838 |
self invalidate. |
1839 |
^ self |
|
1711 | 1840 |
]. |
1487 | 1841 |
chgObj == editValue ifTrue:[ |
2695 | 1842 |
self updateColumnFromEditValue. |
1227 | 1843 |
^ self |
622 | 1844 |
]. |
6053 | 1845 |
chgObj == enableChannel ifTrue:[ |
6054 | 1846 |
enableChannel value ifFalse:[ |
1847 |
self deselect. "Selected Checkboxes can still be edited, so deselect" |
|
1848 |
]. |
|
6053 | 1849 |
self invalidate. |
1850 |
^ self |
|
1851 |
]. |
|
3773 | 1852 |
|
1487 | 1853 |
chgObj == model ifTrue:[ |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1854 |
(what == #selectionIndex or:[ what == #selection ]) ifTrue:[ |
5723 | 1855 |
self selectRowIndex:(model selectionIndex copy). |
1856 |
^ self. |
|
1487 | 1857 |
]. |
1858 |
what == #list ifTrue:[ |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1859 |
cachedPreferredExtent := nil. |
5723 | 1860 |
self listHolder:model list. |
1861 |
^ self. |
|
1487 | 1862 |
]. |
1863 |
what == #value ifTrue:[ |
|
1864 |
model == listHolder ifTrue:[ |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1865 |
cachedPreferredExtent := nil. |
1487 | 1866 |
self list:(listHolder value) |
1867 |
] ifFalse:[ |
|
5708 | 1868 |
useIndex ifTrue:[ |
1869 |
self selectRowIndex:model value |
|
1870 |
] ifFalse:[ |
|
6051 | 1871 |
|myList newSel| |
1872 |
||
1873 |
myList := self list ? #(). |
|
5708 | 1874 |
multipleSelectOk ifTrue:[ |
6051 | 1875 |
newSel := (model value ? #()) |
1876 |
collect:[:each | myList indexOf:each] |
|
1877 |
thenSelect:[:eachIdx | eachIdx ~~ 0]. |
|
5708 | 1878 |
] ifFalse:[ |
6051 | 1879 |
newSel := myList indexOf:model value |
5708 | 1880 |
]. |
1881 |
self selectRowIndex:newSel |
|
1882 |
]. |
|
2776 | 1883 |
]. |
1487 | 1884 |
]. |
1885 |
^ self |
|
1886 |
]. |
|
3773 | 1887 |
|
4219 | 1888 |
(chgObj == listHolder) ifTrue:[ |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1889 |
cachedPreferredExtent := nil. |
1953
9190339e9fad
lost dependents in row bug fix (when changing lists contents with #contents:)
Claus Gittinger <cg@exept.de>
parents:
1952
diff
changeset
|
1890 |
listHoldersList := listHolder value. |
4219 | 1891 |
|
1487 | 1892 |
what == #value ifTrue:[ |
5723 | 1893 |
self list:listHoldersList. |
1894 |
^ self. |
|
1487 | 1895 |
]. |
1896 |
aPara isCollection ifTrue:[ |
|
1897 |
arg1 := aPara at:1. |
|
1898 |
arg2 := aPara at:2. |
|
1899 |
] ifFalse:[ |
|
1900 |
arg1 := arg2 := aPara |
|
1901 |
]. |
|
1902 |
what == #at: ifTrue:[ |
|
5723 | 1903 |
self at:arg1 put:(listHoldersList at:arg1). |
2776 | 1904 |
^ self. |
1487 | 1905 |
]. |
1906 |
what == #insert: ifTrue:[ |
|
5723 | 1907 |
self add:(listHoldersList at:arg1) beforeIndex:arg1. |
2776 | 1908 |
^ self. |
1487 | 1909 |
]. |
1910 |
what == #remove: ifTrue:[ |
|
5723 | 1911 |
self removeFrom:arg1 to:arg1. |
2776 | 1912 |
^ self. |
1487 | 1913 |
]. |
1914 |
what == #removeFrom: ifTrue:[ |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1915 |
listHoldersList size == 0 ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1916 |
self list:nil |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1917 |
] ifFalse:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1918 |
self removeFrom:arg1 to:arg2 |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1919 |
]. |
1487 | 1920 |
^ self |
1921 |
]. |
|
1922 |
what == #insertCollection: ifTrue:[ |
|
1923 |
arg2 ~~ 0 ifTrue:[ |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1924 |
self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1)) |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1925 |
beforeIndex:arg1 |
1487 | 1926 |
]. |
1927 |
^ self. |
|
1928 |
]. |
|
1929 |
what == #replace: ifTrue:[ |
|
5723 | 1930 |
self |
3773 | 1931 |
replaceFrom:arg1 to:arg2 |
1932 |
with:listHoldersList startingAt:arg1. |
|
2537 | 1933 |
^ self |
1487 | 1934 |
]. |
2537 | 1935 |
self list:listHoldersList. |
1487 | 1936 |
^ self |
1937 |
]. |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1938 |
|
1593 | 1939 |
arg1 := aPara ? what. |
2816 | 1940 |
row := (what isNumber) ifTrue:[what] ifFalse:[chgObj]. |
2190 | 1941 |
self invalidateVisibleRow:row readSelector:arg1. |
2695 | 1942 |
editView notNil ifTrue:[ |
1943 |
(self isInSelection:(self identityIndexOfRow:row)) ifTrue:[ |
|
1944 |
self updateEditorFromChangedRow |
|
1945 |
] |
|
1946 |
]. |
|
1947 |
||
5719 | 1948 |
"Modified: / 30-01-2000 / 12:16:49 / cg" |
1949 |
"Modified: / 08-03-2018 / 18:06:19 / stefan" |
|
6051 | 1950 |
"Modified: / 21-05-2019 / 17:22:20 / Claus Gittinger" |
6054 | 1951 |
"Modified: / 22-05-2019 / 16:26:57 / Stefan Vogel" |
2695 | 1952 |
! |
1953 |
||
1954 |
updateColumnFromEditValue |
|
1955 |
|editValueBefore firstSelectedIndex newValue realValue col| |
|
1956 |
||
1957 |
editValueBefore := editValue. |
|
1958 |
||
1959 |
firstSelectedIndex := self firstIndexSelected. |
|
1960 |
newValue := editValue value. |
|
1961 |
||
1962 |
col := self selectedColumn. |
|
1963 |
col at:firstSelectedIndex put:newValue. |
|
3504 | 1964 |
|
1965 |
col editorType == #RadioButton ifTrue:[ |
|
1966 |
"/ turn off the other column |
|
1967 |
||
1968 |
1 to:list size do:[:rowNr | |
|
1969 |
rowNr ~~ firstSelectedIndex ifTrue:[ |
|
1970 |
(col at:rowNr) ~~ false ifTrue:[ |
|
1971 |
col at:rowNr put:false. |
|
1972 |
self invalidateRowAt:rowNr colAt:col columnNumber. |
|
1973 |
]. |
|
1974 |
] |
|
1975 |
] |
|
1976 |
]. |
|
1977 |
||
2695 | 1978 |
realValue := col at:firstSelectedIndex. |
1979 |
(realValue ~= newValue) ifTrue:[ |
|
1980 |
"/ some validation by the row-object; the stored value |
|
1981 |
"/ is different from what I think. |
|
1982 |
"/ update my input fields modelValue |
|
1983 |
||
1984 |
"/ just in case someone nilled or changed the editValue |
|
1985 |
"/ Q: is this CA's paranoia or could this really be done in the at:put: above ??? |
|
3518
ab2b4b5cfda0
Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
1986 |
"/ A (sv): it me happen, if the set method specified in the column descriptor did not set the |
ab2b4b5cfda0
Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
1987 |
"/ model. |
5723 | 1988 |
(editValueBefore == editValue) ifTrue:[ |
3518
ab2b4b5cfda0
Fix reset of editValue when changed model does not exept change
Stefan Vogel <sv@exept.de>
parents:
3512
diff
changeset
|
1989 |
editValue value:realValue withoutNotifying:self. |
3504 | 1990 |
]. |
2695 | 1991 |
]. |
1992 |
||
1993 |
modifiedChannel notNil ifTrue:[ |
|
1994 |
modifiedChannel value:true. |
|
1995 |
]. |
|
1996 |
! |
|
1997 |
||
1998 |
updateEditorFromChangedRow |
|
1999 |
|rowsValue rowNr| |
|
2000 |
||
2001 |
(rowNr := selectedRowIndex) isNumber ifFalse:[ |
|
2002 |
rowNr := rowNr first. |
|
2003 |
]. |
|
3504 | 2004 |
rowsValue := (self columnDescriptorAt:self selectedColIndex) at:rowNr. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2005 |
(editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2006 |
editValue value:rowsValue withoutNotifying:self. |
5723 | 2007 |
editView |
2008 |
withAllSubViewsDo:[:v | |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2009 |
v isInputField ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2010 |
v flash. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2011 |
] |
2695 | 2012 |
] |
2702 | 2013 |
]. |
3773 | 2014 |
! |
2015 |
||
2016 |
updateList |
|
2017 |
listHolder notNil ifTrue:[ |
|
2018 |
self list:listHolder value. |
|
2019 |
^ self |
|
2020 |
]. |
|
2021 |
model notNil ifTrue:[ |
|
2022 |
self list:model value. |
|
2023 |
^ self |
|
2024 |
]. |
|
809 | 2025 |
! ! |
2026 |
||
2027 |
!DSVColumnView methodsFor:'drag & drop'! |
|
2028 |
||
824 | 2029 |
canDrag |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2030 |
"returns true if dragging is enabled" |
5723 | 2031 |
|
824 | 2032 |
^ dropSource notNil |
2033 |
! |
|
2034 |
||
3140 | 2035 |
canStartDragAt:aPoint clickedAt:clickPoint |
2036 |
self canDrag ifFalse:[ |
|
2037 |
^ false |
|
2038 |
]. |
|
2039 |
^ (aPoint dist:clickPoint) > (UserPreferences current motionDistanceToStartDrag) |
|
2040 |
! |
|
2041 |
||
5809 | 2042 |
dragAutoScroll:aDropContext |
2575 | 2043 |
"called by the DragAndDropManager to scroll during a drag/drop operation |
5805 | 2044 |
if required (decided by the widget itself). |
2045 |
If a scroll is done, return true; |
|
2046 |
otherwise false (used to restore the background)" |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2047 |
|
2575 | 2048 |
|yInset absLnNr y| |
2049 |
||
5809 | 2050 |
(super dragAutoScroll:aDropContext) ifTrue:[^ true]. |
2051 |
||
2052 |
y := aDropContext targetPoint y. |
|
2575 | 2053 |
yInset := margin + rowHeight. |
2054 |
y > yInset ifTrue:[ |
|
2055 |
y >= (height - yInset) ifFalse:[^ false]. |
|
2056 |
]. |
|
2057 |
||
2058 |
absLnNr := self yVisibleToRowNr:y. |
|
2059 |
absLnNr isNil ifTrue:[^ false]. |
|
2060 |
||
2061 |
(absLnNr > 1 and:[absLnNr < self size]) ifFalse:[ |
|
2062 |
^ false |
|
2063 |
]. |
|
5809 | 2064 |
aDropContext contentsWillChange. |
2575 | 2065 |
|
5723 | 2066 |
y > yInset |
2580 | 2067 |
ifTrue:[self scrollDown:rowHeight] |
2068 |
ifFalse:[self scrollUp:rowHeight]. |
|
2575 | 2069 |
|
2070 |
^ true |
|
5805 | 2071 |
|
5809 | 2072 |
"Modified: / 14-06-2018 / 11:21:13 / Claus Gittinger" |
2575 | 2073 |
! |
2074 |
||
824 | 2075 |
dropSource |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2076 |
"returns the dropSource or nil" |
5723 | 2077 |
|
824 | 2078 |
^ dropSource |
2079 |
! |
|
2080 |
||
5723 | 2081 |
dropSource:aDropSourceOrNil |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2082 |
"set the dropSource or nil" |
5723 | 2083 |
|
824 | 2084 |
dropSource := aDropSourceOrNil. |
809 | 2085 |
! |
2086 |
||
824 | 2087 |
startDragAt:aPoint |
2398 | 2088 |
|
2089 |
dropSource notNil ifTrue:[ |
|
3140 | 2090 |
buttonReleaseAction := buttonMotionAction := nil. |
2398 | 2091 |
dropSource startDragIn:self at:aPoint. |
809 | 2092 |
] |
542 | 2093 |
! ! |
2094 |
||
637 | 2095 |
!DSVColumnView methodsFor:'drawing'! |
2096 |
||
5723 | 2097 |
colorOnDevice:aColor |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2098 |
"returns color on device" |
5723 | 2099 |
|
637 | 2100 |
|col| |
2101 |
||
641 | 2102 |
aColor = Color noColor ifFalse:[ |
2103 |
col := colorMap at:aColor ifAbsent:nil. |
|
2104 |
col isNil ifTrue:[ |
|
4991 | 2105 |
colorMap at:aColor put:(col := aColor onDevice:device) |
641 | 2106 |
]. |
2107 |
^ col |
|
637 | 2108 |
]. |
641 | 2109 |
^ bgColor |
637 | 2110 |
! |
2111 |
||
2112 |
forceRedraw |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2113 |
"a redraw forced by any other component" |
5723 | 2114 |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2115 |
shown ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2116 |
self invalidate |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2117 |
] |
637 | 2118 |
! |
2119 |
||
2120 |
invalidate |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2121 |
"recompute extent before repair range" |
5723 | 2122 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2123 |
self recomputeHeightOfContents. |
637 | 2124 |
super invalidate. |
2125 |
! |
|
2126 |
||
5723 | 2127 |
invalidateRowAt:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2128 |
"redraw total row at an index" |
5723 | 2129 |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2130 |
self invalidateRowAt:aRowNr colAt:0 |
637 | 2131 |
! |
2132 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2133 |
invalidateRowAt:aRowNr colAt:aColNr |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2134 |
"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
|
2135 |
or the complete visible row (in case of aColNr == 0). |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2136 |
If the row/column is hidden, no redraw is done" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2137 |
|
1497 | 2138 |
|x "{ Class:SmallInteger }" |
2139 |
y "{ Class:SmallInteger }" |
|
2140 |
h "{ Class:SmallInteger }" |
|
2141 |
w "{ Class:SmallInteger }" |
|
2523
a7d71e57632f
care for non-existing column
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
2142 |
col| |
1497 | 2143 |
|
2144 |
(shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[ |
|
1131 | 2145 |
h := rowHeight. |
1497 | 2146 |
y := self yVisibleOfRowNr:aRowNr. |
2147 |
||
2148 |
y < margin ifTrue:[ |
|
637 | 2149 |
(h := h + y) <= margin ifTrue:[ |
2150 |
^ self |
|
2151 |
]. "/ row not visible |
|
2152 |
h := h - margin. |
|
2153 |
y := margin. |
|
2154 |
] ifFalse:[ |
|
2155 |
y >= height ifTrue:[^ self]. |
|
2156 |
]. |
|
2157 |
aColNr ~~ 0 ifTrue:[ "/ redraw column in row |
|
3504 | 2158 |
col := (self columnDescriptorAt:aColNr). |
3672 | 2159 |
w := col isNil ifTrue:[0] ifFalse:[col width]. |
1497 | 2160 |
x := self xVisibleOfColNr:aColNr. |
2161 |
||
2162 |
x < margin ifTrue:[ |
|
637 | 2163 |
(w := w + x) <= margin ifTrue:[ |
2164 |
^ self |
|
2165 |
]. "/ column not visible |
|
2166 |
w := w - margin. |
|
2167 |
x := margin. |
|
2168 |
] ifFalse:[ |
|
2169 |
x >= width ifTrue:[^ self]. |
|
2170 |
] |
|
2171 |
] ifFalse:[ "/ redraw whole row |
|
2172 |
x := margin. |
|
2173 |
w := width. |
|
2174 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2175 |
self invalidateX:x y:y width:w height:h |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2176 |
] |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2177 |
! |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2178 |
|
2469
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2179 |
invalidateRows:aCollection |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2180 |
"redraw some visible rows" |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2181 |
|
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2182 |
shown ifTrue:[ |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2183 |
aCollection do:[:rowIndex | |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2184 |
self invalidateRowAt:rowIndex |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2185 |
] |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2186 |
] |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2187 |
! |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2188 |
|
1956 | 2189 |
invalidateRowsFrom:aStart to:aStop |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2190 |
"redraw visible row from start to stop" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2191 |
|
1956 | 2192 |
|size start stop y0 y1| |
2193 |
||
2194 |
shown ifTrue:[ |
|
2195 |
size := list size. |
|
2196 |
start := aStart notNil ifTrue:[aStart max:1] ifFalse:[1]. |
|
2197 |
stop := aStop notNil ifTrue:[aStop min:size] ifFalse:[size]. |
|
2198 |
||
2199 |
start <= stop ifTrue:[ |
|
2200 |
y0 := (self yVisibleOfRowNr:start) max:margin. |
|
2201 |
y1 := ((self yVisibleOfRowNr:stop) + rowHeight) min:height. |
|
2202 |
||
2203 |
y0 < y1 ifTrue:[ |
|
2204 |
self invalidateX:margin y:y0 width:width height:(y1 - y0) |
|
2205 |
] |
|
2206 |
] |
|
2207 |
] |
|
2208 |
! |
|
2209 |
||
3138 | 2210 |
invalidateSelection |
5214 | 2211 |
"invalidate (force async redraw) the current selection" |
2212 |
||
3504 | 2213 |
|colIndex| |
2214 |
||
5723 | 2215 |
shown ifTrue:[ |
3138 | 2216 |
colIndex := self selectedColIndex ? 0. |
2217 |
||
2218 |
self selectionIndicesDo:[:aRowIndex| |
|
2219 |
self invalidateRowAt:aRowIndex colAt:colIndex. |
|
2220 |
]. |
|
2221 |
] |
|
2222 |
! |
|
2223 |
||
5723 | 2224 |
invalidateVisibleRow:aRow |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2225 |
"redraw row if visible" |
5723 | 2226 |
|
2190 | 2227 |
self invalidateVisibleRow:aRow colAt:0 |
809 | 2228 |
! |
2229 |
||
2190 | 2230 |
invalidateVisibleRow:aRow colAt:aColNr |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2231 |
"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
|
2232 |
or the complete visible row (in case of aColNr == 0). |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2233 |
If the row/column is hidden, no redraw is done" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2234 |
|
637 | 2235 |
|start "{ Class:SmallInteger }" |
2236 |
stop "{ Class:SmallInteger }" |
|
2237 |
| |
|
2238 |
||
2239 |
(start := self indexOfFirstRowShown) ~~ 0 ifTrue:[ |
|
1497 | 2240 |
stop := (start + (height // rowHeight)) min:(list size). |
637 | 2241 |
|
2242 |
aRow isNumber ifTrue:[ |
|
2243 |
(aRow between:start and:stop) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2244 |
self invalidateRowAt:aRow colAt:aColNr |
637 | 2245 |
] |
2246 |
] ifFalse:[ |
|
2247 |
start to:stop do:[:i| |
|
2248 |
(self at:i) == aRow ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2249 |
^ self invalidateRowAt:i colAt:aColNr |
637 | 2250 |
] |
2251 |
] |
|
2252 |
] |
|
2253 |
] |
|
809 | 2254 |
! |
2255 |
||
2190 | 2256 |
invalidateVisibleRow:aRow readSelector:aSelector |
809 | 2257 |
"redraw a column identified by its read selector; if no column with |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2258 |
the specified read selector is detected, the whole line is drawn." |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2259 |
|
809 | 2260 |
|row idx| |
2261 |
||
2262 |
aSelector isNil ifTrue:[ |
|
2263 |
idx := 0 |
|
2264 |
] ifFalse:[ |
|
2265 |
(row := aRow) isNumber ifTrue:[ |
|
2266 |
(row := self at:aRow) isNil ifTrue:[ ^ self ] |
|
2267 |
]. |
|
5723 | 2268 |
idx := columnDescriptors |
4686 | 2269 |
findFirst:[:aCol| aCol description readSelector == aSelector] |
809 | 2270 |
]. |
2190 | 2271 |
self invalidateVisibleRow:aRow colAt:idx |
637 | 2272 |
! |
2273 |
||
2274 |
redrawX:x y:y width:w height:h |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2275 |
"redraw part of myself immediately, given logical coordinates " |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2276 |
|
4161 | 2277 |
|c0 savClip stopRedraw selWidth |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2278 |
start "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2279 |
stop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2280 |
x0 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2281 |
x1 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2282 |
maxX "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2283 |
yTop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2284 |
yBot "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2285 |
clHg "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2286 |
size "{ Class:SmallInteger }" |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2287 |
lineColor |
637 | 2288 |
| |
2289 |
||
2290 |
shown ifFalse:[^ self]. |
|
3993
6840bc23b584
changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
2291 |
self isReallyShown ifFalse:[^ self]. |
6840bc23b584
changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
2292 |
|
5421 | 2293 |
gc paint:bgColor. |
1115 | 2294 |
|
2295 |
columnDescriptors isEmpty ifTrue:[ |
|
5421 | 2296 |
^ gc fillRectangleX:x y:y width:w height:h |
1115 | 2297 |
]. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2298 |
|
1131 | 2299 |
size := list size. |
5723 | 2300 |
yTop := margin - viewOrigin y. |
1115 | 2301 |
c0 := y - yTop max:0. |
2302 |
start := (c0 // rowHeight) + 1. |
|
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2303 |
stop := (((c0 + h - 1) // rowHeight) + 1) min:size. |
1115 | 2304 |
|
2305 |
stop < start ifTrue:[ |
|
5421 | 2306 |
^ gc fillRectangleX:x y:y width:w height:h |
1115 | 2307 |
]. |
4521 | 2308 |
savClip := self clippingBoundsOrNil. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2309 |
|
1115 | 2310 |
maxX := (x + w) min:(width - margin). |
2311 |
x0 := margin - viewOrigin x. |
|
2312 |
yTop := yTop + ((start - 1) * rowHeight). |
|
1131 | 2313 |
clHg := (stop - start + 1) * rowHeight. |
2314 |
yBot := yTop + clHg. |
|
2315 |
||
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2316 |
stopRedraw := false. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2317 |
|
5737 | 2318 |
self class stopRedrawSignal handle:[:ex | |
2319 |
"/ redraw aborted due to too many changes while drawing. |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2320 |
stopRedraw := true. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2321 |
] do:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2322 |
columnDescriptors do:[:aCol| |cw| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2323 |
x1 := x0 + aCol width. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2324 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2325 |
(x1 > x and:[x0 < maxX]) ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2326 |
|left right rect| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2327 |
left := x0 max:x. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2328 |
right := x1 min:maxX. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2329 |
rect := Rectangle left:left top:y width:(right - left) height:h. |
5723 | 2330 |
|
5737 | 2331 |
"/ self clippingBounds:nil. |
5204 | 2332 |
self clippingBounds:rect. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2333 |
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
|
2334 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2335 |
x0 := x1 |
1115 | 2336 |
]. |
2337 |
]. |
|
1131 | 2338 |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2339 |
"/ restore old clipping rectangle |
4521 | 2340 |
self clippingBounds:savClip. |
1131 | 2341 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2342 |
stopRedraw ifTrue:[ |
5737 | 2343 |
"/ redraw aborted due to too many changes while drawing. |
2344 |
"/ try again after some grace period |
|
2345 |
Processor addTimedBlock:[self invalidate] after:0.1 seconds. |
|
2346 |
"/ self invalidate. |
|
2347 |
"/ self makeSelectionVisible. |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2348 |
^ self |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2349 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2350 |
|
1131 | 2351 |
stop == size ifTrue:[ |
1115 | 2352 |
yTop := y + h. |
2353 |
yBot < (yTop - margin) ifTrue:[ |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2354 |
"/ clear to bottom of screen |
5421 | 2355 |
gc paint:bgColor. |
2356 |
gc fillRectangleX:x y:yBot width:w height:(yTop - yBot). |
|
1112 | 2357 |
] |
1136 | 2358 |
]. |
2359 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2360 |
(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
|
2361 |
"/ clear to right of screen |
5421 | 2362 |
gc paint:bgColor. |
2363 |
gc fillRectangleX:x1 y:y width:c0 height:h. |
|
1136 | 2364 |
]. |
4161 | 2365 |
"/ if only rows are selected we have to draw |
2366 |
"/ - the selection frame around the labels |
|
2367 |
"/ - and to fill the selection area behind the table if not bound to the width of the view |
|
2368 |
||
2369 |
self hasRowSelection ifFalse:[ ^ self ]. "/ nothing to do |
|
2370 |
||
2371 |
selWidth := width-margin-x1. |
|
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2372 |
lineColor := self selectionFrameColor. |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2373 |
|
4161 | 2374 |
self selectionIndicesDo:[:rowNr | |
2375 |
| yVis | |
|
2376 |
yVis := self yVisibleOfRowNr:rowNr. |
|
2377 |
selWidth > 0 ifTrue:[ |
|
5421 | 2378 |
gc paint:selectionBackgroundColor. |
2379 |
gc fillRectangleX:x1 y:yVis width:selWidth height:rowHeight. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2380 |
]. |
4161 | 2381 |
lineColor notNil ifTrue:[ |
5421 | 2382 |
gc paint:lineColor. |
2383 |
gc displayLineFromX:x y:yVis toX:width y:yVis. |
|
4161 | 2384 |
yVis := yVis+rowHeight -1. |
5421 | 2385 |
gc displayLineFromX:x y:yVis toX:width y:yVis. |
4161 | 2386 |
]. |
5723 | 2387 |
]. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2388 |
|
3993
6840bc23b584
changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
2389 |
"Modified: / 21-01-2011 / 15:58:11 / cg" |
1112 | 2390 |
! ! |
2391 |
||
2392 |
!DSVColumnView methodsFor:'drawing interactors'! |
|
2393 |
||
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2394 |
displayLabel:aLabel x:xLeft y:yTop |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2395 |
"display the label at x y; test whether the height of the label matches to the current |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2396 |
rowHeight. If not, an exception is raised and the rowHeight is recomputed" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2397 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2398 |
|y h | |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2399 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2400 |
aLabel notNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2401 |
aLabel isString ifTrue:[ |
2593
24ddc48c5ad4
bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents:
2592
diff
changeset
|
2402 |
y := yTop + self rowFontAscent. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2403 |
] ifFalse:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2404 |
h := aLabel heightOn:self. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2405 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2406 |
h > minRowHeight ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2407 |
minRowHeight := h. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2408 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
2409 |
cachedPreferredExtent notNil ifTrue:[ |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
2410 |
"/ rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
5723 | 2411 |
cachedPreferredExtent := Point |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
2412 |
x: cachedPreferredExtent x |
3172
65f4533fbf75
preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents:
3149
diff
changeset
|
2413 |
y: (list size * rowHeight). |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2414 |
self contentsChanged. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2415 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2416 |
self class stopRedrawSignal raiseRequest. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2417 |
]. |
2593
24ddc48c5ad4
bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents:
2592
diff
changeset
|
2418 |
y := yTop + (aLabel ascentOn:self). |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2419 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2420 |
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
|
2421 |
]. |
3172
65f4533fbf75
preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents:
3149
diff
changeset
|
2422 |
|
65f4533fbf75
preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents:
3149
diff
changeset
|
2423 |
"Modified: / 05-02-2007 / 09:07:10 / cg" |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2424 |
! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2425 |
|
3504 | 2426 |
drawCheckToggleAtX:xLeft y:yTop w:cellWidth state:cellValue |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2427 |
"draw a check toggle button" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2428 |
|
1112 | 2429 |
|e form |
2430 |
y "{ Class:SmallInteger }" |
|
2431 |
x "{ Class:SmallInteger }" |
|
2432 |
h "{ Class:SmallInteger }" |
|
2433 |
w "{ Class:SmallInteger }" |
|
3504 | 2434 |
state| |
2435 |
||
2436 |
state := (cellValue ? false). |
|
2437 |
state isBoolean ifFalse:[ state := false ]. |
|
2438 |
||
1112 | 2439 |
w := checkToggleExtent x. |
2440 |
h := checkToggleExtent y. |
|
3504 | 2441 |
y := yTop + ((rowHeight - h) // 2). |
2442 |
x := xLeft + ((cellWidth - w) // 2). |
|
1529 | 2443 |
h odd ifTrue:[y := y + 1]. |
1112 | 2444 |
|
3504 | 2445 |
checkToggleActiveImage isNil ifTrue:[ |
5421 | 2446 |
gc paint:bgColor. |
2447 |
gc fillRectangleX:x y:y width:w height:h. |
|
5890 | 2448 |
self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self. |
1131 | 2449 |
|
3504 | 2450 |
state ifFalse:[ |
1112 | 2451 |
^ self |
2452 |
]. |
|
5421 | 2453 |
gc paint:fgColor on:bgColor. |
1112 | 2454 |
form := checkToggleForm |
2455 |
] ifFalse:[ |
|
5890 | 2456 |
form := self isEnabled |
2457 |
ifTrue:[ |
|
2458 |
state |
|
2459 |
ifTrue:[checkToggleActiveImage] |
|
2460 |
ifFalse:[checkTogglePassiveImage]] |
|
2461 |
ifFalse:[ |
|
2462 |
state |
|
2463 |
ifTrue:[(checkToggleDisabledActiveImage ? checkToggleActiveImage)] |
|
2464 |
ifFalse:[(checkToggleDisabledPassiveImage ? checkTogglePassiveImage)]]. |
|
859 | 2465 |
]. |
1112 | 2466 |
e := (checkToggleExtent - form extent) // 2. |
5421 | 2467 |
gc displayForm:form x:(x + e x) y:(y + e y). |
5890 | 2468 |
|
2469 |
"Modified: / 17-08-2018 / 17:33:03 / Claus Gittinger" |
|
1112 | 2470 |
! |
2471 |
||
1131 | 2472 |
drawComboButtonAtX:xTop y:yTop w:rowWidth |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2473 |
"draw a combo button" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2474 |
|
1112 | 2475 |
|e |
2476 |
x "{ Class:SmallInteger }" |
|
2477 |
y "{ Class:SmallInteger }" |
|
2478 |
h "{ Class:SmallInteger }" |
|
3504 | 2479 |
w "{ Class:SmallInteger }"| |
2480 |
||
1112 | 2481 |
w := comboButtonExtent x. |
2482 |
h := comboButtonExtent y. |
|
3504 | 2483 |
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
|
2484 |
x := xTop + (rowWidth - w - separatorSize - 1). |
1112 | 2485 |
e := (comboButtonExtent - comboButtonForm extent) // 2. |
2486 |
||
5421 | 2487 |
gc paint:bgColor. |
2488 |
gc fillRectangleX:x y:y width:w height:h. |
|
1131 | 2489 |
self drawEdgesAtX:x y:y width:w height:h level:comboButtonLevel on:self. |
5421 | 2490 |
gc paint:fgColor on:bgColor. |
5890 | 2491 |
gc |
2492 |
displayForm: |
|
2493 |
(self isEnabled |
|
2494 |
ifTrue:[comboButtonForm] |
|
2495 |
ifFalse:[comboButtonDisabledForm ? comboButtonForm]) |
|
2496 |
x:(x + e x) |
|
2497 |
y:(y + e y) |
|
2498 |
||
2499 |
"Modified: / 17-08-2018 / 17:35:20 / Claus Gittinger" |
|
1112 | 2500 |
! |
2501 |
||
5723 | 2502 |
drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2503 |
"draw edges for a cell or label" |
5723 | 2504 |
|
2505 |
aGC |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2506 |
drawEdgesForX:x |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2507 |
y:y |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2508 |
width:w |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2509 |
height:h |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2510 |
level:aLevel |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2511 |
shadow:buttonShadowColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2512 |
light:buttonLightColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2513 |
halfShadow:buttonHalfShadowColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2514 |
halfLight:buttonHalfLightColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2515 |
style:ButtonEdgeStyle. |
3504 | 2516 |
! |
2517 |
||
5447 | 2518 |
drawRadioButtonAtX:xLeft y:yTop w:cellWidth state:aBooleanOrNil |
3504 | 2519 |
"draw a radio button" |
2520 |
||
2521 |
|image |
|
2522 |
y "{ Class:SmallInteger }" |
|
2523 |
x "{ Class:SmallInteger }" |
|
2524 |
h "{ Class:SmallInteger }" |
|
2525 |
w "{ Class:SmallInteger }"| |
|
2526 |
||
2527 |
w := radioButtonActiveImage extent x. |
|
2528 |
h := radioButtonActiveImage extent y. |
|
2529 |
y := yTop + ((rowHeight - h) // 2). |
|
2530 |
x := xLeft + ((cellWidth - w) // 2). |
|
2531 |
h odd ifTrue:[y := y + 1]. |
|
2532 |
||
5890 | 2533 |
image := self isEnabled |
2534 |
ifTrue:[ |
|
2535 |
(aBooleanOrNil == true) |
|
2536 |
ifTrue:[radioButtonActiveImage] |
|
2537 |
ifFalse:[radioButtonPassiveImage]] |
|
2538 |
ifFalse:[ |
|
2539 |
(aBooleanOrNil == true) |
|
2540 |
ifTrue:[radioButtonDisabledActiveImage ? radioButtonActiveImage] |
|
2541 |
ifFalse:[radioButtonDisabledPassiveImage ? radioButtonPassiveImage]]. |
|
3504 | 2542 |
|
4991 | 2543 |
image := image onDevice:device. |
3504 | 2544 |
|
2545 |
self displayForm:image x:x y:y. |
|
5447 | 2546 |
|
2547 |
"Modified (format): / 04-02-2017 / 21:31:16 / cg" |
|
5890 | 2548 |
"Modified: / 17-08-2018 / 17:36:23 / Claus Gittinger" |
637 | 2549 |
! ! |
2550 |
||
542 | 2551 |
!DSVColumnView methodsFor:'enumerating columns'! |
2552 |
||
3504 | 2553 |
columnsDo:aOneArgBlock |
2554 |
"evaluate the argument, aOneArgBlock for every columnDescriptor" |
|
5723 | 2555 |
|
542 | 2556 |
columnDescriptors do:aOneArgBlock |
2557 |
! |
|
2558 |
||
5723 | 2559 |
columnsFrom:start to:stop do:aOneArgBlock |
542 | 2560 |
"evaluate the argument, aOneArgBlock for the columns with index start to |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2561 |
stop in the collection of column descriptors" |
5723 | 2562 |
|
2563 |
columnDescriptors |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2564 |
from:start |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2565 |
to:stop |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2566 |
do:aOneArgBlock |
542 | 2567 |
! ! |
2568 |
||
2569 |
!DSVColumnView methodsFor:'event handling'! |
|
2570 |
||
3140 | 2571 |
buttonControlPressAt:clickPoint rowNr:aRowNr colNr:aColNr |
2398 | 2572 |
|isSelected prvRow doAdd chgSet| |
2573 |
||
3140 | 2574 |
buttonMotionAction := buttonReleaseAction := nil. |
3239 | 2575 |
isSelected := self isInSelection:aRowNr. |
2576 |
||
3140 | 2577 |
multipleSelectOk ifFalse:[ |
3239 | 2578 |
isSelected ifTrue:[ |
2579 |
self deselect. |
|
2580 |
] ifFalse:[ |
|
2581 |
self selectRowAt:aRowNr colAt:aColNr atPoint:clickPoint openEditor:false. |
|
2582 |
]. |
|
3140 | 2583 |
^ self |
2584 |
]. |
|
2585 |
||
2586 |
isSelected ifTrue:[ self removeRowFromSelection:aRowNr ] |
|
2587 |
ifFalse:[ self addRowToSelection:aRowNr ]. |
|
2398 | 2588 |
|
2589 |
multipleSelectOk ifFalse:[ ^ self ]. |
|
2590 |
||
3140 | 2591 |
prvRow := aRowNr. |
2398 | 2592 |
chgSet := IdentitySet new. |
2593 |
doAdd := isSelected not. |
|
2594 |
||
5723 | 2595 |
buttonMotionAction := [:p| |
2907 | 2596 |
|rowNr mustRestore step f| |
2597 |
||
2398 | 2598 |
rowNr := self yVisibleToRowNr:(p y). |
2599 |
(rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[ |
|
3140 | 2600 |
rowNr == aRowNr ifTrue:[ |
2398 | 2601 |
mustRestore := true |
2602 |
] ifFalse:[ |
|
3140 | 2603 |
rowNr > aRowNr ifTrue:[ mustRestore := (rowNr < prvRow) ] |
2604 |
ifFalse:[ mustRestore := (rowNr > prvRow) ]. |
|
2398 | 2605 |
]. |
2606 |
prvRow > rowNr ifTrue:[ step := -1 ] |
|
2607 |
ifFalse:[ step := 1 ]. |
|
2907 | 2608 |
|
2609 |
||
2398 | 2610 |
mustRestore ifTrue:[ |
2611 |
[ prvRow ~~ rowNr ] whileTrue:[ |
|
2612 |
(chgSet removeIdentical:prvRow ifAbsent:nil) notNil ifTrue:[ |
|
2613 |
doAdd ifFalse:[ self addRowToSelection:prvRow ] |
|
2614 |
ifTrue:[ self removeRowFromSelection:prvRow ]. |
|
2615 |
]. |
|
2616 |
prvRow := prvRow + step. |
|
2617 |
]. |
|
2618 |
] ifFalse:[ |
|
2619 |
[ prvRow ~~ rowNr ] whileTrue:[ |
|
2620 |
prvRow := prvRow + step. |
|
2621 |
||
2622 |
doAdd ~~ (self isInSelection:rowNr) ifTrue:[ |
|
2623 |
chgSet add:prvRow. |
|
2624 |
||
2625 |
doAdd ifTrue:[ self addRowToSelection:prvRow ] |
|
2626 |
ifFalse:[ self removeRowFromSelection:prvRow ]. |
|
2627 |
] |
|
2628 |
]. |
|
2629 |
]. |
|
2630 |
]. |
|
2631 |
]. |
|
3130
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
2632 |
|
3239 | 2633 |
"Modified: / 21-07-2007 / 22:00:27 / cg" |
2398 | 2634 |
! |
2635 |
||
5723 | 2636 |
buttonMotion:buttonMask x:x y:y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2637 |
"mouse-move while button was pressed - handle multiple selection changes" |
5723 | 2638 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2639 |
self isEnabled ifFalse:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2640 |
^ self |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2641 |
]. |
2788
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
2642 |
|
2398 | 2643 |
buttonMotionAction notNil ifTrue:[ |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2644 |
buttonMotionAction value:(x @ y). |
2398 | 2645 |
buttonMotionAction notNil ifTrue:[ |
2646 |
autoScroll ifTrue:[ |
|
2647 |
"/ if moved outside of view, start autoscroll |
|
2648 |
(y < 0) ifTrue:[ |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2649 |
^ self startAutoScroll:#scrollUp distance:y. |
2398 | 2650 |
]. |
2651 |
(y > height) ifTrue:[ |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2652 |
^ self startAutoScroll:#scrollDown distance:(y - height). |
2398 | 2653 |
]. |
2654 |
] |
|
607 | 2655 |
] |
2656 |
]. |
|
2398 | 2657 |
self stopAutoScroll. |
607 | 2658 |
! |
2659 |
||
542 | 2660 |
buttonMultiPress:button x:x y:y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2661 |
"a button was pressed twice - handle doubleclick here" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2662 |
|
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2663 |
|selectedCol| |
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2664 |
|
2398 | 2665 |
buttonMotionAction := buttonReleaseAction := nil. |
2666 |
||
1805 | 2667 |
self isEnabled ifFalse:[^ self]. |
2668 |
||
3742
a4bb22bc79e2
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3702
diff
changeset
|
2669 |
(button == 1) ifFalse:[ |
542 | 2670 |
^ super buttonMultiPress:button x:x y:y |
2671 |
]. |
|
607 | 2672 |
self numberOfSelections == 1 ifTrue:[ |
2673 |
self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[ |
|
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2674 |
selectedCol := self selectedColIndex. |
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2675 |
( selectedCol == 0 |
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2676 |
or:[selectedCol == (self xVisibleToColNr:x)] |
607 | 2677 |
) ifTrue:[ |
2678 |
self doubleClicked |
|
2679 |
] |
|
542 | 2680 |
] |
2681 |
] |
|
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2682 |
|
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2683 |
"Modified: / 26-03-2007 / 15:19:04 / cg" |
542 | 2684 |
! |
2685 |
||
2686 |
buttonPress:button x:x y:y |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2687 |
"a button was pressed - handle selection here" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2688 |
|
4664 | 2689 |
|rowNr colNr sensor clickPoint clickedIntoSelection column columnEditorType| |
2802 | 2690 |
|
2398 | 2691 |
buttonMotionAction := buttonReleaseAction := nil. |
542 | 2692 |
|
1805 | 2693 |
self isEnabled ifFalse:[^ self]. |
2694 |
||
4664 | 2695 |
rowNr := self yVisibleToRowNr:y. |
2696 |
colNr := self xVisibleToColNr:x. |
|
2697 |
||
5895 | 2698 |
(button == 2) ifTrue:[ |
2699 |
|openMenu| |
|
2700 |
||
4664 | 2701 |
openMenu := false. |
5723 | 2702 |
|
3922 | 2703 |
UserPreferences current selectOnRightClick ifFalse:[ |
4664 | 2704 |
openMenu := true. |
2705 |
] ifTrue:[ |
|
2706 |
UserPreferences current showRightButtonMenuOnRelease ifFalse:[ |
|
2707 |
(rowNr notNil and:[colNr notNil and:[self isRowSelectable:rowNr]]) ifTrue:[ |
|
2708 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false |
|
2709 |
]. |
|
2710 |
openMenu := true. |
|
2711 |
]. |
|
2712 |
]. |
|
5895 | 2713 |
openMenu ifTrue:[ |
2714 |
|menu| |
|
2715 |
||
3922 | 2716 |
menu := self findMenuForSelection. |
5723 | 2717 |
menu notNil ifTrue:[ |
3922 | 2718 |
self startUpMenu:menu. |
4664 | 2719 |
] ifFalse:[ |
2720 |
super buttonPress:button x:x y:y. |
|
3922 | 2721 |
]. |
3504 | 2722 |
^ self |
4664 | 2723 |
]. |
2724 |
]. |
|
5723 | 2725 |
|
2804
8204b926377d
oops - firstRow could be nil
Claus Gittinger <cg@exept.de>
parents:
2802
diff
changeset
|
2726 |
(rowNr isNil or:[colNr isNil]) ifTrue:[ |
2722 | 2727 |
self deselect. |
2398 | 2728 |
super buttonPress:button x:x y:y. |
2729 |
^ self |
|
2730 |
]. |
|
2731 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2732 |
(self isRowSelectable:rowNr) ifFalse:[^ self ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2733 |
|
3140 | 2734 |
sensor := self sensor. |
2735 |
clickPoint := x @ y. |
|
2813 | 2736 |
|
2398 | 2737 |
sensor shiftDown ifTrue:[ |
3140 | 2738 |
self buttonShiftPressAt:clickPoint rowNr:rowNr colNr:colNr. |
2398 | 2739 |
^ self |
2740 |
]. |
|
2802 | 2741 |
sensor ctrlDown ifTrue:[ |
3140 | 2742 |
self buttonControlPressAt:clickPoint rowNr:rowNr colNr:colNr. |
2743 |
^ self |
|
2744 |
]. |
|
2745 |
||
2746 |
multipleSelectOk ifFalse:[ |
|
2747 |
self canDrag ifFalse:[ |
|
2748 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true. |
|
2749 |
^ self |
|
2750 |
]. |
|
2751 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false. |
|
2752 |
||
3923 | 2753 |
((button == 2) and:[UserPreferences current selectOnRightClick]) ifTrue:[ |
5723 | 2754 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true |
3922 | 2755 |
] ifFalse:[ |
5723 | 2756 |
buttonReleaseAction := |
2757 |
[ |
|
6043 | 2758 |
buttonReleaseAction := nil. |
2759 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true. |
|
3922 | 2760 |
]. |
2761 |
||
5723 | 2762 |
buttonMotionAction := |
3922 | 2763 |
[:aPoint| |
2764 |
(self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[ |
|
2765 |
self startDragAt:aPoint |
|
2766 |
] |
|
2767 |
]. |
|
2768 |
]. |
|
3140 | 2769 |
^ self |
2770 |
]. |
|
2771 |
||
3923 | 2772 |
((button == 2) and:[UserPreferences current selectOnRightClick]) ifFalse:[ |
5723 | 2773 |
buttonReleaseAction := |
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2774 |
[ |
6043 | 2775 |
buttonReleaseAction := nil. |
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2776 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true. |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2777 |
]. |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2778 |
|
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2779 |
"/ normally, we select on button release; however, any editor is shown immediately |
5723 | 2780 |
((column := self columnDescriptorAt:colNr) notNil |
6043 | 2781 |
and:[ (columnEditorType := column description editorType) notNil |
2782 |
and:[ columnEditorType ~~ #None ]] |
|
2783 |
) ifTrue:[ |
|
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2784 |
buttonReleaseAction value. |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2785 |
buttonReleaseAction := nil. |
6043 | 2786 |
(editView notNil and:[editView isDialogBox]) ifTrue:[ |
2787 |
editView := nil. |
|
2788 |
]. |
|
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2789 |
editView notNil ifTrue:[ |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2790 |
^ self. |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2791 |
] |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2792 |
] |
3922 | 2793 |
]. |
2794 |
||
3140 | 2795 |
clickedIntoSelection := self isInSelection:rowNr. |
5723 | 2796 |
clickedIntoSelection ifTrue:[ |
3908
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2797 |
|selColIdx| |
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2798 |
|
3140 | 2799 |
selColIdx := self selectedColIndex. |
2800 |
||
2801 |
(selColIdx ~~ 0 and:[selColIdx ~~ colNr]) ifTrue:[ |
|
2802 |
clickedIntoSelection := (selectedRowIndex size > 1) |
|
2803 |
]. |
|
2804 |
]. |
|
2805 |
||
2806 |
clickedIntoSelection ifFalse:[ |
|
2807 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false. |
|
2808 |
] ifTrue:[ |
|
2809 |
self canDrag ifTrue:[ |
|
5723 | 2810 |
buttonMotionAction := |
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2811 |
[:aPoint| |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2812 |
(self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[ |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2813 |
self startDragAt:aPoint |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2814 |
] |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2815 |
]. |
3140 | 2816 |
^ self |
2802 | 2817 |
] |
2818 |
]. |
|
2788
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
2819 |
|
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
2820 |
buttonMotionAction := [:p| |
5723 | 2821 |
(self bounds containsPoint:p) ifTrue:[ |
3908
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2822 |
|rowUnderPoint| |
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2823 |
|
3140 | 2824 |
rowUnderPoint := self yVisibleToRowNr:(p y). |
2825 |
||
2826 |
rowUnderPoint notNil ifTrue:[ |
|
2827 |
buttonReleaseAction notNil ifTrue:[ |
|
5723 | 2828 |
rowUnderPoint == rowNr ifFalse:[ |
3140 | 2829 |
buttonReleaseAction := nil |
2907 | 2830 |
]. |
2831 |
]. |
|
3140 | 2832 |
buttonReleaseAction isNil ifTrue:[ |
2833 |
self selectRowFrom:rowNr to:rowUnderPoint. |
|
2834 |
] |
|
2835 |
] |
|
2907 | 2836 |
]. |
2837 |
]. |
|
3908
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2838 |
|
4056 | 2839 |
"Modified: / 12-07-2011 / 14:54:45 / cg" |
6043 | 2840 |
"Modified: / 23-04-2019 / 19:53:40 / Claus Gittinger" |
542 | 2841 |
! |
2842 |
||
643 | 2843 |
buttonRelease:button x:x y:y |
2844 |
||
2398 | 2845 |
buttonMotionAction := nil. |
1749 | 2846 |
self stopAutoScroll. |
2847 |
||
2398 | 2848 |
buttonReleaseAction notNil ifTrue:[ |
2849 |
buttonReleaseAction value. |
|
2850 |
buttonReleaseAction := nil. |
|
643 | 2851 |
]. |
2852 |
super buttonRelease:button x:x y:y |
|
2853 |
! |
|
2854 |
||
3140 | 2855 |
buttonShiftPressAt:clickPoint rowNr:aRowNr colNr:aColNr |
2856 |
|colIdx numSelRows| |
|
2857 |
||
2858 |
buttonReleaseAction := buttonMotionAction := nil. |
|
2859 |
||
2860 |
colIdx := aColNr. |
|
2861 |
||
2862 |
(multipleSelectOk and:[(numSelRows := selectedRowIndex size) > 0]) ifTrue:[ |
|
2863 |
(numSelRows == 1 and:[self isInSelection:aRowNr]) ifFalse:[ |min max| |
|
2864 |
min := max := aRowNr. |
|
2865 |
||
2866 |
selectedRowIndex do:[:anIndex| |
|
2867 |
min := min min:anIndex. |
|
2868 |
max := max max:anIndex. |
|
2869 |
]. |
|
2870 |
self selectRowFrom:min to:max. |
|
2871 |
^ self |
|
2872 |
]. |
|
2873 |
self selectedColIndex ~~ 0 ifTrue:[ "/ toggle column selection |
|
2874 |
colIdx := 0 |
|
2875 |
]. |
|
2876 |
]. |
|
2877 |
self selectRowAt:aRowNr colAt:colIdx atPoint:clickPoint openEditor:false. |
|
2878 |
! |
|
2879 |
||
809 | 2880 |
characterPress:aChar x:x y:y |
4176 | 2881 |
"search row in column at x/y starting its printable label with character." |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2882 |
|
809 | 2883 |
|colNr rowNr lsize found column| |
2884 |
||
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2885 |
lsize := list size. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2886 |
|
5723 | 2887 |
"/ (rowIfAbsentBlock notNil |
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2888 |
"/ or:[x isNil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2889 |
"/ or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2890 |
"/ ^ self |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2891 |
"/ ]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2892 |
colNr := self findFirstColumnWithStringFrom:1 to:lsize. |
2535 | 2893 |
colNr isNil ifTrue:[ ^ self ]. |
2894 |
||
809 | 2895 |
rowNr := self lastIndexSelected. |
3504 | 2896 |
column := self columnDescriptorAt:colNr. |
809 | 2897 |
found := 0. |
2898 |
||
2899 |
lsize > rowNr ifTrue:[ |
|
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2900 |
"/ search to end |
809 | 2901 |
found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize. |
2902 |
]. |
|
2903 |
||
2904 |
(found == 0 and:[rowNr > 1]) ifTrue:[ |
|
2905 |
"/ search from begin |
|
2906 |
found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1) |
|
2907 |
]. |
|
2908 |
found ~~ 0 ifTrue:[ |
|
2909 |
self selectColIndex:colNr rowIndex:found. |
|
2910 |
]. |
|
2911 |
||
896
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2912 |
"Modified: / 21.5.1998 / 03:30:22 / cg" |
809 | 2913 |
! |
2914 |
||
542 | 2915 |
contentsChanged |
4257 | 2916 |
"size of contents changed - move origin up if possible" |
5723 | 2917 |
|
542 | 2918 |
|y| |
2919 |
||
2920 |
shown ifTrue:[ |
|
2921 |
self recomputeHeightOfContents. |
|
2922 |
y := self maxViewOriginY. |
|
2923 |
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
|
2924 |
scrollWhenUpdating ~~ false ifTrue:[ |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
2925 |
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
|
2926 |
] |
542 | 2927 |
] ifFalse:[ |
2928 |
self updateEditViewOrigin. |
|
2929 |
] |
|
2930 |
]. |
|
2931 |
super contentsChanged |
|
2932 |
! |
|
2933 |
||
2816 | 2934 |
cursorKey:aKey rawKey:rawKey |
2935 |
|hasSelectables step start minSelRowNr maxSelRowNr selColNr selRowNr listSize| |
|
2936 |
||
2937 |
hasSelectables := self hasSelectables. |
|
2938 |
listSize := list size. |
|
2939 |
||
2940 |
(hasSelectables or:[selectRowOnDefault]) ifFalse:[ ^ self ]. |
|
2941 |
||
2942 |
minSelRowNr := self minIndexSelected. |
|
2943 |
maxSelRowNr := self maxIndexSelected. |
|
2944 |
||
2960 | 2945 |
selColNr := hasSelectables ifFalse:[0] ifTrue:[self selectedColIndex]. |
2816 | 2946 |
|
2947 |
aKey == #CursorUp ifTrue:[ |
|
2948 |
selRowNr := minSelRowNr > 1 ifTrue:[minSelRowNr - 1] ifFalse:[listSize]. |
|
2949 |
step := -1. |
|
2950 |
] ifFalse:[ |
|
2951 |
aKey == #CursorDown ifTrue:[ |
|
2952 |
selRowNr := maxSelRowNr < listSize ifTrue:[maxSelRowNr + 1] ifFalse:[1]. |
|
2953 |
step := 1. |
|
2954 |
] ifFalse:[ |
|
2955 |
("aKey == #BeginOfLine or:[" rawKey == #Home "]") ifTrue:[ |
|
2956 |
selRowNr := 1. |
|
2957 |
step := 1. |
|
2958 |
] ifFalse:[ |
|
2959 |
(rawKey == #End) ifTrue:[ |
|
2960 |
selRowNr := listSize. |
|
2961 |
step := -1. |
|
2962 |
] |
|
2963 |
] |
|
2964 |
] |
|
2965 |
]. |
|
2966 |
start := selRowNr. |
|
2967 |
||
2968 |
[ self isRowSelectable:selRowNr ] whileFalse:[ |
|
2969 |
selRowNr := selRowNr + step. |
|
2970 |
||
2971 |
selRowNr == 0 ifTrue:[ |
|
2972 |
selRowNr := listSize. |
|
2973 |
] ifFalse:[ |
|
2974 |
selRowNr > listSize ifTrue:[ |
|
2975 |
selRowNr := 1. |
|
2976 |
]. |
|
2977 |
]. |
|
2978 |
selRowNr == start ifTrue:[^ self ]. |
|
2979 |
]. |
|
2980 |
||
2981 |
((aKey == #CursorUp) or:[aKey == #CursorDown]) ifTrue:[ |
|
2982 |
(multipleSelectOk and:[self sensor shiftDown]) ifTrue:[ |
|
2983 |
self addRowToSelection:selRowNr. |
|
2984 |
||
2985 |
aKey == #CursorDown ifTrue:[ |
|
2986 |
self makeLineVisible:((selRowNr+1) min:listSize) |
|
2987 |
] ifFalse:[ |
|
2988 |
self makeLineVisible:((selRowNr-1) max:1) |
|
2989 |
]. |
|
2990 |
^ self |
|
2991 |
] |
|
2992 |
]. |
|
2993 |
self selectColIndex:selColNr rowIndex:selRowNr |
|
2994 |
! |
|
2995 |
||
542 | 2996 |
doubleClicked |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2997 |
"handle a double click" |
5723 | 2998 |
|
637 | 2999 |
|col sel idx| |
3000 |
||
3001 |
self hasSelection ifTrue:[ |
|
3002 |
idx := self firstIndexSelected. |
|
3003 |
col := self selectedColumn. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3004 |
(col notNil and:[ (sel := col doubleClickedSelector) notNil ]) ifTrue:[ |
2074 | 3005 |
col doubleClickOn:idx |
637 | 3006 |
] ifFalse:[ |
3007 |
doubleClickActionBlock notNil ifTrue:[ |
|
4772 | 3008 |
doubleClickActionBlock valueWithOptionalArgument:idx |
637 | 3009 |
] |
3010 |
] |
|
3011 |
] |
|
542 | 3012 |
! |
3013 |
||
667 | 3014 |
findMenuForSelection |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3015 |
"find the middle button menu for the current selection; returns the menu or nil" |
5723 | 3016 |
|
667 | 3017 |
|col row menu| |
3018 |
||
3019 |
self numberOfSelections == 1 ifTrue:[ |
|
3020 |
row := self at:(self firstIndexSelected). |
|
3021 |
col := self selectedColumn. |
|
3504 | 3022 |
col notNil ifTrue:[ |
3023 |
menu := col menuForRow:row orAdaptor:columnAdaptor. |
|
3024 |
menu notNil ifTrue:[ ^ menu ]. |
|
3025 |
]. |
|
3026 |
||
5723 | 3027 |
col := columnDescriptors |
3504 | 3028 |
detect:[:c | c rendererType == #rowSelector ] |
3029 |
ifNone:[ nil ]. |
|
667 | 3030 |
col notNil ifTrue:[ |
1223
176702811314
kludge: when asking for an itemMenu, pass application to
tm
parents:
1215
diff
changeset
|
3031 |
^ col menuForRow:row inApplication:(self application) |
667 | 3032 |
] |
3033 |
]. |
|
3034 |
^ nil |
|
3035 |
! |
|
3036 |
||
1111 | 3037 |
keyPress:aKey x:x y:y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3038 |
"a key was pressed - handle page-keys here" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3039 |
|
542 | 3040 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
809 | 3041 |
#BeginOfText #EndOfText #ScrollUp #ScrollDown |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3042 |
#CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)> |
542 | 3043 |
|
5723 | 3044 |
|maxColNr firstSelRowNr selRowNr selColNr |
2470 | 3045 |
key column isTab listSize hasSelectables rawKey| |
1111 | 3046 |
|
1805 | 3047 |
self isEnabled ifFalse:[^ self]. |
3048 |
||
1416 | 3049 |
(listSize := list size) == 0 ifTrue:[ |
3050 |
^ super keyPress:aKey x:x y:y |
|
3051 |
]. |
|
1776 | 3052 |
aKey isCharacter ifTrue:[ |
3053 |
^ self characterPress:aKey x:x y:y |
|
542 | 3054 |
]. |
1111 | 3055 |
|
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3056 |
(aKey == #SelectAll) ifTrue:[ |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3057 |
multipleSelectOk ifTrue:[ |
5723 | 3058 |
self selectAllRows. |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3059 |
]. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3060 |
^ self |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3061 |
]. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3062 |
|
1776 | 3063 |
aKey == #PreviousPage ifTrue:[^ self pageUp]. |
3064 |
aKey == #NextPage ifTrue:[^ self pageDown]. |
|
3065 |
aKey == #HalfPageUp ifTrue:[^ self halfPageUp]. |
|
3066 |
aKey == #HalfPageDown ifTrue:[^ self halfPageDown]. |
|
3067 |
aKey == #BeginOfText ifTrue:[^ self scrollToTop]. |
|
3068 |
aKey == #EndOfText ifTrue:[^ self scrollToBottom]. |
|
5723 | 3069 |
aKey == #ScrollUp ifTrue:[^ self scrollUp]. |
3070 |
aKey == #ScrollDown ifTrue:[^ self scrollDown]. |
|
3071 |
||
3072 |
aKey == #Return ifTrue:[ |
|
2816 | 3073 |
editView notNil ifTrue:[ |
3074 |
(self selectedRowIndex size == 1 |
|
3075 |
and:[self selectedRowIndex first == listSize]) ifTrue:[ |
|
3076 |
self selectRowIndex:nil. |
|
3077 |
] ifFalse:[ |
|
3078 |
self cursorKey:#CursorDown rawKey:#CursorDown. |
|
3079 |
]. |
|
3080 |
^ self |
|
3081 |
]. |
|
3082 |
self numberOfSelections == 1 ifTrue:[ |
|
3083 |
self doubleClicked |
|
3084 |
]. |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3085 |
^ self |
542 | 3086 |
]. |
1111 | 3087 |
|
2816 | 3088 |
hasSelectables := self hasSelectables. |
2470 | 3089 |
|
5873 | 3090 |
rawKey := (WindowGroup lastEvent) rawKey. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3091 |
|
5723 | 3092 |
(aKey == #CursorUp |
2816 | 3093 |
or:[aKey == #CursorDown |
3094 |
or:[rawKey == #Home |
|
5723 | 3095 |
or:[rawKey == #End]]]) |
2816 | 3096 |
ifTrue:[ |
3097 |
self cursorKey:aKey rawKey:rawKey. |
|
1776 | 3098 |
^ self |
3099 |
]. |
|
1668 | 3100 |
|
3101 |
hasSelectables ifFalse:[ |
|
3102 |
^ super keyPress:aKey x:x y:y |
|
3103 |
]. |
|
3104 |
||
1776 | 3105 |
"/ CURSOR LEFT/RIGHT or TABING |
2470 | 3106 |
(aKey == #CursorLeft or:[aKey == #CursorRight]) ifTrue:[ |
3107 |
isTab := false. |
|
3108 |
key := aKey. |
|
3109 |
] ifFalse:[ |
|
1668 | 3110 |
tabIntern ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3111 |
^ super keyPress:aKey x:x y:y |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3112 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3113 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3114 |
(aKey includesString:'Tab') ifTrue:[ |
5723 | 3115 |
key := (aKey = #BackTab or:[self sensor shiftDown or:[aKey includesString:'Left']]) |
2482
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
3116 |
ifTrue:[#CursorLeft] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
3117 |
ifFalse:[#CursorRight] |
1416 | 3118 |
] ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3119 |
(aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[ |
1416 | 3120 |
^ super keyPress:aKey x:x y:y |
3121 |
]. |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3122 |
key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3123 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3124 |
isTab := true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3125 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3126 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3127 |
maxColNr := self numberOfColumns. |
2960 | 3128 |
selColNr := self selectedColIndex. |
612 | 3129 |
|
2470 | 3130 |
firstSelRowNr := self firstIndexSelected. |
3131 |
||
1111 | 3132 |
key == #CursorLeft ifTrue:[ |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3133 |
selRowNr := firstSelRowNr. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3134 |
selRowNr == 0 ifTrue:[selRowNr := listSize]. |
1776 | 3135 |
selColNr == 0 ifTrue:[selColNr := maxColNr + 1]. |
3136 |
||
3137 |
[true] whileTrue:[ |
|
3138 |
(selColNr := selColNr - 1) == 0 ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3139 |
[ selRowNr := selRowNr - 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3140 |
selRowNr == 0 ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3141 |
isTab ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3142 |
tabAtStartAction notNil ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3143 |
tabAtStartAction value |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3144 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3145 |
self deselect. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3146 |
self windowGroup focusPreviousFrom:self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3147 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3148 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3149 |
^ self |
1416 | 3150 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3151 |
(self isRowSelectable:selRowNr) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3152 |
] whileFalse. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3153 |
|
1776 | 3154 |
selColNr := maxColNr |
1111 | 3155 |
]. |
3504 | 3156 |
column := self columnDescriptorAt:selColNr. |
1416 | 3157 |
|
1111 | 3158 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
1776 | 3159 |
^ self selectColIndex:selColNr rowIndex:selRowNr. |
1111 | 3160 |
] |
3161 |
] |
|
542 | 3162 |
]. |
1776 | 3163 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3164 |
selRowNr := firstSelRowNr. |
1776 | 3165 |
selRowNr == 0 ifTrue:[selRowNr := 1]. |
3166 |
||
3167 |
[true] whileTrue:[ |
|
3168 |
(selColNr := selColNr + 1) > maxColNr ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3169 |
[ selRowNr := selRowNr + 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3170 |
selRowNr > listSize ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3171 |
isTab ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3172 |
tabAtEndAction notNil ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3173 |
tabAtEndAction value |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3174 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3175 |
self deselect. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3176 |
self windowGroup focusNextFrom:self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3177 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3178 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3179 |
^ self |
1776 | 3180 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3181 |
(self isRowSelectable:selRowNr) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3182 |
] whileFalse. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3183 |
|
1776 | 3184 |
selColNr := 1 |
3185 |
]. |
|
3504 | 3186 |
column := self columnDescriptorAt:selColNr. |
1776 | 3187 |
|
3188 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
|
3189 |
^ self selectColIndex:selColNr rowIndex:selRowNr |
|
3190 |
] |
|
3191 |
]. |
|
5873 | 3192 |
|
3193 |
"Modified: / 09-08-2018 / 09:27:46 / Claus Gittinger" |
|
542 | 3194 |
! |
3195 |
||
5670 | 3196 |
keyboardZoom:largerBoolean |
5279 | 3197 |
"CTRL+/- zoom action" |
3198 |
||
5670 | 3199 |
self fontLargerOrSmaller:largerBoolean |
5279 | 3200 |
! |
3201 |
||
5563 | 3202 |
mouseWheelZoom:amount |
3203 |
"CTRL-wheel action" |
|
3204 |
|oldSize newSize font| |
|
3205 |
||
3206 |
font := gc font. |
|
3207 |
font sizeUnit == #px ifTrue:[ ^ self]. |
|
3208 |
||
3209 |
oldSize := font size. |
|
3210 |
||
3211 |
amount > 0 ifTrue:[ |
|
3212 |
oldSize < 5 ifTrue:[ ^ self]. |
|
3213 |
newSize := oldSize - 1. |
|
3214 |
] ifFalse:[ |
|
3215 |
oldSize > 99 ifTrue:[^ self]. |
|
3216 |
newSize := oldSize + 1. |
|
3217 |
]. |
|
3218 |
||
3219 |
self font:(font asSize:newSize). |
|
3220 |
! |
|
3221 |
||
5723 | 3222 |
originChanged:delta |
542 | 3223 |
"this one is sent, after the origin of my contents has changed - |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3224 |
tell dependents (i.e. scrollers) about this" |
5723 | 3225 |
|
542 | 3226 |
super originChanged:delta. |
3227 |
self updateEditViewOrigin. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3228 |
! |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3229 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3230 |
sizeChanged:how |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3231 |
"size changed - move origin up if possible |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3232 |
change the layout of the labelView dependent on my layout" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3233 |
|
4163 | 3234 |
|selectionWasVisible lastExtent| |
3235 |
||
3236 |
lastExtent := previousExtent notNil ifTrue:[previousExtent] ifFalse:[self extent]. |
|
3237 |
selectionWasVisible := self isSelectionVisibleIn:lastExtent. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3238 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3239 |
previousExtent := self extent. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3240 |
super sizeChanged:how. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3241 |
|
4163 | 3242 |
previousExtent := self extent. |
3243 |
||
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3244 |
"/ 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
|
3245 |
"/ (could be invisible in a notebook ...) |
5723 | 3246 |
realized ifTrue:[ "used to be: shown" |
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3247 |
"/ labelView isVisible ifTrue:[ |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3248 |
"/ lyt := labelView layout. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3249 |
"/ lyt leftOffset:(layout leftOffset). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3250 |
"/ lyt rightOffset:(layout rightOffset). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3251 |
"/ labelView layout:lyt. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3252 |
"/ ]. |
4163 | 3253 |
previousExtent x ~= lastExtent x ifTrue: [ |
4123 | 3254 |
self fitColumns. |
3255 |
]. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3256 |
selectionWasVisible ifTrue:[ |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3257 |
self makeSelectionVisible. |
4020 | 3258 |
]. |
3259 |
self updateEditViewOrigin. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3260 |
]. |
4059 | 3261 |
|
4123 | 3262 |
"Modified: / 04-05-2012 / 14:34:24 / cg" |
542 | 3263 |
! ! |
3264 |
||
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3265 |
!DSVColumnView methodsFor:'focus handling'! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3266 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3267 |
canTab |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3268 |
super canTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3269 |
^ editView isNil |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3270 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3271 |
^ false |
2101 | 3272 |
! |
3273 |
||
3138 | 3274 |
showFocus:explicit |
3275 |
self invalidateSelection. |
|
3276 |
super showFocus:explicit |
|
3277 |
! |
|
3278 |
||
3279 |
showNoFocus:explicit |
|
3280 |
self invalidateSelection. |
|
3281 |
super showNoFocus:explicit |
|
3282 |
! |
|
3283 |
||
2101 | 3284 |
wantsFocusWithPointerEnter |
3285 |
"views which like to take the keyboard focus |
|
3286 |
when the pointer enters can do so by redefining this |
|
3287 |
to return true" |
|
3288 |
||
3924
72044fd3296a
changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
3923
diff
changeset
|
3289 |
editView notNil ifTrue:[^ false]. |
2237 | 3290 |
|
2958 | 3291 |
(UserPreferences current focusFollowsMouse ~~ false |
2101 | 3292 |
and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true) |
3293 |
]) ifTrue:[ |
|
3294 |
list size > 0 ifTrue:[ |
|
3295 |
^ true |
|
3296 |
] |
|
3297 |
]. |
|
3298 |
^ false |
|
3924
72044fd3296a
changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
3923
diff
changeset
|
3299 |
|
72044fd3296a
changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
3923
diff
changeset
|
3300 |
"Modified: / 08-08-2010 / 14:41:00 / cg" |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3301 |
! ! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3302 |
|
542 | 3303 |
!DSVColumnView methodsFor:'gc operations'! |
3304 |
||
5723 | 3305 |
imageOnMyDevice:anImage |
4606
1cc343187f71
Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents:
4589
diff
changeset
|
3306 |
"associate image to device and returns the new image." |
1cc343187f71
Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents:
4589
diff
changeset
|
3307 |
|
1cc343187f71
Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents:
4589
diff
changeset
|
3308 |
anImage isNil ifTrue:[^ nil]. |
4991 | 3309 |
^ anImage onDevice:device. |
1100 | 3310 |
! |
3311 |
||
5723 | 3312 |
registerImage:anImage key:aKey |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3313 |
"any row can register an image with a unique identifier a key symbol" |
5723 | 3314 |
|
542 | 3315 |
|img| |
3316 |
||
3317 |
(img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
|
3318 |
^ img |
|
3319 |
]. |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3320 |
img := self imageOnMyDevice:anImage. |
567 | 3321 |
registererImages at:aKey put:img. |
3322 |
^ img |
|
542 | 3323 |
! |
3324 |
||
5723 | 3325 |
registeredImageAt:aKey |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3326 |
"any row can register an image with a unique identifier" |
5723 | 3327 |
|
542 | 3328 |
^ registererImages at:aKey ifAbsent:nil |
3329 |
! |
|
3330 |
||
3331 |
releaseAllRegisteredImages |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3332 |
"release all registered images" |
5723 | 3333 |
|
542 | 3334 |
registererImages := IdentityDictionary new. |
3335 |
! ! |
|
3336 |
||
3215 | 3337 |
!DSVColumnView methodsFor:'help'! |
3338 |
||
5680 | 3339 |
helpTextAt:aPoint |
3215 | 3340 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)." |
3341 |
||
3248
c9e48b873e6e
do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
3342 |
|rowNr colNr col| |
3215 | 3343 |
|
3344 |
columnDescriptors isEmpty ifTrue:[^ nil]. |
|
3345 |
||
3248
c9e48b873e6e
do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
3346 |
rowNr := self yVisibleToRowNr:aPoint y. |
c9e48b873e6e
do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
3347 |
rowNr isNil ifTrue:[^ nil ]. |
c9e48b873e6e
do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
3348 |
|
3215 | 3349 |
colNr := self xVisibleToColNr:aPoint x. |
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
3350 |
colNr notNil ifTrue:[ |
3215 | 3351 |
col := columnDescriptors at:colNr. |
3458
5f9a85c6279a
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
3449
diff
changeset
|
3352 |
^ col activeHelpTextForRow:rowNr. |
3215 | 3353 |
]. |
3354 |
^ nil |
|
3355 |
||
3356 |
"Created: / 26-03-2007 / 14:42:54 / cg" |
|
3248
c9e48b873e6e
do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
3357 |
"Modified: / 16-10-2007 / 17:52:24 / cg" |
3215 | 3358 |
! ! |
3359 |
||
2500 | 3360 |
!DSVColumnView methodsFor:'initialization & release'! |
542 | 3361 |
|
3362 |
create |
|
4521 | 3363 |
|graphicsDevice| |
3364 |
||
542 | 3365 |
super create. |
4991 | 3366 |
graphicsDevice := device. |
4521 | 3367 |
|
3368 |
fgColor := fgColor onDevice:graphicsDevice. |
|
3369 |
bgColor := bgColor onDevice:graphicsDevice. |
|
3370 |
selectionForegroundColor := selectionForegroundColor onDevice:graphicsDevice. |
|
3371 |
selectionBackgroundColor := selectionBackgroundColor onDevice:graphicsDevice. |
|
3372 |
selectionFrameColor notNil ifTrue:[selectionFrameColor := selectionFrameColor onDevice:graphicsDevice]. |
|
3373 |
selectionForegroundColorNoFocus := selectionForegroundColorNoFocus onDevice:graphicsDevice. |
|
3374 |
selectionBackgroundColorNoFocus := selectionBackgroundColorNoFocus onDevice:graphicsDevice. |
|
3375 |
||
3376 |
buttonShadowColor := buttonShadowColor onDevice:graphicsDevice. |
|
3377 |
buttonLightColor := buttonLightColor onDevice:graphicsDevice. |
|
809 | 3378 |
|
3379 |
buttonHalfShadowColor notNil ifTrue:[ |
|
4521 | 3380 |
buttonHalfShadowColor := buttonHalfShadowColor onDevice:graphicsDevice |
809 | 3381 |
]. |
3382 |
||
3383 |
buttonHalfLightColor notNil ifTrue:[ |
|
4521 | 3384 |
buttonHalfLightColor := buttonHalfLightColor onDevice:graphicsDevice |
809 | 3385 |
]. |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3386 |
rowSelectorForm := self imageOnMyDevice:rowSelectorForm. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3387 |
checkToggleActiveImage := self imageOnMyDevice:checkToggleActiveImage. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3388 |
checkTogglePassiveImage := self imageOnMyDevice:checkTogglePassiveImage. |
3504 | 3389 |
checkToggleForm := self imageOnMyDevice:checkToggleForm. |
3390 |
radioButtonActiveImage := self imageOnMyDevice:radioButtonActiveImage. |
|
3391 |
radioButtonPassiveImage := self imageOnMyDevice:radioButtonPassiveImage. |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3392 |
comboButtonForm := self imageOnMyDevice:comboButtonForm. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3393 |
|
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3394 |
"Modified: / 20-01-2011 / 08:43:51 / cg" |
542 | 3395 |
! |
3396 |
||
3397 |
initStyle |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3398 |
"setup colors, etc." |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3399 |
|
1100 | 3400 |
|button widget| |
809 | 3401 |
|
542 | 3402 |
super initStyle. |
3403 |
||
3404 |
DefaultForegroundColor isNil ifTrue:[ |
|
3405 |
self class updateStyleCache |
|
3406 |
]. |
|
3407 |
fgColor := DefaultForegroundColor. |
|
3408 |
bgColor := DefaultBackgroundColor. |
|
4875 | 3409 |
labelFgColor := DefaultLabelForegroundColor. |
3410 |
labelBgColor := DefaultLabelBackgroundColor. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3411 |
selectionForegroundColor := DefaultHilightForegroundColor. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3412 |
selectionBackgroundColor := DefaultHilightBackgroundColor. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3413 |
selectionFrameColor := DefaultHilightFrameColor. |
809 | 3414 |
|
3415 |
shadowColor isNil ifTrue:[ |
|
3416 |
shadowColor := Color grayPercent:40. |
|
3417 |
]. |
|
3418 |
||
3419 |
lightColor isNil ifTrue:[ |
|
3420 |
lightColor := Color grayPercent:75 |
|
3421 |
]. |
|
3422 |
||
3423 |
buttonLightColor := ButtonLightColor ? lightColor. |
|
3424 |
buttonShadowColor := ButtonShadowColor ? shadowColor. |
|
3425 |
||
3426 |
(ButtonEdgeStyle == #soft) ifTrue:[ |
|
3427 |
buttonHalfShadowColor := ButtonHalfShadowColor. |
|
3428 |
buttonHalfLightColor := ButtonHalfLightColor. |
|
3429 |
||
3430 |
buttonHalfShadowColor isNil ifTrue:[ |
|
3431 |
buttonHalfShadowColor := buttonShadowColor lightened |
|
3432 |
] |
|
3433 |
]. |
|
1490 | 3434 |
|
3435 |
buttonHalfShadowColor isNil ifTrue:[ |
|
3436 |
buttonHalfShadowColor := Color gray |
|
3437 |
]. |
|
3438 |
||
3138 | 3439 |
selectionForegroundColorNoFocus isNil ifTrue:[ |
4653 | 3440 |
selectionForegroundColorNoFocus := DefaultHilightForegroundColorNoFocus. |
3441 |
selectionForegroundColorNoFocus isNil ifTrue:[ |
|
3442 |
selectionForegroundColorNoFocus := selectionForegroundColor slightlyLightened. |
|
3443 |
] |
|
3138 | 3444 |
]. |
3445 |
selectionBackgroundColorNoFocus isNil ifTrue:[ |
|
4644 | 3446 |
selectionBackgroundColorNoFocus := DefaultHilightBackgroundColorNoFocus. |
3447 |
selectionBackgroundColorNoFocus isNil ifTrue:[ |
|
3448 |
selectionBackgroundColor notNil ifTrue:[ |
|
4653 | 3449 |
selectionBackgroundColorNoFocus := selectionBackgroundColor slightlyLightened. |
4644 | 3450 |
"/ selectionBackgroundColorNoFocus := Color brightness:(selectionBackgroundColor "lightened" brightness). "/ asGray. |
3451 |
]. |
|
4101 | 3452 |
]. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3453 |
]. |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3454 |
selectionFrameColorNoFocus isNil ifTrue:[ |
4101 | 3455 |
selectionFrameColor notNil ifTrue:[ |
5723 | 3456 |
selectionFrameColorNoFocus := selectionFrameColor lightened. |
4101 | 3457 |
"/ selectionFrameColorNoFocus := Color brightness:(selectionFrameColor "lightened" brightness). "/ asGray |
3458 |
] |
|
3138 | 3459 |
]. |
3460 |
||
2711 | 3461 |
rowSelectorForm := self class rowSelectorImage. |
3504 | 3462 |
|
1100 | 3463 |
checkToggleActiveImage := CheckToggleActiveImage. |
3464 |
checkTogglePassiveImage := CheckTogglePassiveImage. |
|
5890 | 3465 |
|
3466 |
CheckToggleDisabledActiveImage isNil ifTrue:[ |
|
3467 |
CheckToggleDisabledActiveImage := CheckToggle disabledActiveImage |
|
3468 |
]. |
|
3469 |
CheckToggleDisabledPassiveImage isNil ifTrue:[ |
|
3470 |
CheckToggleDisabledPassiveImage := CheckToggle disabledPassiveImage |
|
3471 |
]. |
|
3472 |
checkToggleDisabledActiveImage := CheckToggleDisabledActiveImage. |
|
3473 |
checkToggleDisabledPassiveImage := CheckToggleDisabledPassiveImage. |
|
1100 | 3474 |
|
3504 | 3475 |
CheckToggleForm isNil ifTrue:[ |
3476 |
widget := CheckToggle new. |
|
3477 |
CheckToggleForm := widget label. |
|
3478 |
CheckToggleLevel := widget offLevel. |
|
3479 |
CheckToggleExtent := widget preferredExtent. |
|
3480 |
]. |
|
3481 |
||
3482 |
checkToggleForm := CheckToggleForm. |
|
3483 |
checkToggleLevel := CheckToggleLevel. |
|
3484 |
checkToggleExtent := CheckToggleExtent. |
|
3485 |
||
3486 |
radioButtonActiveImage := RadioButtonActiveImage. |
|
3487 |
radioButtonPassiveImage := RadioButtonPassiveImage. |
|
3488 |
||
5890 | 3489 |
RadioButtonDisabledActiveImage isNil ifTrue:[ |
3490 |
RadioButtonDisabledActiveImage := RadioButton disabledActiveForm. |
|
3491 |
]. |
|
3492 |
RadioButtonDisabledPassiveImage isNil ifTrue:[ |
|
3493 |
RadioButtonDisabledPassiveImage := RadioButton disabledPassiveForm. |
|
3494 |
]. |
|
3495 |
radioButtonDisabledActiveImage := RadioButtonDisabledActiveImage. |
|
3496 |
radioButtonDisabledPassiveImage := RadioButtonDisabledPassiveImage. |
|
3497 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3498 |
ComboButtonForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3499 |
widget := ComboListView new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3500 |
button := widget menuButton. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3501 |
ComboButtonForm := button label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3502 |
ComboButtonLevel := button offLevel. |
3428
436f115aefe8
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3382
diff
changeset
|
3503 |
ComboButtonExtent := (button preferredWidth) @ (widget preferredHeight). |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3504 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3505 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3506 |
comboButtonForm := ComboButtonForm. |
5890 | 3507 |
ComboButtonDisabledForm isNil ifTrue:[ |
3508 |
ComboButtonDisabledForm := ComboView disabledForm |
|
3509 |
]. |
|
3510 |
comboButtonDisabledForm := ComboButtonDisabledForm. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3511 |
comboButtonLevel := ComboButtonLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3512 |
comboButtonExtent := ComboButtonExtent. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3513 |
|
4101 | 3514 |
"Modified: / 20-01-2012 / 15:48:13 / cg" |
5890 | 3515 |
"Modified: / 17-08-2018 / 17:33:56 / Claus Gittinger" |
542 | 3516 |
! |
3517 |
||
3518 |
initialize |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3519 |
"set default attributes" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3520 |
|
4521 | 3521 |
|fontOnDevice| |
3522 |
||
5603 | 3523 |
verticalSpacing := verticalSpacing ? self class verticalSpacing. |
3524 |
horizontalSpacing := horizontalSpacing ? self class horizontalSpacing. |
|
3525 |
||
542 | 3526 |
super initialize. |
1487 | 3527 |
self lineWidth:0. |
3528 |
||
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3529 |
separatorSize := 1. "/ separators mode 2D |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3530 |
verticalSpacing := self class verticalSpacing. |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3531 |
horizontalSpacing := self class horizontalSpacing. |
1668 | 3532 |
tabIntern := true. |
1487 | 3533 |
useIndex := true. |
5664 | 3534 |
ignoreReselect := true. |
1112 | 3535 |
viewOrigin := 0@0. |
5204 | 3536 |
fontOnDevice := gc deviceFont. |
4521 | 3537 |
rowFontAscent := fontOnDevice ascent. |
5602 | 3538 |
rowHeight := verticalSpacing + (fontOnDevice height) + verticalSpacing + separatorSize. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
3539 |
minRowHeight := rowHeight. |
1112 | 3540 |
multipleSelectOk := false. "/ multiselect disabled |
2960 | 3541 |
selectedRowIndex := 0. "/ no selection |
5723 | 3542 |
self selectedColIndex:0. |
1778
51bbd960baf9
change registeredIcons from IdentityDictionary to Dictionary
ca
parents:
1776
diff
changeset
|
3543 |
registererImages := Dictionary new. |
1112 | 3544 |
columnDescriptors := #(). |
3545 |
beDependentOfRows := false. |
|
3546 |
colorMap := Dictionary new. |
|
3547 |
catchChangeEvents := false. |
|
3548 |
selectRowOnDefault := true. |
|
1749 | 3549 |
autoScroll := true. |
3130
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
3550 |
autoScrollToColumn := true. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3551 |
scrollRowWise := false. |
5723 | 3552 |
sortListInPlace := false. "/ when false (default for backward compatibility): |
4613 | 3553 |
"/ if sorting, create a copy |
3554 |
"/ of the list, which is wrong when useIndex is on, |
|
3555 |
"/ as the application will get the index in the sorted |
|
3556 |
"/ list, which is probably different from tha apps list mode. |
|
3557 |
"/ When true (should be default, but that might break many |
|
3558 |
"/ users), the passed in list is sorted in place (i.e. possibly |
|
3559 |
"/ sorting the application's list). |
|
5194 | 3560 |
|
3561 |
updateListHolderWhenSorting := false. |
|
5723 | 3562 |
"/ when false (default for backward compatibility): |
5194 | 3563 |
"/ if sorting, do not write back the sorted list into the listHolder |
3564 |
"/ When true (should be default, but that might break many |
|
3565 |
"/ users), the sorted list is written back into the listHolder, |
|
3566 |
"/ but only if sortListInPlace is false. |
|
3567 |
||
3223 | 3568 |
"/ need for active help |
3569 |
self enableMotionEvents. |
|
3570 |
||
5603 | 3571 |
"Modified: / 13-09-2017 / 16:08:34 / cg" |
705 | 3572 |
! |
3573 |
||
2807 | 3574 |
mapped |
3575 |
"set selection (if any) after mapping" |
|
5723 | 3576 |
|
2807 | 3577 |
|idx| |
3578 |
||
3579 |
super mapped. |
|
3580 |
needFitColumns == true ifTrue:[ |
|
3581 |
self fitColumns |
|
3582 |
]. |
|
3583 |
(idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
3584 |
self scrollToRowAt:idx colAt:0. |
|
3585 |
]. |
|
3586 |
! |
|
3587 |
||
542 | 3588 |
realize |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3589 |
"recompute contents and fit columns to view" |
5723 | 3590 |
|
1487 | 3591 |
|selection| |
3592 |
||
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3593 |
self bitGravity:#NorthWest. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3594 |
self recomputeHeightOfContents. |
1487 | 3595 |
selection := 0. |
3596 |
model notNil ifTrue:[ |
|
3597 |
(model respondsTo:#selectionIndex) ifTrue:[ |
|
3598 |
selection := model selectionIndex |
|
3599 |
] ifFalse:[ |
|
3600 |
model == listHolder ifFalse:[ |
|
3601 |
selection := model value |
|
3602 |
] |
|
3603 |
] |
|
3604 |
]. |
|
3605 |
self selectRowIndex:selection. |
|
542 | 3606 |
super realize. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3607 |
self fitColumns. |
2011
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
3608 |
! |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
3609 |
|
2157 | 3610 |
release |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3611 |
"remove dependencies" |
5723 | 3612 |
|
2157 | 3613 |
self columnHolder:nil. |
4219 | 3614 |
|
3615 |
beDependentOfRows ifTrue:[self makeIndependentOfRows]. |
|
3616 |
listHolder notNil ifTrue:[ |
|
3617 |
listHolder removeDependent:self. |
|
3618 |
]. |
|
2157 | 3619 |
columnAdaptor isValueModel ifTrue:[ |
3620 |
columnAdaptor removeDependent:self |
|
3621 |
]. |
|
3622 |
super release |
|
607 | 3623 |
! ! |
3624 |
||
3625 |
!DSVColumnView methodsFor:'obsolete'! |
|
3626 |
||
3627 |
has3Dsepartors |
|
3770 | 3628 |
<resource: #obsolete> |
3629 |
"shouldn't be used any more" |
|
3630 |
||
3631 |
self obsoleteMethodWarning. |
|
3632 |
^ self has3Dseparators |
|
3633 |
! |
|
3634 |
||
3635 |
has3Dsepartors:aBool |
|
3636 |
<resource: #obsolete> |
|
5723 | 3637 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3638 |
"shouldn't be used any more" |
5723 | 3639 |
|
3770 | 3640 |
self obsoleteMethodWarning. |
607 | 3641 |
self has3Dseparators:aBool |
542 | 3642 |
! ! |
3643 |
||
3644 |
!DSVColumnView methodsFor:'private'! |
|
3645 |
||
1951 | 3646 |
anyColumnHasBackground |
3647 |
columnDescriptors isNil ifTrue:[^ false]. |
|
3648 |
columnDescriptors do:[:eachCol | |
|
3649 |
|bg| |
|
3650 |
||
3651 |
bg := eachCol backgroundColor. |
|
3652 |
(bg notNil and:[bg isImageOrForm]) ifTrue:[^ true]. |
|
3653 |
eachCol bgSelector notNil ifTrue:[^ true]. |
|
3654 |
]. |
|
3655 |
^ false. |
|
3656 |
! |
|
3657 |
||
3658 |
anyColumnHasPotentialNonConstantBackground |
|
3659 |
columnDescriptors isNil ifTrue:[^ false]. |
|
2933 | 3660 |
^ columnDescriptors contains:[:someCol | someCol hasPotentialNonConstantBackground]. |
3661 |
"/ columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]]. |
|
3662 |
"/ ^ false. |
|
1951 | 3663 |
! |
3664 |
||
1111 | 3665 |
destroyEditView |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3666 |
"destroy the edit view; release KeyboardForwarder" |
2730 | 3667 |
|
2695 | 3668 |
editValue notNil ifTrue:[ |
3669 |
editValue removeDependent:self. |
|
3670 |
editValue := nil |
|
3671 |
]. |
|
3140 | 3672 |
|
3673 |
editView notNil ifTrue:[ |winGroup focusView| |
|
3674 |
self hasFocus ifTrue:[focusView := self]. |
|
6043 | 3675 |
editView isDialogBox ifTrue:[ |
3676 |
focusView := self |
|
3677 |
] ifFalse:[ |
|
3678 |
editView withAllSubViewsDo:[:aView | |
|
3679 |
aView hasFocus ifTrue:[focusView := self]. |
|
3680 |
aView delegate:nil |
|
3681 |
]. |
|
3140 | 3682 |
]. |
1111 | 3683 |
editView destroy. |
3684 |
editView := nil. |
|
2730 | 3685 |
|
3140 | 3686 |
winGroup := self windowGroup. |
3687 |
||
3688 |
winGroup notNil ifTrue:[ |
|
3689 |
winGroup focusView:focusView. |
|
2730 | 3690 |
] |
1111 | 3691 |
]. |
6043 | 3692 |
|
3693 |
"Modified: / 23-04-2019 / 19:13:41 / Claus Gittinger" |
|
1111 | 3694 |
! |
3695 |
||
5723 | 3696 |
detectViewAt:aPoint in:aView |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3697 |
"returns the view at a point" |
5723 | 3698 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3699 |
aView isNil ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3700 |
^ nil |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3701 |
]. |
2019
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
3702 |
^ aView detectViewAt:aPoint. |
637 | 3703 |
! |
3704 |
||
542 | 3705 |
fitColumns |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3706 |
"fit columns to view; " |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3707 |
|
5723 | 3708 |
|selectedColumn columnsWithRelativeWidth |
4415 | 3709 |
overallMinWidth restWidth anyChange oldOrgX newOrgX oldWidth| |
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3710 |
|
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3711 |
realized ifFalse:[ |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3712 |
needFitColumns := true. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3713 |
^ self |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3714 |
]. |
1487 | 3715 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3716 |
cachedPreferredExtent isNil ifTrue:[ |
1487 | 3717 |
self preferredExtent. |
2956 | 3718 |
] ifFalse:[ |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3719 |
oldWidth := cachedPreferredExtent x. |
1487 | 3720 |
]. |
1484 | 3721 |
|
3722 |
columnDescriptors isEmpty ifTrue:[ |
|
3723 |
^ self |
|
3724 |
]. |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3725 |
|
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3726 |
overallMinWidth := 0. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3727 |
anyChange := false. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3728 |
columnsWithRelativeWidth := OrderedCollection new. |
1484 | 3729 |
|
3730 |
columnDescriptors do:[:aCol| |
|
3731 |
aCol canResize ifTrue:[ |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3732 |
anyChange := true. |
1484 | 3733 |
aCol invalidate. |
3734 |
]. |
|
4415 | 3735 |
aCol hasRelativeWidth ifTrue:[columnsWithRelativeWidth add:aCol]. |
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3736 |
overallMinWidth := overallMinWidth + aCol minWidth. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3737 |
]. |
4415 | 3738 |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3739 |
cachedPreferredExtent := width @(self preferredHeight). |
4425 | 3740 |
|
3741 |
columnsWithRelativeWidth notEmpty ifTrue:[ |
|
3742 |
restWidth := self innerWidth - overallMinWidth. |
|
3743 |
||
3744 |
restWidth > 0 ifTrue:[ |
|
3745 |
|sumOfAnnouncedRelativeWidths sumWeach| |
|
3746 |
||
3747 |
"/ distribute restwidth among remaining columns according to |
|
3748 |
"/ their announced relative width's |
|
3749 |
sumOfAnnouncedRelativeWidths := columnsWithRelativeWidth sum:[:each | each description width]. |
|
3750 |
sumWeach := 0. |
|
3751 |
columnsWithRelativeWidth do:[:each | |
|
3752 |
|eachRel wEach| |
|
3753 |
||
3754 |
eachRel := each description width / sumOfAnnouncedRelativeWidths. |
|
3755 |
each == columnsWithRelativeWidth last ifTrue:[ |
|
3756 |
wEach := restWidth - sumWeach. |
|
3757 |
] ifFalse:[ |
|
3758 |
wEach := (eachRel * restWidth) truncated. |
|
3759 |
sumWeach := sumWeach + wEach. |
|
3760 |
]. |
|
3761 |
each setWidth:wEach. |
|
4415 | 3762 |
]. |
4425 | 3763 |
] |
3764 |
] ifFalse:[ |
|
3765 |
anyChange ifTrue:[ |
|
5723 | 3766 |
| resizableColumns numberOfResizable additionalOffsetX | |
4425 | 3767 |
|
3768 |
overallMinWidth := 0. |
|
3769 |
resizableColumns := OrderedCollection new. |
|
3770 |
||
3771 |
columnDescriptors do:[: eachColumn | |
|
3772 |
eachColumn canResize ifTrue:[ resizableColumns add: eachColumn ]. |
|
3773 |
eachColumn width: nil. "force a recomputation of width" |
|
3774 |
overallMinWidth := overallMinWidth + eachColumn width. |
|
3775 |
]. |
|
5723 | 3776 |
numberOfResizable := resizableColumns size. |
3777 |
numberOfResizable > 0 ifTrue:[ |
|
4425 | 3778 |
restWidth := self innerWidth - overallMinWidth. |
3779 |
||
5723 | 3780 |
restWidth > numberOfResizable ifTrue:[ |
3781 |
additionalOffsetX := restWidth // numberOfResizable. |
|
4425 | 3782 |
resizableColumns do:[:aCol| aCol growWidth:additionalOffsetX ]. |
5723 | 3783 |
restWidth := restWidth - (additionalOffsetX * numberOfResizable). |
4425 | 3784 |
]. |
3785 |
restWidth > 0 ifTrue:[ resizableColumns last growWidth:restWidth ]. |
|
3786 |
]. |
|
1484 | 3787 |
]. |
3788 |
]. |
|
1492 | 3789 |
|
612 | 3790 |
shown ifTrue:[ |
4116 | 3791 |
"have to invalidate unconditionally even if nothing has been changed here: |
3792 |
#fitColumns is called from #changeWidthOfColumn:deltaX: |
|
3793 |
after a manual resize" |
|
3794 |
||
3795 |
self invalidate. |
|
3796 |
labelView invalidate. |
|
542 | 3797 |
|
1498 | 3798 |
(oldOrgX := viewOrigin x) ~~ 0 ifTrue:[ |
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3799 |
|prefWidth| |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3800 |
|
1498 | 3801 |
"/ UPDATE VIEW-ORIGIN X |
3802 |
||
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3803 |
prefWidth := self preferredWidth. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3804 |
newOrgX := (prefWidth - self innerWidth) max:0. |
1498 | 3805 |
|
3806 |
newOrgX < oldOrgX ifTrue:[ |
|
3807 |
self originWillChange. |
|
3808 |
viewOrigin := newOrgX @ (viewOrigin y). |
|
3809 |
self originChanged:((newOrgX - oldOrgX) @ 0). |
|
3810 |
] |
|
3811 |
]. |
|
3812 |
||
1930
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3813 |
"/ 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
|
3814 |
|
1930
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3815 |
"/ self hasSelection ifTrue:[ |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3816 |
"/ editView notNil ifTrue:[ |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3817 |
"/ 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
|
3818 |
"/ ]. |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3819 |
"/ self scrollToSelection. |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3820 |
"/ ]. |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3821 |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3822 |
"/ ca: but resize the editView (if there is any currently visible) |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3823 |
|
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3824 |
editView notNil ifTrue:[ |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3825 |
selectedColumn := self selectedColumn. |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3826 |
selectedColumn notNil ifTrue:[ |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3827 |
editView width:(selectedColumn width - (2 * separatorSize)). |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3828 |
] |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3829 |
]. |
3428
436f115aefe8
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3382
diff
changeset
|
3830 |
oldWidth ~= self preferredWidth ifTrue:[ |
2956 | 3831 |
self contentsChanged. |
3832 |
]. |
|
542 | 3833 |
]. |
5723 | 3834 |
|
3835 |
"Modified (format): / 15-03-2018 / 11:40:25 / mawalch" |
|
542 | 3836 |
! |
3837 |
||
2816 | 3838 |
hasSelectables |
3839 |
columnDescriptors do:[:aCol| |
|
3840 |
(aCol rendererType == #rowSelector) ifFalse:[ |
|
3841 |
(aCol description canSelect) ifTrue:[^ true]. |
|
3842 |
] |
|
3843 |
]. |
|
3844 |
^ false. |
|
3845 |
! |
|
3846 |
||
542 | 3847 |
maxViewOriginY |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3848 |
"returns the maximum possible y of the view origin" |
5723 | 3849 |
|
542 | 3850 |
|y| |
3851 |
||
3852 |
y := self heightOfContents - self innerHeight. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3853 |
^ y max:0 |
542 | 3854 |
! |
3855 |
||
3856 |
updateEditViewOrigin |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3857 |
"update origin of the editView" |
5723 | 3858 |
|
542 | 3859 |
|x y| |
3860 |
||
3861 |
editView notNil ifTrue:[ |
|
607 | 3862 |
y := self yVisibleOfRowNr:(self firstIndexSelected). |
2960 | 3863 |
x := self xVisibleOfColNr:self selectedColIndex. |
1112 | 3864 |
editView origin:(x @ y + separatorSize). |
542 | 3865 |
]. |
3866 |
! |
|
3867 |
||
5723 | 3868 |
xVisibleOfColNr:aColNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3869 |
"returns visible x assigned to a column number" |
5723 | 3870 |
|
3871 |
|x |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3872 |
end "{ Class:SmallInteger }"| |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3873 |
|
542 | 3874 |
x := margin - viewOrigin x. |
1498 | 3875 |
aColNr > 1 ifTrue:[ |
1497 | 3876 |
end := aColNr - 1. |
6103 | 3877 |
columnDescriptors from:1 to:end do:[:aCol | x := x + aCol width ] |
1497 | 3878 |
]. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3879 |
^ x |
542 | 3880 |
! |
3881 |
||
5723 | 3882 |
xVisibleToColNr:x |
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
3883 |
"returns the column number for a physical x position. |
5079 | 3884 |
Returns nil if x is beyond the last column." |
5723 | 3885 |
|
3215 | 3886 |
|x0| |
542 | 3887 |
|
3888 |
x0 := x + viewOrigin x - margin. |
|
5723 | 3889 |
columnDescriptors keysAndValuesDo:[:index :aCol | |
1951 | 3890 |
x0 := x0 - aCol width. |
3215 | 3891 |
x0 <= 0 ifTrue:[ ^ index ]. |
542 | 3892 |
]. |
3893 |
^ nil. |
|
3215 | 3894 |
|
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
3895 |
"Modified: / 26-03-2007 / 15:22:01 / cg" |
542 | 3896 |
! |
3897 |
||
5723 | 3898 |
yVisibleOfRowNr:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3899 |
"returns visible y assigned to the row number" |
5723 | 3900 |
|
542 | 3901 |
^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
3902 |
! |
|
3903 |
||
5723 | 3904 |
yVisibleToRowNr:y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3905 |
"returns the row number assigned to a physical y or nil" |
5723 | 3906 |
|
2398 | 3907 |
|rowNr| |
3908 |
||
3909 |
rowNr := (y + viewOrigin y - margin) // rowHeight + 1. |
|
3910 |
(rowNr between:1 and:(list size)) ifTrue:[ |
|
3911 |
^ rowNr |
|
3912 |
]. |
|
3913 |
^ nil |
|
542 | 3914 |
! ! |
3915 |
||
3916 |
!DSVColumnView methodsFor:'queries'! |
|
3917 |
||
2728
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3918 |
firstLineShown |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3919 |
"for protocol-compat. with listviews" |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3920 |
|
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3921 |
^ self indexOfFirstRowShown |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3922 |
! |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3923 |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3924 |
hasOpenEditor |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3925 |
^ editView notNil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3926 |
! |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3927 |
|
563 | 3928 |
indexOfFirstRowShown |
2797 | 3929 |
"returns the index of the first shown row" |
5723 | 3930 |
|
563 | 3931 |
|idx| |
3932 |
||
1498 | 3933 |
idx := (viewOrigin y // rowHeight) + 1. |
2797 | 3934 |
^ (idx max:1) |
3935 |
! |
|
3936 |
||
3937 |
indexOfLastRowShown |
|
3938 |
"returns the index of the last shown row" |
|
5723 | 3939 |
|
2797 | 3940 |
|idx| |
3941 |
||
3942 |
idx := (viewOrigin y + height - 1 // rowHeight) + 1. |
|
3943 |
^ (idx min:list size) |
|
563 | 3944 |
! |
3945 |
||
1805 | 3946 |
isEnabled |
3947 |
^ enableChannel value ~~ false |
|
3948 |
! |
|
3949 |
||
5723 | 3950 |
isRowSelectable:aRowNumber |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3951 |
"returne true if a row number is selectable" |
5723 | 3952 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3953 |
(aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3954 |
selectConditionBlock isNil ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3955 |
^ true |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3956 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3957 |
^ (selectConditionBlock value:aRowNumber) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3958 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3959 |
^ false |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3960 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3961 |
|
542 | 3962 |
numberOfColumns |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3963 |
"returns number of columns" |
5723 | 3964 |
|
542 | 3965 |
^ columnDescriptors size |
3966 |
! |
|
3967 |
||
3968 |
numberOfRows |
|
5723 | 3969 |
"returns number of rows" |
3970 |
||
1497 | 3971 |
^ list size |
5723 | 3972 |
|
3973 |
"Modified (comment): / 15-03-2018 / 12:23:01 / mawalch" |
|
542 | 3974 |
! |
3975 |
||
3976 |
rowHeight |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3977 |
"get the height of the highest row in pixels" |
5723 | 3978 |
|
542 | 3979 |
^ rowHeight |
3980 |
! |
|
3981 |
||
3982 |
separatorSize |
|
3983 |
"returns vertical/horizontal size of a separator dependent on the |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3984 |
3D effect." |
5723 | 3985 |
|
607 | 3986 |
^ separatorSize |
542 | 3987 |
! |
3988 |
||
3989 |
size |
|
5723 | 3990 |
"returns number of rows" |
3991 |
||
542 | 3992 |
^ list size |
5723 | 3993 |
|
3994 |
"Modified (comment): / 15-03-2018 / 12:24:18 / mawalch" |
|
4486 | 3995 |
! |
3996 |
||
3997 |
yVisibleToLineNr:yVisible |
|
3998 |
^ self yVisibleToRowNr:yVisible. |
|
542 | 3999 |
! ! |
4000 |
||
4001 |
!DSVColumnView methodsFor:'recomputation'! |
|
4002 |
||
5952 | 4003 |
computePreferredExtent |
4004 |
"return my preferred extent" |
|
4005 |
||
4006 |
|numRows prefWidth prefHeight| |
|
4007 |
||
4008 |
cachedPreferredExtent notNil ifTrue:[ |
|
4009 |
^ cachedPreferredExtent |
|
4010 |
]. |
|
4011 |
self computeRowHeight. |
|
4012 |
||
4013 |
prefWidth := (columnDescriptors size - 1) max:0. "/ for the separators |
|
4014 |
columnDescriptors do:[:aCol | |
|
4015 |
prefWidth := prefWidth + (aCol minWidth max:5). |
|
4016 |
]. |
|
4017 |
numRows := list size. |
|
4018 |
||
4019 |
"/ no need for a separator after the last row. |
|
4020 |
prefHeight := separatorSize + ((numRows * rowHeight) "- separatorSize") "+ separatorSize". |
|
4021 |
||
4022 |
cachedPreferredExtent := prefWidth @ prefHeight. |
|
4023 |
^ cachedPreferredExtent |
|
4024 |
||
4025 |
"Created: / 09-11-2018 / 19:50:03 / Claus Gittinger" |
|
4026 |
! |
|
4027 |
||
5602 | 4028 |
computeRowHeight |
4029 |
|minHeight| |
|
5723 | 4030 |
|
5603 | 4031 |
minHeight := self font height. |
5602 | 4032 |
|
5723 | 4033 |
columnDescriptors do:[:aCol | |
5602 | 4034 |
minHeight := (aCol heightOfHighestRow) max:minHeight. |
4035 |
]. |
|
5723 | 4036 |
|
5603 | 4037 |
"/ to fix a double bug which compensated for not computing things correctly |
5730 | 4038 |
"/ (verticalSpacing was always computed as 2 into the height, even if changed later, |
5603 | 4039 |
"/ it was stil in the max-of-col-heights, because minHeight was never reset, but always |
4040 |
"/ carried on in the minRowHeight) |
|
4041 |
minHeight := 2 + minHeight + 2. |
|
5723 | 4042 |
|
5602 | 4043 |
rowHeight := (verticalSpacing + minHeight + verticalSpacing + separatorSize). |
4044 |
minRowHeight := rowHeight. |
|
4045 |
||
4046 |
"Created: / 13-09-2017 / 15:32:28 / cg" |
|
4047 |
! |
|
4048 |
||
647 | 4049 |
hasPreferredExtent |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4050 |
"returns true if preferred extent is accumulated" |
5723 | 4051 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4052 |
^ cachedPreferredExtent notNil |
647 | 4053 |
! |
4054 |
||
542 | 4055 |
preferredExtentChanged |
3519 | 4056 |
"called if the preferred extent changed" |
5723 | 4057 |
|
1497 | 4058 |
|x "{ Class:SmallInteger }" |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4059 |
y "{ Class:SmallInteger }"| |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4060 |
|
542 | 4061 |
y := viewOrigin y. |
4062 |
x := viewOrigin x. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4063 |
(y ~~ 0 or:[ x ~~ 0 ]) ifTrue:[ |
542 | 4064 |
self originWillChange. |
4065 |
viewOrigin := 0 @ 0. |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4066 |
cachedPreferredExtent := nil. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4067 |
self originChanged:(x negated @ y negated). |
542 | 4068 |
] |
4069 |
! |
|
4070 |
||
4071 |
recomputeHeightOfContents |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4072 |
"recompute height of contents( scrolling )" |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4073 |
|
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4074 |
cachedPreferredExtent := nil. |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4075 |
"/ cachedPreferredExtent notNil ifTrue:[ |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4076 |
"/ cachedPreferredExtent y:(rowHeight * list size) |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4077 |
"/ ] ifFalse:[ |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4078 |
"/ self preferredExtent |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4079 |
"/ ]. |
542 | 4080 |
! ! |
4081 |
||
4082 |
!DSVColumnView methodsFor:'scroller interface'! |
|
4083 |
||
4084 |
innerHeight |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4085 |
"returns the inner height of the contents shown" |
5723 | 4086 |
|
542 | 4087 |
^ height - margin - margin |
4088 |
! |
|
4089 |
||
4090 |
verticalScrollStep |
|
3500 | 4091 |
"return the amount to scroll when stepping up/down (also used for mouseWheel)." |
5723 | 4092 |
|
542 | 4093 |
^ rowHeight |
4094 |
! |
|
4095 |
||
4096 |
viewOrigin |
|
5723 | 4097 |
"return the viewOrigin; |
5252 | 4098 |
that's the coordinate of the contents which is shown topLeft in the view." |
5723 | 4099 |
|
542 | 4100 |
^ viewOrigin |
4101 |
! |
|
4102 |
||
4103 |
widthOfContents |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4104 |
"return the width of the contents in pixels" |
5723 | 4105 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4106 |
cachedPreferredExtent isNil ifTrue:[ |
647 | 4107 |
self preferredExtent |
4108 |
]. |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4109 |
^ cachedPreferredExtent x |
542 | 4110 |
! |
4111 |
||
4112 |
xOriginOfContents |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4113 |
"return the horizontal origin of the contents in pixels" |
5723 | 4114 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4115 |
^ viewOrigin x |
542 | 4116 |
! |
4117 |
||
4118 |
yOriginOfContents |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4119 |
"return the vertical origin of the contents in pixels" |
5723 | 4120 |
|
542 | 4121 |
^ viewOrigin y |
4122 |
! ! |
|
4123 |
||
4124 |
!DSVColumnView methodsFor:'scrolling'! |
|
4125 |
||
4126 |
scrollTo:anOrigin redraw:doRedraw |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4127 |
"change origin to have newOrigin be visible at the top-left." |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4128 |
|
1497 | 4129 |
|newOrg dltOrg wg |
4130 |
h "{ Class:SmallInteger }" |
|
4131 |
w "{ Class:SmallInteger }" |
|
4132 |
x "{ Class:SmallInteger }" |
|
4133 |
x0 "{ Class:SmallInteger }" |
|
4134 |
x1 "{ Class:SmallInteger }" |
|
4135 |
y "{ Class:SmallInteger }" |
|
4136 |
y0 "{ Class:SmallInteger }" |
|
4137 |
y1 "{ Class:SmallInteger }" |
|
4138 |
dX "{ Class:SmallInteger }" |
|
4139 |
dY "{ Class:SmallInteger }" |
|
4140 |
innerHG "{ Class:SmallInteger }" |
|
4141 |
innerWT "{ Class:SmallInteger }" |
|
2146 | 4142 |
lMargin |
1497 | 4143 |
| |
2146 | 4144 |
|
542 | 4145 |
shown ifFalse:[ |
4146 |
^ self |
|
4147 |
]. |
|
612 | 4148 |
|
1448 | 4149 |
(wg := self windowGroup) notNil ifTrue:[ |
4150 |
wg processRealExposeEventsFor:self. |
|
542 | 4151 |
]. |
612 | 4152 |
|
542 | 4153 |
innerWT := self innerWidth. |
4154 |
innerHG := self innerHeight. |
|
4155 |
||
4156 |
h := viewOrigin y. |
|
4157 |
||
4158 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents |
|
4159 |
y > (dY := self maxViewOriginY) ifTrue:[ |
|
4160 |
y := dY max:h |
|
4161 |
] |
|
4162 |
] ifFalse:[ |
|
4163 |
y := y max:0. |
|
4164 |
]. |
|
4165 |
||
4166 |
(x := anOrigin x) > 0 ifTrue:[ |
|
4167 |
x := x min:(self widthOfContents - innerWT). |
|
4168 |
]. |
|
4169 |
x := x max:0. |
|
4170 |
newOrg := (x @ y). |
|
4171 |
dltOrg := newOrg - viewOrigin. |
|
4172 |
dX := dltOrg x. |
|
4173 |
dY := dltOrg y. |
|
4174 |
||
4175 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
|
4176 |
^ self |
|
4177 |
]. |
|
4178 |
self originWillChange. |
|
4179 |
viewOrigin := newOrg. |
|
4180 |
||
4181 |
doRedraw ifFalse:[ |
|
4182 |
^ self originChanged:dltOrg |
|
4183 |
]. |
|
4184 |
||
4185 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL |
|
4186 |
dY := dY abs. |
|
4187 |
||
4188 |
(dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
4189 |
self invalidate. |
542 | 4190 |
] ifFalse:[ "/ COPY VERTICAL |
4191 |
y0 := y1 := margin + dY. |
|
4192 |
h := innerHG - dY. |
|
4193 |
||
4194 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0] |
|
4195 |
ifFalse:[y1 := margin. y := y1 + h]. |
|
4196 |
||
1460 | 4197 |
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
|
4198 |
self invalidateX:margin y:y width:innerWT height:(innerHG - h). |
542 | 4199 |
] |
4200 |
] ifFalse:[ "/ SCROLL HORIZONTAL |
|
4201 |
dX := dX abs. |
|
4202 |
||
4203 |
innerWT - dX < 20 ifTrue:[ |
|
1487 | 4204 |
labelView invalidate. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
4205 |
self invalidate. |
542 | 4206 |
] ifFalse:[ "/ COPY HORIZONTAL |
643 | 4207 |
x0 := x1 := dX + margin. |
2146 | 4208 |
w := width - dX. |
4209 |
lMargin := labelView margin. |
|
4210 |
||
4211 |
dltOrg x < 0 ifTrue:[ |
|
4212 |
" ->" |
|
5723 | 4213 |
x0 := x := margin. |
2146 | 4214 |
self copyFrom:self x:margin y:margin toX:margin+dX y:margin width:innerWT-dX height:innerHG async:false. |
4215 |
self invalidateX:margin y:margin width:dX height:innerHG. |
|
4216 |
||
4217 |
labelView notNil ifTrue:[ |
|
4218 |
labelView copyFrom:labelView x:lMargin y:lMargin toX:lMargin+dX y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false. |
|
4219 |
labelView invalidateX:lMargin y:lMargin width:dX height:labelView innerHeight. |
|
4220 |
]. |
|
4221 |
] ifFalse:[ |
|
4222 |
x1 := margin. x := w. |
|
4223 |
self copyFrom:self x:margin+dX y:margin toX:margin y:margin width:innerWT-dX height:innerHG async:false. |
|
4224 |
self invalidateX:width-margin-dX y:margin width:dX height:innerHG. |
|
4225 |
||
4226 |
labelView notNil ifTrue:[ |
|
4227 |
labelView copyFrom:labelView x:lMargin+dX y:lMargin toX:lMargin y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false. |
|
4228 |
labelView invalidateX:labelView width-lMargin-dX y:lMargin width:dX height:labelView innerHeight. |
|
4229 |
]. |
|
1487 | 4230 |
]. |
2146 | 4231 |
labelView repairDamage. |
542 | 4232 |
] |
4233 |
]. |
|
4234 |
self originChanged:dltOrg. |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
4235 |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
4236 |
wg notNil ifTrue:[ |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
4237 |
wg processRealExposeEventsFor:self. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
4238 |
]. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
4239 |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
4240 |
"Modified: / 7.9.1998 / 16:39:49 / cg" |
542 | 4241 |
! |
4242 |
||
2728
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4243 |
scrollToLine:aLineNr |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4244 |
"for compat. with listViews" |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4245 |
|
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4246 |
self scrollToRowAt:aLineNr colAt:1. |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4247 |
! |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4248 |
|
542 | 4249 |
scrollToRowAt:aRowNr colAt:aColNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4250 |
"make row at a row number in column at a column number visible" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4251 |
|
1497 | 4252 |
|x "{ Class:SmallInteger }" |
4253 |
y "{ Class:SmallInteger }" |
|
4254 |
l "{ Class:SmallInteger }" |
|
4255 |
dY "{ Class:SmallInteger }" |
|
4256 |
dX "{ Class:SmallInteger }" |
|
4257 |
| |
|
4258 |
||
4259 |
( (aRowNr between:1 and:(list size)) |
|
4260 |
and:[aColNr between:0 and:(columnDescriptors size)] |
|
542 | 4261 |
) ifFalse:[ |
4262 |
^ self |
|
4263 |
]. |
|
4264 |
||
4265 |
dY := dX := 0. |
|
4266 |
y := self yVisibleOfRowNr:aRowNr. |
|
4267 |
||
4268 |
y < margin ifTrue:[ |
|
4269 |
dY := margin - y. |
|
4270 |
] ifFalse:[ |
|
4271 |
y := y + rowHeight. |
|
4272 |
l := height - margin. |
|
4273 |
y > l ifTrue:[dY := l - y] |
|
4274 |
]. |
|
4275 |
||
4276 |
aColNr == 0 ifTrue:[ |
|
4277 |
dY == 0 ifTrue:[^ self]. |
|
4278 |
dX := 0. |
|
4279 |
] ifFalse:[ |
|
4280 |
x := self xVisibleOfColNr:aColNr. |
|
4281 |
||
1163 | 4282 |
x <= margin ifTrue:[ |
542 | 4283 |
dX := margin - x |
4284 |
] ifFalse:[ |
|
1497 | 4285 |
x := x + (columnDescriptors at:aColNr) width. |
542 | 4286 |
l := width - margin. |
4287 |
x > l ifTrue:[dX := l - x] |
|
4288 |
] |
|
4289 |
]. |
|
4290 |
||
4291 |
(dX == 0 and:[dY == 0]) ifFalse:[ |
|
4292 |
self scrollTo:(viewOrigin - (dX @ dY)). |
|
4293 |
] |
|
4294 |
! |
|
4295 |
||
4296 |
scrollToSelection |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4297 |
"make selection visible" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4298 |
|
607 | 4299 |
|rowNr| |
4300 |
||
4301 |
(rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
2960 | 4302 |
self scrollToRowAt:rowNr colAt:self selectedColIndex |
542 | 4303 |
] |
1506 | 4304 |
! |
4305 |
||
4306 |
scrollVerticalTo:aPixelOffset |
|
4307 |
"change origin to make aPixelOffset be the top line" |
|
4308 |
||
4309 |
|orgX orgY| |
|
4310 |
||
4311 |
orgX := viewOrigin x. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4312 |
scrollRowWise ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4313 |
orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4314 |
] ifFalse:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4315 |
orgY := aPixelOffset. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4316 |
]. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4317 |
^ self scrollTo:(orgX @ orgY). |
1749 | 4318 |
! |
4319 |
||
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4320 |
startAutoScroll:aSelectorOrBlock distance:aDistance |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4321 |
"setup for auto-scroll (when button-press-moving below/above view); |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4322 |
- timeDelta for scroll is computed from distance" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4323 |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4324 |
|timeDelta scrollBlock| |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4325 |
|
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4326 |
autoScroll ifFalse:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4327 |
self stopAutoScroll. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4328 |
^ self |
1749 | 4329 |
]. |
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4330 |
|
1749 | 4331 |
autoScrollBlock notNil ifTrue:[ |
4332 |
Processor removeTimedBlock:autoScrollBlock. |
|
4333 |
] ifFalse:[ |
|
4334 |
self compressMotionEvents:false. |
|
4335 |
]. |
|
4336 |
||
4337 |
timeDelta := 0.5 / (aDistance abs). |
|
4338 |
||
5723 | 4339 |
scrollBlock := |
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4340 |
[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4341 |
aSelectorOrBlock isSymbol ifTrue:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4342 |
self perform:aSelectorOrBlock. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4343 |
] ifFalse:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4344 |
aSelectorOrBlock value |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4345 |
]. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4346 |
autoScrollBlock notNil ifTrue:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4347 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4348 |
] |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4349 |
]. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4350 |
|
6145 | 4351 |
autoScrollBlock := [self sensor pushAction:scrollBlock]. |
1749 | 4352 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
4353 |
! |
|
4354 |
||
4355 |
stopAutoScroll |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4356 |
"stop any autoScroll" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4357 |
|
1749 | 4358 |
autoScrollBlock notNil ifTrue:[ |
4359 |
Processor removeTimedBlock:autoScrollBlock. |
|
4360 |
autoScrollBlock := nil. |
|
4361 |
self compressMotionEvents:true. |
|
4362 |
]. |
|
542 | 4363 |
! ! |
4364 |
||
3382 | 4365 |
!DSVColumnView methodsFor:'searching'! |
4366 |
||
5347 | 4367 |
findFirstColumnWithStringFrom:start to:stop |
5723 | 4368 |
start to:stop do:[:eachNr| |
5347 | 4369 |
|row lbl| |
4370 |
||
4371 |
row := self at:eachNr. |
|
5723 | 4372 |
columnDescriptors keysAndValuesDo:[:colNr :col | |
5347 | 4373 |
lbl := col shownValueForRow:row rowNr:eachNr. |
4374 |
||
4375 |
lbl isNonByteCollection ifTrue:[ |
|
4376 |
lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first]. |
|
4377 |
]. |
|
4378 |
(lbl respondsTo:#string) ifTrue:[ |
|
4379 |
lbl := lbl string. |
|
4380 |
]. |
|
4381 |
(lbl size ~~ 0 and:[(lbl at:1) isCharacter]) ifTrue:[ |
|
4382 |
^ colNr |
|
4383 |
] |
|
4384 |
] |
|
4385 |
]. |
|
4386 |
^ nil |
|
4387 |
! |
|
4388 |
||
3382 | 4389 |
findFirstRowWithString: aString from:start to:stop by: step ignoreCase:ignoreCase |
4390 |
"Return the rowNr from the first row that matches aString. |
|
5347 | 4391 |
The search is performed between the start and stop row numbers and incrementing by a step" |
4392 |
||
4393 |
|stringToMatch| |
|
4394 |
||
4395 |
aString isEmptyOrNil ifTrue:[ |
|
4396 |
^ self |
|
4397 |
]. |
|
4398 |
stringToMatch := '*', aString, '*'. |
|
4399 |
||
5723 | 4400 |
start to:stop by:step do:[:rowNr| |
5347 | 4401 |
|row lbl| |
4402 |
||
3382 | 4403 |
row := self at:rowNr. |
5723 | 4404 |
columnDescriptors keysAndValuesDo:[:colNr :col | |
3382 | 4405 |
lbl := col shownValueForRow:row rowNr:rowNr. |
4406 |
||
5347 | 4407 |
lbl isNonByteCollection ifTrue:[ |
4408 |
lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first]. |
|
3382 | 4409 |
]. |
4410 |
(lbl respondsTo:#string) ifTrue:[ |
|
4411 |
lbl := lbl string. |
|
4412 |
]. |
|
4413 |
lbl isNumber ifTrue:[ |
|
4414 |
lbl := lbl printString. |
|
4415 |
]. |
|
4416 |
||
5723 | 4417 |
(lbl size ~~ 0 |
4418 |
and:[(lbl at:1) isCharacter |
|
5347 | 4419 |
and:[stringToMatch match:lbl caseSensitive:ignoreCase not |
4359 | 4420 |
]]) ifTrue:[ |
3382 | 4421 |
^ rowNr |
4422 |
] |
|
4423 |
] |
|
4424 |
]. |
|
4425 |
^ nil |
|
4426 |
! |
|
4427 |
||
4428 |
findFirstRowWithString: aString from:start to:stop ignoreCase:ignoreCase |
|
4429 |
"Return the rowNr from the first row that matches aString. |
|
5347 | 4430 |
The search is performed between the start and stop row numbers" |
4431 |
||
4432 |
^ self findFirstRowWithString:aString from:start to:stop by:1 ignoreCase:ignoreCase |
|
3382 | 4433 |
! ! |
4434 |
||
542 | 4435 |
!DSVColumnView methodsFor:'selection'! |
4436 |
||
5723 | 4437 |
addRowToSelection:aRowNr |
2370 | 4438 |
"add a row to the selection |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4439 |
if a column is selected, the column will be closed" |
5723 | 4440 |
|
2370 | 4441 |
|newSelection| |
4442 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4443 |
(self isRowSelectable:aRowNr) ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4444 |
^ self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4445 |
]. |
2398 | 4446 |
self numberOfSelections == 0 ifTrue:[ |
4447 |
self selectColIndex:0 rowIndex:aRowNr. |
|
2370 | 4448 |
^ self |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4449 |
]. |
2907 | 4450 |
(self isInSelection:aRowNr) ifTrue:[ |
4451 |
^ self |
|
4452 |
]. |
|
2398 | 4453 |
multipleSelectOk ifFalse:[ |
2960 | 4454 |
self selectColIndex:0 rowIndex:aRowNr. |
2370 | 4455 |
^ self |
4456 |
]. |
|
2371 | 4457 |
newSelection := selectedRowIndex copyWith:aRowNr. |
2960 | 4458 |
self selectedColIndex ~~ 0 ifTrue:[ |
2370 | 4459 |
self selectColIndex:0 rowIndex:newSelection. |
2398 | 4460 |
] ifFalse:[ |
2907 | 4461 |
selectedRowIndex := newSelection. |
2398 | 4462 |
self invalidateRowAt:aRowNr. |
4463 |
self selectionChanged. |
|
2370 | 4464 |
]. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4465 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4466 |
|
607 | 4467 |
deselect |
4468 |
self selectColIndex:0 rowIndex:0 |
|
4469 |
! |
|
4470 |
||
4471 |
firstIndexSelected |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4472 |
"returns index of first row selected or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4473 |
|
607 | 4474 |
multipleSelectOk ifFalse:[ |
4475 |
^ selectedRowIndex |
|
4476 |
]. |
|
4477 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
4478 |
^ selectedRowIndex at:1 |
|
4479 |
]. |
|
4480 |
^ 0 |
|
4481 |
! |
|
4482 |
||
2695 | 4483 |
forceAcceptInEditor |
2722 | 4484 |
editView notNil ifTrue:[ |
6043 | 4485 |
editView isDialogBox ifFalse:[ |
4486 |
editView |
|
4487 |
allSubViewsDo:[:aSubView | |
|
4488 |
(aSubView respondsTo:#accept) ifTrue:[ |
|
4489 |
aSubView accept |
|
4490 |
]. |
|
4491 |
] |
|
4492 |
] |
|
2722 | 4493 |
] |
6043 | 4494 |
|
4495 |
"Modified: / 23-04-2019 / 19:17:04 / Claus Gittinger" |
|
2695 | 4496 |
! |
4497 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4498 |
hasRowSelection |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4499 |
"returns true if a selection exists, and its a complete row |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4500 |
(as opposed to either no selection, or a columnSelection)" |
5723 | 4501 |
|
2960 | 4502 |
^ self hasSelection and:[ self selectedColIndex == 0 ] |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4503 |
! |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4504 |
|
542 | 4505 |
hasSelection |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4506 |
"returns true if a selection exists" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4507 |
|
607 | 4508 |
^ self numberOfSelections ~~ 0 |
542 | 4509 |
! |
4510 |
||
607 | 4511 |
isInSelection:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4512 |
"returns true, if row, aRowNr is in the selection" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4513 |
|
607 | 4514 |
aRowNr ~~ 0 ifTrue:[ |
4515 |
multipleSelectOk ifFalse:[ |
|
4516 |
^ aRowNr == selectedRowIndex |
|
4517 |
]. |
|
4518 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
4519 |
^ selectedRowIndex includes:aRowNr |
|
4520 |
] |
|
4521 |
]. |
|
4522 |
^ false |
|
4523 |
! |
|
4524 |
||
5723 | 4525 |
isRowSelected:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4526 |
"returns true, if row is in the selection" |
5723 | 4527 |
|
2960 | 4528 |
self selectedColIndex == 0 ifTrue:[ |
647 | 4529 |
^ self isInSelection:aRowNr |
4530 |
]. |
|
4531 |
^ false |
|
4532 |
! |
|
4533 |
||
2263 | 4534 |
isRowVisible:aRowNr |
4535 |
|y h| |
|
4536 |
||
4537 |
h := rowHeight. |
|
4538 |
y := self yVisibleOfRowNr:aRowNr. |
|
4539 |
||
4540 |
y < margin ifTrue:[ |
|
4541 |
(h := h + y) <= margin ifTrue:[ |
|
4542 |
^ false |
|
5723 | 4543 |
]. |
2263 | 4544 |
] ifFalse:[ |
4545 |
y >= (height-margin) ifTrue:[^ false]. |
|
4546 |
]. |
|
4547 |
^ true |
|
4548 |
! |
|
4549 |
||
5723 | 4550 |
isSelected:aRowNr inColumn:aColNr |
612 | 4551 |
"returns true if cell in a row; a row number, in a column, a column |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4552 |
number is selected." |
5723 | 4553 |
|
1042 | 4554 |
multipleSelectOk ifFalse:[ |
4555 |
aRowNr ~~ selectedRowIndex ifTrue:[ |
|
4556 |
^ false |
|
4557 |
] |
|
4558 |
] ifTrue:[ |
|
2960 | 4559 |
(selectedRowIndex size ~~ 0 and:[ selectedRowIndex includes:aRowNr ]) ifFalse:[ |
1042 | 4560 |
^ false |
4561 |
] |
|
607 | 4562 |
]. |
2960 | 4563 |
^ (self selectedColIndex == 0 or:[ self selectedColIndex == aColNr ]) |
607 | 4564 |
! |
4565 |
||
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4566 |
isSelectionVisibleIn:anExtentPoint |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4567 |
self selectionIndicesDo:[:selRowNr | |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4568 |
|y| |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4569 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4570 |
y := self yVisibleOfRowNr:selRowNr. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4571 |
(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
|
4572 |
]. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4573 |
^ false. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4574 |
! |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4575 |
|
809 | 4576 |
lastIndexSelected |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4577 |
"returns index of last selected row or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4578 |
|
809 | 4579 |
multipleSelectOk ifFalse:[ |
4580 |
^ selectedRowIndex |
|
4581 |
]. |
|
4582 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
4583 |
^ selectedRowIndex last |
|
4584 |
]. |
|
4585 |
^ 0 |
|
4586 |
! |
|
4587 |
||
5723 | 4588 |
makeLineVisible:aLine |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4589 |
"scroll to make aLine visible" |
5723 | 4590 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4591 |
|colNr| |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4592 |
|
2960 | 4593 |
aLine == 0 ifTrue:[ |
4594 |
^ self |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4595 |
]. |
2960 | 4596 |
(self isRowVisible:aLine) ifTrue:[ |
4597 |
^ self |
|
4598 |
]. |
|
4599 |
(self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[ |
|
4600 |
colNr := self selectedColIndex |
|
4601 |
] ifFalse:[ colNr := 1 ]. |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4602 |
self scrollToRowAt:aLine colAt:colNr |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4603 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4604 |
|
2246 | 4605 |
makeSelectionVisible |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4606 |
"scroll to make the selection line visible" |
5723 | 4607 |
|
2246 | 4608 |
|rowNr colNr| |
4609 |
||
4610 |
rowNr := self firstIndexSelected. |
|
2960 | 4611 |
rowNr == 0 ifTrue:[ |
4612 |
^ self |
|
2246 | 4613 |
]. |
2960 | 4614 |
(self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[ |
4615 |
colNr := self selectedColIndex |
|
4616 |
] ifFalse:[ colNr := 1 ]. |
|
2246 | 4617 |
self scrollToRowAt:rowNr colAt:colNr |
4618 |
! |
|
4619 |
||
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4620 |
maxIndexSelected |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4621 |
"return the largest index selected or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4622 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4623 |
multipleSelectOk ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4624 |
^ selectedRowIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4625 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4626 |
selectedRowIndex size ~~ 0 ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4627 |
^ selectedRowIndex max |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4628 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4629 |
^ 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4630 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4631 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4632 |
minIndexSelected |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4633 |
"return the smallest index selected or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4634 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4635 |
multipleSelectOk ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4636 |
^ selectedRowIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4637 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4638 |
selectedRowIndex size ~~ 0 ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4639 |
^ selectedRowIndex min |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4640 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4641 |
^ 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4642 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4643 |
|
607 | 4644 |
numberOfSelections |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4645 |
"return the number of selected rows" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4646 |
|
607 | 4647 |
multipleSelectOk ifFalse:[ |
4648 |
^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
|
4649 |
]. |
|
4650 |
^ selectedRowIndex size |
|
542 | 4651 |
! |
4652 |
||
3140 | 4653 |
openEditorOnSelection |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4654 |
|colIdx column rowIdx editorAndModel winGroup |
3770 | 4655 |
editor filter keyBrdFwd selColor| |
3140 | 4656 |
|
4657 |
(shown and:[editView isNil]) ifFalse:[ |
|
4658 |
^ self |
|
4659 |
]. |
|
4660 |
winGroup := self windowGroup. |
|
4661 |
winGroup isNil ifTrue:[^ self ]. |
|
4662 |
||
4663 |
colIdx := self selectedColIndex ? 0. |
|
3504 | 4664 |
column := self columnDescriptorAt:colIdx. |
3140 | 4665 |
column isNil ifTrue:[^ self]. |
4666 |
||
4667 |
rowIdx := self selectedRowIndex ? 0. |
|
4668 |
rowIdx == 0 ifTrue:[^ self ]. |
|
4669 |
||
4670 |
rowIdx isSequenceable ifTrue:[ |
|
4671 |
rowIdx := rowIdx at:1 ifAbsent:[ ^ self ]. |
|
4672 |
]. |
|
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4673 |
|
5723 | 4674 |
editorAndModel := column editorForRowAt:rowIdx. |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4675 |
editorAndModel isNil ifTrue:[^ self]. |
6043 | 4676 |
|
4677 |
editor := editorAndModel editor. |
|
4678 |
editor isDialogBox ifTrue:[ |
|
4679 |
editor open. |
|
4680 |
editor accepted ifTrue:[ |
|
4681 |
"/ editorAndModel acceptAction value:nil. |
|
4682 |
]. |
|
4683 |
editView := editor. |
|
4684 |
didEditWithDialog := true. |
|
4685 |
^ self |
|
4686 |
]. |
|
3140 | 4687 |
|
4688 |
autoScrollToColumn == true ifTrue:[ |
|
4689 |
self scrollToRowAt:rowIdx colAt:colIdx. |
|
4690 |
]. |
|
4691 |
||
5723 | 4692 |
editView := SimpleView |
4693 |
extent:((column width - (2 * separatorSize)) |
|
3140 | 4694 |
@ (rowHeight - (2 * separatorSize))) |
4695 |
in:self. |
|
4696 |
||
4697 |
self updateEditViewOrigin. |
|
4698 |
||
4699 |
(column containsText or:[ column showSelectionHighLighted not ]) ifTrue:[ |
|
3149 | 4700 |
selColor := (column backgroundColorAt:rowIdx) |
3140 | 4701 |
] ifFalse:[ |
4702 |
selColor := selectionBackgroundColor |
|
4703 |
]. |
|
4704 |
editView viewBackground:selectionBackgroundColor. |
|
4705 |
||
3770 | 4706 |
editView add:editor. |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4707 |
editorAndModel editorNeedsCursorKeys ifTrue:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4708 |
editorAndModel editorNeedsReturnKey ifTrue:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4709 |
"/ only steal TAB from the editor |
4176 | 4710 |
filter := [:aKey | #( #Tab #NonInsertingTab #BackTab ) includes:aKey ] |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4711 |
] ifFalse:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4712 |
"/ steal TAB and RETURN from the editor |
4176 | 4713 |
filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #Return ) includes:aKey ] |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4714 |
]. |
3140 | 4715 |
] ifFalse:[ |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4716 |
editorAndModel editorNeedsReturnKey ifTrue:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4717 |
"/ only steal TAB and Curosr Keys from the editor |
4176 | 4718 |
filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown ) includes:aKey ] |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4719 |
] ifFalse:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4720 |
"/ steal TAB, RETURN and Curosr Keys from the editor |
4176 | 4721 |
filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown #Return ) includes:aKey ] |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4722 |
]. |
3140 | 4723 |
]. |
5723 | 4724 |
keyBrdFwd := KeyboardForwarder |
3140 | 4725 |
toView:self |
4726 |
condition:nil |
|
4727 |
filter:filter. |
|
5723 | 4728 |
editView |
4729 |
withAllSubViewsDo:[:aView | |
|
3140 | 4730 |
aView delegate:keyBrdFwd. |
4496 | 4731 |
aView font:self font. |
3140 | 4732 |
]. |
3141 | 4733 |
|
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4734 |
(editValue := editorAndModel model) notNil ifTrue:[ |
3140 | 4735 |
editValue addDependent:self. |
4736 |
]. |
|
4737 |
editView realize. |
|
3770 | 4738 |
editor canTab:true. |
3962 | 4739 |
|
3770 | 4740 |
winGroup focusView:editor. |
3140 | 4741 |
|
3504 | 4742 |
self processAllExposeEvents. |
3960
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4743 |
|
3962 | 4744 |
"Modified: / 02-11-2010 / 22:04:01 / cg" |
6043 | 4745 |
"Modified: / 23-04-2019 / 18:47:46 / Claus Gittinger" |
3504 | 4746 |
! |
4747 |
||
4748 |
processAllExposeEvents |
|
4749 |
|sensor| |
|
4750 |
||
3140 | 4751 |
sensor := self sensor. |
5723 | 4752 |
[ |
3504 | 4753 |
sensor hasExposeEventFor:nil |
3140 | 4754 |
] whileTrue:[ |
3504 | 4755 |
self windowGroup processExposeEvents |
4756 |
]. |
|
4757 |
||
4758 |
||
4759 |
||
4760 |
||
4761 |
||
4762 |
||
4763 |
||
4764 |
||
4765 |
||
4766 |
||
4767 |
||
4768 |
||
4769 |
||
4770 |
||
4771 |
||
3140 | 4772 |
! |
4773 |
||
2398 | 4774 |
removeRowFromSelection:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4775 |
"remove a row from the selection" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4776 |
|
2398 | 4777 |
(self isInSelection:aRowNr) ifFalse:[^ self]. |
4778 |
||
4779 |
self numberOfSelections == 1 ifTrue:[ |
|
4780 |
self deselect. |
|
4781 |
] ifFalse:[ |
|
4782 |
selectedRowIndex := selectedRowIndex copyWithout:aRowNr. |
|
4783 |
self invalidateRowAt:aRowNr. |
|
4784 |
self selectionChanged. |
|
4785 |
]. |
|
4786 |
! |
|
4787 |
||
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
4788 |
selectAllRows |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4789 |
"select all" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4790 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4791 |
multipleSelectOk ifFalse:[^ self]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4792 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4793 |
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
|
4794 |
self selectionChanged. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4795 |
self invalidate. |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
4796 |
! |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
4797 |
|
542 | 4798 |
selectColIndex:aColNr rowIndex:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4799 |
"change selection with notification" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4800 |
|
3140 | 4801 |
self selectColIndex:aColNr rowIndex:aRowNr openEditor:true. |
4802 |
! |
|
4803 |
||
4804 |
selectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor |
|
4805 |
"change selection with notification" |
|
4806 |
||
5666 | 4807 |
|oldCol oldRow| |
4808 |
||
4809 |
oldCol := self selectedColIndex. |
|
4810 |
oldRow := self selectedRowIndex. |
|
542 | 4811 |
|
3140 | 4812 |
self setSelectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor. |
542 | 4813 |
|
5723 | 4814 |
(oldCol ~~ self selectedColIndex |
5666 | 4815 |
or:[oldRow ~= self selectedRowIndex |
4816 |
or:[ignoreReselect == false]]) ifTrue:[ |
|
3302
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
4817 |
self selectionChanged:aColNr |
542 | 4818 |
]. |
4819 |
! |
|
4820 |
||
6180 | 4821 |
selectRow:anInteger |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4822 |
"select a row" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4823 |
|
6180 | 4824 |
^ self selectedRowIndex:anInteger |
542 | 4825 |
! |
4826 |
||
809 | 4827 |
selectRowAt:rowNr colAt:colNr atPoint:aPoint |
3140 | 4828 |
self selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:true. |
4829 |
! |
|
4830 |
||
4831 |
selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:openEditor |
|
4459 | 4832 |
|view p shouldClick editorType| |
3140 | 4833 |
|
4834 |
view := editView. |
|
6043 | 4835 |
didEditWithDialog := false. |
3140 | 4836 |
self selectColIndex:colNr rowIndex:rowNr openEditor:openEditor. |
4837 |
openEditor ifFalse:[ ^ self ]. |
|
4838 |
||
6043 | 4839 |
didEditWithDialog ifTrue:[didEditWithDialog := false. ^ self]. |
4840 |
||
3140 | 4841 |
editView isNil ifTrue:[ |
4842 |
"/ might be a reselection |
|
4843 |
self openEditorOnSelection. |
|
4844 |
editView isNil ifTrue:[^ self]. |
|
4845 |
] ifFalse:[ |
|
4846 |
editView == view ifTrue:[^ self]. |
|
4847 |
]. |
|
5517 | 4848 |
view := self detectViewAt:aPoint ignoreInvisible:false. |
3140 | 4849 |
|
4459 | 4850 |
shouldClick := true. |
4851 |
"/ when PreselectAllWhenOpeningEditor is true, we should not click into |
|
5902 | 4852 |
"/ the editor, as this could clear the selection. |
4459 | 4853 |
"/ however, for non-text editors, it is a good idea to do so... |
4854 |
PreselectAllWhenOpeningEditor == true ifTrue:[ |
|
4855 |
shouldClick := false. |
|
5990 | 4856 |
]. |
4857 |
||
4858 |
editorType := self selectedColumn editorType. |
|
4859 |
editorType == #ComboList ifTrue:[ |
|
4860 |
shouldClick := true |
|
4861 |
] ifFalse:[ |
|
5902 | 4862 |
editorType == #ComboBox ifTrue:[ |
4863 |
"/ only click if clicked onto menu-pull button |
|
4864 |
(view ~~ self and:[view notNil]) ifTrue:[ |
|
4865 |
|screenPoint comboSubView| |
|
5990 | 4866 |
|
5902 | 4867 |
screenPoint := device translatePoint:aPoint fromView:self toView:nil. |
4868 |
comboSubView := device viewFromPoint:screenPoint. |
|
4869 |
(comboSubView notNil and:[comboSubView isKindOf:Button]) ifTrue:[ |
|
4870 |
shouldClick := true |
|
4871 |
]. |
|
4872 |
]. |
|
5990 | 4873 |
] ifFalse:[ |
4874 |
editorType == #CheckToggle ifTrue:[ |
|
4875 |
shouldClick := true |
|
4876 |
] ifFalse:[ |
|
4877 |
editorType == #RadioButton ifTrue:[ |
|
4878 |
shouldClick := true |
|
4879 |
] ifFalse:[ |
|
4880 |
"/ TODO: more heuristics here... |
|
4881 |
"/ editorType == #RadioButton ifTrue:[ ]. |
|
4882 |
(view isKindOf:ComboBoxButton) ifTrue:[ |
|
4883 |
shouldClick := true |
|
4884 |
]. |
|
4885 |
]. |
|
4886 |
] |
|
5902 | 4887 |
]. |
5990 | 4888 |
]. |
4889 |
||
4459 | 4890 |
shouldClick ifTrue:[ |
2125 | 4891 |
"/ simulate clicking into the editor |
4459 | 4892 |
self breakPoint:#ca. |
5723 | 4893 |
(view ~~ self and:[view notNil]) ifTrue:[ |
4991 | 4894 |
p := device translatePoint:aPoint fromView:self toView:view. |
5723 | 4895 |
self sensor |
3960
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4896 |
pushEvent:(WindowEvent buttonPress:1 x:p x y:p y view:view); |
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4897 |
pushEvent:(WindowEvent buttonRelease:1 x:p x y:p y view:view). |
3504 | 4898 |
|
4899 |
"/ "/ a very special hack for radioButtons: |
|
4900 |
"/ "/ if the button is now on, all other cells must be turned off !! |
|
4901 |
"/ self selectedColumn editorType == #RadioButton ifTrue:[ |
|
4902 |
"/ 1 tolist size do:[:eachRowNr | |
|
4903 |
"/ eachRowNr ~~ rowNr ifTrue:[ |
|
4904 |
"/ self at:eachRowNr put:false |
|
4905 |
"/ ]. |
|
4906 |
"/ ]. |
|
4907 |
"/ ]. |
|
3960
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4908 |
]. |
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4909 |
]. |
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4910 |
|
4073
14b8653c124f
changed: #selectRowAt:colAt:atPoint:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4059
diff
changeset
|
4911 |
"Modified: / 07-09-2011 / 16:08:45 / cg" |
5517 | 4912 |
"Modified: / 15-03-2017 / 21:09:54 / stefan" |
6043 | 4913 |
"Modified: / 23-04-2019 / 19:17:11 / Claus Gittinger" |
809 | 4914 |
! |
4915 |
||
5723 | 4916 |
selectRowFrom:start to:stop |
2470 | 4917 |
|step oldSelection newSelection| |
2398 | 4918 |
|
4919 |
start == stop ifTrue:[ |
|
4920 |
self selectColIndex:0 rowIndex:start. |
|
4921 |
^ self |
|
4922 |
]. |
|
2470 | 4923 |
step := (start <= stop) ifTrue:1 ifFalse:-1. |
5723 | 4924 |
newSelection := (start to:stop by:step) |
2960 | 4925 |
select:[:idx | self isRowSelectable:idx ]. |
4926 |
self selectedColIndex ~~ 0 ifTrue:[ |
|
2470 | 4927 |
self selectColIndex:0 rowIndex:newSelection. |
2398 | 4928 |
^ self |
4929 |
]. |
|
2470 | 4930 |
oldSelection := selectedRowIndex ? #(). |
4931 |
selectedRowIndex := newSelection. |
|
5723 | 4932 |
newSelection |
2960 | 4933 |
select:[:i | (oldSelection includes:i) not ] |
4934 |
thenDo:[:i | self invalidateRowAt:i ]. |
|
5723 | 4935 |
oldSelection |
2960 | 4936 |
select:[:i | (newSelection includes:i) not ] |
4937 |
thenDo:[:i | self invalidateRowAt:i ]. |
|
2398 | 4938 |
self selectionChanged. |
4939 |
! |
|
4940 |
||
5969 | 4941 |
selectRowIndex:anInteger |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4942 |
"set selection of rows" |
5723 | 4943 |
|
5969 | 4944 |
self selectColIndex:self selectedColIndex rowIndex:anInteger |
4945 |
||
4946 |
"Modified (format): / 21-11-2018 / 20:08:26 / Claus Gittinger" |
|
542 | 4947 |
! |
4948 |
||
4949 |
selectedColIndex |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4950 |
"returns selected column number or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4951 |
|
2960 | 4952 |
^ self selectedColIndexHolder value |
542 | 4953 |
! |
4954 |
||
4955 |
selectedColumn |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4956 |
"returns selected column or nil" |
5723 | 4957 |
|
2960 | 4958 |
^ columnDescriptors at:self selectedColIndex ifAbsent:nil. |
542 | 4959 |
! |
4960 |
||
4961 |
selectedRow |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4962 |
"returns the selected row (or collection if multiple selection) or nil" |
5723 | 4963 |
|
607 | 4964 |
multipleSelectOk ifFalse:[ |
4965 |
^ self at:selectedRowIndex ifAbsent:nil |
|
4966 |
]. |
|
4967 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4968 |
^ selectedRowIndex collect:[:i | self at:i ] |
607 | 4969 |
]. |
4970 |
^ nil |
|
4971 |
! |
|
4972 |
||
5723 | 4973 |
selectedRow:something |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4974 |
"select something" |
5723 | 4975 |
|
607 | 4976 |
self selectedRowIndex:something |
542 | 4977 |
! |
4978 |
||
4979 |
selectedRowIndex |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4980 |
"returns selected row number or 0" |
5723 | 4981 |
|
542 | 4982 |
^ selectedRowIndex |
4983 |
! |
|
4984 |
||
5723 | 4985 |
selectedRowIndex:rowOrCollectionOfRows |
2470 | 4986 |
"set the row selection (single or multiple rows); |
2816 | 4987 |
does NOT change the selected column." |
5723 | 4988 |
|
5708 | 4989 |
self selectColIndex:(self selectedColIndex) rowIndex:rowOrCollectionOfRows |
542 | 4990 |
! |
4991 |
||
4992 |
selectionChanged |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4993 |
"selection has changed" |
5723 | 4994 |
|
5708 | 4995 |
self selectionChanged:nil |
4996 |
! |
|
4997 |
||
4998 |
selectionChanged:colNrOrNil |
|
4999 |
"selection has changed" |
|
5723 | 5000 |
|
1487 | 5001 |
|val| |
5002 |
||
5003 |
model notNil ifTrue:[ |
|
5004 |
val := self selectedRowIndex copy. |
|
5005 |
(model respondsTo:#selectionIndex:) ifTrue:[ |
|
5006 |
model selectionIndex:val |
|
5007 |
] ifFalse:[ |
|
5708 | 5008 |
|newVal| |
5009 |
||
5010 |
newVal := (useIndex ifTrue:[val] ifFalse:[self selectedRow]). |
|
5011 |
"/ must check here: valueHolder compares using identity to identify |
|
5012 |
"/ changes. This would lead to an endless recursion.... |
|
5013 |
model value ~= newVal ifTrue:[ |
|
5014 |
model value:newVal |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
5015 |
] |
1487 | 5016 |
] |
5017 |
]. |
|
542 | 5018 |
actionBlock notNil ifTrue:[ |
5708 | 5019 |
colNrOrNil isNil ifTrue:[ |
5020 |
actionBlock valueWithOptionalArgument:(self selectedRowIndex) |
|
3302
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5021 |
] ifFalse:[ |
5708 | 5022 |
actionBlock valueWithOptionalArgument:(self selectedRowIndex) and:colNrOrNil |
5023 |
]. |
|
3302
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5024 |
] |
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5025 |
! |
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5026 |
|
5723 | 5027 |
selectionIndicesDo:aOneArgBlock |
607 | 5028 |
"evaluate block on each row selected; the argument to the row |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
5029 |
is the index of the selected row" |
5723 | 5030 |
|
607 | 5031 |
multipleSelectOk ifFalse:[ |
5032 |
selectedRowIndex ~~ 0 ifTrue:[ |
|
5033 |
aOneArgBlock value:selectedRowIndex |
|
5034 |
] |
|
5035 |
] ifTrue:[ |
|
5036 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
5037 |
selectedRowIndex do:aOneArgBlock |
607 | 5038 |
] |
542 | 5039 |
] |
5040 |
! |
|
5041 |
||
5723 | 5042 |
setSelectColIndex:colNrArg rowIndex:rowNrArg |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
5043 |
"change selection without notification" |
3140 | 5044 |
|
5045 |
self setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:true |
|
5046 |
! |
|
5047 |
||
5048 |
setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:openEditor |
|
5049 |
"change selection without notification" |
|
5050 |
||
3504 | 5051 |
|rowNr colNr newCol oldCol oldRow sglSelRow oldSz winGroup| |
542 | 5052 |
|
5709 | 5053 |
rowNr := self validateSelection:rowNrArg. |
5054 |
rowNr isNil ifTrue:[ |
|
5723 | 5055 |
rowNr := multipleSelectOk ifTrue:[#()] ifFalse:[0]. |
5709 | 5056 |
]. |
5057 |
||
2470 | 5058 |
colNr := colNrArg. |
2695 | 5059 |
rowNr == 0 ifTrue:[ |
5060 |
colNr := 0. |
|
5061 |
] ifFalse:[ |
|
5062 |
multipleSelectOk ifTrue:[ |
|
2960 | 5063 |
(rowNr size == 1) ifFalse:[ |
5064 |
colNr := 0 |
|
5065 |
] |
|
2695 | 5066 |
]. |
542 | 5067 |
]. |
607 | 5068 |
(colNr := colNr ? 0) ~~ 0 ifTrue:[ |
3504 | 5069 |
newCol := self columnDescriptorAt:colNr. |
607 | 5070 |
newCol rendererType == #rowSelector ifTrue:[ |
5071 |
colNr := 0. |
|
5072 |
newCol := nil |
|
5073 |
] ifFalse:[ |
|
2960 | 5074 |
multipleSelectOk ifTrue:[ |
5075 |
sglSelRow := rowNr at:1 |
|
5076 |
] ifFalse:[ |
|
5077 |
sglSelRow := rowNr |
|
5078 |
]. |
|
607 | 5079 |
(newCol canSelect:sglSelRow) ifFalse:[ |
5080 |
newCol := nil. |
|
2960 | 5081 |
colNr := 0. |
1112 | 5082 |
selectRowOnDefault ifFalse:[ |
3449
2ba8e55953aa
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
5083 |
rowNr := multipleSelectOk ifTrue:[nil] ifFalse:[0] |
1112 | 5084 |
] |
607 | 5085 |
] |
5086 |
] |
|
5087 |
]. |
|
3140 | 5088 |
|
2960 | 5089 |
(rowNr = selectedRowIndex and:[ colNr == self selectedColIndex ]) ifTrue:[ |
6043 | 5090 |
(editView notNil and:[editView isDialogBox]) ifTrue:[ |
5091 |
editView := nil |
|
5092 |
]. |
|
643 | 5093 |
^ self |
542 | 5094 |
]. |
3140 | 5095 |
|
542 | 5096 |
"/ release old selection |
3140 | 5097 |
|
2960 | 5098 |
oldSz := self numberOfSelections. |
5099 |
oldCol := self selectedColIndex. |
|
542 | 5100 |
oldRow := selectedRowIndex. |
612 | 5101 |
oldSz == 1 ifTrue:[ |
2960 | 5102 |
multipleSelectOk ifTrue:[ |
5103 |
oldRow := oldRow at:1 |
|
5104 |
]. |
|
2695 | 5105 |
self updateColumnFromEditValueAndDestroyEditView. |
612 | 5106 |
]. |
5666 | 5107 |
|
5108 |
(rowNr ~= selectedRowIndex |
|
5109 |
or:[ignoreReselect == false]) ifTrue:[ |
|
2960 | 5110 |
selectedRowIndex := rowNr. |
3302
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5111 |
self selectionChanged:colNr. |
2960 | 5112 |
]. |
5113 |
self selectedColIndex:colNr. |
|
5114 |
shown ifFalse:[ ^ self ]. |
|
3140 | 5115 |
|
5116 |
winGroup := self windowGroup. |
|
5117 |
winGroup isNil ifTrue:[^ self ]. |
|
5118 |
||
2960 | 5119 |
oldSz > 1 ifTrue:[ |
5120 |
"/ redraw old selection |
|
5723 | 5121 |
oldRow do:[:aRowNr | |
2960 | 5122 |
"/ unselected if visible |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
5123 |
self invalidateRowAt:aRowNr colAt:0 |
618 | 5124 |
] |
5125 |
] ifFalse:[ |
|
5126 |
oldSz == 1 ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
5127 |
self invalidateRowAt:oldRow colAt:oldCol |
618 | 5128 |
] |
2960 | 5129 |
]. |
3140 | 5130 |
|
542 | 5131 |
"/ show new selection |
3140 | 5132 |
|
542 | 5133 |
newCol notNil ifTrue:[ |
3140 | 5134 |
openEditor ifTrue:[ |
5135 |
self openEditorOnSelection. |
|
5136 |
editView notNil ifTrue:[^ self]. |
|
5137 |
]. |
|
5138 |
self invalidateRowAt:sglSelRow colAt:colNr. |
|
5139 |
||
3130
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
5140 |
autoScrollToColumn == true ifTrue:[ |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
5141 |
self scrollToRowAt:sglSelRow colAt:colNr. |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
5142 |
]. |
612 | 5143 |
] ifFalse:[ |
2960 | 5144 |
self selectionIndicesDo:[:i | self invalidateRowAt:i colAt:0 ]. |
612 | 5145 |
self scrollToRowAt:(self firstIndexSelected) colAt:0 |
5146 |
]. |
|
3504 | 5147 |
|
5148 |
self processAllExposeEvents. |
|
612 | 5149 |
|
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
5150 |
"Modified: / 12-07-2011 / 14:22:42 / cg" |
6043 | 5151 |
"Modified: / 23-04-2019 / 19:30:50 / Claus Gittinger" |
607 | 5152 |
! |
5153 |
||
2695 | 5154 |
updateColumnFromEditValueAndDestroyEditView |
5155 |
|edValue selCol selRow| |
|
5156 |
||
2960 | 5157 |
selCol := self selectedColIndex. |
2695 | 5158 |
selRow := selectedRowIndex. |
5159 |
editValue notNil ifTrue:[ |
|
5160 |
editValue removeDependent:self |
|
5161 |
]. |
|
5162 |
editView notNil ifTrue:[ |
|
5163 |
self forceAcceptInEditor |
|
5164 |
]. |
|
5165 |
editValue notNil ifTrue:[ |
|
5166 |
edValue := editValue value. |
|
5167 |
edValue isSequenceable ifTrue:[ |
|
5168 |
edValue size == 0 ifTrue:[ |
|
5169 |
edValue := nil |
|
5170 |
] ifFalse:[ |
|
5171 |
edValue isString ifFalse:[ |
|
5172 |
edValue := edValue select:[:el | el notNil ]. |
|
5173 |
edValue size == 0 ifTrue:[ |
|
5174 |
edValue := nil |
|
5175 |
] |
|
5176 |
] |
|
5177 |
] |
|
5178 |
]. |
|
5179 |
selRow isNumber ifFalse:[ |
|
5180 |
"/ ??? should we do ???: |
|
5181 |
"/ selRow do:[:eachRow | |
|
5182 |
"/ (self columnAt:selCol) at:eachRow put:edValue. |
|
5183 |
"/ ] |
|
5184 |
selRow := selRow first |
|
5185 |
]. |
|
3504 | 5186 |
(self columnDescriptorAt:selCol) at:selRow put:edValue. |
2695 | 5187 |
modifiedChannel notNil ifTrue:[ |
5188 |
modifiedChannel value:true |
|
5189 |
]. |
|
5190 |
editValue := nil |
|
5191 |
]. |
|
5192 |
self destroyEditView. |
|
5193 |
! |
|
5194 |
||
607 | 5195 |
validateSelection:aSelection |
5196 |
|newSel| |
|
5197 |
||
2733 | 5198 |
(list size == 0 or:[aSelection isNil or:[aSelection == 0]]) ifTrue:[ |
607 | 5199 |
^ multipleSelectOk ifFalse:[0] ifTrue:[nil] |
5200 |
]. |
|
5201 |
||
2733 | 5202 |
newSel := aSelection. |
5203 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5204 |
multipleSelectOk ifFalse:[ |
2732 | 5205 |
newSel isInteger ifFalse:[ |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5206 |
newSel := self identityIndexOfRow:aSelection. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5207 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5208 |
^ (self isRowSelectable:newSel) ifTrue:[newSel] ifFalse:[0]. |
607 | 5209 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5210 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5211 |
"multiple selection |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5212 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5213 |
aSelection size ~~ 0 ifTrue:[ |
2732 | 5214 |
aSelection first isInteger ifTrue:[ |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5215 |
newSel := aSelection select:[:idx| self isRowSelectable:idx ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5216 |
] ifFalse:[ |
5723 | 5217 |
newSel := aSelection |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5218 |
collect:[:el| self identityIndexOfRow:el ] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5219 |
thenSelect:[:idx| self isRowSelectable:idx ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5220 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5221 |
newSel notEmpty ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5222 |
^ newSel |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5223 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5224 |
] ifFalse:[ |
2733 | 5225 |
newSel isInteger ifFalse:[ |
5226 |
newSel := self identityIndexOfRow:aSelection. |
|
5227 |
]. |
|
5228 |
(self isRowSelectable:newSel) ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5229 |
^ Array with:newSel |
2733 | 5230 |
] |
607 | 5231 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5232 |
^ nil |
542 | 5233 |
! ! |
5234 |
||
5235 |
!DSVColumnView class methodsFor:'documentation'! |
|
5236 |
||
5237 |
version |
|
4794 | 5238 |
^ '$Header$' |
3757 | 5239 |
! |
5240 |
||
5241 |
version_CVS |
|
4794 | 5242 |
^ '$Header$' |
542 | 5243 |
! ! |
4161 | 5244 |