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