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