author | Stefan Vogel <sv@exept.de> |
Wed, 22 May 2019 18:07:59 +0200 | |
changeset 6054 | 8b6b5de90065 |
parent 6053 | 88091f958e67 |
child 6072 | f62d23bf936f |
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 |
||
123 |
beDependentOfRows <Boolean> keep rows dependent; on 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 }" |
|
1639 |
| |
|
1640 |
||
1641 |
( (start := startIndex) < 1 |
|
1642 |
or:[(stop := stopIndex) > list size] |
|
1643 |
) ifTrue:[ |
|
1644 |
^ self subscriptBoundsError:start |
|
618 | 1645 |
]. |
861 | 1646 |
size := stop - start + 1. |
1647 |
||
1648 |
beDependentOfRows ifTrue:[ |
|
1649 |
list from:start to:stop do:[:r| r notNil ifTrue:[r removeDependent:self]]. |
|
1650 |
]. |
|
1651 |
noSel := self numberOfSelections. |
|
1652 |
||
1653 |
noSel ~~ 0 ifTrue:[ |
|
1654 |
noSel == 1 ifTrue:[ |
|
1655 |
noSel := self firstIndexSelected. |
|
1656 |
||
1657 |
noSel < start ifFalse:[ |
|
1658 |
noSel > stop ifTrue:[ |
|
1659 |
noSel := noSel - size. |
|
1660 |
||
1661 |
multipleSelectOk ifFalse:[selectedRowIndex := noSel] |
|
1662 |
ifTrue:[selectedRowIndex at:1 put:noSel] |
|
1663 |
] ifFalse:[ |
|
637 | 1664 |
editValue notNil ifTrue:[ |
1665 |
editValue removeDependent:self. |
|
1666 |
editValue := nil. |
|
1667 |
]. |
|
861 | 1668 |
self deselect. |
637 | 1669 |
] |
607 | 1670 |
] |
1671 |
] ifFalse:[ |
|
861 | 1672 |
coll := OrderedCollection new:noSel. |
1673 |
||
1674 |
selectedRowIndex do:[:i| |
|
1675 |
i < start ifTrue:[ |
|
1676 |
coll add:i |
|
1677 |
] ifFalse:[ |
|
1678 |
i > stop ifTrue:[ |
|
1679 |
coll add:(i - size) |
|
1680 |
] |
|
1681 |
] |
|
1682 |
]. |
|
1683 |
coll size == 0 ifTrue:[ |
|
1684 |
self deselect |
|
1685 |
] ifFalse:[ |
|
1686 |
selectedRowIndex := coll |
|
1687 |
] |
|
542 | 1688 |
] |
1689 |
]. |
|
861 | 1690 |
list removeFrom:start to:stop. |
1691 |
||
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1692 |
y0 := (start - 1) * rowHeight. |
861 | 1693 |
dY := size * rowHeight. |
1694 |
y1 := dY + y0. |
|
542 | 1695 |
yB := y1 + margin - viewOrigin y. |
1696 |
self recomputeHeightOfContents. |
|
1697 |
||
1698 |
y0 < (oY := viewOrigin y) ifTrue:[ |
|
1699 |
(noRedraw := y1 <= oY) ifFalse:[dY := y0 - oY] |
|
861 | 1700 |
ifTrue:[dY := dY negated]. |
542 | 1701 |
self originWillChange. |
1948
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
1702 |
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
|
1703 |
"/ viewOrigin y:(dY + oY). |
5723 | 1704 |
self originChanged:(0 @ dY). |
542 | 1705 |
] ifFalse:[ |
1706 |
noRedraw := y0 > (height + viewOrigin y) |
|
1707 |
]. |
|
1708 |
||
1483 | 1709 |
(shown not or:[self sensor hasDamageFor:self]) ifTrue:[ |
1710 |
self invalidate. |
|
1711 |
^ self contentsChanged. |
|
1712 |
]. |
|
1713 |
||
542 | 1714 |
(noRedraw or:[shown not]) ifFalse:[ |
861 | 1715 |
y0 := self yVisibleOfRowNr:start. |
542 | 1716 |
y0 := y0 max:margin. |
1717 |
||
1951 | 1718 |
"/ cg: if I have a non-solid background color, |
1719 |
"/ or individual items have a bgColor selector, |
|
1720 |
"/ invalidate the area (and readraw) instead of a scroll. |
|
5723 | 1721 |
(viewBackground isImageOrForm |
1951 | 1722 |
or:[ self anyColumnHasPotentialNonConstantBackground ]) |
1723 |
ifTrue:[ |
|
1724 |
"/ do not scroll but invalidate ... |
|
1725 |
] ifFalse:[ |
|
1726 |
y1 := yB. |
|
1727 |
h := height - margin - yB. |
|
1728 |
||
1729 |
h > 0 ifTrue:[ |
|
1730 |
self copyFrom:self x:0 y:yB toX:0 y:y0 width:width height:h async:false |
|
1731 |
]. |
|
1732 |
y0 := y0 + h. |
|
561 | 1733 |
]. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
1734 |
self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
542 | 1735 |
]. |
1736 |
self contentsChanged. |
|
861 | 1737 |
! |
1738 |
||
5723 | 1739 |
removeIndex:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1740 |
"remove row at an index; returns the removed row" |
5723 | 1741 |
|
861 | 1742 |
|row| |
1743 |
||
1744 |
row := list at:aRowNr ifAbsent:nil. |
|
1745 |
self removeFrom:aRowNr to:aRowNr. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1746 |
^ row |
542 | 1747 |
! |
1748 |
||
1749 |
removeLast |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1750 |
"remove last row; the row is returned" |
5723 | 1751 |
|
1497 | 1752 |
^ self removeIndex:(list size) |
1956 | 1753 |
! |
1754 |
||
1755 |
replaceFrom:start to:stop with:aCollection startingAt:repStart |
|
1756 |
"replace elements in the receiver between index start and stop, |
|
1757 |
with elements taken from replacementCollection starting at repStart. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1758 |
Return the receiver." |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1759 |
|
2032 | 1760 |
|inSelList listSize repStop run| |
1956 | 1761 |
|
1762 |
inSelList := OrderedCollection new. |
|
1763 |
listSize := list size. |
|
1764 |
repStop := repStart + (stop - start). |
|
1765 |
||
1766 |
list isNil ifTrue:[ |
|
1767 |
list := OrderedCollection new |
|
1768 |
]. |
|
1769 |
||
1770 |
[listSize < stop] whileTrue:[ list add:nil. listSize := listSize + 1 ]. |
|
1771 |
||
1772 |
start to:stop do:[:i| |aRow| |
|
1773 |
aRow := list at:i ifAbsent:nil. |
|
5723 | 1774 |
|
1956 | 1775 |
aRow notNil ifTrue:[ |
1776 |
beDependentOfRows ifTrue:[aRow removeDependent:self]. |
|
1777 |
||
1778 |
(self isInSelection:i) ifTrue:[ |
|
1779 |
inSelList add:i |
|
1780 |
]. |
|
1781 |
list at:i put:nil. |
|
1782 |
] |
|
1783 |
]. |
|
1784 |
||
1785 |
beDependentOfRows ifTrue:[ |
|
1786 |
aCollection from:repStart to:repStop do:[:aRow| |
|
1787 |
aRow notNil ifTrue:[aRow addDependent:self] |
|
1788 |
] |
|
1789 |
]. |
|
1790 |
||
1791 |
run := start. |
|
1792 |
aCollection from:repStart to:repStop do:[:aRow| |
|
1793 |
list at:run put:aRow. |
|
1794 |
run := run + 1. |
|
1795 |
]. |
|
1796 |
self invalidateRowsFrom:start to:stop. |
|
1797 |
||
1798 |
inSelList size ~~ 0 ifTrue:[ |
|
1799 |
self numberOfSelections == inSelList size ifTrue:[ |
|
1800 |
self deselect |
|
1801 |
] ifFalse:[ |
|
1802 |
selectedRowIndex := selectedRowIndex select:[:i| (inSelList identityIndexOf:i) == 0 ]. |
|
1803 |
self selectionChanged. |
|
1804 |
] |
|
1805 |
]. |
|
542 | 1806 |
! ! |
1807 |
||
1808 |
!DSVColumnView methodsFor:'change & update'! |
|
1809 |
||
1492 | 1810 |
changeWidthOfColumn:aColumn deltaX:aDeltaX |
1811 |
||
1812 |
aColumn setDescWidth:(aColumn width + aDeltaX). |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1813 |
cachedPreferredExtent notNil ifTrue:[self fitColumns] |
1492 | 1814 |
! |
1815 |
||
5723 | 1816 |
update:what with:aPara from:chgObj |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1817 |
"one of my rows/cells changed its value" |
5723 | 1818 |
|
2695 | 1819 |
|row listHoldersList arg1 arg2 col| |
1487 | 1820 |
|
1821 |
chgObj == columnHolder ifTrue:[ |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1822 |
cachedPreferredExtent := nil. |
5723 | 1823 |
self columnDescriptors:(columnHolder value). |
1824 |
^ self. |
|
622 | 1825 |
]. |
1711 | 1826 |
chgObj == columnAdaptor ifTrue:[ |
1827 |
col := columnAdaptor value. |
|
5723 | 1828 |
columnDescriptors do:[:aCol | |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1829 |
aCol columnAdaptor:col |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1830 |
]. |
2776 | 1831 |
self invalidate. |
1832 |
^ self |
|
1711 | 1833 |
]. |
1487 | 1834 |
chgObj == editValue ifTrue:[ |
2695 | 1835 |
self updateColumnFromEditValue. |
1227 | 1836 |
^ self |
622 | 1837 |
]. |
6053 | 1838 |
chgObj == enableChannel ifTrue:[ |
6054 | 1839 |
enableChannel value ifFalse:[ |
1840 |
self deselect. "Selected Checkboxes can still be edited, so deselect" |
|
1841 |
]. |
|
6053 | 1842 |
self invalidate. |
1843 |
^ self |
|
1844 |
]. |
|
3773 | 1845 |
|
1487 | 1846 |
chgObj == model ifTrue:[ |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1847 |
(what == #selectionIndex or:[ what == #selection ]) ifTrue:[ |
5723 | 1848 |
self selectRowIndex:(model selectionIndex copy). |
1849 |
^ self. |
|
1487 | 1850 |
]. |
1851 |
what == #list ifTrue:[ |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1852 |
cachedPreferredExtent := nil. |
5723 | 1853 |
self listHolder:model list. |
1854 |
^ self. |
|
1487 | 1855 |
]. |
1856 |
what == #value ifTrue:[ |
|
1857 |
model == listHolder ifTrue:[ |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1858 |
cachedPreferredExtent := nil. |
1487 | 1859 |
self list:(listHolder value) |
1860 |
] ifFalse:[ |
|
5708 | 1861 |
useIndex ifTrue:[ |
1862 |
self selectRowIndex:model value |
|
1863 |
] ifFalse:[ |
|
6051 | 1864 |
|myList newSel| |
1865 |
||
1866 |
myList := self list ? #(). |
|
5708 | 1867 |
multipleSelectOk ifTrue:[ |
6051 | 1868 |
newSel := (model value ? #()) |
1869 |
collect:[:each | myList indexOf:each] |
|
1870 |
thenSelect:[:eachIdx | eachIdx ~~ 0]. |
|
5708 | 1871 |
] ifFalse:[ |
6051 | 1872 |
newSel := myList indexOf:model value |
5708 | 1873 |
]. |
1874 |
self selectRowIndex:newSel |
|
1875 |
]. |
|
2776 | 1876 |
]. |
1487 | 1877 |
]. |
1878 |
^ self |
|
1879 |
]. |
|
3773 | 1880 |
|
4219 | 1881 |
(chgObj == listHolder) ifTrue:[ |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1882 |
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
|
1883 |
listHoldersList := listHolder value. |
4219 | 1884 |
|
1487 | 1885 |
what == #value ifTrue:[ |
5723 | 1886 |
self list:listHoldersList. |
1887 |
^ self. |
|
1487 | 1888 |
]. |
1889 |
aPara isCollection ifTrue:[ |
|
1890 |
arg1 := aPara at:1. |
|
1891 |
arg2 := aPara at:2. |
|
1892 |
] ifFalse:[ |
|
1893 |
arg1 := arg2 := aPara |
|
1894 |
]. |
|
1895 |
what == #at: ifTrue:[ |
|
5723 | 1896 |
self at:arg1 put:(listHoldersList at:arg1). |
2776 | 1897 |
^ self. |
1487 | 1898 |
]. |
1899 |
what == #insert: ifTrue:[ |
|
5723 | 1900 |
self add:(listHoldersList at:arg1) beforeIndex:arg1. |
2776 | 1901 |
^ self. |
1487 | 1902 |
]. |
1903 |
what == #remove: ifTrue:[ |
|
5723 | 1904 |
self removeFrom:arg1 to:arg1. |
2776 | 1905 |
^ self. |
1487 | 1906 |
]. |
1907 |
what == #removeFrom: ifTrue:[ |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1908 |
listHoldersList size == 0 ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1909 |
self list:nil |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1910 |
] ifFalse:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1911 |
self removeFrom:arg1 to:arg2 |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1912 |
]. |
1487 | 1913 |
^ self |
1914 |
]. |
|
1915 |
what == #insertCollection: ifTrue:[ |
|
1916 |
arg2 ~~ 0 ifTrue:[ |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1917 |
self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1)) |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1918 |
beforeIndex:arg1 |
1487 | 1919 |
]. |
1920 |
^ self. |
|
1921 |
]. |
|
1922 |
what == #replace: ifTrue:[ |
|
5723 | 1923 |
self |
3773 | 1924 |
replaceFrom:arg1 to:arg2 |
1925 |
with:listHoldersList startingAt:arg1. |
|
2537 | 1926 |
^ self |
1487 | 1927 |
]. |
2537 | 1928 |
self list:listHoldersList. |
1487 | 1929 |
^ self |
1930 |
]. |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
1931 |
|
1593 | 1932 |
arg1 := aPara ? what. |
2816 | 1933 |
row := (what isNumber) ifTrue:[what] ifFalse:[chgObj]. |
2190 | 1934 |
self invalidateVisibleRow:row readSelector:arg1. |
2695 | 1935 |
editView notNil ifTrue:[ |
1936 |
(self isInSelection:(self identityIndexOfRow:row)) ifTrue:[ |
|
1937 |
self updateEditorFromChangedRow |
|
1938 |
] |
|
1939 |
]. |
|
1940 |
||
5719 | 1941 |
"Modified: / 30-01-2000 / 12:16:49 / cg" |
1942 |
"Modified: / 08-03-2018 / 18:06:19 / stefan" |
|
6051 | 1943 |
"Modified: / 21-05-2019 / 17:22:20 / Claus Gittinger" |
6054 | 1944 |
"Modified: / 22-05-2019 / 16:26:57 / Stefan Vogel" |
2695 | 1945 |
! |
1946 |
||
1947 |
updateColumnFromEditValue |
|
1948 |
|editValueBefore firstSelectedIndex newValue realValue col| |
|
1949 |
||
1950 |
editValueBefore := editValue. |
|
1951 |
||
1952 |
firstSelectedIndex := self firstIndexSelected. |
|
1953 |
newValue := editValue value. |
|
1954 |
||
1955 |
col := self selectedColumn. |
|
1956 |
col at:firstSelectedIndex put:newValue. |
|
3504 | 1957 |
|
1958 |
col editorType == #RadioButton ifTrue:[ |
|
1959 |
"/ turn off the other column |
|
1960 |
||
1961 |
1 to:list size do:[:rowNr | |
|
1962 |
rowNr ~~ firstSelectedIndex ifTrue:[ |
|
1963 |
(col at:rowNr) ~~ false ifTrue:[ |
|
1964 |
col at:rowNr put:false. |
|
1965 |
self invalidateRowAt:rowNr colAt:col columnNumber. |
|
1966 |
]. |
|
1967 |
] |
|
1968 |
] |
|
1969 |
]. |
|
1970 |
||
2695 | 1971 |
realValue := col at:firstSelectedIndex. |
1972 |
(realValue ~= newValue) ifTrue:[ |
|
1973 |
"/ some validation by the row-object; the stored value |
|
1974 |
"/ is different from what I think. |
|
1975 |
"/ update my input fields modelValue |
|
1976 |
||
1977 |
"/ just in case someone nilled or changed the editValue |
|
1978 |
"/ 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
|
1979 |
"/ 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
|
1980 |
"/ model. |
5723 | 1981 |
(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
|
1982 |
editValue value:realValue withoutNotifying:self. |
3504 | 1983 |
]. |
2695 | 1984 |
]. |
1985 |
||
1986 |
modifiedChannel notNil ifTrue:[ |
|
1987 |
modifiedChannel value:true. |
|
1988 |
]. |
|
1989 |
! |
|
1990 |
||
1991 |
updateEditorFromChangedRow |
|
1992 |
|rowsValue rowNr| |
|
1993 |
||
1994 |
(rowNr := selectedRowIndex) isNumber ifFalse:[ |
|
1995 |
rowNr := rowNr first. |
|
1996 |
]. |
|
3504 | 1997 |
rowsValue := (self columnDescriptorAt:self selectedColIndex) at:rowNr. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1998 |
(editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
1999 |
editValue value:rowsValue withoutNotifying:self. |
5723 | 2000 |
editView |
2001 |
withAllSubViewsDo:[:v | |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2002 |
v isInputField ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2003 |
v flash. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2004 |
] |
2695 | 2005 |
] |
2702 | 2006 |
]. |
3773 | 2007 |
! |
2008 |
||
2009 |
updateList |
|
2010 |
listHolder notNil ifTrue:[ |
|
2011 |
self list:listHolder value. |
|
2012 |
^ self |
|
2013 |
]. |
|
2014 |
model notNil ifTrue:[ |
|
2015 |
self list:model value. |
|
2016 |
^ self |
|
2017 |
]. |
|
809 | 2018 |
! ! |
2019 |
||
2020 |
!DSVColumnView methodsFor:'drag & drop'! |
|
2021 |
||
824 | 2022 |
canDrag |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2023 |
"returns true if dragging is enabled" |
5723 | 2024 |
|
824 | 2025 |
^ dropSource notNil |
2026 |
! |
|
2027 |
||
3140 | 2028 |
canStartDragAt:aPoint clickedAt:clickPoint |
2029 |
self canDrag ifFalse:[ |
|
2030 |
^ false |
|
2031 |
]. |
|
2032 |
^ (aPoint dist:clickPoint) > (UserPreferences current motionDistanceToStartDrag) |
|
2033 |
! |
|
2034 |
||
5809 | 2035 |
dragAutoScroll:aDropContext |
2575 | 2036 |
"called by the DragAndDropManager to scroll during a drag/drop operation |
5805 | 2037 |
if required (decided by the widget itself). |
2038 |
If a scroll is done, return true; |
|
2039 |
otherwise false (used to restore the background)" |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2040 |
|
2575 | 2041 |
|yInset absLnNr y| |
2042 |
||
5809 | 2043 |
(super dragAutoScroll:aDropContext) ifTrue:[^ true]. |
2044 |
||
2045 |
y := aDropContext targetPoint y. |
|
2575 | 2046 |
yInset := margin + rowHeight. |
2047 |
y > yInset ifTrue:[ |
|
2048 |
y >= (height - yInset) ifFalse:[^ false]. |
|
2049 |
]. |
|
2050 |
||
2051 |
absLnNr := self yVisibleToRowNr:y. |
|
2052 |
absLnNr isNil ifTrue:[^ false]. |
|
2053 |
||
2054 |
(absLnNr > 1 and:[absLnNr < self size]) ifFalse:[ |
|
2055 |
^ false |
|
2056 |
]. |
|
5809 | 2057 |
aDropContext contentsWillChange. |
2575 | 2058 |
|
5723 | 2059 |
y > yInset |
2580 | 2060 |
ifTrue:[self scrollDown:rowHeight] |
2061 |
ifFalse:[self scrollUp:rowHeight]. |
|
2575 | 2062 |
|
2063 |
^ true |
|
5805 | 2064 |
|
5809 | 2065 |
"Modified: / 14-06-2018 / 11:21:13 / Claus Gittinger" |
2575 | 2066 |
! |
2067 |
||
824 | 2068 |
dropSource |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2069 |
"returns the dropSource or nil" |
5723 | 2070 |
|
824 | 2071 |
^ dropSource |
2072 |
! |
|
2073 |
||
5723 | 2074 |
dropSource:aDropSourceOrNil |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2075 |
"set the dropSource or nil" |
5723 | 2076 |
|
824 | 2077 |
dropSource := aDropSourceOrNil. |
809 | 2078 |
! |
2079 |
||
824 | 2080 |
startDragAt:aPoint |
2398 | 2081 |
|
2082 |
dropSource notNil ifTrue:[ |
|
3140 | 2083 |
buttonReleaseAction := buttonMotionAction := nil. |
2398 | 2084 |
dropSource startDragIn:self at:aPoint. |
809 | 2085 |
] |
542 | 2086 |
! ! |
2087 |
||
637 | 2088 |
!DSVColumnView methodsFor:'drawing'! |
2089 |
||
5723 | 2090 |
colorOnDevice:aColor |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2091 |
"returns color on device" |
5723 | 2092 |
|
637 | 2093 |
|col| |
2094 |
||
641 | 2095 |
aColor = Color noColor ifFalse:[ |
2096 |
col := colorMap at:aColor ifAbsent:nil. |
|
2097 |
col isNil ifTrue:[ |
|
4991 | 2098 |
colorMap at:aColor put:(col := aColor onDevice:device) |
641 | 2099 |
]. |
2100 |
^ col |
|
637 | 2101 |
]. |
641 | 2102 |
^ bgColor |
637 | 2103 |
! |
2104 |
||
2105 |
forceRedraw |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2106 |
"a redraw forced by any other component" |
5723 | 2107 |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2108 |
shown ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2109 |
self invalidate |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2110 |
] |
637 | 2111 |
! |
2112 |
||
2113 |
invalidate |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2114 |
"recompute extent before repair range" |
5723 | 2115 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2116 |
self recomputeHeightOfContents. |
637 | 2117 |
super invalidate. |
2118 |
! |
|
2119 |
||
5723 | 2120 |
invalidateRowAt:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2121 |
"redraw total row at an index" |
5723 | 2122 |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2123 |
self invalidateRowAt:aRowNr colAt:0 |
637 | 2124 |
! |
2125 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2126 |
invalidateRowAt:aRowNr colAt:aColNr |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2127 |
"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
|
2128 |
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
|
2129 |
If the row/column is hidden, no redraw is done" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2130 |
|
1497 | 2131 |
|x "{ Class:SmallInteger }" |
2132 |
y "{ Class:SmallInteger }" |
|
2133 |
h "{ Class:SmallInteger }" |
|
2134 |
w "{ Class:SmallInteger }" |
|
2523
a7d71e57632f
care for non-existing column
Claus Gittinger <cg@exept.de>
parents:
2500
diff
changeset
|
2135 |
col| |
1497 | 2136 |
|
2137 |
(shown and:[aRowNr notNil and:[aRowNr between:1 and:list size]]) ifTrue:[ |
|
1131 | 2138 |
h := rowHeight. |
1497 | 2139 |
y := self yVisibleOfRowNr:aRowNr. |
2140 |
||
2141 |
y < margin ifTrue:[ |
|
637 | 2142 |
(h := h + y) <= margin ifTrue:[ |
2143 |
^ self |
|
2144 |
]. "/ row not visible |
|
2145 |
h := h - margin. |
|
2146 |
y := margin. |
|
2147 |
] ifFalse:[ |
|
2148 |
y >= height ifTrue:[^ self]. |
|
2149 |
]. |
|
2150 |
aColNr ~~ 0 ifTrue:[ "/ redraw column in row |
|
3504 | 2151 |
col := (self columnDescriptorAt:aColNr). |
3672 | 2152 |
w := col isNil ifTrue:[0] ifFalse:[col width]. |
1497 | 2153 |
x := self xVisibleOfColNr:aColNr. |
2154 |
||
2155 |
x < margin ifTrue:[ |
|
637 | 2156 |
(w := w + x) <= margin ifTrue:[ |
2157 |
^ self |
|
2158 |
]. "/ column not visible |
|
2159 |
w := w - margin. |
|
2160 |
x := margin. |
|
2161 |
] ifFalse:[ |
|
2162 |
x >= width ifTrue:[^ self]. |
|
2163 |
] |
|
2164 |
] ifFalse:[ "/ redraw whole row |
|
2165 |
x := margin. |
|
2166 |
w := width. |
|
2167 |
]. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2168 |
self invalidateX:x y:y width:w height:h |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2169 |
] |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2170 |
! |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2171 |
|
2469
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2172 |
invalidateRows:aCollection |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2173 |
"redraw some visible rows" |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2174 |
|
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2175 |
shown ifTrue:[ |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2176 |
aCollection do:[:rowIndex | |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2177 |
self invalidateRowAt:rowIndex |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2178 |
] |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2179 |
] |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2180 |
! |
a6e3ffd6df94
Avoid duplicate computations (sv, cg)
Stefan Vogel <sv@exept.de>
parents:
2458
diff
changeset
|
2181 |
|
1956 | 2182 |
invalidateRowsFrom:aStart to:aStop |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2183 |
"redraw visible row from start to stop" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2184 |
|
1956 | 2185 |
|size start stop y0 y1| |
2186 |
||
2187 |
shown ifTrue:[ |
|
2188 |
size := list size. |
|
2189 |
start := aStart notNil ifTrue:[aStart max:1] ifFalse:[1]. |
|
2190 |
stop := aStop notNil ifTrue:[aStop min:size] ifFalse:[size]. |
|
2191 |
||
2192 |
start <= stop ifTrue:[ |
|
2193 |
y0 := (self yVisibleOfRowNr:start) max:margin. |
|
2194 |
y1 := ((self yVisibleOfRowNr:stop) + rowHeight) min:height. |
|
2195 |
||
2196 |
y0 < y1 ifTrue:[ |
|
2197 |
self invalidateX:margin y:y0 width:width height:(y1 - y0) |
|
2198 |
] |
|
2199 |
] |
|
2200 |
] |
|
2201 |
! |
|
2202 |
||
3138 | 2203 |
invalidateSelection |
5214 | 2204 |
"invalidate (force async redraw) the current selection" |
2205 |
||
3504 | 2206 |
|colIndex| |
2207 |
||
5723 | 2208 |
shown ifTrue:[ |
3138 | 2209 |
colIndex := self selectedColIndex ? 0. |
2210 |
||
2211 |
self selectionIndicesDo:[:aRowIndex| |
|
2212 |
self invalidateRowAt:aRowIndex colAt:colIndex. |
|
2213 |
]. |
|
2214 |
] |
|
2215 |
! |
|
2216 |
||
5723 | 2217 |
invalidateVisibleRow:aRow |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2218 |
"redraw row if visible" |
5723 | 2219 |
|
2190 | 2220 |
self invalidateVisibleRow:aRow colAt:0 |
809 | 2221 |
! |
2222 |
||
2190 | 2223 |
invalidateVisibleRow:aRow colAt:aColNr |
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2224 |
"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
|
2225 |
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
|
2226 |
If the row/column is hidden, no redraw is done" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2227 |
|
637 | 2228 |
|start "{ Class:SmallInteger }" |
2229 |
stop "{ Class:SmallInteger }" |
|
2230 |
| |
|
2231 |
||
2232 |
(start := self indexOfFirstRowShown) ~~ 0 ifTrue:[ |
|
1497 | 2233 |
stop := (start + (height // rowHeight)) min:(list size). |
637 | 2234 |
|
2235 |
aRow isNumber ifTrue:[ |
|
2236 |
(aRow between:start and:stop) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2237 |
self invalidateRowAt:aRow colAt:aColNr |
637 | 2238 |
] |
2239 |
] ifFalse:[ |
|
2240 |
start to:stop do:[:i| |
|
2241 |
(self at:i) == aRow ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
2242 |
^ self invalidateRowAt:i colAt:aColNr |
637 | 2243 |
] |
2244 |
] |
|
2245 |
] |
|
2246 |
] |
|
809 | 2247 |
! |
2248 |
||
2190 | 2249 |
invalidateVisibleRow:aRow readSelector:aSelector |
809 | 2250 |
"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
|
2251 |
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
|
2252 |
|
809 | 2253 |
|row idx| |
2254 |
||
2255 |
aSelector isNil ifTrue:[ |
|
2256 |
idx := 0 |
|
2257 |
] ifFalse:[ |
|
2258 |
(row := aRow) isNumber ifTrue:[ |
|
2259 |
(row := self at:aRow) isNil ifTrue:[ ^ self ] |
|
2260 |
]. |
|
5723 | 2261 |
idx := columnDescriptors |
4686 | 2262 |
findFirst:[:aCol| aCol description readSelector == aSelector] |
809 | 2263 |
]. |
2190 | 2264 |
self invalidateVisibleRow:aRow colAt:idx |
637 | 2265 |
! |
2266 |
||
2267 |
redrawX:x y:y width:w height:h |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2268 |
"redraw part of myself immediately, given logical coordinates " |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2269 |
|
4161 | 2270 |
|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
|
2271 |
start "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2272 |
stop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2273 |
x0 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2274 |
x1 "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2275 |
maxX "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2276 |
yTop "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2277 |
yBot "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2278 |
clHg "{ Class:SmallInteger }" |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2279 |
size "{ Class:SmallInteger }" |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2280 |
lineColor |
637 | 2281 |
| |
2282 |
||
2283 |
shown ifFalse:[^ self]. |
|
3993
6840bc23b584
changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
2284 |
self isReallyShown ifFalse:[^ self]. |
6840bc23b584
changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
2285 |
|
5421 | 2286 |
gc paint:bgColor. |
1115 | 2287 |
|
2288 |
columnDescriptors isEmpty ifTrue:[ |
|
5421 | 2289 |
^ gc fillRectangleX:x y:y width:w height:h |
1115 | 2290 |
]. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2291 |
|
1131 | 2292 |
size := list size. |
5723 | 2293 |
yTop := margin - viewOrigin y. |
1115 | 2294 |
c0 := y - yTop max:0. |
2295 |
start := (c0 // rowHeight) + 1. |
|
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2296 |
stop := (((c0 + h - 1) // rowHeight) + 1) min:size. |
1115 | 2297 |
|
2298 |
stop < start ifTrue:[ |
|
5421 | 2299 |
^ gc fillRectangleX:x y:y width:w height:h |
1115 | 2300 |
]. |
4521 | 2301 |
savClip := self clippingBoundsOrNil. |
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2302 |
|
1115 | 2303 |
maxX := (x + w) min:(width - margin). |
2304 |
x0 := margin - viewOrigin x. |
|
2305 |
yTop := yTop + ((start - 1) * rowHeight). |
|
1131 | 2306 |
clHg := (stop - start + 1) * rowHeight. |
2307 |
yBot := yTop + clHg. |
|
2308 |
||
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2309 |
stopRedraw := false. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2310 |
|
5737 | 2311 |
self class stopRedrawSignal handle:[:ex | |
2312 |
"/ 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
|
2313 |
stopRedraw := true. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2314 |
] do:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2315 |
columnDescriptors do:[:aCol| |cw| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2316 |
x1 := x0 + aCol width. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2317 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2318 |
(x1 > x and:[x0 < maxX]) ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2319 |
|left right rect| |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2320 |
left := x0 max:x. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2321 |
right := x1 min:maxX. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2322 |
rect := Rectangle left:left top:y width:(right - left) height:h. |
5723 | 2323 |
|
5737 | 2324 |
"/ self clippingBounds:nil. |
5204 | 2325 |
self clippingBounds:rect. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2326 |
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
|
2327 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2328 |
x0 := x1 |
1115 | 2329 |
]. |
2330 |
]. |
|
1131 | 2331 |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2332 |
"/ restore old clipping rectangle |
4521 | 2333 |
self clippingBounds:savClip. |
1131 | 2334 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2335 |
stopRedraw ifTrue:[ |
5737 | 2336 |
"/ redraw aborted due to too many changes while drawing. |
2337 |
"/ try again after some grace period |
|
2338 |
Processor addTimedBlock:[self invalidate] after:0.1 seconds. |
|
2339 |
"/ self invalidate. |
|
2340 |
"/ self makeSelectionVisible. |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2341 |
^ self |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2342 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2343 |
|
1131 | 2344 |
stop == size ifTrue:[ |
1115 | 2345 |
yTop := y + h. |
2346 |
yBot < (yTop - margin) ifTrue:[ |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
2347 |
"/ clear to bottom of screen |
5421 | 2348 |
gc paint:bgColor. |
2349 |
gc fillRectangleX:x y:yBot width:w height:(yTop - yBot). |
|
1112 | 2350 |
] |
1136 | 2351 |
]. |
2352 |
||
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
2353 |
(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
|
2354 |
"/ clear to right of screen |
5421 | 2355 |
gc paint:bgColor. |
2356 |
gc fillRectangleX:x1 y:y width:c0 height:h. |
|
1136 | 2357 |
]. |
4161 | 2358 |
"/ if only rows are selected we have to draw |
2359 |
"/ - the selection frame around the labels |
|
2360 |
"/ - and to fill the selection area behind the table if not bound to the width of the view |
|
2361 |
||
2362 |
self hasRowSelection ifFalse:[ ^ self ]. "/ nothing to do |
|
2363 |
||
2364 |
selWidth := width-margin-x1. |
|
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2365 |
lineColor := self selectionFrameColor. |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2366 |
|
4161 | 2367 |
self selectionIndicesDo:[:rowNr | |
2368 |
| yVis | |
|
2369 |
yVis := self yVisibleOfRowNr:rowNr. |
|
2370 |
selWidth > 0 ifTrue:[ |
|
5421 | 2371 |
gc paint:selectionBackgroundColor. |
2372 |
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
|
2373 |
]. |
4161 | 2374 |
lineColor notNil ifTrue:[ |
5421 | 2375 |
gc paint:lineColor. |
2376 |
gc displayLineFromX:x y:yVis toX:width y:yVis. |
|
4161 | 2377 |
yVis := yVis+rowHeight -1. |
5421 | 2378 |
gc displayLineFromX:x y:yVis toX:width y:yVis. |
4161 | 2379 |
]. |
5723 | 2380 |
]. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
2381 |
|
3993
6840bc23b584
changed: #redrawX:y:width:height:
Claus Gittinger <cg@exept.de>
parents:
3991
diff
changeset
|
2382 |
"Modified: / 21-01-2011 / 15:58:11 / cg" |
1112 | 2383 |
! ! |
2384 |
||
2385 |
!DSVColumnView methodsFor:'drawing interactors'! |
|
2386 |
||
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2387 |
displayLabel:aLabel x:xLeft y:yTop |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2388 |
"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
|
2389 |
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
|
2390 |
|
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2391 |
|y h | |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2392 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2393 |
aLabel notNil ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2394 |
aLabel isString ifTrue:[ |
2593
24ddc48c5ad4
bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents:
2592
diff
changeset
|
2395 |
y := yTop + self rowFontAscent. |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2396 |
] ifFalse:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2397 |
h := aLabel heightOn:self. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2398 |
|
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2399 |
h > minRowHeight ifTrue:[ |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2400 |
minRowHeight := h. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2401 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
2402 |
cachedPreferredExtent notNil ifTrue:[ |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
2403 |
"/ rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
5723 | 2404 |
cachedPreferredExtent := Point |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
2405 |
x: cachedPreferredExtent x |
3172
65f4533fbf75
preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents:
3149
diff
changeset
|
2406 |
y: (list size * rowHeight). |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2407 |
self contentsChanged. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2408 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2409 |
self class stopRedrawSignal raiseRequest. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2410 |
]. |
2593
24ddc48c5ad4
bugfix: recomputation of rowHeight if label is heigher than current rowHeight
ca
parents:
2592
diff
changeset
|
2411 |
y := yTop + (aLabel ascentOn:self). |
2592
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2412 |
]. |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2413 |
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
|
2414 |
]. |
3172
65f4533fbf75
preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents:
3149
diff
changeset
|
2415 |
|
65f4533fbf75
preferredExtent race condition
Claus Gittinger <cg@exept.de>
parents:
3149
diff
changeset
|
2416 |
"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
|
2417 |
! |
ab64fbe4fb1e
resize #rowHeight if a display label does not match the computed rowHeight
ca
parents:
2580
diff
changeset
|
2418 |
|
3504 | 2419 |
drawCheckToggleAtX:xLeft y:yTop w:cellWidth state:cellValue |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2420 |
"draw a check toggle button" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2421 |
|
1112 | 2422 |
|e form |
2423 |
y "{ Class:SmallInteger }" |
|
2424 |
x "{ Class:SmallInteger }" |
|
2425 |
h "{ Class:SmallInteger }" |
|
2426 |
w "{ Class:SmallInteger }" |
|
3504 | 2427 |
state| |
2428 |
||
2429 |
state := (cellValue ? false). |
|
2430 |
state isBoolean ifFalse:[ state := false ]. |
|
2431 |
||
1112 | 2432 |
w := checkToggleExtent x. |
2433 |
h := checkToggleExtent y. |
|
3504 | 2434 |
y := yTop + ((rowHeight - h) // 2). |
2435 |
x := xLeft + ((cellWidth - w) // 2). |
|
1529 | 2436 |
h odd ifTrue:[y := y + 1]. |
1112 | 2437 |
|
3504 | 2438 |
checkToggleActiveImage isNil ifTrue:[ |
5421 | 2439 |
gc paint:bgColor. |
2440 |
gc fillRectangleX:x y:y width:w height:h. |
|
5890 | 2441 |
self drawEdgesAtX:x y:y width:w height:h level:checkToggleLevel on:self. |
1131 | 2442 |
|
3504 | 2443 |
state ifFalse:[ |
1112 | 2444 |
^ self |
2445 |
]. |
|
5421 | 2446 |
gc paint:fgColor on:bgColor. |
1112 | 2447 |
form := checkToggleForm |
2448 |
] ifFalse:[ |
|
5890 | 2449 |
form := self isEnabled |
2450 |
ifTrue:[ |
|
2451 |
state |
|
2452 |
ifTrue:[checkToggleActiveImage] |
|
2453 |
ifFalse:[checkTogglePassiveImage]] |
|
2454 |
ifFalse:[ |
|
2455 |
state |
|
2456 |
ifTrue:[(checkToggleDisabledActiveImage ? checkToggleActiveImage)] |
|
2457 |
ifFalse:[(checkToggleDisabledPassiveImage ? checkTogglePassiveImage)]]. |
|
859 | 2458 |
]. |
1112 | 2459 |
e := (checkToggleExtent - form extent) // 2. |
5421 | 2460 |
gc displayForm:form x:(x + e x) y:(y + e y). |
5890 | 2461 |
|
2462 |
"Modified: / 17-08-2018 / 17:33:03 / Claus Gittinger" |
|
1112 | 2463 |
! |
2464 |
||
1131 | 2465 |
drawComboButtonAtX:xTop y:yTop w:rowWidth |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2466 |
"draw a combo button" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2467 |
|
1112 | 2468 |
|e |
2469 |
x "{ Class:SmallInteger }" |
|
2470 |
y "{ Class:SmallInteger }" |
|
2471 |
h "{ Class:SmallInteger }" |
|
3504 | 2472 |
w "{ Class:SmallInteger }"| |
2473 |
||
1112 | 2474 |
w := comboButtonExtent x. |
2475 |
h := comboButtonExtent y. |
|
3504 | 2476 |
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
|
2477 |
x := xTop + (rowWidth - w - separatorSize - 1). |
1112 | 2478 |
e := (comboButtonExtent - comboButtonForm extent) // 2. |
2479 |
||
5421 | 2480 |
gc paint:bgColor. |
2481 |
gc fillRectangleX:x y:y width:w height:h. |
|
1131 | 2482 |
self drawEdgesAtX:x y:y width:w height:h level:comboButtonLevel on:self. |
5421 | 2483 |
gc paint:fgColor on:bgColor. |
5890 | 2484 |
gc |
2485 |
displayForm: |
|
2486 |
(self isEnabled |
|
2487 |
ifTrue:[comboButtonForm] |
|
2488 |
ifFalse:[comboButtonDisabledForm ? comboButtonForm]) |
|
2489 |
x:(x + e x) |
|
2490 |
y:(y + e y) |
|
2491 |
||
2492 |
"Modified: / 17-08-2018 / 17:35:20 / Claus Gittinger" |
|
1112 | 2493 |
! |
2494 |
||
5723 | 2495 |
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
|
2496 |
"draw edges for a cell or label" |
5723 | 2497 |
|
2498 |
aGC |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2499 |
drawEdgesForX:x |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2500 |
y:y |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2501 |
width:w |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2502 |
height:h |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2503 |
level:aLevel |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2504 |
shadow:buttonShadowColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2505 |
light:buttonLightColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2506 |
halfShadow:buttonHalfShadowColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2507 |
halfLight:buttonHalfLightColor |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2508 |
style:ButtonEdgeStyle. |
3504 | 2509 |
! |
2510 |
||
5447 | 2511 |
drawRadioButtonAtX:xLeft y:yTop w:cellWidth state:aBooleanOrNil |
3504 | 2512 |
"draw a radio button" |
2513 |
||
2514 |
|image |
|
2515 |
y "{ Class:SmallInteger }" |
|
2516 |
x "{ Class:SmallInteger }" |
|
2517 |
h "{ Class:SmallInteger }" |
|
2518 |
w "{ Class:SmallInteger }"| |
|
2519 |
||
2520 |
w := radioButtonActiveImage extent x. |
|
2521 |
h := radioButtonActiveImage extent y. |
|
2522 |
y := yTop + ((rowHeight - h) // 2). |
|
2523 |
x := xLeft + ((cellWidth - w) // 2). |
|
2524 |
h odd ifTrue:[y := y + 1]. |
|
2525 |
||
5890 | 2526 |
image := self isEnabled |
2527 |
ifTrue:[ |
|
2528 |
(aBooleanOrNil == true) |
|
2529 |
ifTrue:[radioButtonActiveImage] |
|
2530 |
ifFalse:[radioButtonPassiveImage]] |
|
2531 |
ifFalse:[ |
|
2532 |
(aBooleanOrNil == true) |
|
2533 |
ifTrue:[radioButtonDisabledActiveImage ? radioButtonActiveImage] |
|
2534 |
ifFalse:[radioButtonDisabledPassiveImage ? radioButtonPassiveImage]]. |
|
3504 | 2535 |
|
4991 | 2536 |
image := image onDevice:device. |
3504 | 2537 |
|
2538 |
self displayForm:image x:x y:y. |
|
5447 | 2539 |
|
2540 |
"Modified (format): / 04-02-2017 / 21:31:16 / cg" |
|
5890 | 2541 |
"Modified: / 17-08-2018 / 17:36:23 / Claus Gittinger" |
637 | 2542 |
! ! |
2543 |
||
542 | 2544 |
!DSVColumnView methodsFor:'enumerating columns'! |
2545 |
||
3504 | 2546 |
columnsDo:aOneArgBlock |
2547 |
"evaluate the argument, aOneArgBlock for every columnDescriptor" |
|
5723 | 2548 |
|
542 | 2549 |
columnDescriptors do:aOneArgBlock |
2550 |
! |
|
2551 |
||
5723 | 2552 |
columnsFrom:start to:stop do:aOneArgBlock |
542 | 2553 |
"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
|
2554 |
stop in the collection of column descriptors" |
5723 | 2555 |
|
2556 |
columnDescriptors |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2557 |
from:start |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2558 |
to:stop |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2559 |
do:aOneArgBlock |
542 | 2560 |
! ! |
2561 |
||
2562 |
!DSVColumnView methodsFor:'event handling'! |
|
2563 |
||
3140 | 2564 |
buttonControlPressAt:clickPoint rowNr:aRowNr colNr:aColNr |
2398 | 2565 |
|isSelected prvRow doAdd chgSet| |
2566 |
||
3140 | 2567 |
buttonMotionAction := buttonReleaseAction := nil. |
3239 | 2568 |
isSelected := self isInSelection:aRowNr. |
2569 |
||
3140 | 2570 |
multipleSelectOk ifFalse:[ |
3239 | 2571 |
isSelected ifTrue:[ |
2572 |
self deselect. |
|
2573 |
] ifFalse:[ |
|
2574 |
self selectRowAt:aRowNr colAt:aColNr atPoint:clickPoint openEditor:false. |
|
2575 |
]. |
|
3140 | 2576 |
^ self |
2577 |
]. |
|
2578 |
||
2579 |
isSelected ifTrue:[ self removeRowFromSelection:aRowNr ] |
|
2580 |
ifFalse:[ self addRowToSelection:aRowNr ]. |
|
2398 | 2581 |
|
2582 |
multipleSelectOk ifFalse:[ ^ self ]. |
|
2583 |
||
3140 | 2584 |
prvRow := aRowNr. |
2398 | 2585 |
chgSet := IdentitySet new. |
2586 |
doAdd := isSelected not. |
|
2587 |
||
5723 | 2588 |
buttonMotionAction := [:p| |
2907 | 2589 |
|rowNr mustRestore step f| |
2590 |
||
2398 | 2591 |
rowNr := self yVisibleToRowNr:(p y). |
2592 |
(rowNr notNil and:[rowNr ~~ prvRow]) ifTrue:[ |
|
3140 | 2593 |
rowNr == aRowNr ifTrue:[ |
2398 | 2594 |
mustRestore := true |
2595 |
] ifFalse:[ |
|
3140 | 2596 |
rowNr > aRowNr ifTrue:[ mustRestore := (rowNr < prvRow) ] |
2597 |
ifFalse:[ mustRestore := (rowNr > prvRow) ]. |
|
2398 | 2598 |
]. |
2599 |
prvRow > rowNr ifTrue:[ step := -1 ] |
|
2600 |
ifFalse:[ step := 1 ]. |
|
2907 | 2601 |
|
2602 |
||
2398 | 2603 |
mustRestore ifTrue:[ |
2604 |
[ prvRow ~~ rowNr ] whileTrue:[ |
|
2605 |
(chgSet removeIdentical:prvRow ifAbsent:nil) notNil ifTrue:[ |
|
2606 |
doAdd ifFalse:[ self addRowToSelection:prvRow ] |
|
2607 |
ifTrue:[ self removeRowFromSelection:prvRow ]. |
|
2608 |
]. |
|
2609 |
prvRow := prvRow + step. |
|
2610 |
]. |
|
2611 |
] ifFalse:[ |
|
2612 |
[ prvRow ~~ rowNr ] whileTrue:[ |
|
2613 |
prvRow := prvRow + step. |
|
2614 |
||
2615 |
doAdd ~~ (self isInSelection:rowNr) ifTrue:[ |
|
2616 |
chgSet add:prvRow. |
|
2617 |
||
2618 |
doAdd ifTrue:[ self addRowToSelection:prvRow ] |
|
2619 |
ifFalse:[ self removeRowFromSelection:prvRow ]. |
|
2620 |
] |
|
2621 |
]. |
|
2622 |
]. |
|
2623 |
]. |
|
2624 |
]. |
|
3130
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
2625 |
|
3239 | 2626 |
"Modified: / 21-07-2007 / 22:00:27 / cg" |
2398 | 2627 |
! |
2628 |
||
5723 | 2629 |
buttonMotion:buttonMask x:x y:y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2630 |
"mouse-move while button was pressed - handle multiple selection changes" |
5723 | 2631 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2632 |
self isEnabled ifFalse:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2633 |
^ self |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2634 |
]. |
2788
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
2635 |
|
2398 | 2636 |
buttonMotionAction notNil ifTrue:[ |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2637 |
buttonMotionAction value:(x @ y). |
2398 | 2638 |
buttonMotionAction notNil ifTrue:[ |
2639 |
autoScroll ifTrue:[ |
|
2640 |
"/ if moved outside of view, start autoscroll |
|
2641 |
(y < 0) ifTrue:[ |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2642 |
^ self startAutoScroll:#scrollUp distance:y. |
2398 | 2643 |
]. |
2644 |
(y > height) ifTrue:[ |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
2645 |
^ self startAutoScroll:#scrollDown distance:(y - height). |
2398 | 2646 |
]. |
2647 |
] |
|
607 | 2648 |
] |
2649 |
]. |
|
2398 | 2650 |
self stopAutoScroll. |
607 | 2651 |
! |
2652 |
||
542 | 2653 |
buttonMultiPress:button x:x y:y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2654 |
"a button was pressed twice - handle doubleclick here" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2655 |
|
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2656 |
|selectedCol| |
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2657 |
|
2398 | 2658 |
buttonMotionAction := buttonReleaseAction := nil. |
2659 |
||
1805 | 2660 |
self isEnabled ifFalse:[^ self]. |
2661 |
||
3742
a4bb22bc79e2
preps for right-menu on buttonRelease
Claus Gittinger <cg@exept.de>
parents:
3702
diff
changeset
|
2662 |
(button == 1) ifFalse:[ |
542 | 2663 |
^ super buttonMultiPress:button x:x y:y |
2664 |
]. |
|
607 | 2665 |
self numberOfSelections == 1 ifTrue:[ |
2666 |
self firstIndexSelected == (self yVisibleToRowNr:y) ifTrue:[ |
|
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2667 |
selectedCol := self selectedColIndex. |
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2668 |
( selectedCol == 0 |
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2669 |
or:[selectedCol == (self xVisibleToColNr:x)] |
607 | 2670 |
) ifTrue:[ |
2671 |
self doubleClicked |
|
2672 |
] |
|
542 | 2673 |
] |
2674 |
] |
|
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2675 |
|
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
2676 |
"Modified: / 26-03-2007 / 15:19:04 / cg" |
542 | 2677 |
! |
2678 |
||
2679 |
buttonPress:button x:x y:y |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2680 |
"a button was pressed - handle selection here" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2681 |
|
4664 | 2682 |
|rowNr colNr sensor clickPoint clickedIntoSelection column columnEditorType| |
2802 | 2683 |
|
2398 | 2684 |
buttonMotionAction := buttonReleaseAction := nil. |
542 | 2685 |
|
1805 | 2686 |
self isEnabled ifFalse:[^ self]. |
2687 |
||
4664 | 2688 |
rowNr := self yVisibleToRowNr:y. |
2689 |
colNr := self xVisibleToColNr:x. |
|
2690 |
||
5895 | 2691 |
(button == 2) ifTrue:[ |
2692 |
|openMenu| |
|
2693 |
||
4664 | 2694 |
openMenu := false. |
5723 | 2695 |
|
3922 | 2696 |
UserPreferences current selectOnRightClick ifFalse:[ |
4664 | 2697 |
openMenu := true. |
2698 |
] ifTrue:[ |
|
2699 |
UserPreferences current showRightButtonMenuOnRelease ifFalse:[ |
|
2700 |
(rowNr notNil and:[colNr notNil and:[self isRowSelectable:rowNr]]) ifTrue:[ |
|
2701 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false |
|
2702 |
]. |
|
2703 |
openMenu := true. |
|
2704 |
]. |
|
2705 |
]. |
|
5895 | 2706 |
openMenu ifTrue:[ |
2707 |
|menu| |
|
2708 |
||
3922 | 2709 |
menu := self findMenuForSelection. |
5723 | 2710 |
menu notNil ifTrue:[ |
3922 | 2711 |
self startUpMenu:menu. |
4664 | 2712 |
] ifFalse:[ |
2713 |
super buttonPress:button x:x y:y. |
|
3922 | 2714 |
]. |
3504 | 2715 |
^ self |
4664 | 2716 |
]. |
2717 |
]. |
|
5723 | 2718 |
|
2804
8204b926377d
oops - firstRow could be nil
Claus Gittinger <cg@exept.de>
parents:
2802
diff
changeset
|
2719 |
(rowNr isNil or:[colNr isNil]) ifTrue:[ |
2722 | 2720 |
self deselect. |
2398 | 2721 |
super buttonPress:button x:x y:y. |
2722 |
^ self |
|
2723 |
]. |
|
2724 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2725 |
(self isRowSelectable:rowNr) ifFalse:[^ self ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
2726 |
|
3140 | 2727 |
sensor := self sensor. |
2728 |
clickPoint := x @ y. |
|
2813 | 2729 |
|
2398 | 2730 |
sensor shiftDown ifTrue:[ |
3140 | 2731 |
self buttonShiftPressAt:clickPoint rowNr:rowNr colNr:colNr. |
2398 | 2732 |
^ self |
2733 |
]. |
|
2802 | 2734 |
sensor ctrlDown ifTrue:[ |
3140 | 2735 |
self buttonControlPressAt:clickPoint rowNr:rowNr colNr:colNr. |
2736 |
^ self |
|
2737 |
]. |
|
2738 |
||
2739 |
multipleSelectOk ifFalse:[ |
|
2740 |
self canDrag ifFalse:[ |
|
2741 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true. |
|
2742 |
^ self |
|
2743 |
]. |
|
2744 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false. |
|
2745 |
||
3923 | 2746 |
((button == 2) and:[UserPreferences current selectOnRightClick]) ifTrue:[ |
5723 | 2747 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true |
3922 | 2748 |
] ifFalse:[ |
5723 | 2749 |
buttonReleaseAction := |
2750 |
[ |
|
6043 | 2751 |
buttonReleaseAction := nil. |
2752 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:true. |
|
3922 | 2753 |
]. |
2754 |
||
5723 | 2755 |
buttonMotionAction := |
3922 | 2756 |
[:aPoint| |
2757 |
(self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[ |
|
2758 |
self startDragAt:aPoint |
|
2759 |
] |
|
2760 |
]. |
|
2761 |
]. |
|
3140 | 2762 |
^ self |
2763 |
]. |
|
2764 |
||
3923 | 2765 |
((button == 2) and:[UserPreferences current selectOnRightClick]) ifFalse:[ |
5723 | 2766 |
buttonReleaseAction := |
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2767 |
[ |
6043 | 2768 |
buttonReleaseAction := nil. |
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2769 |
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
|
2770 |
]. |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2771 |
|
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2772 |
"/ normally, we select on button release; however, any editor is shown immediately |
5723 | 2773 |
((column := self columnDescriptorAt:colNr) notNil |
6043 | 2774 |
and:[ (columnEditorType := column description editorType) notNil |
2775 |
and:[ columnEditorType ~~ #None ]] |
|
2776 |
) ifTrue:[ |
|
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2777 |
buttonReleaseAction value. |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2778 |
buttonReleaseAction := nil. |
6043 | 2779 |
(editView notNil and:[editView isDialogBox]) ifTrue:[ |
2780 |
editView := nil. |
|
2781 |
]. |
|
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2782 |
editView notNil ifTrue:[ |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2783 |
^ self. |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2784 |
] |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2785 |
] |
3922 | 2786 |
]. |
2787 |
||
3140 | 2788 |
clickedIntoSelection := self isInSelection:rowNr. |
5723 | 2789 |
clickedIntoSelection ifTrue:[ |
3908
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2790 |
|selColIdx| |
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2791 |
|
3140 | 2792 |
selColIdx := self selectedColIndex. |
2793 |
||
2794 |
(selColIdx ~~ 0 and:[selColIdx ~~ colNr]) ifTrue:[ |
|
2795 |
clickedIntoSelection := (selectedRowIndex size > 1) |
|
2796 |
]. |
|
2797 |
]. |
|
2798 |
||
2799 |
clickedIntoSelection ifFalse:[ |
|
2800 |
self selectRowAt:rowNr colAt:colNr atPoint:clickPoint openEditor:false. |
|
2801 |
] ifTrue:[ |
|
2802 |
self canDrag ifTrue:[ |
|
5723 | 2803 |
buttonMotionAction := |
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2804 |
[:aPoint| |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2805 |
(self canStartDragAt:aPoint clickedAt:clickPoint) ifTrue:[ |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2806 |
self startDragAt:aPoint |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2807 |
] |
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
2808 |
]. |
3140 | 2809 |
^ self |
2802 | 2810 |
] |
2811 |
]. |
|
2788
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
2812 |
|
8f45f2da80fa
selection/multiSelection/startDrag
Claus Gittinger <cg@exept.de>
parents:
2777
diff
changeset
|
2813 |
buttonMotionAction := [:p| |
5723 | 2814 |
(self bounds containsPoint:p) ifTrue:[ |
3908
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2815 |
|rowUnderPoint| |
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2816 |
|
3140 | 2817 |
rowUnderPoint := self yVisibleToRowNr:(p y). |
2818 |
||
2819 |
rowUnderPoint notNil ifTrue:[ |
|
2820 |
buttonReleaseAction notNil ifTrue:[ |
|
5723 | 2821 |
rowUnderPoint == rowNr ifFalse:[ |
3140 | 2822 |
buttonReleaseAction := nil |
2907 | 2823 |
]. |
2824 |
]. |
|
3140 | 2825 |
buttonReleaseAction isNil ifTrue:[ |
2826 |
self selectRowFrom:rowNr to:rowUnderPoint. |
|
2827 |
] |
|
2828 |
] |
|
2907 | 2829 |
]. |
2830 |
]. |
|
3908
a8586db23418
comment/format in: #buttonPress:x:y:
Claus Gittinger <cg@exept.de>
parents:
3897
diff
changeset
|
2831 |
|
4056 | 2832 |
"Modified: / 12-07-2011 / 14:54:45 / cg" |
6043 | 2833 |
"Modified: / 23-04-2019 / 19:53:40 / Claus Gittinger" |
542 | 2834 |
! |
2835 |
||
643 | 2836 |
buttonRelease:button x:x y:y |
2837 |
||
2398 | 2838 |
buttonMotionAction := nil. |
1749 | 2839 |
self stopAutoScroll. |
2840 |
||
2398 | 2841 |
buttonReleaseAction notNil ifTrue:[ |
2842 |
buttonReleaseAction value. |
|
2843 |
buttonReleaseAction := nil. |
|
643 | 2844 |
]. |
2845 |
super buttonRelease:button x:x y:y |
|
2846 |
! |
|
2847 |
||
3140 | 2848 |
buttonShiftPressAt:clickPoint rowNr:aRowNr colNr:aColNr |
2849 |
|colIdx numSelRows| |
|
2850 |
||
2851 |
buttonReleaseAction := buttonMotionAction := nil. |
|
2852 |
||
2853 |
colIdx := aColNr. |
|
2854 |
||
2855 |
(multipleSelectOk and:[(numSelRows := selectedRowIndex size) > 0]) ifTrue:[ |
|
2856 |
(numSelRows == 1 and:[self isInSelection:aRowNr]) ifFalse:[ |min max| |
|
2857 |
min := max := aRowNr. |
|
2858 |
||
2859 |
selectedRowIndex do:[:anIndex| |
|
2860 |
min := min min:anIndex. |
|
2861 |
max := max max:anIndex. |
|
2862 |
]. |
|
2863 |
self selectRowFrom:min to:max. |
|
2864 |
^ self |
|
2865 |
]. |
|
2866 |
self selectedColIndex ~~ 0 ifTrue:[ "/ toggle column selection |
|
2867 |
colIdx := 0 |
|
2868 |
]. |
|
2869 |
]. |
|
2870 |
self selectRowAt:aRowNr colAt:colIdx atPoint:clickPoint openEditor:false. |
|
2871 |
! |
|
2872 |
||
809 | 2873 |
characterPress:aChar x:x y:y |
4176 | 2874 |
"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
|
2875 |
|
809 | 2876 |
|colNr rowNr lsize found column| |
2877 |
||
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2878 |
lsize := list size. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2879 |
|
5723 | 2880 |
"/ (rowIfAbsentBlock notNil |
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2881 |
"/ or:[x isNil |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2882 |
"/ or:[(colNr := self xVisibleToColNr:x) isNil]]) ifTrue:[ |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2883 |
"/ ^ self |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2884 |
"/ ]. |
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2885 |
colNr := self findFirstColumnWithStringFrom:1 to:lsize. |
2535 | 2886 |
colNr isNil ifTrue:[ ^ self ]. |
2887 |
||
809 | 2888 |
rowNr := self lastIndexSelected. |
3504 | 2889 |
column := self columnDescriptorAt:colNr. |
809 | 2890 |
found := 0. |
2891 |
||
2892 |
lsize > rowNr ifTrue:[ |
|
2445
df54aa1128b3
charcter search: first column which contains a string is searched for
penk
parents:
2398
diff
changeset
|
2893 |
"/ search to end |
809 | 2894 |
found := column findRowNrStartingWithChar:aChar start:(rowNr + 1) stop:lsize. |
2895 |
]. |
|
2896 |
||
2897 |
(found == 0 and:[rowNr > 1]) ifTrue:[ |
|
2898 |
"/ search from begin |
|
2899 |
found := column findRowNrStartingWithChar:aChar start:1 stop:(rowNr - 1) |
|
2900 |
]. |
|
2901 |
found ~~ 0 ifTrue:[ |
|
2902 |
self selectColIndex:colNr rowIndex:found. |
|
2903 |
]. |
|
2904 |
||
896
aa07612a7c04
care for redirected messages in characterPress:
Claus Gittinger <cg@exept.de>
parents:
892
diff
changeset
|
2905 |
"Modified: / 21.5.1998 / 03:30:22 / cg" |
809 | 2906 |
! |
2907 |
||
542 | 2908 |
contentsChanged |
4257 | 2909 |
"size of contents changed - move origin up if possible" |
5723 | 2910 |
|
542 | 2911 |
|y| |
2912 |
||
2913 |
shown ifTrue:[ |
|
2914 |
self recomputeHeightOfContents. |
|
2915 |
y := self maxViewOriginY. |
|
2916 |
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
|
2917 |
scrollWhenUpdating ~~ false ifTrue:[ |
9ed8131d94bb
viewOrigin fix (when list is set to nil while not shown);
Claus Gittinger <cg@exept.de>
parents:
1947
diff
changeset
|
2918 |
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
|
2919 |
] |
542 | 2920 |
] ifFalse:[ |
2921 |
self updateEditViewOrigin. |
|
2922 |
] |
|
2923 |
]. |
|
2924 |
super contentsChanged |
|
2925 |
! |
|
2926 |
||
2816 | 2927 |
cursorKey:aKey rawKey:rawKey |
2928 |
|hasSelectables step start minSelRowNr maxSelRowNr selColNr selRowNr listSize| |
|
2929 |
||
2930 |
hasSelectables := self hasSelectables. |
|
2931 |
listSize := list size. |
|
2932 |
||
2933 |
(hasSelectables or:[selectRowOnDefault]) ifFalse:[ ^ self ]. |
|
2934 |
||
2935 |
minSelRowNr := self minIndexSelected. |
|
2936 |
maxSelRowNr := self maxIndexSelected. |
|
2937 |
||
2960 | 2938 |
selColNr := hasSelectables ifFalse:[0] ifTrue:[self selectedColIndex]. |
2816 | 2939 |
|
2940 |
aKey == #CursorUp ifTrue:[ |
|
2941 |
selRowNr := minSelRowNr > 1 ifTrue:[minSelRowNr - 1] ifFalse:[listSize]. |
|
2942 |
step := -1. |
|
2943 |
] ifFalse:[ |
|
2944 |
aKey == #CursorDown ifTrue:[ |
|
2945 |
selRowNr := maxSelRowNr < listSize ifTrue:[maxSelRowNr + 1] ifFalse:[1]. |
|
2946 |
step := 1. |
|
2947 |
] ifFalse:[ |
|
2948 |
("aKey == #BeginOfLine or:[" rawKey == #Home "]") ifTrue:[ |
|
2949 |
selRowNr := 1. |
|
2950 |
step := 1. |
|
2951 |
] ifFalse:[ |
|
2952 |
(rawKey == #End) ifTrue:[ |
|
2953 |
selRowNr := listSize. |
|
2954 |
step := -1. |
|
2955 |
] |
|
2956 |
] |
|
2957 |
] |
|
2958 |
]. |
|
2959 |
start := selRowNr. |
|
2960 |
||
2961 |
[ self isRowSelectable:selRowNr ] whileFalse:[ |
|
2962 |
selRowNr := selRowNr + step. |
|
2963 |
||
2964 |
selRowNr == 0 ifTrue:[ |
|
2965 |
selRowNr := listSize. |
|
2966 |
] ifFalse:[ |
|
2967 |
selRowNr > listSize ifTrue:[ |
|
2968 |
selRowNr := 1. |
|
2969 |
]. |
|
2970 |
]. |
|
2971 |
selRowNr == start ifTrue:[^ self ]. |
|
2972 |
]. |
|
2973 |
||
2974 |
((aKey == #CursorUp) or:[aKey == #CursorDown]) ifTrue:[ |
|
2975 |
(multipleSelectOk and:[self sensor shiftDown]) ifTrue:[ |
|
2976 |
self addRowToSelection:selRowNr. |
|
2977 |
||
2978 |
aKey == #CursorDown ifTrue:[ |
|
2979 |
self makeLineVisible:((selRowNr+1) min:listSize) |
|
2980 |
] ifFalse:[ |
|
2981 |
self makeLineVisible:((selRowNr-1) max:1) |
|
2982 |
]. |
|
2983 |
^ self |
|
2984 |
] |
|
2985 |
]. |
|
2986 |
self selectColIndex:selColNr rowIndex:selRowNr |
|
2987 |
! |
|
2988 |
||
542 | 2989 |
doubleClicked |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2990 |
"handle a double click" |
5723 | 2991 |
|
637 | 2992 |
|col sel idx| |
2993 |
||
2994 |
self hasSelection ifTrue:[ |
|
2995 |
idx := self firstIndexSelected. |
|
2996 |
col := self selectedColumn. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
2997 |
(col notNil and:[ (sel := col doubleClickedSelector) notNil ]) ifTrue:[ |
2074 | 2998 |
col doubleClickOn:idx |
637 | 2999 |
] ifFalse:[ |
3000 |
doubleClickActionBlock notNil ifTrue:[ |
|
4772 | 3001 |
doubleClickActionBlock valueWithOptionalArgument:idx |
637 | 3002 |
] |
3003 |
] |
|
3004 |
] |
|
542 | 3005 |
! |
3006 |
||
667 | 3007 |
findMenuForSelection |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3008 |
"find the middle button menu for the current selection; returns the menu or nil" |
5723 | 3009 |
|
667 | 3010 |
|col row menu| |
3011 |
||
3012 |
self numberOfSelections == 1 ifTrue:[ |
|
3013 |
row := self at:(self firstIndexSelected). |
|
3014 |
col := self selectedColumn. |
|
3504 | 3015 |
col notNil ifTrue:[ |
3016 |
menu := col menuForRow:row orAdaptor:columnAdaptor. |
|
3017 |
menu notNil ifTrue:[ ^ menu ]. |
|
3018 |
]. |
|
3019 |
||
5723 | 3020 |
col := columnDescriptors |
3504 | 3021 |
detect:[:c | c rendererType == #rowSelector ] |
3022 |
ifNone:[ nil ]. |
|
667 | 3023 |
col notNil ifTrue:[ |
1223
176702811314
kludge: when asking for an itemMenu, pass application to
tm
parents:
1215
diff
changeset
|
3024 |
^ col menuForRow:row inApplication:(self application) |
667 | 3025 |
] |
3026 |
]. |
|
3027 |
^ nil |
|
3028 |
! |
|
3029 |
||
1111 | 3030 |
keyPress:aKey x:x y:y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3031 |
"a key was pressed - handle page-keys here" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3032 |
|
542 | 3033 |
<resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
809 | 3034 |
#BeginOfText #EndOfText #ScrollUp #ScrollDown |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3035 |
#CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)> |
542 | 3036 |
|
5723 | 3037 |
|maxColNr firstSelRowNr selRowNr selColNr |
2470 | 3038 |
key column isTab listSize hasSelectables rawKey| |
1111 | 3039 |
|
1805 | 3040 |
self isEnabled ifFalse:[^ self]. |
3041 |
||
1416 | 3042 |
(listSize := list size) == 0 ifTrue:[ |
3043 |
^ super keyPress:aKey x:x y:y |
|
3044 |
]. |
|
1776 | 3045 |
aKey isCharacter ifTrue:[ |
3046 |
^ self characterPress:aKey x:x y:y |
|
542 | 3047 |
]. |
1111 | 3048 |
|
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3049 |
(aKey == #SelectAll) ifTrue:[ |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3050 |
multipleSelectOk ifTrue:[ |
5723 | 3051 |
self selectAllRows. |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3052 |
]. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3053 |
^ self |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3054 |
]. |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
3055 |
|
1776 | 3056 |
aKey == #PreviousPage ifTrue:[^ self pageUp]. |
3057 |
aKey == #NextPage ifTrue:[^ self pageDown]. |
|
3058 |
aKey == #HalfPageUp ifTrue:[^ self halfPageUp]. |
|
3059 |
aKey == #HalfPageDown ifTrue:[^ self halfPageDown]. |
|
3060 |
aKey == #BeginOfText ifTrue:[^ self scrollToTop]. |
|
3061 |
aKey == #EndOfText ifTrue:[^ self scrollToBottom]. |
|
5723 | 3062 |
aKey == #ScrollUp ifTrue:[^ self scrollUp]. |
3063 |
aKey == #ScrollDown ifTrue:[^ self scrollDown]. |
|
3064 |
||
3065 |
aKey == #Return ifTrue:[ |
|
2816 | 3066 |
editView notNil ifTrue:[ |
3067 |
(self selectedRowIndex size == 1 |
|
3068 |
and:[self selectedRowIndex first == listSize]) ifTrue:[ |
|
3069 |
self selectRowIndex:nil. |
|
3070 |
] ifFalse:[ |
|
3071 |
self cursorKey:#CursorDown rawKey:#CursorDown. |
|
3072 |
]. |
|
3073 |
^ self |
|
3074 |
]. |
|
3075 |
self numberOfSelections == 1 ifTrue:[ |
|
3076 |
self doubleClicked |
|
3077 |
]. |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3078 |
^ self |
542 | 3079 |
]. |
1111 | 3080 |
|
2816 | 3081 |
hasSelectables := self hasSelectables. |
2470 | 3082 |
|
5873 | 3083 |
rawKey := (WindowGroup lastEvent) rawKey. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3084 |
|
5723 | 3085 |
(aKey == #CursorUp |
2816 | 3086 |
or:[aKey == #CursorDown |
3087 |
or:[rawKey == #Home |
|
5723 | 3088 |
or:[rawKey == #End]]]) |
2816 | 3089 |
ifTrue:[ |
3090 |
self cursorKey:aKey rawKey:rawKey. |
|
1776 | 3091 |
^ self |
3092 |
]. |
|
1668 | 3093 |
|
3094 |
hasSelectables ifFalse:[ |
|
3095 |
^ super keyPress:aKey x:x y:y |
|
3096 |
]. |
|
3097 |
||
1776 | 3098 |
"/ CURSOR LEFT/RIGHT or TABING |
2470 | 3099 |
(aKey == #CursorLeft or:[aKey == #CursorRight]) ifTrue:[ |
3100 |
isTab := false. |
|
3101 |
key := aKey. |
|
3102 |
] ifFalse:[ |
|
1668 | 3103 |
tabIntern ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3104 |
^ super keyPress:aKey x:x y:y |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3105 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3106 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3107 |
(aKey includesString:'Tab') ifTrue:[ |
5723 | 3108 |
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
|
3109 |
ifTrue:[#CursorLeft] |
13acaaf02528
Use SynchronousWindoeSensor if no windowGroup
Stefan Vogel <sv@exept.de>
parents:
2470
diff
changeset
|
3110 |
ifFalse:[#CursorRight] |
1416 | 3111 |
] ifFalse:[ |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3112 |
(aKey == #FocusPrevious or:[aKey == #FocusNext]) ifFalse:[ |
1416 | 3113 |
^ super keyPress:aKey x:x y:y |
3114 |
]. |
|
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3115 |
key := aKey == #FocusPrevious ifTrue:[#CursorLeft] ifFalse:[#CursorRight]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3116 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3117 |
isTab := true. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3118 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3119 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3120 |
maxColNr := self numberOfColumns. |
2960 | 3121 |
selColNr := self selectedColIndex. |
612 | 3122 |
|
2470 | 3123 |
firstSelRowNr := self firstIndexSelected. |
3124 |
||
1111 | 3125 |
key == #CursorLeft ifTrue:[ |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3126 |
selRowNr := firstSelRowNr. |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3127 |
selRowNr == 0 ifTrue:[selRowNr := listSize]. |
1776 | 3128 |
selColNr == 0 ifTrue:[selColNr := maxColNr + 1]. |
3129 |
||
3130 |
[true] whileTrue:[ |
|
3131 |
(selColNr := selColNr - 1) == 0 ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3132 |
[ selRowNr := selRowNr - 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3133 |
selRowNr == 0 ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3134 |
isTab ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3135 |
tabAtStartAction notNil ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3136 |
tabAtStartAction value |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3137 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3138 |
self deselect. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3139 |
self windowGroup focusPreviousFrom:self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3140 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3141 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3142 |
^ self |
1416 | 3143 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3144 |
(self isRowSelectable:selRowNr) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3145 |
] whileFalse. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3146 |
|
1776 | 3147 |
selColNr := maxColNr |
1111 | 3148 |
]. |
3504 | 3149 |
column := self columnDescriptorAt:selColNr. |
1416 | 3150 |
|
1111 | 3151 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
1776 | 3152 |
^ self selectColIndex:selColNr rowIndex:selRowNr. |
1111 | 3153 |
] |
3154 |
] |
|
542 | 3155 |
]. |
1776 | 3156 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
3157 |
selRowNr := firstSelRowNr. |
1776 | 3158 |
selRowNr == 0 ifTrue:[selRowNr := 1]. |
3159 |
||
3160 |
[true] whileTrue:[ |
|
3161 |
(selColNr := selColNr + 1) > maxColNr ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3162 |
[ selRowNr := selRowNr + 1. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3163 |
selRowNr > listSize ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3164 |
isTab ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3165 |
tabAtEndAction notNil ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3166 |
tabAtEndAction value |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3167 |
] ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3168 |
self deselect. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3169 |
self windowGroup focusNextFrom:self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3170 |
] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3171 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3172 |
^ self |
1776 | 3173 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3174 |
(self isRowSelectable:selRowNr) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3175 |
] whileFalse. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3176 |
|
1776 | 3177 |
selColNr := 1 |
3178 |
]. |
|
3504 | 3179 |
column := self columnDescriptorAt:selColNr. |
1776 | 3180 |
|
3181 |
(column rendererType ~~ #rowSelector and:[column canSelect:selRowNr]) ifTrue:[ |
|
3182 |
^ self selectColIndex:selColNr rowIndex:selRowNr |
|
3183 |
] |
|
3184 |
]. |
|
5873 | 3185 |
|
3186 |
"Modified: / 09-08-2018 / 09:27:46 / Claus Gittinger" |
|
542 | 3187 |
! |
3188 |
||
5670 | 3189 |
keyboardZoom:largerBoolean |
5279 | 3190 |
"CTRL+/- zoom action" |
3191 |
||
5670 | 3192 |
self fontLargerOrSmaller:largerBoolean |
5279 | 3193 |
! |
3194 |
||
5563 | 3195 |
mouseWheelZoom:amount |
3196 |
"CTRL-wheel action" |
|
3197 |
|oldSize newSize font| |
|
3198 |
||
3199 |
font := gc font. |
|
3200 |
font sizeUnit == #px ifTrue:[ ^ self]. |
|
3201 |
||
3202 |
oldSize := font size. |
|
3203 |
||
3204 |
amount > 0 ifTrue:[ |
|
3205 |
oldSize < 5 ifTrue:[ ^ self]. |
|
3206 |
newSize := oldSize - 1. |
|
3207 |
] ifFalse:[ |
|
3208 |
oldSize > 99 ifTrue:[^ self]. |
|
3209 |
newSize := oldSize + 1. |
|
3210 |
]. |
|
3211 |
||
3212 |
self font:(font asSize:newSize). |
|
3213 |
! |
|
3214 |
||
5723 | 3215 |
originChanged:delta |
542 | 3216 |
"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
|
3217 |
tell dependents (i.e. scrollers) about this" |
5723 | 3218 |
|
542 | 3219 |
super originChanged:delta. |
3220 |
self updateEditViewOrigin. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3221 |
! |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3222 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3223 |
sizeChanged:how |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3224 |
"size changed - move origin up if possible |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3225 |
change the layout of the labelView dependent on my layout" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3226 |
|
4163 | 3227 |
|selectionWasVisible lastExtent| |
3228 |
||
3229 |
lastExtent := previousExtent notNil ifTrue:[previousExtent] ifFalse:[self extent]. |
|
3230 |
selectionWasVisible := self isSelectionVisibleIn:lastExtent. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3231 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3232 |
previousExtent := self extent. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3233 |
super sizeChanged:how. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3234 |
|
4163 | 3235 |
previousExtent := self extent. |
3236 |
||
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3237 |
"/ 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
|
3238 |
"/ (could be invisible in a notebook ...) |
5723 | 3239 |
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
|
3240 |
"/ labelView isVisible ifTrue:[ |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3241 |
"/ lyt := labelView layout. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3242 |
"/ lyt leftOffset:(layout leftOffset). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3243 |
"/ lyt rightOffset:(layout rightOffset). |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3244 |
"/ labelView layout:lyt. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3245 |
"/ ]. |
4163 | 3246 |
previousExtent x ~= lastExtent x ifTrue: [ |
4123 | 3247 |
self fitColumns. |
3248 |
]. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3249 |
selectionWasVisible ifTrue:[ |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3250 |
self makeSelectionVisible. |
4020 | 3251 |
]. |
3252 |
self updateEditViewOrigin. |
|
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
3253 |
]. |
4059 | 3254 |
|
4123 | 3255 |
"Modified: / 04-05-2012 / 14:34:24 / cg" |
542 | 3256 |
! ! |
3257 |
||
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3258 |
!DSVColumnView methodsFor:'focus handling'! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3259 |
|
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3260 |
canTab |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3261 |
super canTab ifTrue:[ |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3262 |
^ editView isNil |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3263 |
]. |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3264 |
^ false |
2101 | 3265 |
! |
3266 |
||
3138 | 3267 |
showFocus:explicit |
3268 |
self invalidateSelection. |
|
3269 |
super showFocus:explicit |
|
3270 |
! |
|
3271 |
||
3272 |
showNoFocus:explicit |
|
3273 |
self invalidateSelection. |
|
3274 |
super showNoFocus:explicit |
|
3275 |
! |
|
3276 |
||
2101 | 3277 |
wantsFocusWithPointerEnter |
3278 |
"views which like to take the keyboard focus |
|
3279 |
when the pointer enters can do so by redefining this |
|
3280 |
to return true" |
|
3281 |
||
3924
72044fd3296a
changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
3923
diff
changeset
|
3282 |
editView notNil ifTrue:[^ false]. |
2237 | 3283 |
|
2958 | 3284 |
(UserPreferences current focusFollowsMouse ~~ false |
2101 | 3285 |
and:[(styleSheet at:#'selection.requestFocusOnPointerEnter' default:true) |
3286 |
]) ifTrue:[ |
|
3287 |
list size > 0 ifTrue:[ |
|
3288 |
^ true |
|
3289 |
] |
|
3290 |
]. |
|
3291 |
^ false |
|
3924
72044fd3296a
changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
3923
diff
changeset
|
3292 |
|
72044fd3296a
changed: #wantsFocusWithPointerEnter
Claus Gittinger <cg@exept.de>
parents:
3923
diff
changeset
|
3293 |
"Modified: / 08-08-2010 / 14:41:00 / cg" |
1665
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3294 |
! ! |
51c444bfe5ae
default behavour tabing; not yet configurable (next step)
ca
parents:
1661
diff
changeset
|
3295 |
|
542 | 3296 |
!DSVColumnView methodsFor:'gc operations'! |
3297 |
||
5723 | 3298 |
imageOnMyDevice:anImage |
4606
1cc343187f71
Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents:
4589
diff
changeset
|
3299 |
"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
|
3300 |
|
1cc343187f71
Sending of Image>>#clearMaskedPixels moved to Image >> #asFormOnDevice:
Stefan Vogel <sv@exept.de>
parents:
4589
diff
changeset
|
3301 |
anImage isNil ifTrue:[^ nil]. |
4991 | 3302 |
^ anImage onDevice:device. |
1100 | 3303 |
! |
3304 |
||
5723 | 3305 |
registerImage:anImage key:aKey |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3306 |
"any row can register an image with a unique identifier a key symbol" |
5723 | 3307 |
|
542 | 3308 |
|img| |
3309 |
||
3310 |
(img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
|
3311 |
^ img |
|
3312 |
]. |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3313 |
img := self imageOnMyDevice:anImage. |
567 | 3314 |
registererImages at:aKey put:img. |
3315 |
^ img |
|
542 | 3316 |
! |
3317 |
||
5723 | 3318 |
registeredImageAt:aKey |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3319 |
"any row can register an image with a unique identifier" |
5723 | 3320 |
|
542 | 3321 |
^ registererImages at:aKey ifAbsent:nil |
3322 |
! |
|
3323 |
||
3324 |
releaseAllRegisteredImages |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3325 |
"release all registered images" |
5723 | 3326 |
|
542 | 3327 |
registererImages := IdentityDictionary new. |
3328 |
! ! |
|
3329 |
||
3215 | 3330 |
!DSVColumnView methodsFor:'help'! |
3331 |
||
5680 | 3332 |
helpTextAt:aPoint |
3215 | 3333 |
"return the helpText for aPoint (i.e. when mouse-pointer is moved over an item)." |
3334 |
||
3248
c9e48b873e6e
do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
3335 |
|rowNr colNr col| |
3215 | 3336 |
|
3337 |
columnDescriptors isEmpty ifTrue:[^ nil]. |
|
3338 |
||
3248
c9e48b873e6e
do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
3339 |
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
|
3340 |
rowNr isNil ifTrue:[^ nil ]. |
c9e48b873e6e
do not provide col-helptext if beyond the last row
Claus Gittinger <cg@exept.de>
parents:
3239
diff
changeset
|
3341 |
|
3215 | 3342 |
colNr := self xVisibleToColNr:aPoint x. |
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
3343 |
colNr notNil ifTrue:[ |
3215 | 3344 |
col := columnDescriptors at:colNr. |
3458
5f9a85c6279a
Row specific active help (with DataSet)
Stefan Vogel <sv@exept.de>
parents:
3449
diff
changeset
|
3345 |
^ col activeHelpTextForRow:rowNr. |
3215 | 3346 |
]. |
3347 |
^ nil |
|
3348 |
||
3349 |
"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
|
3350 |
"Modified: / 16-10-2007 / 17:52:24 / cg" |
3215 | 3351 |
! ! |
3352 |
||
2500 | 3353 |
!DSVColumnView methodsFor:'initialization & release'! |
542 | 3354 |
|
3355 |
create |
|
4521 | 3356 |
|graphicsDevice| |
3357 |
||
542 | 3358 |
super create. |
4991 | 3359 |
graphicsDevice := device. |
4521 | 3360 |
|
3361 |
fgColor := fgColor onDevice:graphicsDevice. |
|
3362 |
bgColor := bgColor onDevice:graphicsDevice. |
|
3363 |
selectionForegroundColor := selectionForegroundColor onDevice:graphicsDevice. |
|
3364 |
selectionBackgroundColor := selectionBackgroundColor onDevice:graphicsDevice. |
|
3365 |
selectionFrameColor notNil ifTrue:[selectionFrameColor := selectionFrameColor onDevice:graphicsDevice]. |
|
3366 |
selectionForegroundColorNoFocus := selectionForegroundColorNoFocus onDevice:graphicsDevice. |
|
3367 |
selectionBackgroundColorNoFocus := selectionBackgroundColorNoFocus onDevice:graphicsDevice. |
|
3368 |
||
3369 |
buttonShadowColor := buttonShadowColor onDevice:graphicsDevice. |
|
3370 |
buttonLightColor := buttonLightColor onDevice:graphicsDevice. |
|
809 | 3371 |
|
3372 |
buttonHalfShadowColor notNil ifTrue:[ |
|
4521 | 3373 |
buttonHalfShadowColor := buttonHalfShadowColor onDevice:graphicsDevice |
809 | 3374 |
]. |
3375 |
||
3376 |
buttonHalfLightColor notNil ifTrue:[ |
|
4521 | 3377 |
buttonHalfLightColor := buttonHalfLightColor onDevice:graphicsDevice |
809 | 3378 |
]. |
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3379 |
rowSelectorForm := self imageOnMyDevice:rowSelectorForm. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3380 |
checkToggleActiveImage := self imageOnMyDevice:checkToggleActiveImage. |
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3381 |
checkTogglePassiveImage := self imageOnMyDevice:checkTogglePassiveImage. |
3504 | 3382 |
checkToggleForm := self imageOnMyDevice:checkToggleForm. |
3383 |
radioButtonActiveImage := self imageOnMyDevice:radioButtonActiveImage. |
|
3384 |
radioButtonPassiveImage := self imageOnMyDevice:radioButtonPassiveImage. |
|
2488
74c81c1e30d7
imageOnDevice -> imageOnMyDevice
Claus Gittinger <cg@exept.de>
parents:
2487
diff
changeset
|
3385 |
comboButtonForm := self imageOnMyDevice:comboButtonForm. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3386 |
|
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3387 |
"Modified: / 20-01-2011 / 08:43:51 / cg" |
542 | 3388 |
! |
3389 |
||
3390 |
initStyle |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3391 |
"setup colors, etc." |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3392 |
|
1100 | 3393 |
|button widget| |
809 | 3394 |
|
542 | 3395 |
super initStyle. |
3396 |
||
3397 |
DefaultForegroundColor isNil ifTrue:[ |
|
3398 |
self class updateStyleCache |
|
3399 |
]. |
|
3400 |
fgColor := DefaultForegroundColor. |
|
3401 |
bgColor := DefaultBackgroundColor. |
|
4875 | 3402 |
labelFgColor := DefaultLabelForegroundColor. |
3403 |
labelBgColor := DefaultLabelBackgroundColor. |
|
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3404 |
selectionForegroundColor := DefaultHilightForegroundColor. |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
3405 |
selectionBackgroundColor := DefaultHilightBackgroundColor. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3406 |
selectionFrameColor := DefaultHilightFrameColor. |
809 | 3407 |
|
3408 |
shadowColor isNil ifTrue:[ |
|
3409 |
shadowColor := Color grayPercent:40. |
|
3410 |
]. |
|
3411 |
||
3412 |
lightColor isNil ifTrue:[ |
|
3413 |
lightColor := Color grayPercent:75 |
|
3414 |
]. |
|
3415 |
||
3416 |
buttonLightColor := ButtonLightColor ? lightColor. |
|
3417 |
buttonShadowColor := ButtonShadowColor ? shadowColor. |
|
3418 |
||
3419 |
(ButtonEdgeStyle == #soft) ifTrue:[ |
|
3420 |
buttonHalfShadowColor := ButtonHalfShadowColor. |
|
3421 |
buttonHalfLightColor := ButtonHalfLightColor. |
|
3422 |
||
3423 |
buttonHalfShadowColor isNil ifTrue:[ |
|
3424 |
buttonHalfShadowColor := buttonShadowColor lightened |
|
3425 |
] |
|
3426 |
]. |
|
1490 | 3427 |
|
3428 |
buttonHalfShadowColor isNil ifTrue:[ |
|
3429 |
buttonHalfShadowColor := Color gray |
|
3430 |
]. |
|
3431 |
||
3138 | 3432 |
selectionForegroundColorNoFocus isNil ifTrue:[ |
4653 | 3433 |
selectionForegroundColorNoFocus := DefaultHilightForegroundColorNoFocus. |
3434 |
selectionForegroundColorNoFocus isNil ifTrue:[ |
|
3435 |
selectionForegroundColorNoFocus := selectionForegroundColor slightlyLightened. |
|
3436 |
] |
|
3138 | 3437 |
]. |
3438 |
selectionBackgroundColorNoFocus isNil ifTrue:[ |
|
4644 | 3439 |
selectionBackgroundColorNoFocus := DefaultHilightBackgroundColorNoFocus. |
3440 |
selectionBackgroundColorNoFocus isNil ifTrue:[ |
|
3441 |
selectionBackgroundColor notNil ifTrue:[ |
|
4653 | 3442 |
selectionBackgroundColorNoFocus := selectionBackgroundColor slightlyLightened. |
4644 | 3443 |
"/ selectionBackgroundColorNoFocus := Color brightness:(selectionBackgroundColor "lightened" brightness). "/ asGray. |
3444 |
]. |
|
4101 | 3445 |
]. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3446 |
]. |
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3447 |
selectionFrameColorNoFocus isNil ifTrue:[ |
4101 | 3448 |
selectionFrameColor notNil ifTrue:[ |
5723 | 3449 |
selectionFrameColorNoFocus := selectionFrameColor lightened. |
4101 | 3450 |
"/ selectionFrameColorNoFocus := Color brightness:(selectionFrameColor "lightened" brightness). "/ asGray |
3451 |
] |
|
3138 | 3452 |
]. |
3453 |
||
2711 | 3454 |
rowSelectorForm := self class rowSelectorImage. |
3504 | 3455 |
|
1100 | 3456 |
checkToggleActiveImage := CheckToggleActiveImage. |
3457 |
checkTogglePassiveImage := CheckTogglePassiveImage. |
|
5890 | 3458 |
|
3459 |
CheckToggleDisabledActiveImage isNil ifTrue:[ |
|
3460 |
CheckToggleDisabledActiveImage := CheckToggle disabledActiveImage |
|
3461 |
]. |
|
3462 |
CheckToggleDisabledPassiveImage isNil ifTrue:[ |
|
3463 |
CheckToggleDisabledPassiveImage := CheckToggle disabledPassiveImage |
|
3464 |
]. |
|
3465 |
checkToggleDisabledActiveImage := CheckToggleDisabledActiveImage. |
|
3466 |
checkToggleDisabledPassiveImage := CheckToggleDisabledPassiveImage. |
|
1100 | 3467 |
|
3504 | 3468 |
CheckToggleForm isNil ifTrue:[ |
3469 |
widget := CheckToggle new. |
|
3470 |
CheckToggleForm := widget label. |
|
3471 |
CheckToggleLevel := widget offLevel. |
|
3472 |
CheckToggleExtent := widget preferredExtent. |
|
3473 |
]. |
|
3474 |
||
3475 |
checkToggleForm := CheckToggleForm. |
|
3476 |
checkToggleLevel := CheckToggleLevel. |
|
3477 |
checkToggleExtent := CheckToggleExtent. |
|
3478 |
||
3479 |
radioButtonActiveImage := RadioButtonActiveImage. |
|
3480 |
radioButtonPassiveImage := RadioButtonPassiveImage. |
|
3481 |
||
5890 | 3482 |
RadioButtonDisabledActiveImage isNil ifTrue:[ |
3483 |
RadioButtonDisabledActiveImage := RadioButton disabledActiveForm. |
|
3484 |
]. |
|
3485 |
RadioButtonDisabledPassiveImage isNil ifTrue:[ |
|
3486 |
RadioButtonDisabledPassiveImage := RadioButton disabledPassiveForm. |
|
3487 |
]. |
|
3488 |
radioButtonDisabledActiveImage := RadioButtonDisabledActiveImage. |
|
3489 |
radioButtonDisabledPassiveImage := RadioButtonDisabledPassiveImage. |
|
3490 |
||
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3491 |
ComboButtonForm isNil ifTrue:[ |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3492 |
widget := ComboListView new. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3493 |
button := widget menuButton. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3494 |
ComboButtonForm := button label. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3495 |
ComboButtonLevel := button offLevel. |
3428
436f115aefe8
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3382
diff
changeset
|
3496 |
ComboButtonExtent := (button preferredWidth) @ (widget preferredHeight). |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3497 |
]. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3498 |
|
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3499 |
comboButtonForm := ComboButtonForm. |
5890 | 3500 |
ComboButtonDisabledForm isNil ifTrue:[ |
3501 |
ComboButtonDisabledForm := ComboView disabledForm |
|
3502 |
]. |
|
3503 |
comboButtonDisabledForm := ComboButtonDisabledForm. |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3504 |
comboButtonLevel := ComboButtonLevel. |
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
3505 |
comboButtonExtent := ComboButtonExtent. |
3989
5c6706e4e0d1
preps for highlight-frame color
Claus Gittinger <cg@exept.de>
parents:
3988
diff
changeset
|
3506 |
|
4101 | 3507 |
"Modified: / 20-01-2012 / 15:48:13 / cg" |
5890 | 3508 |
"Modified: / 17-08-2018 / 17:33:56 / Claus Gittinger" |
542 | 3509 |
! |
3510 |
||
3511 |
initialize |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3512 |
"set default attributes" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3513 |
|
4521 | 3514 |
|fontOnDevice| |
3515 |
||
5603 | 3516 |
verticalSpacing := verticalSpacing ? self class verticalSpacing. |
3517 |
horizontalSpacing := horizontalSpacing ? self class horizontalSpacing. |
|
3518 |
||
542 | 3519 |
super initialize. |
1487 | 3520 |
self lineWidth:0. |
3521 |
||
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3522 |
separatorSize := 1. "/ separators mode 2D |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3523 |
verticalSpacing := self class verticalSpacing. |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3524 |
horizontalSpacing := self class horizontalSpacing. |
1668 | 3525 |
tabIntern := true. |
1487 | 3526 |
useIndex := true. |
5664 | 3527 |
ignoreReselect := true. |
1112 | 3528 |
viewOrigin := 0@0. |
5204 | 3529 |
fontOnDevice := gc deviceFont. |
4521 | 3530 |
rowFontAscent := fontOnDevice ascent. |
5602 | 3531 |
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
|
3532 |
minRowHeight := rowHeight. |
1112 | 3533 |
multipleSelectOk := false. "/ multiselect disabled |
2960 | 3534 |
selectedRowIndex := 0. "/ no selection |
5723 | 3535 |
self selectedColIndex:0. |
1778
51bbd960baf9
change registeredIcons from IdentityDictionary to Dictionary
ca
parents:
1776
diff
changeset
|
3536 |
registererImages := Dictionary new. |
1112 | 3537 |
columnDescriptors := #(). |
3538 |
beDependentOfRows := false. |
|
3539 |
colorMap := Dictionary new. |
|
3540 |
catchChangeEvents := false. |
|
3541 |
selectRowOnDefault := true. |
|
1749 | 3542 |
autoScroll := true. |
3130
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
3543 |
autoScrollToColumn := true. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3544 |
scrollRowWise := false. |
5723 | 3545 |
sortListInPlace := false. "/ when false (default for backward compatibility): |
4613 | 3546 |
"/ if sorting, create a copy |
3547 |
"/ of the list, which is wrong when useIndex is on, |
|
3548 |
"/ as the application will get the index in the sorted |
|
3549 |
"/ list, which is probably different from tha apps list mode. |
|
3550 |
"/ When true (should be default, but that might break many |
|
3551 |
"/ users), the passed in list is sorted in place (i.e. possibly |
|
3552 |
"/ sorting the application's list). |
|
5194 | 3553 |
|
3554 |
updateListHolderWhenSorting := false. |
|
5723 | 3555 |
"/ when false (default for backward compatibility): |
5194 | 3556 |
"/ if sorting, do not write back the sorted list into the listHolder |
3557 |
"/ When true (should be default, but that might break many |
|
3558 |
"/ users), the sorted list is written back into the listHolder, |
|
3559 |
"/ but only if sortListInPlace is false. |
|
3560 |
||
3223 | 3561 |
"/ need for active help |
3562 |
self enableMotionEvents. |
|
3563 |
||
5603 | 3564 |
"Modified: / 13-09-2017 / 16:08:34 / cg" |
705 | 3565 |
! |
3566 |
||
2807 | 3567 |
mapped |
3568 |
"set selection (if any) after mapping" |
|
5723 | 3569 |
|
2807 | 3570 |
|idx| |
3571 |
||
3572 |
super mapped. |
|
3573 |
needFitColumns == true ifTrue:[ |
|
3574 |
self fitColumns |
|
3575 |
]. |
|
3576 |
(idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
3577 |
self scrollToRowAt:idx colAt:0. |
|
3578 |
]. |
|
3579 |
! |
|
3580 |
||
542 | 3581 |
realize |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3582 |
"recompute contents and fit columns to view" |
5723 | 3583 |
|
1487 | 3584 |
|selection| |
3585 |
||
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3586 |
self bitGravity:#NorthWest. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3587 |
self recomputeHeightOfContents. |
1487 | 3588 |
selection := 0. |
3589 |
model notNil ifTrue:[ |
|
3590 |
(model respondsTo:#selectionIndex) ifTrue:[ |
|
3591 |
selection := model selectionIndex |
|
3592 |
] ifFalse:[ |
|
3593 |
model == listHolder ifFalse:[ |
|
3594 |
selection := model value |
|
3595 |
] |
|
3596 |
] |
|
3597 |
]. |
|
3598 |
self selectRowIndex:selection. |
|
542 | 3599 |
super realize. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3600 |
self fitColumns. |
2011
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
3601 |
! |
128778a6a31d
dont scroll to top on mapped
Claus Gittinger <cg@exept.de>
parents:
1971
diff
changeset
|
3602 |
|
2157 | 3603 |
release |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3604 |
"remove dependencies" |
5723 | 3605 |
|
2157 | 3606 |
self columnHolder:nil. |
4219 | 3607 |
|
3608 |
beDependentOfRows ifTrue:[self makeIndependentOfRows]. |
|
3609 |
listHolder notNil ifTrue:[ |
|
3610 |
listHolder removeDependent:self. |
|
3611 |
]. |
|
2157 | 3612 |
columnAdaptor isValueModel ifTrue:[ |
3613 |
columnAdaptor removeDependent:self |
|
3614 |
]. |
|
3615 |
super release |
|
607 | 3616 |
! ! |
3617 |
||
3618 |
!DSVColumnView methodsFor:'obsolete'! |
|
3619 |
||
3620 |
has3Dsepartors |
|
3770 | 3621 |
<resource: #obsolete> |
3622 |
"shouldn't be used any more" |
|
3623 |
||
3624 |
self obsoleteMethodWarning. |
|
3625 |
^ self has3Dseparators |
|
3626 |
! |
|
3627 |
||
3628 |
has3Dsepartors:aBool |
|
3629 |
<resource: #obsolete> |
|
5723 | 3630 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3631 |
"shouldn't be used any more" |
5723 | 3632 |
|
3770 | 3633 |
self obsoleteMethodWarning. |
607 | 3634 |
self has3Dseparators:aBool |
542 | 3635 |
! ! |
3636 |
||
3637 |
!DSVColumnView methodsFor:'private'! |
|
3638 |
||
1951 | 3639 |
anyColumnHasBackground |
3640 |
columnDescriptors isNil ifTrue:[^ false]. |
|
3641 |
columnDescriptors do:[:eachCol | |
|
3642 |
|bg| |
|
3643 |
||
3644 |
bg := eachCol backgroundColor. |
|
3645 |
(bg notNil and:[bg isImageOrForm]) ifTrue:[^ true]. |
|
3646 |
eachCol bgSelector notNil ifTrue:[^ true]. |
|
3647 |
]. |
|
3648 |
^ false. |
|
3649 |
! |
|
3650 |
||
3651 |
anyColumnHasPotentialNonConstantBackground |
|
3652 |
columnDescriptors isNil ifTrue:[^ false]. |
|
2933 | 3653 |
^ columnDescriptors contains:[:someCol | someCol hasPotentialNonConstantBackground]. |
3654 |
"/ columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]]. |
|
3655 |
"/ ^ false. |
|
1951 | 3656 |
! |
3657 |
||
1111 | 3658 |
destroyEditView |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3659 |
"destroy the edit view; release KeyboardForwarder" |
2730 | 3660 |
|
2695 | 3661 |
editValue notNil ifTrue:[ |
3662 |
editValue removeDependent:self. |
|
3663 |
editValue := nil |
|
3664 |
]. |
|
3140 | 3665 |
|
3666 |
editView notNil ifTrue:[ |winGroup focusView| |
|
3667 |
self hasFocus ifTrue:[focusView := self]. |
|
6043 | 3668 |
editView isDialogBox ifTrue:[ |
3669 |
focusView := self |
|
3670 |
] ifFalse:[ |
|
3671 |
editView withAllSubViewsDo:[:aView | |
|
3672 |
aView hasFocus ifTrue:[focusView := self]. |
|
3673 |
aView delegate:nil |
|
3674 |
]. |
|
3140 | 3675 |
]. |
1111 | 3676 |
editView destroy. |
3677 |
editView := nil. |
|
2730 | 3678 |
|
3140 | 3679 |
winGroup := self windowGroup. |
3680 |
||
3681 |
winGroup notNil ifTrue:[ |
|
3682 |
winGroup focusView:focusView. |
|
2730 | 3683 |
] |
1111 | 3684 |
]. |
6043 | 3685 |
|
3686 |
"Modified: / 23-04-2019 / 19:13:41 / Claus Gittinger" |
|
1111 | 3687 |
! |
3688 |
||
5723 | 3689 |
detectViewAt:aPoint in:aView |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3690 |
"returns the view at a point" |
5723 | 3691 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3692 |
aView isNil ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3693 |
^ nil |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3694 |
]. |
2019
0d2757149700
extracted common code to detectViewAt:aPoint.
Claus Gittinger <cg@exept.de>
parents:
2011
diff
changeset
|
3695 |
^ aView detectViewAt:aPoint. |
637 | 3696 |
! |
3697 |
||
542 | 3698 |
fitColumns |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3699 |
"fit columns to view; " |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3700 |
|
5723 | 3701 |
|selectedColumn columnsWithRelativeWidth |
4415 | 3702 |
overallMinWidth restWidth anyChange oldOrgX newOrgX oldWidth| |
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3703 |
|
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3704 |
realized ifFalse:[ |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3705 |
needFitColumns := true. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3706 |
^ self |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3707 |
]. |
1487 | 3708 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3709 |
cachedPreferredExtent isNil ifTrue:[ |
1487 | 3710 |
self preferredExtent. |
2956 | 3711 |
] ifFalse:[ |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
3712 |
oldWidth := cachedPreferredExtent x. |
1487 | 3713 |
]. |
1484 | 3714 |
|
3715 |
columnDescriptors isEmpty ifTrue:[ |
|
3716 |
^ self |
|
3717 |
]. |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3718 |
|
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3719 |
overallMinWidth := 0. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3720 |
anyChange := false. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3721 |
columnsWithRelativeWidth := OrderedCollection new. |
1484 | 3722 |
|
3723 |
columnDescriptors do:[:aCol| |
|
3724 |
aCol canResize ifTrue:[ |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3725 |
anyChange := true. |
1484 | 3726 |
aCol invalidate. |
3727 |
]. |
|
4415 | 3728 |
aCol hasRelativeWidth ifTrue:[columnsWithRelativeWidth add:aCol]. |
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3729 |
overallMinWidth := overallMinWidth + aCol minWidth. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3730 |
]. |
4415 | 3731 |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3732 |
cachedPreferredExtent := width @(self preferredHeight). |
4425 | 3733 |
|
3734 |
columnsWithRelativeWidth notEmpty ifTrue:[ |
|
3735 |
restWidth := self innerWidth - overallMinWidth. |
|
3736 |
||
3737 |
restWidth > 0 ifTrue:[ |
|
3738 |
|sumOfAnnouncedRelativeWidths sumWeach| |
|
3739 |
||
3740 |
"/ distribute restwidth among remaining columns according to |
|
3741 |
"/ their announced relative width's |
|
3742 |
sumOfAnnouncedRelativeWidths := columnsWithRelativeWidth sum:[:each | each description width]. |
|
3743 |
sumWeach := 0. |
|
3744 |
columnsWithRelativeWidth do:[:each | |
|
3745 |
|eachRel wEach| |
|
3746 |
||
3747 |
eachRel := each description width / sumOfAnnouncedRelativeWidths. |
|
3748 |
each == columnsWithRelativeWidth last ifTrue:[ |
|
3749 |
wEach := restWidth - sumWeach. |
|
3750 |
] ifFalse:[ |
|
3751 |
wEach := (eachRel * restWidth) truncated. |
|
3752 |
sumWeach := sumWeach + wEach. |
|
3753 |
]. |
|
3754 |
each setWidth:wEach. |
|
4415 | 3755 |
]. |
4425 | 3756 |
] |
3757 |
] ifFalse:[ |
|
3758 |
anyChange ifTrue:[ |
|
5723 | 3759 |
| resizableColumns numberOfResizable additionalOffsetX | |
4425 | 3760 |
|
3761 |
overallMinWidth := 0. |
|
3762 |
resizableColumns := OrderedCollection new. |
|
3763 |
||
3764 |
columnDescriptors do:[: eachColumn | |
|
3765 |
eachColumn canResize ifTrue:[ resizableColumns add: eachColumn ]. |
|
3766 |
eachColumn width: nil. "force a recomputation of width" |
|
3767 |
overallMinWidth := overallMinWidth + eachColumn width. |
|
3768 |
]. |
|
5723 | 3769 |
numberOfResizable := resizableColumns size. |
3770 |
numberOfResizable > 0 ifTrue:[ |
|
4425 | 3771 |
restWidth := self innerWidth - overallMinWidth. |
3772 |
||
5723 | 3773 |
restWidth > numberOfResizable ifTrue:[ |
3774 |
additionalOffsetX := restWidth // numberOfResizable. |
|
4425 | 3775 |
resizableColumns do:[:aCol| aCol growWidth:additionalOffsetX ]. |
5723 | 3776 |
restWidth := restWidth - (additionalOffsetX * numberOfResizable). |
4425 | 3777 |
]. |
3778 |
restWidth > 0 ifTrue:[ resizableColumns last growWidth:restWidth ]. |
|
3779 |
]. |
|
1484 | 3780 |
]. |
3781 |
]. |
|
1492 | 3782 |
|
612 | 3783 |
shown ifTrue:[ |
4116 | 3784 |
"have to invalidate unconditionally even if nothing has been changed here: |
3785 |
#fitColumns is called from #changeWidthOfColumn:deltaX: |
|
3786 |
after a manual resize" |
|
3787 |
||
3788 |
self invalidate. |
|
3789 |
labelView invalidate. |
|
542 | 3790 |
|
1498 | 3791 |
(oldOrgX := viewOrigin x) ~~ 0 ifTrue:[ |
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3792 |
|prefWidth| |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3793 |
|
1498 | 3794 |
"/ UPDATE VIEW-ORIGIN X |
3795 |
||
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3796 |
prefWidth := self preferredWidth. |
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3797 |
newOrgX := (prefWidth - self innerWidth) max:0. |
1498 | 3798 |
|
3799 |
newOrgX < oldOrgX ifTrue:[ |
|
3800 |
self originWillChange. |
|
3801 |
viewOrigin := newOrgX @ (viewOrigin y). |
|
3802 |
self originChanged:((newOrgX - oldOrgX) @ 0). |
|
3803 |
] |
|
3804 |
]. |
|
3805 |
||
1930
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3806 |
"/ 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
|
3807 |
|
1930
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3808 |
"/ self hasSelection ifTrue:[ |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3809 |
"/ editView notNil ifTrue:[ |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3810 |
"/ 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
|
3811 |
"/ ]. |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3812 |
"/ self scrollToSelection. |
31274c3264d6
do not scroll to selection when a column-size is changed
Claus Gittinger <cg@exept.de>
parents:
1926
diff
changeset
|
3813 |
"/ ]. |
2319
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3814 |
|
4095
1a4c11fc0865
added: #invalidateDeviceRectangle:repairNow:
Claus Gittinger <cg@exept.de>
parents:
4073
diff
changeset
|
3815 |
"/ 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
|
3816 |
|
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3817 |
editView notNil ifTrue:[ |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3818 |
selectedColumn := self selectedColumn. |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3819 |
selectedColumn notNil ifTrue:[ |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3820 |
editView width:(selectedColumn width - (2 * separatorSize)). |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3821 |
] |
b75af47412ff
bug fix; if columns extent changed, update extent of editView
ca
parents:
2318
diff
changeset
|
3822 |
]. |
3428
436f115aefe8
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3382
diff
changeset
|
3823 |
oldWidth ~= self preferredWidth ifTrue:[ |
2956 | 3824 |
self contentsChanged. |
3825 |
]. |
|
542 | 3826 |
]. |
5723 | 3827 |
|
3828 |
"Modified (format): / 15-03-2018 / 11:40:25 / mawalch" |
|
542 | 3829 |
! |
3830 |
||
2816 | 3831 |
hasSelectables |
3832 |
columnDescriptors do:[:aCol| |
|
3833 |
(aCol rendererType == #rowSelector) ifFalse:[ |
|
3834 |
(aCol description canSelect) ifTrue:[^ true]. |
|
3835 |
] |
|
3836 |
]. |
|
3837 |
^ false. |
|
3838 |
! |
|
3839 |
||
542 | 3840 |
maxViewOriginY |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3841 |
"returns the maximum possible y of the view origin" |
5723 | 3842 |
|
542 | 3843 |
|y| |
3844 |
||
3845 |
y := self heightOfContents - self innerHeight. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3846 |
^ y max:0 |
542 | 3847 |
! |
3848 |
||
3849 |
updateEditViewOrigin |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3850 |
"update origin of the editView" |
5723 | 3851 |
|
542 | 3852 |
|x y| |
3853 |
||
3854 |
editView notNil ifTrue:[ |
|
607 | 3855 |
y := self yVisibleOfRowNr:(self firstIndexSelected). |
2960 | 3856 |
x := self xVisibleOfColNr:self selectedColIndex. |
1112 | 3857 |
editView origin:(x @ y + separatorSize). |
542 | 3858 |
]. |
3859 |
! |
|
3860 |
||
5723 | 3861 |
xVisibleOfColNr:aColNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3862 |
"returns visible x assigned to a column number" |
5723 | 3863 |
|
3864 |
|x |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3865 |
end "{ Class:SmallInteger }"| |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3866 |
|
542 | 3867 |
x := margin - viewOrigin x. |
1498 | 3868 |
aColNr > 1 ifTrue:[ |
1497 | 3869 |
end := aColNr - 1. |
5723 | 3870 |
columnDescriptors |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3871 |
from:1 |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3872 |
to:end |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3873 |
do:[:aCol | x := x + aCol width ] |
1497 | 3874 |
]. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3875 |
^ x |
542 | 3876 |
! |
3877 |
||
5723 | 3878 |
xVisibleToColNr:x |
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
3879 |
"returns the column number for a physical x position. |
5079 | 3880 |
Returns nil if x is beyond the last column." |
5723 | 3881 |
|
3215 | 3882 |
|x0| |
542 | 3883 |
|
3884 |
x0 := x + viewOrigin x - margin. |
|
5723 | 3885 |
columnDescriptors keysAndValuesDo:[:index :aCol | |
1951 | 3886 |
x0 := x0 - aCol width. |
3215 | 3887 |
x0 <= 0 ifTrue:[ ^ index ]. |
542 | 3888 |
]. |
3889 |
^ nil. |
|
3215 | 3890 |
|
3217
e74188fce7c2
xVisibleToSelectionIndex:x different return value confusion
Claus Gittinger <cg@exept.de>
parents:
3215
diff
changeset
|
3891 |
"Modified: / 26-03-2007 / 15:22:01 / cg" |
542 | 3892 |
! |
3893 |
||
5723 | 3894 |
yVisibleOfRowNr:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3895 |
"returns visible y assigned to the row number" |
5723 | 3896 |
|
542 | 3897 |
^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
3898 |
! |
|
3899 |
||
5723 | 3900 |
yVisibleToRowNr:y |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3901 |
"returns the row number assigned to a physical y or nil" |
5723 | 3902 |
|
2398 | 3903 |
|rowNr| |
3904 |
||
3905 |
rowNr := (y + viewOrigin y - margin) // rowHeight + 1. |
|
3906 |
(rowNr between:1 and:(list size)) ifTrue:[ |
|
3907 |
^ rowNr |
|
3908 |
]. |
|
3909 |
^ nil |
|
542 | 3910 |
! ! |
3911 |
||
3912 |
!DSVColumnView methodsFor:'queries'! |
|
3913 |
||
2728
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3914 |
firstLineShown |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3915 |
"for protocol-compat. with listviews" |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3916 |
|
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3917 |
^ self indexOfFirstRowShown |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3918 |
! |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
3919 |
|
1149
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3920 |
hasOpenEditor |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3921 |
^ editView notNil |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3922 |
! |
c212f122c8b3
allow collections of string and icons for a cell label
Claus Gittinger <cg@exept.de>
parents:
1136
diff
changeset
|
3923 |
|
563 | 3924 |
indexOfFirstRowShown |
2797 | 3925 |
"returns the index of the first shown row" |
5723 | 3926 |
|
563 | 3927 |
|idx| |
3928 |
||
1498 | 3929 |
idx := (viewOrigin y // rowHeight) + 1. |
2797 | 3930 |
^ (idx max:1) |
3931 |
! |
|
3932 |
||
3933 |
indexOfLastRowShown |
|
3934 |
"returns the index of the last shown row" |
|
5723 | 3935 |
|
2797 | 3936 |
|idx| |
3937 |
||
3938 |
idx := (viewOrigin y + height - 1 // rowHeight) + 1. |
|
3939 |
^ (idx min:list size) |
|
563 | 3940 |
! |
3941 |
||
1805 | 3942 |
isEnabled |
3943 |
^ enableChannel value ~~ false |
|
3944 |
! |
|
3945 |
||
5723 | 3946 |
isRowSelectable:aRowNumber |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3947 |
"returne true if a row number is selectable" |
5723 | 3948 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3949 |
(aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3950 |
selectConditionBlock isNil ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3951 |
^ true |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3952 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3953 |
^ (selectConditionBlock value:aRowNumber) |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3954 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3955 |
^ false |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3956 |
! |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
3957 |
|
542 | 3958 |
numberOfColumns |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3959 |
"returns number of columns" |
5723 | 3960 |
|
542 | 3961 |
^ columnDescriptors size |
3962 |
! |
|
3963 |
||
3964 |
numberOfRows |
|
5723 | 3965 |
"returns number of rows" |
3966 |
||
1497 | 3967 |
^ list size |
5723 | 3968 |
|
3969 |
"Modified (comment): / 15-03-2018 / 12:23:01 / mawalch" |
|
542 | 3970 |
! |
3971 |
||
3972 |
rowHeight |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
3973 |
"get the height of the highest row in pixels" |
5723 | 3974 |
|
542 | 3975 |
^ rowHeight |
3976 |
! |
|
3977 |
||
3978 |
separatorSize |
|
3979 |
"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
|
3980 |
3D effect." |
5723 | 3981 |
|
607 | 3982 |
^ separatorSize |
542 | 3983 |
! |
3984 |
||
3985 |
size |
|
5723 | 3986 |
"returns number of rows" |
3987 |
||
542 | 3988 |
^ list size |
5723 | 3989 |
|
3990 |
"Modified (comment): / 15-03-2018 / 12:24:18 / mawalch" |
|
4486 | 3991 |
! |
3992 |
||
3993 |
yVisibleToLineNr:yVisible |
|
3994 |
^ self yVisibleToRowNr:yVisible. |
|
542 | 3995 |
! ! |
3996 |
||
3997 |
!DSVColumnView methodsFor:'recomputation'! |
|
3998 |
||
5952 | 3999 |
computePreferredExtent |
4000 |
"return my preferred extent" |
|
4001 |
||
4002 |
|numRows prefWidth prefHeight| |
|
4003 |
||
4004 |
cachedPreferredExtent notNil ifTrue:[ |
|
4005 |
^ cachedPreferredExtent |
|
4006 |
]. |
|
4007 |
self computeRowHeight. |
|
4008 |
||
4009 |
prefWidth := (columnDescriptors size - 1) max:0. "/ for the separators |
|
4010 |
columnDescriptors do:[:aCol | |
|
4011 |
prefWidth := prefWidth + (aCol minWidth max:5). |
|
4012 |
]. |
|
4013 |
numRows := list size. |
|
4014 |
||
4015 |
"/ no need for a separator after the last row. |
|
4016 |
prefHeight := separatorSize + ((numRows * rowHeight) "- separatorSize") "+ separatorSize". |
|
4017 |
||
4018 |
cachedPreferredExtent := prefWidth @ prefHeight. |
|
4019 |
^ cachedPreferredExtent |
|
4020 |
||
4021 |
"Created: / 09-11-2018 / 19:50:03 / Claus Gittinger" |
|
4022 |
! |
|
4023 |
||
5602 | 4024 |
computeRowHeight |
4025 |
|minHeight| |
|
5723 | 4026 |
|
5603 | 4027 |
minHeight := self font height. |
5602 | 4028 |
|
5723 | 4029 |
columnDescriptors do:[:aCol | |
5602 | 4030 |
minHeight := (aCol heightOfHighestRow) max:minHeight. |
4031 |
]. |
|
5723 | 4032 |
|
5603 | 4033 |
"/ to fix a double bug which compensated for not computing things correctly |
5730 | 4034 |
"/ (verticalSpacing was always computed as 2 into the height, even if changed later, |
5603 | 4035 |
"/ it was stil in the max-of-col-heights, because minHeight was never reset, but always |
4036 |
"/ carried on in the minRowHeight) |
|
4037 |
minHeight := 2 + minHeight + 2. |
|
5723 | 4038 |
|
5602 | 4039 |
rowHeight := (verticalSpacing + minHeight + verticalSpacing + separatorSize). |
4040 |
minRowHeight := rowHeight. |
|
4041 |
||
4042 |
"Created: / 13-09-2017 / 15:32:28 / cg" |
|
4043 |
! |
|
4044 |
||
647 | 4045 |
hasPreferredExtent |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4046 |
"returns true if preferred extent is accumulated" |
5723 | 4047 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4048 |
^ cachedPreferredExtent notNil |
647 | 4049 |
! |
4050 |
||
542 | 4051 |
preferredExtentChanged |
3519 | 4052 |
"called if the preferred extent changed" |
5723 | 4053 |
|
1497 | 4054 |
|x "{ Class:SmallInteger }" |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4055 |
y "{ Class:SmallInteger }"| |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4056 |
|
542 | 4057 |
y := viewOrigin y. |
4058 |
x := viewOrigin x. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4059 |
(y ~~ 0 or:[ x ~~ 0 ]) ifTrue:[ |
542 | 4060 |
self originWillChange. |
4061 |
viewOrigin := 0 @ 0. |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4062 |
cachedPreferredExtent := nil. |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4063 |
self originChanged:(x negated @ y negated). |
542 | 4064 |
] |
4065 |
! |
|
4066 |
||
4067 |
recomputeHeightOfContents |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4068 |
"recompute height of contents( scrolling )" |
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4069 |
|
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4070 |
cachedPreferredExtent := nil. |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4071 |
"/ cachedPreferredExtent notNil ifTrue:[ |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4072 |
"/ cachedPreferredExtent y:(rowHeight * list size) |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4073 |
"/ ] ifFalse:[ |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4074 |
"/ self preferredExtent |
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4075 |
"/ ]. |
542 | 4076 |
! ! |
4077 |
||
4078 |
!DSVColumnView methodsFor:'scroller interface'! |
|
4079 |
||
4080 |
innerHeight |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4081 |
"returns the inner height of the contents shown" |
5723 | 4082 |
|
542 | 4083 |
^ height - margin - margin |
4084 |
! |
|
4085 |
||
4086 |
verticalScrollStep |
|
3500 | 4087 |
"return the amount to scroll when stepping up/down (also used for mouseWheel)." |
5723 | 4088 |
|
542 | 4089 |
^ rowHeight |
4090 |
! |
|
4091 |
||
4092 |
viewOrigin |
|
5723 | 4093 |
"return the viewOrigin; |
5252 | 4094 |
that's the coordinate of the contents which is shown topLeft in the view." |
5723 | 4095 |
|
542 | 4096 |
^ viewOrigin |
4097 |
! |
|
4098 |
||
4099 |
widthOfContents |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4100 |
"return the width of the contents in pixels" |
5723 | 4101 |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4102 |
cachedPreferredExtent isNil ifTrue:[ |
647 | 4103 |
self preferredExtent |
4104 |
]. |
|
3488
d30da03147fe
preferredExtent changes & fixes (ubs)
Claus Gittinger <cg@exept.de>
parents:
3478
diff
changeset
|
4105 |
^ cachedPreferredExtent x |
542 | 4106 |
! |
4107 |
||
4108 |
xOriginOfContents |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4109 |
"return the horizontal origin of the contents in pixels" |
5723 | 4110 |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4111 |
^ viewOrigin x |
542 | 4112 |
! |
4113 |
||
4114 |
yOriginOfContents |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4115 |
"return the vertical origin of the contents in pixels" |
5723 | 4116 |
|
542 | 4117 |
^ viewOrigin y |
4118 |
! ! |
|
4119 |
||
4120 |
!DSVColumnView methodsFor:'scrolling'! |
|
4121 |
||
4122 |
scrollTo:anOrigin redraw:doRedraw |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4123 |
"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
|
4124 |
|
1497 | 4125 |
|newOrg dltOrg wg |
4126 |
h "{ Class:SmallInteger }" |
|
4127 |
w "{ Class:SmallInteger }" |
|
4128 |
x "{ Class:SmallInteger }" |
|
4129 |
x0 "{ Class:SmallInteger }" |
|
4130 |
x1 "{ Class:SmallInteger }" |
|
4131 |
y "{ Class:SmallInteger }" |
|
4132 |
y0 "{ Class:SmallInteger }" |
|
4133 |
y1 "{ Class:SmallInteger }" |
|
4134 |
dX "{ Class:SmallInteger }" |
|
4135 |
dY "{ Class:SmallInteger }" |
|
4136 |
innerHG "{ Class:SmallInteger }" |
|
4137 |
innerWT "{ Class:SmallInteger }" |
|
2146 | 4138 |
lMargin |
1497 | 4139 |
| |
2146 | 4140 |
|
542 | 4141 |
shown ifFalse:[ |
4142 |
^ self |
|
4143 |
]. |
|
612 | 4144 |
|
1448 | 4145 |
(wg := self windowGroup) notNil ifTrue:[ |
4146 |
wg processRealExposeEventsFor:self. |
|
542 | 4147 |
]. |
612 | 4148 |
|
542 | 4149 |
innerWT := self innerWidth. |
4150 |
innerHG := self innerHeight. |
|
4151 |
||
4152 |
h := viewOrigin y. |
|
4153 |
||
4154 |
(y := anOrigin y) > h ifTrue:[ "/ end of contents |
|
4155 |
y > (dY := self maxViewOriginY) ifTrue:[ |
|
4156 |
y := dY max:h |
|
4157 |
] |
|
4158 |
] ifFalse:[ |
|
4159 |
y := y max:0. |
|
4160 |
]. |
|
4161 |
||
4162 |
(x := anOrigin x) > 0 ifTrue:[ |
|
4163 |
x := x min:(self widthOfContents - innerWT). |
|
4164 |
]. |
|
4165 |
x := x max:0. |
|
4166 |
newOrg := (x @ y). |
|
4167 |
dltOrg := newOrg - viewOrigin. |
|
4168 |
dX := dltOrg x. |
|
4169 |
dY := dltOrg y. |
|
4170 |
||
4171 |
(dX == 0 and:[dY == 0]) ifTrue:[ |
|
4172 |
^ self |
|
4173 |
]. |
|
4174 |
self originWillChange. |
|
4175 |
viewOrigin := newOrg. |
|
4176 |
||
4177 |
doRedraw ifFalse:[ |
|
4178 |
^ self originChanged:dltOrg |
|
4179 |
]. |
|
4180 |
||
4181 |
dY ~~ 0 ifTrue:[ "/ SCROLL VERTICAL |
|
4182 |
dY := dY abs. |
|
4183 |
||
4184 |
(dX ~~ 0 or:[innerHG - dY < 20]) ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
4185 |
self invalidate. |
542 | 4186 |
] ifFalse:[ "/ COPY VERTICAL |
4187 |
y0 := y1 := margin + dY. |
|
4188 |
h := innerHG - dY. |
|
4189 |
||
4190 |
dltOrg y < 0 ifTrue:[y0 := margin. y := y0] |
|
4191 |
ifFalse:[y1 := margin. y := y1 + h]. |
|
4192 |
||
1460 | 4193 |
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
|
4194 |
self invalidateX:margin y:y width:innerWT height:(innerHG - h). |
542 | 4195 |
] |
4196 |
] ifFalse:[ "/ SCROLL HORIZONTAL |
|
4197 |
dX := dX abs. |
|
4198 |
||
4199 |
innerWT - dX < 20 ifTrue:[ |
|
1487 | 4200 |
labelView invalidate. |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
4201 |
self invalidate. |
542 | 4202 |
] ifFalse:[ "/ COPY HORIZONTAL |
643 | 4203 |
x0 := x1 := dX + margin. |
2146 | 4204 |
w := width - dX. |
4205 |
lMargin := labelView margin. |
|
4206 |
||
4207 |
dltOrg x < 0 ifTrue:[ |
|
4208 |
" ->" |
|
5723 | 4209 |
x0 := x := margin. |
2146 | 4210 |
self copyFrom:self x:margin y:margin toX:margin+dX y:margin width:innerWT-dX height:innerHG async:false. |
4211 |
self invalidateX:margin y:margin width:dX height:innerHG. |
|
4212 |
||
4213 |
labelView notNil ifTrue:[ |
|
4214 |
labelView copyFrom:labelView x:lMargin y:lMargin toX:lMargin+dX y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false. |
|
4215 |
labelView invalidateX:lMargin y:lMargin width:dX height:labelView innerHeight. |
|
4216 |
]. |
|
4217 |
] ifFalse:[ |
|
4218 |
x1 := margin. x := w. |
|
4219 |
self copyFrom:self x:margin+dX y:margin toX:margin y:margin width:innerWT-dX height:innerHG async:false. |
|
4220 |
self invalidateX:width-margin-dX y:margin width:dX height:innerHG. |
|
4221 |
||
4222 |
labelView notNil ifTrue:[ |
|
4223 |
labelView copyFrom:labelView x:lMargin+dX y:lMargin toX:lMargin y:lMargin width:labelView innerWidth-dX height:labelView innerHeight async:false. |
|
4224 |
labelView invalidateX:labelView width-lMargin-dX y:lMargin width:dX height:labelView innerHeight. |
|
4225 |
]. |
|
1487 | 4226 |
]. |
2146 | 4227 |
labelView repairDamage. |
542 | 4228 |
] |
4229 |
]. |
|
4230 |
self originChanged:dltOrg. |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
4231 |
|
2458
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
4232 |
wg notNil ifTrue:[ |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
4233 |
wg processRealExposeEventsFor:self. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
4234 |
]. |
0411397ef0a2
readraw after scroll: process expose events.
Claus Gittinger <cg@exept.de>
parents:
2445
diff
changeset
|
4235 |
|
1123
ea32a2e3d44d
care for sensor becoming nil while handling exposeEvents
Claus Gittinger <cg@exept.de>
parents:
1115
diff
changeset
|
4236 |
"Modified: / 7.9.1998 / 16:39:49 / cg" |
542 | 4237 |
! |
4238 |
||
2728
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4239 |
scrollToLine:aLineNr |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4240 |
"for compat. with listViews" |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4241 |
|
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4242 |
self scrollToRowAt:aLineNr colAt:1. |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4243 |
! |
a53382733524
+scrollToLine (listView compat.)
Claus Gittinger <cg@exept.de>
parents:
2722
diff
changeset
|
4244 |
|
542 | 4245 |
scrollToRowAt:aRowNr colAt:aColNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4246 |
"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
|
4247 |
|
1497 | 4248 |
|x "{ Class:SmallInteger }" |
4249 |
y "{ Class:SmallInteger }" |
|
4250 |
l "{ Class:SmallInteger }" |
|
4251 |
dY "{ Class:SmallInteger }" |
|
4252 |
dX "{ Class:SmallInteger }" |
|
4253 |
| |
|
4254 |
||
4255 |
( (aRowNr between:1 and:(list size)) |
|
4256 |
and:[aColNr between:0 and:(columnDescriptors size)] |
|
542 | 4257 |
) ifFalse:[ |
4258 |
^ self |
|
4259 |
]. |
|
4260 |
||
4261 |
dY := dX := 0. |
|
4262 |
y := self yVisibleOfRowNr:aRowNr. |
|
4263 |
||
4264 |
y < margin ifTrue:[ |
|
4265 |
dY := margin - y. |
|
4266 |
] ifFalse:[ |
|
4267 |
y := y + rowHeight. |
|
4268 |
l := height - margin. |
|
4269 |
y > l ifTrue:[dY := l - y] |
|
4270 |
]. |
|
4271 |
||
4272 |
aColNr == 0 ifTrue:[ |
|
4273 |
dY == 0 ifTrue:[^ self]. |
|
4274 |
dX := 0. |
|
4275 |
] ifFalse:[ |
|
4276 |
x := self xVisibleOfColNr:aColNr. |
|
4277 |
||
1163 | 4278 |
x <= margin ifTrue:[ |
542 | 4279 |
dX := margin - x |
4280 |
] ifFalse:[ |
|
1497 | 4281 |
x := x + (columnDescriptors at:aColNr) width. |
542 | 4282 |
l := width - margin. |
4283 |
x > l ifTrue:[dX := l - x] |
|
4284 |
] |
|
4285 |
]. |
|
4286 |
||
4287 |
(dX == 0 and:[dY == 0]) ifFalse:[ |
|
4288 |
self scrollTo:(viewOrigin - (dX @ dY)). |
|
4289 |
] |
|
4290 |
! |
|
4291 |
||
4292 |
scrollToSelection |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4293 |
"make selection visible" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4294 |
|
607 | 4295 |
|rowNr| |
4296 |
||
4297 |
(rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
2960 | 4298 |
self scrollToRowAt:rowNr colAt:self selectedColIndex |
542 | 4299 |
] |
1506 | 4300 |
! |
4301 |
||
4302 |
scrollVerticalTo:aPixelOffset |
|
4303 |
"change origin to make aPixelOffset be the top line" |
|
4304 |
||
4305 |
|orgX orgY| |
|
4306 |
||
4307 |
orgX := viewOrigin x. |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4308 |
scrollRowWise ifTrue:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4309 |
orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4310 |
] ifFalse:[ |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4311 |
orgY := aPixelOffset. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4312 |
]. |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4313 |
^ self scrollTo:(orgX @ orgY). |
1749 | 4314 |
! |
4315 |
||
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4316 |
startAutoScroll:aSelectorOrBlock distance:aDistance |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4317 |
"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
|
4318 |
- timeDelta for scroll is computed from distance" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4319 |
|
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4320 |
|timeDelta scrollBlock| |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4321 |
|
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4322 |
autoScroll ifFalse:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4323 |
self stopAutoScroll. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4324 |
^ self |
1749 | 4325 |
]. |
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4326 |
|
1749 | 4327 |
autoScrollBlock notNil ifTrue:[ |
4328 |
Processor removeTimedBlock:autoScrollBlock. |
|
4329 |
] ifFalse:[ |
|
4330 |
self compressMotionEvents:false. |
|
4331 |
]. |
|
4332 |
||
4333 |
timeDelta := 0.5 / (aDistance abs). |
|
4334 |
||
5723 | 4335 |
scrollBlock := |
2670
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4336 |
[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4337 |
aSelectorOrBlock isSymbol ifTrue:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4338 |
self perform:aSelectorOrBlock. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4339 |
] ifFalse:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4340 |
aSelectorOrBlock value |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4341 |
]. |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4342 |
autoScrollBlock notNil ifTrue:[ |
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4343 |
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
|
4344 |
] |
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 |
|
27dacfff1d6d
autoScroll: let timedBlock push an event which performs the scroll
Claus Gittinger <cg@exept.de>
parents:
2637
diff
changeset
|
4347 |
autoScrollBlock := [self sensor pushUserEvent:#value for:scrollBlock]. |
1749 | 4348 |
Processor addTimedBlock:autoScrollBlock afterSeconds:timeDelta. |
4349 |
! |
|
4350 |
||
4351 |
stopAutoScroll |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4352 |
"stop any autoScroll" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4353 |
|
1749 | 4354 |
autoScrollBlock notNil ifTrue:[ |
4355 |
Processor removeTimedBlock:autoScrollBlock. |
|
4356 |
autoScrollBlock := nil. |
|
4357 |
self compressMotionEvents:true. |
|
4358 |
]. |
|
542 | 4359 |
! ! |
4360 |
||
3382 | 4361 |
!DSVColumnView methodsFor:'searching'! |
4362 |
||
5347 | 4363 |
findFirstColumnWithStringFrom:start to:stop |
5723 | 4364 |
start to:stop do:[:eachNr| |
5347 | 4365 |
|row lbl| |
4366 |
||
4367 |
row := self at:eachNr. |
|
5723 | 4368 |
columnDescriptors keysAndValuesDo:[:colNr :col | |
5347 | 4369 |
lbl := col shownValueForRow:row rowNr:eachNr. |
4370 |
||
4371 |
lbl isNonByteCollection ifTrue:[ |
|
4372 |
lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first]. |
|
4373 |
]. |
|
4374 |
(lbl respondsTo:#string) ifTrue:[ |
|
4375 |
lbl := lbl string. |
|
4376 |
]. |
|
4377 |
(lbl size ~~ 0 and:[(lbl at:1) isCharacter]) ifTrue:[ |
|
4378 |
^ colNr |
|
4379 |
] |
|
4380 |
] |
|
4381 |
]. |
|
4382 |
^ nil |
|
4383 |
! |
|
4384 |
||
3382 | 4385 |
findFirstRowWithString: aString from:start to:stop by: step ignoreCase:ignoreCase |
4386 |
"Return the rowNr from the first row that matches aString. |
|
5347 | 4387 |
The search is performed between the start and stop row numbers and incrementing by a step" |
4388 |
||
4389 |
|stringToMatch| |
|
4390 |
||
4391 |
aString isEmptyOrNil ifTrue:[ |
|
4392 |
^ self |
|
4393 |
]. |
|
4394 |
stringToMatch := '*', aString, '*'. |
|
4395 |
||
5723 | 4396 |
start to:stop by:step do:[:rowNr| |
5347 | 4397 |
|row lbl| |
4398 |
||
3382 | 4399 |
row := self at:rowNr. |
5723 | 4400 |
columnDescriptors keysAndValuesDo:[:colNr :col | |
3382 | 4401 |
lbl := col shownValueForRow:row rowNr:rowNr. |
4402 |
||
5347 | 4403 |
lbl isNonByteCollection ifTrue:[ |
4404 |
lbl := lbl isEmpty ifTrue:[nil] ifFalse:[lbl first]. |
|
3382 | 4405 |
]. |
4406 |
(lbl respondsTo:#string) ifTrue:[ |
|
4407 |
lbl := lbl string. |
|
4408 |
]. |
|
4409 |
lbl isNumber ifTrue:[ |
|
4410 |
lbl := lbl printString. |
|
4411 |
]. |
|
4412 |
||
5723 | 4413 |
(lbl size ~~ 0 |
4414 |
and:[(lbl at:1) isCharacter |
|
5347 | 4415 |
and:[stringToMatch match:lbl caseSensitive:ignoreCase not |
4359 | 4416 |
]]) ifTrue:[ |
3382 | 4417 |
^ rowNr |
4418 |
] |
|
4419 |
] |
|
4420 |
]. |
|
4421 |
^ nil |
|
4422 |
! |
|
4423 |
||
4424 |
findFirstRowWithString: aString from:start to:stop ignoreCase:ignoreCase |
|
4425 |
"Return the rowNr from the first row that matches aString. |
|
5347 | 4426 |
The search is performed between the start and stop row numbers" |
4427 |
||
4428 |
^ self findFirstRowWithString:aString from:start to:stop by:1 ignoreCase:ignoreCase |
|
3382 | 4429 |
! ! |
4430 |
||
542 | 4431 |
!DSVColumnView methodsFor:'selection'! |
4432 |
||
5723 | 4433 |
addRowToSelection:aRowNr |
2370 | 4434 |
"add a row to the selection |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4435 |
if a column is selected, the column will be closed" |
5723 | 4436 |
|
2370 | 4437 |
|newSelection| |
4438 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4439 |
(self isRowSelectable:aRowNr) ifFalse:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4440 |
^ self |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4441 |
]. |
2398 | 4442 |
self numberOfSelections == 0 ifTrue:[ |
4443 |
self selectColIndex:0 rowIndex:aRowNr. |
|
2370 | 4444 |
^ self |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4445 |
]. |
2907 | 4446 |
(self isInSelection:aRowNr) ifTrue:[ |
4447 |
^ self |
|
4448 |
]. |
|
2398 | 4449 |
multipleSelectOk ifFalse:[ |
2960 | 4450 |
self selectColIndex:0 rowIndex:aRowNr. |
2370 | 4451 |
^ self |
4452 |
]. |
|
2371 | 4453 |
newSelection := selectedRowIndex copyWith:aRowNr. |
2960 | 4454 |
self selectedColIndex ~~ 0 ifTrue:[ |
2370 | 4455 |
self selectColIndex:0 rowIndex:newSelection. |
2398 | 4456 |
] ifFalse:[ |
2907 | 4457 |
selectedRowIndex := newSelection. |
2398 | 4458 |
self invalidateRowAt:aRowNr. |
4459 |
self selectionChanged. |
|
2370 | 4460 |
]. |
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4461 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4462 |
|
607 | 4463 |
deselect |
4464 |
self selectColIndex:0 rowIndex:0 |
|
4465 |
! |
|
4466 |
||
4467 |
firstIndexSelected |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4468 |
"returns index of first row selected or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4469 |
|
607 | 4470 |
multipleSelectOk ifFalse:[ |
4471 |
^ selectedRowIndex |
|
4472 |
]. |
|
4473 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
4474 |
^ selectedRowIndex at:1 |
|
4475 |
]. |
|
4476 |
^ 0 |
|
4477 |
! |
|
4478 |
||
2695 | 4479 |
forceAcceptInEditor |
2722 | 4480 |
editView notNil ifTrue:[ |
6043 | 4481 |
editView isDialogBox ifFalse:[ |
4482 |
editView |
|
4483 |
allSubViewsDo:[:aSubView | |
|
4484 |
(aSubView respondsTo:#accept) ifTrue:[ |
|
4485 |
aSubView accept |
|
4486 |
]. |
|
4487 |
] |
|
4488 |
] |
|
2722 | 4489 |
] |
6043 | 4490 |
|
4491 |
"Modified: / 23-04-2019 / 19:17:04 / Claus Gittinger" |
|
2695 | 4492 |
! |
4493 |
||
2151
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4494 |
hasRowSelection |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4495 |
"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
|
4496 |
(as opposed to either no selection, or a columnSelection)" |
5723 | 4497 |
|
2960 | 4498 |
^ 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
|
4499 |
! |
50f8723054e7
selected row is highlighted over the full width;
Claus Gittinger <cg@exept.de>
parents:
2146
diff
changeset
|
4500 |
|
542 | 4501 |
hasSelection |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4502 |
"returns true if a selection exists" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4503 |
|
607 | 4504 |
^ self numberOfSelections ~~ 0 |
542 | 4505 |
! |
4506 |
||
607 | 4507 |
isInSelection:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4508 |
"returns true, if row, aRowNr is in the selection" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4509 |
|
607 | 4510 |
aRowNr ~~ 0 ifTrue:[ |
4511 |
multipleSelectOk ifFalse:[ |
|
4512 |
^ aRowNr == selectedRowIndex |
|
4513 |
]. |
|
4514 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
4515 |
^ selectedRowIndex includes:aRowNr |
|
4516 |
] |
|
4517 |
]. |
|
4518 |
^ false |
|
4519 |
! |
|
4520 |
||
5723 | 4521 |
isRowSelected:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4522 |
"returns true, if row is in the selection" |
5723 | 4523 |
|
2960 | 4524 |
self selectedColIndex == 0 ifTrue:[ |
647 | 4525 |
^ self isInSelection:aRowNr |
4526 |
]. |
|
4527 |
^ false |
|
4528 |
! |
|
4529 |
||
2263 | 4530 |
isRowVisible:aRowNr |
4531 |
|y h| |
|
4532 |
||
4533 |
h := rowHeight. |
|
4534 |
y := self yVisibleOfRowNr:aRowNr. |
|
4535 |
||
4536 |
y < margin ifTrue:[ |
|
4537 |
(h := h + y) <= margin ifTrue:[ |
|
4538 |
^ false |
|
5723 | 4539 |
]. |
2263 | 4540 |
] ifFalse:[ |
4541 |
y >= (height-margin) ifTrue:[^ false]. |
|
4542 |
]. |
|
4543 |
^ true |
|
4544 |
! |
|
4545 |
||
5723 | 4546 |
isSelected:aRowNr inColumn:aColNr |
612 | 4547 |
"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
|
4548 |
number is selected." |
5723 | 4549 |
|
1042 | 4550 |
multipleSelectOk ifFalse:[ |
4551 |
aRowNr ~~ selectedRowIndex ifTrue:[ |
|
4552 |
^ false |
|
4553 |
] |
|
4554 |
] ifTrue:[ |
|
2960 | 4555 |
(selectedRowIndex size ~~ 0 and:[ selectedRowIndex includes:aRowNr ]) ifFalse:[ |
1042 | 4556 |
^ false |
4557 |
] |
|
607 | 4558 |
]. |
2960 | 4559 |
^ (self selectedColIndex == 0 or:[ self selectedColIndex == aColNr ]) |
607 | 4560 |
! |
4561 |
||
2276
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4562 |
isSelectionVisibleIn:anExtentPoint |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4563 |
self selectionIndicesDo:[:selRowNr | |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4564 |
|y| |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4565 |
|
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4566 |
y := self yVisibleOfRowNr:selRowNr. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4567 |
(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
|
4568 |
]. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4569 |
^ false. |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4570 |
! |
19de72502874
dont make selection visible after resize, if it was not visible before
ca
parents:
2263
diff
changeset
|
4571 |
|
809 | 4572 |
lastIndexSelected |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4573 |
"returns index of last selected row or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4574 |
|
809 | 4575 |
multipleSelectOk ifFalse:[ |
4576 |
^ selectedRowIndex |
|
4577 |
]. |
|
4578 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
4579 |
^ selectedRowIndex last |
|
4580 |
]. |
|
4581 |
^ 0 |
|
4582 |
! |
|
4583 |
||
5723 | 4584 |
makeLineVisible:aLine |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4585 |
"scroll to make aLine visible" |
5723 | 4586 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4587 |
|colNr| |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4588 |
|
2960 | 4589 |
aLine == 0 ifTrue:[ |
4590 |
^ self |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4591 |
]. |
2960 | 4592 |
(self isRowVisible:aLine) ifTrue:[ |
4593 |
^ self |
|
4594 |
]. |
|
4595 |
(self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[ |
|
4596 |
colNr := self selectedColIndex |
|
4597 |
] ifFalse:[ colNr := 1 ]. |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4598 |
self scrollToRowAt:aLine colAt:colNr |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4599 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4600 |
|
2246 | 4601 |
makeSelectionVisible |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4602 |
"scroll to make the selection line visible" |
5723 | 4603 |
|
2246 | 4604 |
|rowNr colNr| |
4605 |
||
4606 |
rowNr := self firstIndexSelected. |
|
2960 | 4607 |
rowNr == 0 ifTrue:[ |
4608 |
^ self |
|
2246 | 4609 |
]. |
2960 | 4610 |
(self selectedColIndex notNil and:[ self selectedColIndex ~~ 0 ]) ifTrue:[ |
4611 |
colNr := self selectedColIndex |
|
4612 |
] ifFalse:[ colNr := 1 ]. |
|
2246 | 4613 |
self scrollToRowAt:rowNr colAt:colNr |
4614 |
! |
|
4615 |
||
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4616 |
maxIndexSelected |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4617 |
"return the largest index selected or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4618 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4619 |
multipleSelectOk ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4620 |
^ selectedRowIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4621 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4622 |
selectedRowIndex size ~~ 0 ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4623 |
^ selectedRowIndex max |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4624 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4625 |
^ 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4626 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4627 |
|
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4628 |
minIndexSelected |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4629 |
"return the smallest index selected or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4630 |
|
2363
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4631 |
multipleSelectOk ifFalse:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4632 |
^ selectedRowIndex |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4633 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4634 |
selectedRowIndex size ~~ 0 ifTrue:[ |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4635 |
^ selectedRowIndex min |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4636 |
]. |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4637 |
^ 0 |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4638 |
! |
72cda227e48d
shift + cursorUp/Down adds to selection
Claus Gittinger <cg@exept.de>
parents:
2333
diff
changeset
|
4639 |
|
607 | 4640 |
numberOfSelections |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4641 |
"return the number of selected rows" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4642 |
|
607 | 4643 |
multipleSelectOk ifFalse:[ |
4644 |
^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
|
4645 |
]. |
|
4646 |
^ selectedRowIndex size |
|
542 | 4647 |
! |
4648 |
||
3140 | 4649 |
openEditorOnSelection |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4650 |
|colIdx column rowIdx editorAndModel winGroup |
3770 | 4651 |
editor filter keyBrdFwd selColor| |
3140 | 4652 |
|
4653 |
(shown and:[editView isNil]) ifFalse:[ |
|
4654 |
^ self |
|
4655 |
]. |
|
4656 |
winGroup := self windowGroup. |
|
4657 |
winGroup isNil ifTrue:[^ self ]. |
|
4658 |
||
4659 |
colIdx := self selectedColIndex ? 0. |
|
3504 | 4660 |
column := self columnDescriptorAt:colIdx. |
3140 | 4661 |
column isNil ifTrue:[^ self]. |
4662 |
||
4663 |
rowIdx := self selectedRowIndex ? 0. |
|
4664 |
rowIdx == 0 ifTrue:[^ self ]. |
|
4665 |
||
4666 |
rowIdx isSequenceable ifTrue:[ |
|
4667 |
rowIdx := rowIdx at:1 ifAbsent:[ ^ self ]. |
|
4668 |
]. |
|
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4669 |
|
5723 | 4670 |
editorAndModel := column editorForRowAt:rowIdx. |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4671 |
editorAndModel isNil ifTrue:[^ self]. |
6043 | 4672 |
|
4673 |
editor := editorAndModel editor. |
|
4674 |
editor isDialogBox ifTrue:[ |
|
4675 |
editor open. |
|
4676 |
editor accepted ifTrue:[ |
|
4677 |
"/ editorAndModel acceptAction value:nil. |
|
4678 |
]. |
|
4679 |
editView := editor. |
|
4680 |
didEditWithDialog := true. |
|
4681 |
^ self |
|
4682 |
]. |
|
3140 | 4683 |
|
4684 |
autoScrollToColumn == true ifTrue:[ |
|
4685 |
self scrollToRowAt:rowIdx colAt:colIdx. |
|
4686 |
]. |
|
4687 |
||
5723 | 4688 |
editView := SimpleView |
4689 |
extent:((column width - (2 * separatorSize)) |
|
3140 | 4690 |
@ (rowHeight - (2 * separatorSize))) |
4691 |
in:self. |
|
4692 |
||
4693 |
self updateEditViewOrigin. |
|
4694 |
||
4695 |
(column containsText or:[ column showSelectionHighLighted not ]) ifTrue:[ |
|
3149 | 4696 |
selColor := (column backgroundColorAt:rowIdx) |
3140 | 4697 |
] ifFalse:[ |
4698 |
selColor := selectionBackgroundColor |
|
4699 |
]. |
|
4700 |
editView viewBackground:selectionBackgroundColor. |
|
4701 |
||
3770 | 4702 |
editView add:editor. |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4703 |
editorAndModel editorNeedsCursorKeys ifTrue:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4704 |
editorAndModel editorNeedsReturnKey ifTrue:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4705 |
"/ only steal TAB from the editor |
4176 | 4706 |
filter := [:aKey | #( #Tab #NonInsertingTab #BackTab ) includes:aKey ] |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4707 |
] ifFalse:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4708 |
"/ steal TAB and RETURN from the editor |
4176 | 4709 |
filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #Return ) includes:aKey ] |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4710 |
]. |
3140 | 4711 |
] ifFalse:[ |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4712 |
editorAndModel editorNeedsReturnKey ifTrue:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4713 |
"/ only steal TAB and Curosr Keys from the editor |
4176 | 4714 |
filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown ) includes:aKey ] |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4715 |
] ifFalse:[ |
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4716 |
"/ steal TAB, RETURN and Curosr Keys from the editor |
4176 | 4717 |
filter := [:aKey | #( #Tab #NonInsertingTab #BackTab #CursorUp #CursorDown #Return ) includes:aKey ] |
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4718 |
]. |
3140 | 4719 |
]. |
5723 | 4720 |
keyBrdFwd := KeyboardForwarder |
3140 | 4721 |
toView:self |
4722 |
condition:nil |
|
4723 |
filter:filter. |
|
5723 | 4724 |
editView |
4725 |
withAllSubViewsDo:[:aView | |
|
3140 | 4726 |
aView delegate:keyBrdFwd. |
4496 | 4727 |
aView font:self font. |
3140 | 4728 |
]. |
3141 | 4729 |
|
3855
41653ef27914
changed: #openEditorOnSelection
Claus Gittinger <cg@exept.de>
parents:
3779
diff
changeset
|
4730 |
(editValue := editorAndModel model) notNil ifTrue:[ |
3140 | 4731 |
editValue addDependent:self. |
4732 |
]. |
|
4733 |
editView realize. |
|
3770 | 4734 |
editor canTab:true. |
3962 | 4735 |
|
3770 | 4736 |
winGroup focusView:editor. |
3140 | 4737 |
|
3504 | 4738 |
self processAllExposeEvents. |
3960
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4739 |
|
3962 | 4740 |
"Modified: / 02-11-2010 / 22:04:01 / cg" |
6043 | 4741 |
"Modified: / 23-04-2019 / 18:47:46 / Claus Gittinger" |
3504 | 4742 |
! |
4743 |
||
4744 |
processAllExposeEvents |
|
4745 |
|sensor| |
|
4746 |
||
3140 | 4747 |
sensor := self sensor. |
5723 | 4748 |
[ |
3504 | 4749 |
sensor hasExposeEventFor:nil |
3140 | 4750 |
] whileTrue:[ |
3504 | 4751 |
self windowGroup processExposeEvents |
4752 |
]. |
|
4753 |
||
4754 |
||
4755 |
||
4756 |
||
4757 |
||
4758 |
||
4759 |
||
4760 |
||
4761 |
||
4762 |
||
4763 |
||
4764 |
||
4765 |
||
4766 |
||
4767 |
||
3140 | 4768 |
! |
4769 |
||
2398 | 4770 |
removeRowFromSelection:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4771 |
"remove a row from the selection" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4772 |
|
2398 | 4773 |
(self isInSelection:aRowNr) ifFalse:[^ self]. |
4774 |
||
4775 |
self numberOfSelections == 1 ifTrue:[ |
|
4776 |
self deselect. |
|
4777 |
] ifFalse:[ |
|
4778 |
selectedRowIndex := selectedRowIndex copyWithout:aRowNr. |
|
4779 |
self invalidateRowAt:aRowNr. |
|
4780 |
self selectionChanged. |
|
4781 |
]. |
|
4782 |
! |
|
4783 |
||
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
4784 |
selectAllRows |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4785 |
"select all" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4786 |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4787 |
multipleSelectOk ifFalse:[^ self]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4788 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4789 |
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
|
4790 |
self selectionChanged. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
4791 |
self invalidate. |
1947
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
4792 |
! |
1e11b36633b2
added selectAllRows (Alt-Shift-A) key function
Claus Gittinger <cg@exept.de>
parents:
1946
diff
changeset
|
4793 |
|
542 | 4794 |
selectColIndex:aColNr rowIndex:aRowNr |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4795 |
"change selection with notification" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4796 |
|
3140 | 4797 |
self selectColIndex:aColNr rowIndex:aRowNr openEditor:true. |
4798 |
! |
|
4799 |
||
4800 |
selectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor |
|
4801 |
"change selection with notification" |
|
4802 |
||
5666 | 4803 |
|oldCol oldRow| |
4804 |
||
4805 |
oldCol := self selectedColIndex. |
|
4806 |
oldRow := self selectedRowIndex. |
|
542 | 4807 |
|
3140 | 4808 |
self setSelectColIndex:aColNr rowIndex:aRowNr openEditor:openEditor. |
542 | 4809 |
|
5723 | 4810 |
(oldCol ~~ self selectedColIndex |
5666 | 4811 |
or:[oldRow ~= self selectedRowIndex |
4812 |
or:[ignoreReselect == false]]) ifTrue:[ |
|
3302
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
4813 |
self selectionChanged:aColNr |
542 | 4814 |
]. |
4815 |
! |
|
4816 |
||
607 | 4817 |
selectRow:something |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4818 |
"select a row" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4819 |
|
607 | 4820 |
^ self selectedRowIndex:something |
542 | 4821 |
! |
4822 |
||
809 | 4823 |
selectRowAt:rowNr colAt:colNr atPoint:aPoint |
3140 | 4824 |
self selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:true. |
4825 |
! |
|
4826 |
||
4827 |
selectRowAt:rowNr colAt:colNr atPoint:aPoint openEditor:openEditor |
|
4459 | 4828 |
|view p shouldClick editorType| |
3140 | 4829 |
|
4830 |
view := editView. |
|
6043 | 4831 |
didEditWithDialog := false. |
3140 | 4832 |
self selectColIndex:colNr rowIndex:rowNr openEditor:openEditor. |
4833 |
openEditor ifFalse:[ ^ self ]. |
|
4834 |
||
6043 | 4835 |
didEditWithDialog ifTrue:[didEditWithDialog := false. ^ self]. |
4836 |
||
3140 | 4837 |
editView isNil ifTrue:[ |
4838 |
"/ might be a reselection |
|
4839 |
self openEditorOnSelection. |
|
4840 |
editView isNil ifTrue:[^ self]. |
|
4841 |
] ifFalse:[ |
|
4842 |
editView == view ifTrue:[^ self]. |
|
4843 |
]. |
|
5517 | 4844 |
view := self detectViewAt:aPoint ignoreInvisible:false. |
3140 | 4845 |
|
4459 | 4846 |
shouldClick := true. |
4847 |
"/ when PreselectAllWhenOpeningEditor is true, we should not click into |
|
5902 | 4848 |
"/ the editor, as this could clear the selection. |
4459 | 4849 |
"/ however, for non-text editors, it is a good idea to do so... |
4850 |
PreselectAllWhenOpeningEditor == true ifTrue:[ |
|
4851 |
shouldClick := false. |
|
5990 | 4852 |
]. |
4853 |
||
4854 |
editorType := self selectedColumn editorType. |
|
4855 |
editorType == #ComboList ifTrue:[ |
|
4856 |
shouldClick := true |
|
4857 |
] ifFalse:[ |
|
5902 | 4858 |
editorType == #ComboBox ifTrue:[ |
4859 |
"/ only click if clicked onto menu-pull button |
|
4860 |
(view ~~ self and:[view notNil]) ifTrue:[ |
|
4861 |
|screenPoint comboSubView| |
|
5990 | 4862 |
|
5902 | 4863 |
screenPoint := device translatePoint:aPoint fromView:self toView:nil. |
4864 |
comboSubView := device viewFromPoint:screenPoint. |
|
4865 |
(comboSubView notNil and:[comboSubView isKindOf:Button]) ifTrue:[ |
|
4866 |
shouldClick := true |
|
4867 |
]. |
|
4868 |
]. |
|
5990 | 4869 |
] ifFalse:[ |
4870 |
editorType == #CheckToggle ifTrue:[ |
|
4871 |
shouldClick := true |
|
4872 |
] ifFalse:[ |
|
4873 |
editorType == #RadioButton ifTrue:[ |
|
4874 |
shouldClick := true |
|
4875 |
] ifFalse:[ |
|
4876 |
"/ TODO: more heuristics here... |
|
4877 |
"/ editorType == #RadioButton ifTrue:[ ]. |
|
4878 |
(view isKindOf:ComboBoxButton) ifTrue:[ |
|
4879 |
shouldClick := true |
|
4880 |
]. |
|
4881 |
]. |
|
4882 |
] |
|
5902 | 4883 |
]. |
5990 | 4884 |
]. |
4885 |
||
4459 | 4886 |
shouldClick ifTrue:[ |
2125 | 4887 |
"/ simulate clicking into the editor |
4459 | 4888 |
self breakPoint:#ca. |
5723 | 4889 |
(view ~~ self and:[view notNil]) ifTrue:[ |
4991 | 4890 |
p := device translatePoint:aPoint fromView:self toView:view. |
5723 | 4891 |
self sensor |
3960
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4892 |
pushEvent:(WindowEvent buttonPress:1 x:p x y:p y view:view); |
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4893 |
pushEvent:(WindowEvent buttonRelease:1 x:p x y:p y view:view). |
3504 | 4894 |
|
4895 |
"/ "/ a very special hack for radioButtons: |
|
4896 |
"/ "/ if the button is now on, all other cells must be turned off !! |
|
4897 |
"/ self selectedColumn editorType == #RadioButton ifTrue:[ |
|
4898 |
"/ 1 tolist size do:[:eachRowNr | |
|
4899 |
"/ eachRowNr ~~ rowNr ifTrue:[ |
|
4900 |
"/ self at:eachRowNr put:false |
|
4901 |
"/ ]. |
|
4902 |
"/ ]. |
|
4903 |
"/ ]. |
|
3960
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4904 |
]. |
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4905 |
]. |
20b0047e59c6
+PreselectAllWhenOpeningEditor
Claus Gittinger <cg@exept.de>
parents:
3924
diff
changeset
|
4906 |
|
4073
14b8653c124f
changed: #selectRowAt:colAt:atPoint:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4059
diff
changeset
|
4907 |
"Modified: / 07-09-2011 / 16:08:45 / cg" |
5517 | 4908 |
"Modified: / 15-03-2017 / 21:09:54 / stefan" |
6043 | 4909 |
"Modified: / 23-04-2019 / 19:17:11 / Claus Gittinger" |
809 | 4910 |
! |
4911 |
||
5723 | 4912 |
selectRowFrom:start to:stop |
2470 | 4913 |
|step oldSelection newSelection| |
2398 | 4914 |
|
4915 |
start == stop ifTrue:[ |
|
4916 |
self selectColIndex:0 rowIndex:start. |
|
4917 |
^ self |
|
4918 |
]. |
|
2470 | 4919 |
step := (start <= stop) ifTrue:1 ifFalse:-1. |
5723 | 4920 |
newSelection := (start to:stop by:step) |
2960 | 4921 |
select:[:idx | self isRowSelectable:idx ]. |
4922 |
self selectedColIndex ~~ 0 ifTrue:[ |
|
2470 | 4923 |
self selectColIndex:0 rowIndex:newSelection. |
2398 | 4924 |
^ self |
4925 |
]. |
|
2470 | 4926 |
oldSelection := selectedRowIndex ? #(). |
4927 |
selectedRowIndex := newSelection. |
|
5723 | 4928 |
newSelection |
2960 | 4929 |
select:[:i | (oldSelection includes:i) not ] |
4930 |
thenDo:[:i | self invalidateRowAt:i ]. |
|
5723 | 4931 |
oldSelection |
2960 | 4932 |
select:[:i | (newSelection includes:i) not ] |
4933 |
thenDo:[:i | self invalidateRowAt:i ]. |
|
2398 | 4934 |
self selectionChanged. |
4935 |
! |
|
4936 |
||
5969 | 4937 |
selectRowIndex:anInteger |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4938 |
"set selection of rows" |
5723 | 4939 |
|
5969 | 4940 |
self selectColIndex:self selectedColIndex rowIndex:anInteger |
4941 |
||
4942 |
"Modified (format): / 21-11-2018 / 20:08:26 / Claus Gittinger" |
|
542 | 4943 |
! |
4944 |
||
4945 |
selectedColIndex |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4946 |
"returns selected column number or 0" |
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4947 |
|
2960 | 4948 |
^ self selectedColIndexHolder value |
542 | 4949 |
! |
4950 |
||
4951 |
selectedColumn |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4952 |
"returns selected column or nil" |
5723 | 4953 |
|
2960 | 4954 |
^ columnDescriptors at:self selectedColIndex ifAbsent:nil. |
542 | 4955 |
! |
4956 |
||
4957 |
selectedRow |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4958 |
"returns the selected row (or collection if multiple selection) or nil" |
5723 | 4959 |
|
607 | 4960 |
multipleSelectOk ifFalse:[ |
4961 |
^ self at:selectedRowIndex ifAbsent:nil |
|
4962 |
]. |
|
4963 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4964 |
^ selectedRowIndex collect:[:i | self at:i ] |
607 | 4965 |
]. |
4966 |
^ nil |
|
4967 |
! |
|
4968 |
||
5723 | 4969 |
selectedRow:something |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4970 |
"select something" |
5723 | 4971 |
|
607 | 4972 |
self selectedRowIndex:something |
542 | 4973 |
! |
4974 |
||
4975 |
selectedRowIndex |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4976 |
"returns selected row number or 0" |
5723 | 4977 |
|
542 | 4978 |
^ selectedRowIndex |
4979 |
! |
|
4980 |
||
5723 | 4981 |
selectedRowIndex:rowOrCollectionOfRows |
2470 | 4982 |
"set the row selection (single or multiple rows); |
2816 | 4983 |
does NOT change the selected column." |
5723 | 4984 |
|
5708 | 4985 |
self selectColIndex:(self selectedColIndex) rowIndex:rowOrCollectionOfRows |
542 | 4986 |
! |
4987 |
||
4988 |
selectionChanged |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
4989 |
"selection has changed" |
5723 | 4990 |
|
5708 | 4991 |
self selectionChanged:nil |
4992 |
! |
|
4993 |
||
4994 |
selectionChanged:colNrOrNil |
|
4995 |
"selection has changed" |
|
5723 | 4996 |
|
1487 | 4997 |
|val| |
4998 |
||
4999 |
model notNil ifTrue:[ |
|
5000 |
val := self selectedRowIndex copy. |
|
5001 |
(model respondsTo:#selectionIndex:) ifTrue:[ |
|
5002 |
model selectionIndex:val |
|
5003 |
] ifFalse:[ |
|
5708 | 5004 |
|newVal| |
5005 |
||
5006 |
newVal := (useIndex ifTrue:[val] ifFalse:[self selectedRow]). |
|
5007 |
"/ must check here: valueHolder compares using identity to identify |
|
5008 |
"/ changes. This would lead to an endless recursion.... |
|
5009 |
model value ~= newVal ifTrue:[ |
|
5010 |
model value:newVal |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
5011 |
] |
1487 | 5012 |
] |
5013 |
]. |
|
542 | 5014 |
actionBlock notNil ifTrue:[ |
5708 | 5015 |
colNrOrNil isNil ifTrue:[ |
5016 |
actionBlock valueWithOptionalArgument:(self selectedRowIndex) |
|
3302
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5017 |
] ifFalse:[ |
5708 | 5018 |
actionBlock valueWithOptionalArgument:(self selectedRowIndex) and:colNrOrNil |
5019 |
]. |
|
3302
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5020 |
] |
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5021 |
! |
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5022 |
|
5723 | 5023 |
selectionIndicesDo:aOneArgBlock |
607 | 5024 |
"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
|
5025 |
is the index of the selected row" |
5723 | 5026 |
|
607 | 5027 |
multipleSelectOk ifFalse:[ |
5028 |
selectedRowIndex ~~ 0 ifTrue:[ |
|
5029 |
aOneArgBlock value:selectedRowIndex |
|
5030 |
] |
|
5031 |
] ifTrue:[ |
|
5032 |
selectedRowIndex size ~~ 0 ifTrue:[ |
|
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
5033 |
selectedRowIndex do:aOneArgBlock |
607 | 5034 |
] |
542 | 5035 |
] |
5036 |
! |
|
5037 |
||
5723 | 5038 |
setSelectColIndex:colNrArg rowIndex:rowNrArg |
2714
f0d55d0e204d
categories; AEG stuff removed
Claus Gittinger <cg@exept.de>
parents:
2711
diff
changeset
|
5039 |
"change selection without notification" |
3140 | 5040 |
|
5041 |
self setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:true |
|
5042 |
! |
|
5043 |
||
5044 |
setSelectColIndex:colNrArg rowIndex:rowNrArg openEditor:openEditor |
|
5045 |
"change selection without notification" |
|
5046 |
||
3504 | 5047 |
|rowNr colNr newCol oldCol oldRow sglSelRow oldSz winGroup| |
542 | 5048 |
|
5709 | 5049 |
rowNr := self validateSelection:rowNrArg. |
5050 |
rowNr isNil ifTrue:[ |
|
5723 | 5051 |
rowNr := multipleSelectOk ifTrue:[#()] ifFalse:[0]. |
5709 | 5052 |
]. |
5053 |
||
2470 | 5054 |
colNr := colNrArg. |
2695 | 5055 |
rowNr == 0 ifTrue:[ |
5056 |
colNr := 0. |
|
5057 |
] ifFalse:[ |
|
5058 |
multipleSelectOk ifTrue:[ |
|
2960 | 5059 |
(rowNr size == 1) ifFalse:[ |
5060 |
colNr := 0 |
|
5061 |
] |
|
2695 | 5062 |
]. |
542 | 5063 |
]. |
607 | 5064 |
(colNr := colNr ? 0) ~~ 0 ifTrue:[ |
3504 | 5065 |
newCol := self columnDescriptorAt:colNr. |
607 | 5066 |
newCol rendererType == #rowSelector ifTrue:[ |
5067 |
colNr := 0. |
|
5068 |
newCol := nil |
|
5069 |
] ifFalse:[ |
|
2960 | 5070 |
multipleSelectOk ifTrue:[ |
5071 |
sglSelRow := rowNr at:1 |
|
5072 |
] ifFalse:[ |
|
5073 |
sglSelRow := rowNr |
|
5074 |
]. |
|
607 | 5075 |
(newCol canSelect:sglSelRow) ifFalse:[ |
5076 |
newCol := nil. |
|
2960 | 5077 |
colNr := 0. |
1112 | 5078 |
selectRowOnDefault ifFalse:[ |
3449
2ba8e55953aa
some comments changed into reasonable english
Claus Gittinger <cg@exept.de>
parents:
3428
diff
changeset
|
5079 |
rowNr := multipleSelectOk ifTrue:[nil] ifFalse:[0] |
1112 | 5080 |
] |
607 | 5081 |
] |
5082 |
] |
|
5083 |
]. |
|
3140 | 5084 |
|
2960 | 5085 |
(rowNr = selectedRowIndex and:[ colNr == self selectedColIndex ]) ifTrue:[ |
6043 | 5086 |
(editView notNil and:[editView isDialogBox]) ifTrue:[ |
5087 |
editView := nil |
|
5088 |
]. |
|
643 | 5089 |
^ self |
542 | 5090 |
]. |
3140 | 5091 |
|
542 | 5092 |
"/ release old selection |
3140 | 5093 |
|
2960 | 5094 |
oldSz := self numberOfSelections. |
5095 |
oldCol := self selectedColIndex. |
|
542 | 5096 |
oldRow := selectedRowIndex. |
612 | 5097 |
oldSz == 1 ifTrue:[ |
2960 | 5098 |
multipleSelectOk ifTrue:[ |
5099 |
oldRow := oldRow at:1 |
|
5100 |
]. |
|
2695 | 5101 |
self updateColumnFromEditValueAndDestroyEditView. |
612 | 5102 |
]. |
5666 | 5103 |
|
5104 |
(rowNr ~= selectedRowIndex |
|
5105 |
or:[ignoreReselect == false]) ifTrue:[ |
|
2960 | 5106 |
selectedRowIndex := rowNr. |
3302
6725ecddd8e3
pass colNr down to selectionChanged
Claus Gittinger <cg@exept.de>
parents:
3248
diff
changeset
|
5107 |
self selectionChanged:colNr. |
2960 | 5108 |
]. |
5109 |
self selectedColIndex:colNr. |
|
5110 |
shown ifFalse:[ ^ self ]. |
|
3140 | 5111 |
|
5112 |
winGroup := self windowGroup. |
|
5113 |
winGroup isNil ifTrue:[^ self ]. |
|
5114 |
||
2960 | 5115 |
oldSz > 1 ifTrue:[ |
5116 |
"/ redraw old selection |
|
5723 | 5117 |
oldRow do:[:aRowNr | |
2960 | 5118 |
"/ unselected if visible |
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
5119 |
self invalidateRowAt:aRowNr colAt:0 |
618 | 5120 |
] |
5121 |
] ifFalse:[ |
|
5122 |
oldSz == 1 ifTrue:[ |
|
1408
1cda0a4fb566
use invalidate... insteat of redraw...
Claus Gittinger <cg@exept.de>
parents:
1333
diff
changeset
|
5123 |
self invalidateRowAt:oldRow colAt:oldCol |
618 | 5124 |
] |
2960 | 5125 |
]. |
3140 | 5126 |
|
542 | 5127 |
"/ show new selection |
3140 | 5128 |
|
542 | 5129 |
newCol notNil ifTrue:[ |
3140 | 5130 |
openEditor ifTrue:[ |
5131 |
self openEditorOnSelection. |
|
5132 |
editView notNil ifTrue:[^ self]. |
|
5133 |
]. |
|
5134 |
self invalidateRowAt:sglSelRow colAt:colNr. |
|
5135 |
||
3130
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
5136 |
autoScrollToColumn == true ifTrue:[ |
30ac624dd866
added a hook to allow for autoScrollToColumn to be disabled.
Claus Gittinger <cg@exept.de>
parents:
3091
diff
changeset
|
5137 |
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
|
5138 |
]. |
612 | 5139 |
] ifFalse:[ |
2960 | 5140 |
self selectionIndicesDo:[:i | self invalidateRowAt:i colAt:0 ]. |
612 | 5141 |
self scrollToRowAt:(self firstIndexSelected) colAt:0 |
5142 |
]. |
|
3504 | 5143 |
|
5144 |
self processAllExposeEvents. |
|
612 | 5145 |
|
4055
4373923243d3
comment/format in: #setSelectColIndex:rowIndex:openEditor:
Claus Gittinger <cg@exept.de>
parents:
4020
diff
changeset
|
5146 |
"Modified: / 12-07-2011 / 14:22:42 / cg" |
6043 | 5147 |
"Modified: / 23-04-2019 / 19:30:50 / Claus Gittinger" |
607 | 5148 |
! |
5149 |
||
2695 | 5150 |
updateColumnFromEditValueAndDestroyEditView |
5151 |
|edValue selCol selRow| |
|
5152 |
||
2960 | 5153 |
selCol := self selectedColIndex. |
2695 | 5154 |
selRow := selectedRowIndex. |
5155 |
editValue notNil ifTrue:[ |
|
5156 |
editValue removeDependent:self |
|
5157 |
]. |
|
5158 |
editView notNil ifTrue:[ |
|
5159 |
self forceAcceptInEditor |
|
5160 |
]. |
|
5161 |
editValue notNil ifTrue:[ |
|
5162 |
edValue := editValue value. |
|
5163 |
edValue isSequenceable ifTrue:[ |
|
5164 |
edValue size == 0 ifTrue:[ |
|
5165 |
edValue := nil |
|
5166 |
] ifFalse:[ |
|
5167 |
edValue isString ifFalse:[ |
|
5168 |
edValue := edValue select:[:el | el notNil ]. |
|
5169 |
edValue size == 0 ifTrue:[ |
|
5170 |
edValue := nil |
|
5171 |
] |
|
5172 |
] |
|
5173 |
] |
|
5174 |
]. |
|
5175 |
selRow isNumber ifFalse:[ |
|
5176 |
"/ ??? should we do ???: |
|
5177 |
"/ selRow do:[:eachRow | |
|
5178 |
"/ (self columnAt:selCol) at:eachRow put:edValue. |
|
5179 |
"/ ] |
|
5180 |
selRow := selRow first |
|
5181 |
]. |
|
3504 | 5182 |
(self columnDescriptorAt:selCol) at:selRow put:edValue. |
2695 | 5183 |
modifiedChannel notNil ifTrue:[ |
5184 |
modifiedChannel value:true |
|
5185 |
]. |
|
5186 |
editValue := nil |
|
5187 |
]. |
|
5188 |
self destroyEditView. |
|
5189 |
! |
|
5190 |
||
607 | 5191 |
validateSelection:aSelection |
5192 |
|newSel| |
|
5193 |
||
2733 | 5194 |
(list size == 0 or:[aSelection isNil or:[aSelection == 0]]) ifTrue:[ |
607 | 5195 |
^ multipleSelectOk ifFalse:[0] ifTrue:[nil] |
5196 |
]. |
|
5197 |
||
2733 | 5198 |
newSel := aSelection. |
5199 |
||
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5200 |
multipleSelectOk ifFalse:[ |
2732 | 5201 |
newSel isInteger ifFalse:[ |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5202 |
newSel := self identityIndexOfRow:aSelection. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5203 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5204 |
^ (self isRowSelectable:newSel) ifTrue:[newSel] ifFalse:[0]. |
607 | 5205 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5206 |
|
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5207 |
"multiple selection |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5208 |
" |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5209 |
aSelection size ~~ 0 ifTrue:[ |
2732 | 5210 |
aSelection first isInteger ifTrue:[ |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5211 |
newSel := aSelection select:[:idx| self isRowSelectable:idx ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5212 |
] ifFalse:[ |
5723 | 5213 |
newSel := aSelection |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5214 |
collect:[:el| self identityIndexOfRow:el ] |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5215 |
thenSelect:[:idx| self isRowSelectable:idx ]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5216 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5217 |
newSel notEmpty ifTrue:[ |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5218 |
^ newSel |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5219 |
]. |
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5220 |
] ifFalse:[ |
2733 | 5221 |
newSel isInteger ifFalse:[ |
5222 |
newSel := self identityIndexOfRow:aSelection. |
|
5223 |
]. |
|
5224 |
(self isRowSelectable:newSel) ifTrue:[ |
|
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5225 |
^ Array with:newSel |
2733 | 5226 |
] |
607 | 5227 |
]. |
2636
103067a67ff9
add selectConditionBlock: to enable the selection of a row
ca
parents:
2593
diff
changeset
|
5228 |
^ nil |
542 | 5229 |
! ! |
5230 |
||
5231 |
!DSVColumnView class methodsFor:'documentation'! |
|
5232 |
||
5233 |
version |
|
4794 | 5234 |
^ '$Header$' |
3757 | 5235 |
! |
5236 |
||
5237 |
version_CVS |
|
4794 | 5238 |
^ '$Header$' |
542 | 5239 |
! ! |
4161 | 5240 |