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