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